From 9becbcdf568f718c612926fb9e7173265e4945ab Mon Sep 17 00:00:00 2001 From: FlysonBot Date: Wed, 4 Dec 2024 07:14:26 +0000 Subject: [PATCH] test(main/game_storage): add test for retrieve empty game with None instead of empty list --- tests/main/test_game_storage.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/main/test_game_storage.py b/tests/main/test_game_storage.py index 5ce4789..1a58d9b 100644 --- a/tests/main/test_game_storage.py +++ b/tests/main/test_game_storage.py @@ -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)