[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-bank] branch master updated: Access API.
From: |
gnunet |
Subject: |
[taler-bank] branch master updated: Access API. |
Date: |
Thu, 27 Aug 2020 12:02:27 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository bank.
The following commit(s) were added to refs/heads/master by this push:
new d78c748 Access API.
d78c748 is described below
commit d78c748c463999c401d673953e0f45b46e2c7a1b
Author: MS <ms@taler.net>
AuthorDate: Thu Aug 27 12:01:55 2020 +0200
Access API.
Testing the withdrawal status query.
---
talerbank/app/tests.py | 24 ++++++++++++++++++++++--
talerbank/app/urls.py | 1 +
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index 2f59b06..6617ced 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -65,7 +65,7 @@ def clear_db():
cursor.execute("ALTER SEQUENCE app_banktransaction_id_seq RESTART")
# Testing the "Access API":
-# (testing) registration + ask for balance + withdraw: create / ask status
/ abort / confirm.
+# (testing) registration* + ask for balance* + withdraw: create* / ask
status / abort / confirm.
class AccessApiWithdrawTestCase(TestCase):
def setUp(self):
clear_db()
@@ -77,7 +77,7 @@ class AccessApiWithdrawTestCase(TestCase):
)
self.user_bank_account.save()
- def test_withdraw(self):
+ def test_withdraw_create(self):
c = Client()
r = c.post(
reverse("access-api-withdrawal",
kwargs=dict(acct_id="RandomUser")),
@@ -86,7 +86,27 @@ class AccessApiWithdrawTestCase(TestCase):
data=dict(amount=f"{settings.TALER_CURRENCY}:5")
)
self.assertEqual(r.status_code, 200)
+
+ def test_withdraw_status(self):
+ c = Client()
+ r = c.post(
+ reverse("access-api-withdrawal",
kwargs=dict(acct_id="RandomUser")),
+ HTTP_AUTHORIZATION=make_auth_line("RandomUser", "XYZ"),
+ content_type="application/json",
+ data=dict(amount=f"{settings.TALER_CURRENCY}:5")
+ )
+ self.assertEqual(r.status_code, 200)
+ data = r.content.decode("utf-8")
+ data_dict = json.loads(data)
+ withdrawal_id = data_dict.get("withdrawal_id")
+ self.assertTrue(withdrawal_id)
+ r = c.get(
+ reverse("access-api-withdrawal-status",
+ kwargs=dict(acct_id="RandomUser", wid=withdrawal_id)),
+ HTTP_AUTHORIZATION=make_auth_line("RandomUser", "XYZ"),
+ )
print(r.content.decode("utf-8"))
+ self.assertEqual(r.status_code, 200)
class AccessApiBalanceTestCase(TestCase):
def setUp(self):
diff --git a/talerbank/app/urls.py b/talerbank/app/urls.py
index aee547f..9f2ab15 100644
--- a/talerbank/app/urls.py
+++ b/talerbank/app/urls.py
@@ -66,6 +66,7 @@ taler_bank_accounts_api_patterns = [
path(
"accounts/<str:acct_id>/withdrawals/<str:wid>",
views.bank_accounts_api_get_withdrawal,
+ name="access-api-withdrawal-status"
),
path(
"accounts/<str:acct_id>/withdrawals/<str:wid>/confirm",
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-bank] branch master updated: Access API.,
gnunet <=