Beispiel #1
0
 def __init__(self, reader, writer, token):
     super().__init__(Platform.Steam, __version__, reader, writer, token)
     self._steam_id = None
     self._regmon = get_steam_registry_monitor()
     self._local_games_cache = local_games_list()
     self._http_client = AuthenticatedHttpClient()
     self._client = SteamHttpClient(self._http_client)
     self._achievements_cache = Cache()
def test_local_games_list_no_registry(mock_get_library_folders,
                                      mock_get_installed_games,
                                      mock_get_app_states_from_registry):
    library_folders = ["cofiguration_path"]
    mock_get_library_folders.return_value = library_folders
    mock_get_installed_games.return_value = ["1513", "12351"]
    mock_get_app_states_from_registry.return_value = {}
    assert local_games_list() == []
def test_local_games_list_no_games(mock_get_library_folders,
                                   mock_get_installed_games,
                                   mock_get_app_states_from_registry):
    library_folders = ["cofiguration_path"]
    mock_get_library_folders.return_value = library_folders
    mock_get_installed_games.return_value = []
    mock_get_app_states_from_registry.return_value = {}
    assert local_games_list() == []
    mock_get_library_folders.assert_called_once_with()
    mock_get_installed_games.assert_called_once_with(library_folders)
    mock_get_app_states_from_registry.assert_called_once()
def test_local_games_list(mock_get_library_folders, mock_get_installed_games,
                          mock_get_app_states_from_registry):
    library_folders = ["cofiguration_path"]
    mock_get_library_folders.return_value = library_folders
    mock_get_installed_games.return_value = ["1513", "12351"]
    mock_get_app_states_from_registry.return_value = {
        "1513": LocalGameState.Installed,
        "12351": LocalGameState.Installed | LocalGameState.Running,
        "89123": LocalGameState.Installed
    }
    assert local_games_list() == [
        LocalGame("1513", LocalGameState.Installed),
        LocalGame("12351", LocalGameState.Installed | LocalGameState.Running)
    ]
def test_local_games_list_no_steam(mocker):
    get_library_folders = mocker.patch("local_games.get_library_folders")
    get_library_folders.return_value = []
    assert local_games_list() == []
    get_library_folders.assert_called_once_with()