def test_download_resolver_for_bitness():
    data = {
        'platform': 'windows',
        'machine_name': 'test_dw',
        'download_struct': [{
            'name': '32-bit'
        }, {
            'name': '64-bit'
        }]
    }
    sub = SubproductDownload(data)
    download = HumbleDownloadResolver(BITNESS.B64)(sub)
    assert download.name == '64-bit'
    download = HumbleDownloadResolver(BITNESS.B32)(sub)
    assert download.name == '32-bit'
Esempio n. 2
0
    def __init__(self, reader, writer, token):
        super().__init__(Platform.HumbleBundle, __version__, reader, writer,
                         token)
        self._api = AuthorizedHumbleAPI()
        self._download_resolver = HumbleDownloadResolver()
        self._app_finder = AppFinder()
        self._settings = Settings()
        self._library_resolver = None
        self._subscription_months: List[ChoiceMonth] = []

        self._owned_games: Dict[str, HumbleGame] = {}
        self._trove_games: Dict[str, TroveGame] = {}
        self._choice_games = {
        }  # for now model.subscription.ChoiceContet or Extras TODO consider adding to model.game

        self._local_games = {}
        self._cached_game_states = {}

        self._getting_owned_games = asyncio.Lock()
        self._owned_check: asyncio.Task = asyncio.create_task(asyncio.sleep(8))
        self._statuses_check: asyncio.Task = asyncio.create_task(
            asyncio.sleep(4))
        self._installed_check: asyncio.Task = asyncio.create_task(
            asyncio.sleep(4))

        self._rescan_needed = True
        self._under_installation = set()
    def __init__(self, reader, writer, token):
        super().__init__(Platform.HumbleBundle, __version__, reader, writer, token)
        self._api = AuthorizedHumbleAPI()
        self._download_resolver = HumbleDownloadResolver()
        self._app_finder = AppFinder
        self._settings = None
        self._library_resolver = None

        self._owned_games = {}
        self._local_games = {}
        self._cached_game_states = {}

        self._getting_owned_games = asyncio.Event()
        self._check_owned_task = asyncio.create_task(asyncio.sleep(0))
        self._check_installed_task = asyncio.create_task(asyncio.sleep(5))
        self._check_statuses_task = asyncio.create_task(asyncio.sleep(2))

        self.__under_instalation = set()
    def __init__(self, reader, writer, token):
        super().__init__(Platform.HumbleBundle, __version__, reader, writer,
                         token)
        self._api = AuthorizedHumbleAPI()
        self._download_resolver = HumbleDownloadResolver()
        self._app_finder = AppFinder()
        self._settings = Settings()
        self._library_resolver = None

        self._owned_games = {}
        self._local_games = {}
        self._cached_game_states = {}

        self._getting_owned_games = asyncio.Lock()
        self._owned_check: asyncio.Task = asyncio.create_task(asyncio.sleep(8))
        self._statuses_check: asyncio.Task = asyncio.create_task(
            asyncio.sleep(4))
        self._installed_check: asyncio.Task = asyncio.create_task(
            asyncio.sleep(4))

        self._rescan_needed = True
        self._under_installation = set()
async def test_install_game(plugin_mock, overgrowth):
    id_ = overgrowth['product']['machine_name']
    subproduct = overgrowth['subproducts'][0]

    game = Subproduct(subproduct)
    plugin_mock._owned_games = {id_: game}
    # Note windows have also download_struct named "Patch". Not supported currently, only one download
    download_urls = {
        "linux":
        "https://dl.humble.com/wolfiregames/overgrowth-1.4.0_build-5584-linux64.zip?gamekey=XrCTukcAFwsh&ttl=1563893021&t=46b9a84ac7c864cf8fe263239a9978ae",
        "windows":
        "https://dl.humble.com/wolfiregames/overgrowth-1.4.0_build-5584-win64.zip?gamekey=XrCTukcAFwsh&ttl=1563893021&t=7f2263e7f3360f3beb112e58521145a0",
        "mac":
        "https://dl.humble.com/wolfiregames/overgrowth-1.4.0_build-5584-macosx.zip?gamekey=XrCTukcAFwsh&ttl=1563893021&t=5ade7954d8fc63bbe861932be538c07e",
    }

    for os in [HP.WINDOWS, HP.MAC]:
        plugin_mock._download_resolver = HumbleDownloadResolver(
            target_platform=os)
        with patch('webbrowser.open') as browser_open:
            await plugin_mock.install_game(id_)
            browser_open.assert_called_once_with(download_urls[os.value])