async def test_find_games_display_icon(uk_torchlight2, mock_winreg_watcher):
    """Find exe based on DisplayIcon subkey"""
    human_name, machine_name = "Torchlight 2", "torchlight2"
    owned_games = {human_name: machine_name}
    expected_exe = uk_torchlight2.display_icon

    finder = WindowsAppFinder()
    finder._reg = mock_winreg_watcher(uninstall_keys=[uk_torchlight2])
    res = await finder(owned_games)
    assert machine_name in res
    assert expected_exe == str(res[machine_name].executable)
async def test_find_game_display_uninstall(mock_winreg_watcher):
    """Find exe based on DisplayIcon subkey but not if it is uninstaller"""
    human_name, machine_name = "Agame", 'agame'
    uninstall = "C:\\agame\\uninstall.exe"
    uk_game = UninstallKey(key_name=human_name,
                           display_name=human_name,
                           uninstall_string=uninstall,
                           display_icon=uninstall)
    owned_games = {human_name: machine_name}
    finder = WindowsAppFinder()
    finder._reg = mock_winreg_watcher(uninstall_keys=[uk_game])
    assert {} == await finder(owned_games)
示例#3
0
def test_refresh_uks(uk_annas_quest, uk_windosill, patch_wrc):
    subkeys = [("Anna's Quest_is1", {
        "DisplayName": "Anna's Quest",
        "InstallLocation": "D:\\Games\\Anna's Quest\\",
        "UninstallString": "\"D:\\Games\\Anna's Quest\\unins000.exe\""
    }),
               (uk_windosill.key_name, {
                   "DisplayName": uk_windosill.display_name,
                   "InstallLocation": uk_windosill.install_location,
                   "UninstallString": uk_windosill.uninstall_string
               })]
    expected = set([uk_annas_quest, uk_windosill])
    with patch_wrc(subkeys):
        finder = WindowsAppFinder()
        finder.refresh()
        assert finder._reg.uninstall_keys == expected
示例#4
0
async def test_find_games_display_icon(uk_torchlight2):
    """Find exe based on DisplayIcon subkey"""
    human_name, machine_name = "Torchlight 2", "torchlight2"
    owned_games = [TroveGame({'human-name': human_name, 'machine_name': machine_name})]
    finder = WindowsAppFinder()
    expected_exe = uk_torchlight2.display_icon
    with patch.object(finder._reg, '_WinRegUninstallWatcher__uninstall_keys', [uk_torchlight2]):
        assert expected_exe == str((await finder.find_local_games(owned_games))[0].executable)
示例#5
0
def test_no_match():
    human_name = "Orks: final cutdown"
    uk = UninstallKey(
        'keyname',
        'displayname',
        'uninstall_str',
        install_location='somewhere\\else',
    )
    assert False == WindowsAppFinder._matches(human_name, uk)
示例#6
0
def test_match_colon_in_name():
    human_name = "Orks: final cutdown"
    install_location = "C:\\Games\\Orks Final Cutdown"
    uk = UninstallKey(
        key_name="mock",
        display_name="Orks Final Cutdown",
        uninstall_string="mock",
        install_location=install_location,
    )
    assert True == WindowsAppFinder._matches(human_name, uk)
示例#7
0
def test_match_with_folder_name():
    human_name = "The Windosill"
    install_location = 'C:\\Games\\The Windosill\\'
    uk = UninstallKey(
        key_name="Windosill_is1",
        display_name="Windosill version 1.61",
        uninstall_string="\"C:\\Games\\The Windosill\\uninstall.exe\"",
        install_location=install_location,
    )
    assert True == WindowsAppFinder._matches(human_name, uk)
示例#8
0
async def test_find_game_display_uninstall():
    """Find exe based on DisplayIcon subkey but not if it is uninstaller"""
    human_name, machine_name = "Agame", 'agame'
    uninstall = "C:\\agame\\uninstall.exe"
    uk_game = UninstallKey(
        key_name=human_name,
        display_name=human_name,
        uninstall_string=uninstall,
        display_icon=uninstall
    )
    owned_games = [TroveGame({'human-name': human_name, 'machine_name': machine_name})]
    finder = WindowsAppFinder()
    with patch.object(finder._reg, '_WinRegUninstallWatcher__uninstall_keys', set([uk_game])):
        assert [] == await finder.find_local_games(owned_games)
示例#9
0
def test_match_by_key_name():
    uk = UninstallKey('Limbo', '', uninstall_string='')
    human_name = 'LIMBO'
    assert True == WindowsAppFinder._matches(human_name, uk)