Skip to content

Conversation

@aaronjae22
Copy link
Collaborator

@aaronjae22 aaronjae22 commented Jan 11, 2025

  • confest.py Contains fixtures for creating reusable test data like User, Actor, and PortabilityOutbox

    • user:
      • Creates a User object in the database with a username and password.
      • Simulates a user for testing.
    • actor:
      • Creates an Actor object linked to the user.
      • Represents public-facing user data compliant with LOLA.
      • Each Actor is linked to its correspondent User (it could change later). This has nothing to do on how testers will fetch or access Actor outbox. I just wanted to make sure that each Actor in the testbed is a user itself.
    • outbox:
      • Creates a PortabilityOutbox linked to the actor.
      • Represents the collection of activities tied to an Actor.
  • test_models.py tests the behaviour of our models, including relationships and custom methods like get_json_ld()

    • test_actor_creation:
      • Ensures the Actor model correctly stores data and links to the User.
      • The @pytest.mark.django_db marker ensures pytest can interact with the test database.
    • test_actor_json_ld:
      • Validates the JSON-LD representation generated by Actor.get_json_ld().
    • test_outbox_creation:
      • Confirms the PortabilityOutbox is created and linked to the Actor.
  • test_serializers.py ensures that serializers produce the correct JSON representation of Actor and PortabilityOutbox instances

    • test_actor_serializer:
      • Ensures that the serialized data matches the expected fields, including LOLA-compliant json_ld.
    • test_outbox_serializer:
      • Confirms that PortabilityOutbox serialization includes the linked Actor and activities.
  • test_api.py tests api endpoints for accessibility and compliance with LOLA

    • test_actor_detail_api:
      • Validates that /api/actors/{id}/ returns the correct Actor data, including json_ld.
    • test_outbox_detail_api:
      • Ensures /api/actors/{id}/outbox/ returns the correct outbox data.
  • test_urls.py validates that URLs resolve to the correct views

    • test_actor_detail_url:
      • Confirms /api/actors/{id}/ resolves to ActorDetailView.
    • test_outbox_detail_url:
      • Confirms /api/actors/{id}/outbox/ resolves to PortabilityOutboxDetailView.
image

Closes #2
Closes #7
Closes #12

@aaronjae22 aaronjae22 requested a review from lisad January 11, 2025 00:04
@aaronjae22 aaronjae22 self-assigned this Jan 11, 2025
@aaronjae22
Copy link
Collaborator Author

I will proceed to merge it in order to add the following features.

@aaronjae22 aaronjae22 merged commit e26e3aa into main Jan 18, 2025
@aaronjae22 aaronjae22 deleted the adding-pytests branch January 18, 2025 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write endpoint tests Write model unit tests Add a test framework to ActivityPub Test server

1 participant