[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-bank] branch master updated: test integration API's withdrawal
From: |
gnunet |
Subject: |
[taler-bank] branch master updated: test integration API's withdrawal |
Date: |
Tue, 13 Oct 2020 14:43:31 +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 0fc6253 test integration API's withdrawal
0fc6253 is described below
commit 0fc6253eb0b8b4d818d173d64472191e5e9ff508
Author: MS <ms@taler.net>
AuthorDate: Tue Oct 13 14:43:13 2020 +0200
test integration API's withdrawal
---
talerbank/app/static/web-common | 2 +-
talerbank/app/tests.py | 46 ++++++++++++++++++++++++++++++++++++-----
talerbank/app/urls.py | 23 +++++++++------------
3 files changed, 52 insertions(+), 19 deletions(-)
diff --git a/talerbank/app/static/web-common b/talerbank/app/static/web-common
index eaefc57..e9554ba 160000
--- a/talerbank/app/static/web-common
+++ b/talerbank/app/static/web-common
@@ -1 +1 @@
-Subproject commit eaefc57f2ea5434ad6b7f1c11ee4daa0fc92c76c
+Subproject commit e9554baf0f3f880d656284ef5e9089bbd8313464
diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index ab09ace..288fc60 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -19,6 +19,7 @@
import json
import time
+import uuid
import zlib
import timeit
import logging
@@ -31,7 +32,7 @@ from django.urls import reverse
from django.conf import settings
from django.contrib.auth.models import User
from mock import patch, MagicMock
-from .models import BankAccount, BankTransaction
+from .models import BankAccount, BankTransaction, TalerWithdrawOperation
from . import urls
from .views import wire_transfer, get_reserve_pub, PaytoParse
from taler.util.amount import (
@@ -120,15 +121,50 @@ class WireGatewayTestCase(TestCase):
)
self.assertEqual(r.status_code, 200)
-# Testing the "Integration API":
-# has three operations: 1) /config, 2,3) create, see status of withdrawal.
-class IntegrationConfigTestCase(TestCase):
+class IntegrationApiTestCase(TestCase):
+ def setUp(self):
+ clear_db()
+
+ self.exchange = User.objects.create_user(username="RandomExchange",
password="XYZ")
+ self.exchange.save()
+ self.exchange_bank_account = BankAccount(
+ user=self.exchange,
+ balance=SignedAmount(True, Amount(settings.TALER_CURRENCY, 100, 0))
+ )
+ self.exchange_bank_account.save()
+
+ self.user = User.objects.create_user(username="RandomUser",
password="XYZ")
+ self.user.save()
+ self.user_bank_account = BankAccount(
+ user=self.user,
+ balance=SignedAmount(True, Amount(settings.TALER_CURRENCY, 100, 0))
+ )
+ self.user_bank_account.save()
+ self.client = Client()
+
def test_config(self):
c = Client()
r = c.get("/config")
self.assertEqual(r.status_code, 200)
-class AccessAndIntegrationApiWithdrawTestCase(TestCase):
+ def test_withdraw(self):
+ operation = TalerWithdrawOperation(
+ amount=Amount(settings.TALER_CURRENCY, 100, 0),
+ withdraw_account=self.user_bank_account
+ )
+ operation.save()
+ r = self.client.post(
+ reverse("api-withdraw-operation",
+ kwargs=dict(withdraw_id=operation.withdraw_id)),
+ data=dict(
+ reserve_pub="reserve-public-key",
+
selected_exchange=f"payto://x-taler-bank/localhost/RandomExchange"
+ ),
+ content_type="application/json"
+ )
+ self.assertEqual(r.status_code, 200)
+
+class AccessApiWithdrawTestCase(TestCase):
def setUp(self):
clear_db()
self.user = User.objects.create_user(username="RandomUser",
password="XYZ")
diff --git a/talerbank/app/urls.py b/talerbank/app/urls.py
index 71d87bf..f3018c3 100644
--- a/talerbank/app/urls.py
+++ b/talerbank/app/urls.py
@@ -47,20 +47,13 @@ taler_wire_gateway_patterns = [
taler_bank_integration_api_patterns = [
- path(
- "api/config",
- views.api_config,
- name="api-config",
+ path("api/config",
+ views.api_config,
+ name="api-config"
),
- path(
- "api/withdrawal-operation/<str:withdraw_id>",
- views.api_withdraw_operation,
- name="api-withdraw-operation",
- ),
- path(
- "confirm-withdrawal/<str:withdraw_id>",
- views.confirm_withdrawal,
- name="withdraw-confirm",
+ path("api/withdrawal-operation/<str:withdraw_id>",
+ views.api_withdraw_operation,
+ name="api-withdraw-operation"
),
]
@@ -97,6 +90,10 @@ urlpatterns = [
path("", include(taler_bank_integration_api_patterns)),
path("", include(taler_bank_access_api_patterns)),
path("taler-wire-gateway/", include(taler_wire_gateway_patterns)),
+ path("confirm-withdrawal/<str:withdraw_id>",
+ views.confirm_withdrawal,
+ name="withdraw-confirm",
+ ),
path("abort-withdrawal/<str:withdraw_id>",
views.abort_withdrawal,
name="abort-withdrawal"
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-bank] branch master updated: test integration API's withdrawal,
gnunet <=