Example #1
0
 def test_get_dlc_info(self, mock_isfile):
     mock_isfile.side_effect = [True]
     json_content = '{"dlcs": {"example_dlc" : {"example_key": "example_value"}}}'
     with patch("builtins.open", mock_open(read_data=json_content)):
         game = Game("Game Name test")
         game_get_status = game.get_dlc_info("example_key", "example_dlc")
     expected = "example_value"
     observed = game_get_status
     self.assertEqual(expected, observed)
Example #2
0
 def test2_get_dlc_info_legacy(self, mock_isfile):
     mock_isfile.side_effect = [True, True]
     json_content = '{"dlcs": {"example_dlc" : {"example_key": "example_value"}}}'
     with patch("builtins.open", mock_open(read_data=json_content)):
         game = Game("Game Name test")
         game.set_dlc_info = MagicMock()
         game.load_minigalaxy_info_json = MagicMock()
         game.load_minigalaxy_info_json.return_value = {}
         game_get_status = game.get_dlc_info("example_key", "example_dlc")
     expected = "example_value"
     observed = game_get_status
     self.assertEqual(expected, observed)