tests.users package#
Submodules#
tests.users.test_users module#
Module for tests on user / client.
This module contains test cases for testing the “User” (otherwise called Client) entity and all related functionality.
- Classes:
TestUserTestCase TestUserAsyncioMethodsTestCase
- class tests.users.test_users.TestUserAsyncioMethodsTestCase(methodName='runTest')[source]#
Bases:
IsolatedAsyncioTestCase
Test case class for testing functionalities of the user class utilising asyncio.
- async test_user_generate_message_method_calls_google_gemini_api_method_to_generate_message() None [source]#
Test that the User object generate method returns some non-empty string result which is also the result of the Google Gemini API call. :return: None
- user = <user.user_def.User object>#
- class tests.users.test_users.TestUserTestCase(methodName='runTest')[source]#
Bases:
TestCase
Test case class for tests for User entity
- setUp() None [source]#
Method defining what must be run before each test method within this class. :return: None
- classmethod setUpClass() None [source]#
Defines attributes and calls for test case, before tests are executed. :return: None
- tearDown() None [source]#
Method defining actions after each test method within this class. :return: None
- test_role_setter_only_accepts_Role_object_argument() None [source]#
Test that initialised User role setter only accepts Role objects
- Returns:
None
- test_that_passed_name_and_display_picture_url_are_applied_to_user_instance()[source]#
Test that name and or display_picture_url keyword arguments passed to User constructor are set as attributes on user. :return: None
- test_that_user_object_by_default_has_empty_username_and_image_url()[source]#
Test that at initialisation of User object, if user name and or display picture is not supplied as arguments to the constructor, name and display_picture_url attributes default to empty string. :return: None
- test_user_can_be_initialised_with_particular_role() None [source]#
Test that User object can be initialised with a particular role.
- Returns:
None
- test_user_can_be_initialised_with_random_role() None [source]#
Test that User object can be initialised with random role. :return: None
- test_user_has_display_picture_attribute() None [source]#
Test that user object has display picture attribute :return: None
- test_user_has_name_attribute() None [source]#
Test that initialized user object has name attribute :return: None
- test_user_has_role_attribute() None [source]#
Test that initialized user object has role attribute.
- Returns:
None
- test_user_role_attribute_is_Role_NOT_SET_at_initialisation() None [source]#
Test that the user role attribute is unset (Role.NOT_SET) at initialisation
- Returns:
None
- test_user_role_getter_and_setter_are_properties() None [source]#
Test that User object getter and setter are properties
- Returns:
None
- test_user_role_getter_returns_user_role_value() None [source]#
Test that initialised user object’s getter for role returns expected value
- Returns:
None
- test_user_role_setter_sets_user_role_value() None [source]#
Test that initialised user object’s setter for role sets the supplied role
- Returns:
None
- test_user_set_random_role_method_randomly_selects_role_on_user_instance() None [source]#
Test if the set_random_role method on the initialised user object changes the role of the user object.
Warning
This test is more of a regression test, and it essentially exists to protect the set_random_role method. Because of the relative unpredictability of the usage of the random module here, a more statistical distribution approach is employed to test that the method does perform as vaguely expected.
THIS IN NO WAY IS A TEST OF random.choice() or any such variation. Since future refactors and abstractions may consume from the set_random_role method, this is just a sanity test to guarantee that regardless of the future refactors done to the source code, random selection is guaranteed.
- Returns:
None