tests.controller package

Contents

tests.controller package#

Submodules#

tests.controller.test_controller module#

Module for tests on application controller

This module contains test cases or testing the “Controller” (otherwise called Application Controller) entity and all related functionality.

Classes:

ApplicationControllerTestCase AsyncControllerTest

class tests.controller.test_controller.ApplicationControllerTestCase(methodName='runTest')[source]#

Bases: IsolatedAsyncioTestCase

Test case class for Application Controller

classmethod setUpClass()[source]#

Hook method for setting up class fixture before running tests in the class.

async test_controller_connects_to_chat_websocket_on_init() None[source]#

Test that controller calls method to connect to chat web socket on init. :return: None

async test_controller_constructor_has_array_of_unique_users_based_on_constructor_argument() None[source]#

Test that the controller constructor takes in kwarg for number of users and populates participating_users attribute with number of unique User objects is specified by the keyword argument. :return: None

async test_controller_fails_to_connect_to_chat_websocket_on_invalid_url() None[source]#

Test that controller fails to connect to the chat web socket on init when supplied with invalid url :return: None

async test_controller_has_null_websocket_attribute_which_becomes_populated_on_connection() None[source]#

Test that controller has null ‘websocket’ attribute before connection to chat websocket; after connection Controller.websocket becomes populated ideally with a websockets.WebSocketClientProtocol object. :return: None

async test_controller_has_string_chat_context_attribute_gotten_from_constructor() None[source]#

Test that the controller has string chat context supplied by the constructor at initialisation. :return: None

async test_controller_has_web_socket_url_attribute_gotten_from_constructor() None[source]#

Test that controller has web socket url attribute and gets web socket URL as part of kwargs from constructor. :return: None

async test_controller_method_for_connecting_to_websocket_can_send_messages_to_websocket() None[source]#

Test that Controller websocket connector can send message to websocket. :return:

async test_controller_on_init_initialises_base_kafka_manager_with_correct_arguments() None[source]#

Test that the controller at initialisation, creates a Kafka Manager via the Kafka Manager factory with correct arguments. :return: None

async test_initialised_controller_has_kafka_manager_attribute() None[source]#

Test that the controller has a Kafka Manager attribute on initialisation. :return: None

async test_set_websocket_invalid_type() None[source]#

Test that setting Controller websocket attribute to invalid type will raise Exception. :return:

async test_that_controller_has_first_publisher_attribute_which_must_have_role_of_publisher() None[source]#

Test that initialised consumer has ‘first_publisher’ attribute which must have role of PUBLISHER :return: None

async test_that_controller_raises_exception_on_nonsensical_input_for_number_of_participating_users() None[source]#

Test that the controller constructor raises an exception when non int types or an int less than one is passed for number of participating users.

Returns:

None

async test_that_on_init_of_controller_all_consumers_in_kafka_manager_are_subscribed_to_group_chat_kafka_topic() None[source]#

Test that on initialisation of application controller, all consumers in kafka manager are subscribed to the group chat kafka topic. :return: None

tests.controller.test_controller.setUpModule()[source]#
tests.controller.test_controller.tearDownModule()[source]#

tests.controller.test_kafka_manager module#

Module for tests on application controller Kafka Manager.

This module contains test cases or testing the “Controller’s Kafka Manager” (otherwise called Application Controller Kafka Manager) entity and all related functionality.

class tests.controller.test_kafka_manager.TestKafkaManager(methodName='runTest')[source]#

Bases: IsolatedAsyncioTestCase

Test class for tests on application controller kafka manager

async test_close_method_of_kafka_manager_class_stops_all_producers_and_producers() None[source]#

Test that calling Kafka Manager close() method stops all producer / consumer instances of the kafka manager.

Returns:

None

async test_instantiated_kafka_manager_class_consumers_property_is_immutable() None[source]#

Test that instantiated kafka manager class consumers property is immutable

Returns:

None

async test_instantiated_kafka_manager_class_consumers_property_returns_a_tuple_of_AIOKafkaConsumers_objects() None[source]#

Test that instantiated kafka manager class consumers property returns a tuple of AIOKafkaConsumer objects.

Returns:

None

test_instantiated_kafka_manager_class_has_consumers_property() None[source]#

Test that instantiated kafka manager class has consumers property :return: None

test_instantiated_kafka_manager_class_has_producers_property() None[source]#

Test that instantiated kafka manager class has producers property

Returns:

None

async test_instantiated_kafka_manager_class_producers_property_is_immutable() None[source]#

Test that instantiated kafka manager class producers property is immutable

Returns:

None

async test_instantiated_kafka_manager_class_producers_property_returns_a_tuple_of_AIOKafkaProducers_objects() None[source]#

Test that instantiated kafka manager class producers property returns a tuple of AIOKafkaProducer objects.

Returns:

None

test_kafka_manager_class_exists() None[source]#

Test that the class for controller kafka manager exists. :return: None

async test_on_closure_of_kafka_manager_class_close_method_is_called() None[source]#

Test that on closure / clean up of the kafka manager class, method to close all producer / consumer instances of the kafka manager is called. :return: None

async test_on_instantiation_of_kafka_manager_class_all_producer_and_consumer_instances_are_started() None[source]#

Test that on instantiation of kafka manager class, all producer and consumer instances are started. :return: None

class tests.controller.test_kafka_manager.TestKafkaManagerFactory(methodName='runTest')[source]#

Bases: IsolatedAsyncioTestCase

Test class for tests on application controller kafka manager factory class

test_kafka_manager_factory_class_exists() None[source]#

Test that the class for controller kafka manager factory exists. :return: None

test_kafka_manager_factory_method_for_creating_base_kafka_manager_takes_a_non_zero_input_for_number_of_users() None[source]#

Test that the method for creating base kafka manager within the kafka manager factory takes number of chat users. :return: None

async test_kafka_manager_factory_method_for_creating_base_kafka_manager_works() None[source]#

Test that the class for controller kafka manager has method that returns kafka manger. :return: None

Module contents#