Skip to content

Model Definition and Testing for ActivityPub (Code Structure Changed)

This pull request introduces initial model definitions for the ActivityPub library and integrates a test suite to ensure functionality and correctness across various classes and functions.

Key Additions

  1. Model Definitions:

    • This PR establishes the foundational models required for the ActivityPub library, including various actor types (such as Person, Group, Organization, Application, and Service) and core objects (such as Object, Actor, and Collection).
    • These models are structured to support serialization and deserialization, which aligns with ActivityPub standards (Activity Stream).
    • Validation for certain fields, such as MIME types in media_type fields, is incorporated to ensure data integrity and compliance.
  2. Serializer Class:

    • A dedicated serializer class is included to handle the conversion between ActivityPub model instances and JSON format, ensuring interoperability with external services.
    • This serializer supports camelCase field names and converts from the Python-standard snake_case for consistency with the ActivityPub protocol.
  3. Test Suite:

    • A new tests directory and accompanying test files have been added to verify the functionality of the models and serializers.
    • These tests include unit tests for model instantiation, field validation, and serialization/deserialization processes.
    • The tests aim to ensure that all components behave as expected, particularly when handling various actor and object types defined in the library.

Results of Testing

  • The initial tests confirm that the model definitions correctly represent ActivityPub entities and maintain integrity across expected use cases.
  • Serialization and deserialization tests verify that JSON conversions are accurate and meet the protocol requirements.
  • Validation checks within the models, particularly for media types and other required fields, are functioning as expected and return appropriate error messages when validation fails.

This foundational work provides a solid basis for further development and refinement of the ActivityPub library, allowing for reliable testing as new features and models are introduced. Screenshot_2024-11-04_at_22.08.32

Screenshot_2024-11-04_at_22.09.21

Merge request reports

Loading