How to use the riotwatcher._apis.BaseApi function in riotwatcher

To help you get started, we’ve selected a few riotwatcher examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pseudonym117 / Riot-Watcher / tests / _apis / test_BaseApi.py View on Github external
def test_base_api_request_preview_handler(self):
        base_api = BaseApi(self._api_key, [self._request_handler_mock])
        endpoint_name = "endpoint_xx"
        method_name = "method_xx"
        region = "region_xx"
        url_ext = "url_xx"
        kwarg = "extra_xx"

        base_api.request(endpoint_name, method_name, region, url_ext, extra=kwarg)

        self._request_handler_mock.preview_request.assert_called_once_with(
            region,
            endpoint_name,
            method_name,
            "https://region_xx.api.riotgames.com%s" % url_ext,
            {"extra": kwarg},
        )
github pseudonym117 / Riot-Watcher / tests / _apis / test_BaseApi.py View on Github external
def test_base_api_request_static_preview_handler(self):
        base_api = BaseApi(self._api_key, [self._request_handler_mock])
        version = "version_xx"
        locale = "locale_xx"
        url_ext = "url_xx"

        ret = base_api.request_static(version, locale, url_ext)

        self._request_handler_mock.preview_static_request.assert_called_once_with(
            "https://ddragon.leagueoflegends.com/cdn/%s/data/%s/%s.json"
            % (version, locale, url_ext),
            {},
        )
github pseudonym117 / Riot-Watcher / tests / _apis / test_BaseApi.py View on Github external
def test_base_api_request_static_after_handler_with_preview_return(self):
        base_api = BaseApi(self._api_key, [self._request_handler_mock])
        version = "version_xx"
        locale = "locale_xx"
        url_ext = "url_xx"

        ret = base_api.request_static(version, locale, url_ext)

        self._request_handler_mock.after_static_request.assert_called_once_with(
            "https://ddragon.leagueoflegends.com/cdn/%s/data/%s/%s.json"
            % (version, locale, url_ext),
            self._expected_preview_return,
        )

        self.assertEqual(ret, self._expected_after_return)
github pseudonym117 / Riot-Watcher / tests / _apis / test_BaseApi.py View on Github external
def test_base_api_request_static_after_handler_with_preview_no_return(
        self, mock_get
    ):
        mock_get.return_value = self._mock_api_response

        base_api = BaseApi(self._api_key, [self._request_handler_mock_no_return])
        version = "version_xx"
        locale = "locale_xx"
        url_ext = "url_xx"

        ret = base_api.request_static(version, locale, url_ext)

        self._request_handler_mock_no_return.after_static_request.assert_called_once_with(
            "https://ddragon.leagueoflegends.com/cdn/%s/data/%s/%s.json"
            % (version, locale, url_ext),
            self._mock_api_response,
        )

        mock_get.assert_called_once_with(
            "https://ddragon.leagueoflegends.com/cdn/%s/data/%s/%s.json"
            % (version, locale, url_ext)
        )
github pseudonym117 / Riot-Watcher / tests / _apis / test_BaseApi.py View on Github external
def test_base_api_request_after_handler_with_preview_no_return(self, mock_get):
        mock_get.return_value = self._mock_api_response

        base_api = BaseApi(self._api_key, [self._request_handler_mock_no_return])
        endpoint_name = "endpoint_xx"
        method_name = "method_xx"
        region = "region_xx"
        url_ext = "url_xx"
        kwarg = "extra_xx"

        ret = base_api.request(endpoint_name, method_name, region, url_ext, extra=kwarg)

        self._request_handler_mock_no_return.after_request.assert_called_once_with(
            region,
            endpoint_name,
            method_name,
            "https://region_xx.api.riotgames.com%s" % url_ext,
            self._mock_api_response,
        )
github pseudonym117 / Riot-Watcher / tests / _apis / test_BaseApi.py View on Github external
def test_base_api_request_after_handler_with_preview_return(self):
        base_api = BaseApi(self._api_key, [self._request_handler_mock])
        endpoint_name = "endpoint_xx"
        method_name = "method_xx"
        region = "region_xx"
        url_ext = "url_xx"
        kwarg = "extra_xx"

        ret = base_api.request(endpoint_name, method_name, region, url_ext, extra=kwarg)

        self._request_handler_mock.after_request.assert_called_once_with(
            region,
            endpoint_name,
            method_name,
            "https://region_xx.api.riotgames.com%s" % url_ext,
            self._expected_preview_return,
        )