Here's a summary of the unit tests that have been added to the game app:
CharacterModelTest:
Tests the creation of a Character model with various fields.
Checks string representation of the Character.
Validates the maximum length of the 'name' field.
Tests the 'description' field for accepting text.
Tests adding and removing Quality, Interest, and Activity objects to a Character.
Tests uploading an in-memory image to the image field.
Cleans up any created files after the tests.
CharacterSelectionFormTest:
Tests the initialization of a form with the correct queryset and widget.
Validates the form with both valid and invalid data.
CharacterCreationViewTest:
Tests the GET request response of the view.
Tests the POST request with valid and invalid form data.
Cleans up any test image files after the tests.
GetCharacterDetailsTest:
Tests responses when retrieving character details with various scenarios.
Cleans up any test image files after the tests.
GameSessionProcessorTest:
Tests the game_session_processor function in various scenarios.
setUp: Creates test users, a game session, and associated players, and sets up a request factory.
test_authenticated_user_with_active_game_session: Tests that an authenticated user with an active game session gets the correct game session URL in the context.
test_authenticated_user_no_active_game_session: Verifies that an authenticated user without an active game session does not get a game session URL in the context.
test_unauthenticated_user: Confirms that an unauthenticated user receives an empty context or a context with game_session_url set to None, depending on the actual behavior of the game_session_processor.
Here's a summary of the unit tests that have been added to the game app: