This PR adds comprehensive unit tests for the BasicUser class to ensure all its methods and properties work as expected.
This PR resolves the issue #54
Tests
test_login:
Verifies that the login method correctly calls the sign_into_os function from the os_api client with async_req=True when connect_after_login is set to False.
test_login_and_connect:
Checks that when connect_after_login is set to True, the login method starts a new thread for the connection process after logging in.
test_logout:
Ensures the logout method properly calls the sign_out_of_os method on the os_api client to log the user out.
test_connect:
Confirms that the connect method calls allocations_connect_new_cloud on the allocations_api with the UserProfile instance to establish a new cloud allocation.
test_connect_without_login:
Tests that attempting to call the connect method without a valid user_profile (i.e., when user_profile is None) raises a PermissionError.
test_disconnect:
Verifies that the disconnect method calls allocations_disconnect_cloud on the allocations_api using the current allocation from user_profile.
test_disconnect_without_login:
Checks that calling disconnect when user_profile is None raises a PermissionError, preventing disconnection without a logged-in user.
test_picture_property:
Ensures the picture property returns the correct URL from the user_profile's picture attribute.
test_name_property:
Confirms that the name property correctly retrieves the name value from the user_profile.
test_email_property:
Verifies that the email property accurately returns the email address from the user_profile.
test_vanity_name_property:
Ensures the vanity_name property returns the correct vanity name stored in the user_profile.
test_cloud_status_property:
Checks that the cloud_status property correctly reflects the cloud allocation status (RUNNING, STOPPED, etc.) from the user_profile's allocation status.
Changes Made
Added BasicUserTest class in test_basic_user.py to cover all the functionalities and properties of the BasicUser class.
Mocked dependencies like os_api, allocations_api, and UserProfile to isolate the unit tests.
Ensured that all tests are self-contained and do not require any external setup.
Screenshot
the above image indicates passing of all 12 test cases for the BasicUser Class .
Description
This PR adds comprehensive unit tests for the BasicUser class to ensure all its methods and properties work as expected.
This PR resolves the issue #54
Tests
Changes Made
Screenshot
the above image indicates passing of all 12 test cases for the BasicUser Class .