From 5c5fe4368c98181675cf6eeb5e3bf25030ebebf6 Mon Sep 17 00:00:00 2001 From: gleb Date: Mon, 26 Apr 2021 15:35:34 +0300 Subject: [PATCH] add tests for qiwi --- glQiwiApi/qiwi/qiwi_api.py | 1 - tests/qiwi_test.py | 27 +++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/glQiwiApi/qiwi/qiwi_api.py b/glQiwiApi/qiwi/qiwi_api.py index 43254a39..a28b61ef 100644 --- a/glQiwiApi/qiwi/qiwi_api.py +++ b/glQiwiApi/qiwi/qiwi_api.py @@ -34,7 +34,6 @@ Account, Balance, Identification, - Response, Sum, Commission, OptionalSum, diff --git a/tests/qiwi_test.py b/tests/qiwi_test.py index 6773c5a3..8ec1fd51 100644 --- a/tests/qiwi_test.py +++ b/tests/qiwi_test.py @@ -4,9 +4,9 @@ from glQiwiApi import QiwiWrapper, types, sync, RequestError, InvalidData from glQiwiApi.core import AioTestCase -TOKEN = '4cb242f9ead43bd0e1e98eb7c442262f' -WALLET = '+380968317459' -QIWI_SECRET = 'eyJ2ZXJzaW9uIjoiUDJQIiwiZGF0YSI6eyJwYXlpbl9tZXJjaGFudF9zaXRlX3VpZCI6ImJuMXZmNy0wMCIsInVzZXJfaWQiOiIzODA5NjgzMTc0NTkiLCJzZWNyZXQiOiI2ZmVjYzA4ZWEyOTgxMDY3N2VkNDU1YjY3MTVhZjc3ZjRhMjY4Yzc5MDU0ZGI2ZmYyZTEzZjI1Njk5ODQ3M2ZmIn19' +TOKEN = 'token' +WALLET = '+number' +QIWI_SECRET = 'p2p token' class SyncQiwiTestCase(unittest.TestCase): @@ -64,8 +64,7 @@ def test_transaction_info(self): self.wallet.transaction_info, info[0].transaction_id, info[0].type - ) - , types.Transaction) + ), types.Transaction) ) def test_to_wallet(self): @@ -105,11 +104,11 @@ def test_available_balances(self): ) def test_to_card(self): - txn_id = sync(self.wallet.to_card, to_card='4890494688391549', + txn_id = sync(self.wallet.to_card, to_card='card_number', trans_sum=1) self.assertTrue(isinstance(txn_id, str)) with self.assertRaises(RequestError): - sync(self.wallet.to_card, to_card='+380985272064', trans_sum=1) + sync(self.wallet.to_card, to_card='+wrong_number', trans_sum=1) def test_test_limits(self): limits = sync(self.wallet.get_limits) @@ -146,12 +145,12 @@ async def test_account_info(self): async def test_commission(self) -> None: async with self.wallet as w: - commission = await (w.commission(to_account='+380985272064', + commission = await (w.commission(to_account='+number', pay_sum=1)) self.assertTrue(isinstance(commission, types.Commission)) with self.assertRaises(RequestError): async with self.wallet as w: - await w.commission(to_account='+380985272064', + await w.commission(to_account='+number', pay_sum=-1) async def test_fail(self): @@ -168,7 +167,7 @@ async def test_fail(self): trans_sum=1) with self.assertRaises(RequestError): async with self.wallet as w: - await w.to_wallet(to_number='+380985272064', + await w.to_wallet(to_number='+number', trans_sum=-1) async def test_transactions_history(self): @@ -201,7 +200,7 @@ async def test_transaction_info(self): async def test_to_wallet(self): async with self.wallet as w: - txn_id = await w.to_wallet(to_number='+380985272064', + txn_id = await w.to_wallet(to_number='+number', trans_sum=1) self.assertTrue(isinstance(txn_id, str)) @@ -222,7 +221,7 @@ async def test_p2p_creation(self): async def test_p2p_status_check(self): async with self.wallet as w: bill = await w.create_p2p_bill(amount=1, - comment='my_comment') + comment='my_comment') checked = await bill.check() status = await self.wallet.check_p2p_bill_status( bill_id=bill.bill_id @@ -245,8 +244,8 @@ async def test_available_balances(self): async def test_to_card(self): async with self.wallet as w: - txn_id = await w.to_card(to_card='4890494688391549', - trans_sum=1) + txn_id = await w.to_card(to_card='card', + trans_sum=1) with self.assertRaises(RequestError): txn_id = await w.to_card(to_card='+380985272064', trans_sum=1)