[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] branch master updated: /add/admin testcase fix
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] branch master updated: /add/admin testcase fixed but ROOT_URLCONF doesn't switch between normal and admin url-views mapping. |
Date: |
Thu, 02 Feb 2017 10:47:49 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository bank.
The following commit(s) were added to refs/heads/master by this push:
new 471ebf4 /add/admin testcase fixed but ROOT_URLCONF doesn't switch
between normal and admin url-views mapping.
471ebf4 is described below
commit 471ebf41b0cc48ac12f72d0876e62addb08a6457
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Feb 2 10:46:39 2017 +0100
/add/admin testcase fixed but ROOT_URLCONF doesn't switch
between normal and admin url-views mapping.
---
talerbank/app/tests.py | 19 +++++++++----------
talerbank/app/views.py | 4 ++--
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index c4f3ca1..9981b04 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -37,13 +37,14 @@ class RegisterTestCase(TestCase):
ba = BankAccount(user=bank, currency=settings.TALER_CURRENCY)
ba.account_no = 1
ba.save()
- settings.ROOT_URLCONF = "talerbank.app.urls"
+ settings.configure(ROOT_URLCONF="talerbank.app.urls")
def tearDown(self):
clearDb()
def test_register(self):
c = Client()
+ logger.info("My ROOT_URLCONF, {}".format(settings.ROOT_URLCONF))
response = c.post(reverse("register"),
{"username": "test_register",
"password": "test_register"},
@@ -62,7 +63,7 @@ class LoginTestCase(TestCase):
user_account = BankAccount(user=user,
currency=settings.TALER_CURRENCY)
user_account.save()
- settings.ROOT_URLCONF = "talerbank.app.urls"
+ settings.configure(ROOT_URLCONF="talerbank.app.urls")
def tearDown(self):
@@ -71,6 +72,7 @@ class LoginTestCase(TestCase):
def test_login(self):
c = Client()
+ logger.info("My ROOT_URLCONF, {}".format(settings.ROOT_URLCONF))
response = c.post(reverse("login"),
{"username": "test_user",
"password": "test_password"},
@@ -91,18 +93,15 @@ class AddIncomingTestCase(TestCase):
currency=settings.TALER_CURRENCY)
bank_account.save()
user_account.save()
- settings.ROOT_URLCONF = "talerbank.app.urlsadmin"
+ settings.configure(ROOT_URLCONF="talerbank.app.urlsadmin")
def tearDown(self):
clearDb()
def test_add_incoming(self):
c = Client()
+ data = '{"debit_account":1, "credit_account":2, "wtid":"TESTWTID",
"amount":{"value":1, "fraction":0, "currency":"%s"}}' % settings.TALER_CURRENCY
response = c.post(reverse("add-incoming"),
- {"debit_account": 1,
- "credit_account": 2,
- "wtid": "test_wtid",
- "amount": {"value": 1,
- "fraction": 0,
- "currency": "TROIO"}},
- follow=True)
+ data=data,
+ content_type="application/json",
+ follow=True)
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 4cc5673..86eb4a3 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -21,7 +21,7 @@ import django.contrib.auth.forms
from django import forms
from django.conf import settings
from django.contrib.auth.decorators import login_required
-from django.http import HttpResponse, HttpResponseBadRequest,
HttpResponseServerError
+from django.http import JsonResponse, HttpResponse, HttpResponseBadRequest,
HttpResponseServerError
from django.shortcuts import render, redirect
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST, require_GET
@@ -296,7 +296,7 @@ def add_incoming(request):
within the browser, and only over the private admin interface.
"""
logger.info("handling /admin/add/incoming")
- logger.info("about to crash")
+ logger.info(request.body.decode("utf-8"))
data = json.loads(request.body.decode("utf-8"))
logger.info(json.dumps(data))
try:
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-bank] branch master updated: /add/admin testcase fixed but ROOT_URLCONF doesn't switch between normal and admin url-views mapping.,
gnunet <=