Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
GLEF1X committed Apr 24, 2021
1 parent bfd1de7 commit 4dd0140
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions glQiwiApi/core/aiohttp_custom_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def get_cached_session(self) -> Optional[aiohttp.ClientSession]:
cached = self._cache[self._cached_key]
if self.check_session(cached):
return cached
return None

def set_cached_session(self):
cached_session = self.get_cached_session()
Expand Down
10 changes: 4 additions & 6 deletions glQiwiApi/core/basic_requests_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ async def _request(
set_timeout: bool = True,
cookies: Optional[LooseCookies] = None,
json: Optional[dict] = None,
skip_exceptions: bool = False,
data: Optional[Dict[str, Union[
str, int, List[
Union[str, int]
Expand Down Expand Up @@ -105,11 +104,10 @@ async def _request(
ClientProxyConnectionError,
ServerDisconnectedError
) as ex:
if not skip_exceptions:
self.raise_exception(
status_code='400_special_bad_proxy',
json_info=ex
)
self.raise_exception(
status_code='400_special_bad_proxy',
json_info=ex
)
return Response.bad_response()
# Get content and return response
try:
Expand Down
4 changes: 2 additions & 2 deletions glQiwiApi/core/web_hooks/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class QiwiWalletWebView(BaseWebHookView):
"""

def _check_ip(self, ip: str) -> bool:
return _check_ip(ip)
def _check_ip(self, ip_address: str) -> bool:
return _check_ip(ip_address)

async def parse_update(self) -> types.WebHook:
"""
Expand Down
10 changes: 5 additions & 5 deletions tests/you_money_test.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import unittest

from glQiwiApi import YooMoneyAPI
from glQiwiApi.abstracts import AioTestCase
from glQiwiApi.core.abstracts import AioTestCase
from glQiwiApi.types import Payment, AccountInfo, Operation

TOKEN = 'some_token'


class YooMoneyTest(AioTestCase):
def setUp(self) -> None:
self.w = YooMoneyAPI(TOKEN)
self.wallet = YooMoneyAPI(TOKEN)

async def test_build_url_to_get_token(self):
url = await YooMoneyAPI.build_url_for_auth(
Expand All @@ -27,19 +27,19 @@ async def test_get_access_token(self):
self.assertEqual(isinstance(token, str), True)

async def test_account_info(self) -> None:
account_info = await self.w.account_info()
account_info = await self.wallet.account_info()
self.assertEqual(isinstance(account_info, AccountInfo), True)

async def test_transaction_history(self) -> None:
transactions = await self.w.transactions()
transactions = await self.wallet.transactions()
self.assertEqual(
all(
isinstance(
transaction, Operation
) for transaction in transactions), True)

async def test_send(self):
payment = await self.w.send(
payment = await self.wallet.send(
to_account='4100116633099701',
protect=True,
amount=2,
Expand Down

0 comments on commit 4dd0140

Please sign in to comment.