Skip to content

Commit

Permalink
test(main/game_storage): add test for retrieve empty game with None i…
Browse files Browse the repository at this point in the history
…nstead of empty list
  • Loading branch information
FlysonBot committed Dec 4, 2024
1 parent a16515e commit 9becbcd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/main/test_game_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ def test_retrieve_empty_games(self):
games = retrieve_stored_games()
self.assertEqual(games, [])

def test_retrieve_none_games(self):
"""Test the retrieve_stored_games function with None saved_games"""
mock_user_data_manager = create_autospec(UserDataManager, instance=True)
mock_user_data_manager.saved_games = None

with patch("mastermind.main.game_storage.userdata", new=mock_user_data_manager):
games = retrieve_stored_games()
self.assertEqual(games, [])

def test_list_continuable_games_index(self):
"""Test the list_continuable_games_index function"""
continuable_indexes = list_continuable_games_index(self.sample_games)
Expand Down

0 comments on commit 9becbcd

Please sign in to comment.