Beispiel #1
0
def test_new_game_not_owned(create_authenticated_plugin):
    loop = asyncio.get_event_loop()
    pg = create_authenticated_plugin()

    new_game = NewGame()
    new_game.owned = False

    loop.run_until_complete(pg._add_new_games([new_game]))

    pg.add_game.assert_not_called()
Beispiel #2
0
def test_new_game_owned(create_authenticated_plugin):
    loop = asyncio.get_event_loop()
    pg = create_authenticated_plugin()

    new_game = NewGame()

    pg.add_game = mock.create_autospec(pg.add_game)

    loop.run_until_complete(pg._add_new_games([new_game]))

    pg.add_game.assert_called_with(new_game.as_galaxy_game())
Beispiel #3
0
    def test_launch_game_space_id(create_authenticated_plugin):
        loop = asyncio.get_event_loop()
        pg = create_authenticated_plugin()

        new_game = NewGame()
        new_game.status = "Installed"

        pg.user_can_perform_actions.return_value = True

        pg.games_collection.get_local_games.return_value = [new_game]

        pg.open_uplay_client = mock.create_autospec(pg.open_uplay_client)

        with mock.patch("plugin.subprocess.Popen") as pop:
            loop.run_until_complete(pg.launch_game("123"))
            pop.assert_called_with(f"start uplay://launch/{new_game.launch_id}", shell=True)

        pg.open_uplay_client.assert_not_called()
def test_install_game_cant_perform(create_authenticated_plugin):
    loop = asyncio.get_event_loop()
    pg = create_authenticated_plugin()

    new_game = NewGame()
    new_game.status = "NotInstalled"

    pg.user_can_perform_actions.return_value = False

    pg.games_collection = [new_game]

    pg.open_uplay_client = mock.create_autospec(pg.open_uplay_client)

    with mock.patch("plugin.subprocess.Popen") as pop:
        loop.run_until_complete(pg.install_game("321"))
        pop.assert_not_called()

    pg.open_uplay_client.assert_not_called()
Beispiel #5
0
    def test_launch_steam_game(create_authenticated_plugin):
        loop = asyncio.get_event_loop()
        pg = create_authenticated_plugin()

        new_game = NewGame()
        new_game.type = "Steam"
        new_game.status = "Installed"

        pg.user_can_perform_actions.return_value = True

        pg.games_collection.get_local_games.return_value = [new_game]

        pg.open_uplay_client = mock.create_autospec(pg.open_uplay_client)

        with mock.patch("plugin.is_steam_installed") as steam_installed:
            with mock.patch("plugin.subprocess.Popen") as pop:
                steam_installed.return_value = True
                loop.run_until_complete(pg.launch_game("321"))
                pop.assert_called_with(f"start steam://rungameid/{new_game.third_party_id}", shell=True)

        pg.open_uplay_client.assert_not_called()