tests.utils.functions package#
Submodules#
tests.utils.functions.test_functions module#
Module for tests on utility functions.
This module contains test cases for testing the functions module in the utilities package and all related functionality to the function module.
- Classes:
TestCreateMessageJSON TestGenerateMessage TestAddChat
- class tests.utils.functions.test_functions.TestAddChat(methodName='runTest')[source]#
Bases:
BaseTestDatabaseTestCase
Test case class for tests on function for adding Chat to database
- test_function_adds_new_chat_record_to_database() None [source]#
Test that function adds new chat record to database.
- Returns:
None
- test_function_raises_exception_when_chat_context_is_an_empty_string() None [source]#
Test that function raises exception if the chat context is essentially an empty string.
- class tests.utils.functions.test_functions.TestCreateApacheKafkaTopic(methodName='runTest')[source]#
Bases:
TestCase
Test case class for tests on function for calling Apache Kafka topic.
- property randomly_generated_kafka_test_topic: str#
Generate random kafka topic string :return: String topic name
- classmethod setUpClass()[source]#
Hook method for setting up class fixture before running tests in the class.
- test_function_creates_kafka_topic() None [source]#
Test function creates kafka topic with given name. :return: None
- test_function_displays_warning_in_the_event_topic_to_be_created_already_exists() None [source]#
Test function raises warning in the event that topic to be created has already been created and the augmented topic is created. :return: None
- test_function_raises_exception_if_kafka_topic_was_not_created_successfully() None [source]#
Test function raises RuntimeError in the event that creation of kafka topic was not successful. :return: None
- class tests.utils.functions.test_functions.TestCreateMessageJSON(methodName='runTest')[source]#
Bases:
TestCase
Test case class for tests on function for creating user message JSON object. Here, “User” may refer to user.User or any comparable user entity existing outside this code base.
More importantly, the emphasis here is on the message from the user. This can be either generated from User.generate_message or received at the websocket (for example fastapi.Websocket.receive_json()
- class tests.utils.functions.test_functions.TestGenerateMessage(methodName='runTest')[source]#
Bases:
TestCase
Test case class for tests on function for generating message.
- classmethod setUpClass()[source]#
Hook method for setting up class fixture before running tests in the class.
- test_function_calls_User_generate_message_method_once_during_function_call() None [source]#
Test that User’s generate_message method was called during execution of function as it is the function that generates the message content for the user. :return: None
- test_function_return_type_is_of_expected_json_type() None [source]#
Test that the function returns a result of expected type. :return: None
- test_function_returns_message_json_with_different_context_id_from_passed_context_id_if_parent_id_is_None() None [source]#
Test that function returns message json with context_id different to that of passed context_id if parent_id is None. :return: None
- test_function_returns_message_json_with_same_context_id_from_passed_context_id_if_parent_id_is_not_None() None [source]#
Test that function returns message json with same context_id as passed context_id if parent_id is not None :return: None