Skip to content

Commit 9becbcd

Browse files
committed
test(main/game_storage): add test for retrieve empty game with None instead of empty list
1 parent a16515e commit 9becbcd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/main/test_game_storage.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ def test_retrieve_empty_games(self):
3838
games = retrieve_stored_games()
3939
self.assertEqual(games, [])
4040

41+
def test_retrieve_none_games(self):
42+
"""Test the retrieve_stored_games function with None saved_games"""
43+
mock_user_data_manager = create_autospec(UserDataManager, instance=True)
44+
mock_user_data_manager.saved_games = None
45+
46+
with patch("mastermind.main.game_storage.userdata", new=mock_user_data_manager):
47+
games = retrieve_stored_games()
48+
self.assertEqual(games, [])
49+
4150
def test_list_continuable_games_index(self):
4251
"""Test the list_continuable_games_index function"""
4352
continuable_indexes = list_continuable_games_index(self.sample_games)

0 commit comments

Comments
 (0)