예제 #1
0
async def plugin(reader, writer):
    """Return plugin instance with all feature methods mocked"""
    methods = (
        "handshake_complete",
        "authenticate",
        "get_owned_games",
        "prepare_achievements_context",
        "get_unlocked_achievements",
        "achievements_import_complete",
        "get_local_games",
        "launch_game",
        "launch_platform_client",
        "install_game",
        "uninstall_game",
        "get_friends",
        "get_game_time",
        "prepare_game_times_context",
        "game_times_import_complete",
        "shutdown_platform_client",
        "shutdown",
        "tick",
        "get_game_library_settings",
        "prepare_game_library_settings_context",
        "game_library_settings_import_complete",
    )

    with ExitStack() as stack:
        for method in methods:
            stack.enter_context(patch.object(Plugin, method))

        async with Plugin(Platform.Generic, "0.1", reader, writer,
                          "token") as plugin:
            plugin.shutdown.return_value = async_return_value(None)
            yield plugin
def plugin(reader, writer):
    """Return plugin instance with all feature methods mocked"""
    async_methods = (
        "handshake_complete",
        "authenticate",
        "get_owned_games",
        "get_unlocked_achievements",
        "get_local_games",
        "launch_game",
        "install_game",
        "uninstall_game",
        "get_friends",
        "get_game_times",
        "shutdown_platform_client"
    )

    methods = (
        "shutdown",
        "tick"
    )

    with ExitStack() as stack:
        for method in async_methods:
            stack.enter_context(patch.object(Plugin, method, new_callable=coroutine_mock))
        for method in methods:
            stack.enter_context(patch.object(Plugin, method))
        yield Plugin(Platform.Generic, "0.1", reader, writer, "token")
예제 #3
0
def test_base_class():
    plugin = Plugin(Platform.Generic, "0.1", None, None, None)
    assert set(plugin.features) == {
        Feature.ImportInstalledGames, Feature.ImportOwnedGames,
        Feature.LaunchGame, Feature.InstallGame, Feature.UninstallGame,
        Feature.ImportAchievements, Feature.ImportGameTime,
        Feature.ImportFriends, Feature.ShutdownPlatformClient
    }
예제 #4
0
def test_base_class():
    plugin = Plugin(Platform.Generic, "0.1", None, None, None)
    assert set(plugin.features) == {
        Feature.ImportInstalledGames, Feature.ImportOwnedGames,
        Feature.LaunchGame, Feature.InstallGame, Feature.UninstallGame,
        Feature.ImportAchievements, Feature.ImportGameTime,
        Feature.ImportFriends, Feature.ShutdownPlatformClient,
        Feature.LaunchPlatformClient, Feature.ImportGameLibrarySettings,
        Feature.ImportOSCompatibility, Feature.ImportUserPresence
    }
def test_base_class():
    plugin = Plugin(Platform.Generic, "0.1", None, None, None)
    assert plugin.features == []