Skip to content

Add unit test for channel manager on stream server #4

@sachalevy

Description

@sachalevy

The stream-server is based on the django plugin called django-event-stream which leverages ASGI to handle asynchronous events and allows the implementation of long-lasting HTTP streaming requests (essentially enabling server-side notifications). In order to manage the creation of new channels (through which clients connect to the server), we need to modify the DefaultChannelManager from the django_eventstream package. This implies overriding the following methods, as defined in the feedapp/channelmanager.py file:

  • can_read_channel: checks the format of the requested channel and verify that the corresponding user is valid.
  • get_channels_for_request: retrieve a list of channels available on the server for the current request (as the package implements many to many communication styles). Our implementation handles dispatching user queries at this stage.

Need to test the following methods:

  • can_read_channel: mock with combinations of user and channel configuration, given that user is in db & not.
  • get_channels_for_request: test the retrieved channel set based on request and kwargs inputs.
  • add_artificial_welcome_event: required by current process to make channel searchable from storage (make sure does store the expected events).
  • handle_query_request: test for integration of input validation, channel search, query recording, and event forwarding to producer.
  • check_consumer_inputs: verify input validation method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    testTesting related matters

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions