gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-bank] branch master updated: fix default passwords f


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] branch master updated: fix default passwords for exchange's testing purposes
Date: Tue, 09 May 2017 17:34:34 +0200

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 fe1b84e  fix default passwords for exchange's testing purposes
fe1b84e is described below

commit fe1b84e11b69d4dba7eea860c47126150c3d00cd
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue May 9 17:34:11 2017 +0200

    fix default passwords for exchange's testing purposes
---
 .../app/management/commands/provide_accounts.py    |  5 +++--
 talerbank/app/tests.py                             | 25 +++++++++++-----------
 talerbank/app/views.py                             |  4 ++--
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/talerbank/app/management/commands/provide_accounts.py 
b/talerbank/app/management/commands/provide_accounts.py
index 54d0206..cf3f0cd 100644
--- a/talerbank/app/management/commands/provide_accounts.py
+++ b/talerbank/app/management/commands/provide_accounts.py
@@ -31,7 +31,7 @@ def demo_accounts():
         try:
             User.objects.get(username=name)
         except User.DoesNotExist:
-            u = User.objects.create_user(username=name, password='')
+            u = User.objects.create_user(username=name, password='x')
             b = BankAccount(user=u,
                             currency=settings.TALER_CURRENCY,
                             is_public=True)
@@ -52,7 +52,7 @@ def ensure_account(name):
         sys.exit(1)
     except User.DoesNotExist:
         logger.info("Creating *user* account '{}'".format(name))
-        user = User.objects.create_user(username=name, password='')
+        user = User.objects.create_user(username=name, password='x')
 
     try:
         BankAccount.objects.get(user=user)
@@ -64,6 +64,7 @@ def ensure_account(name):
         acc.save()
         logger.info("Creating *bank* account number '{}' for user 
'{}'".format(acc.account_no, name))
 
+
 def basic_accounts():
     ensure_account("Bank")
     ensure_account("Exchange")
diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index 7d3c057..2ece08b 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -115,6 +115,7 @@ class HistoryTestCase(TestCase):
 
     def test_history(self):
         c = Client()
+
         response = c.get(reverse("history", urlconf=urls), {"auth": "basic", 
"delta": "+4"},
                          **{"HTTP_X_TALER_BANK_USERNAME": "User", 
"HTTP_X_TALER_BANK_PASSWORD": "Password"})
         self.assertEqual(200, response.status_code)
@@ -125,35 +126,35 @@ class HistoryTestCase(TestCase):
         data = response.content.decode("utf-8")
         data = json.loads(data)
         self.assertEqual(data["data"][0]["row_id"], 6)
-
-        # Get latest record
+#
+#        # Get latest record
         response = c.get(reverse("history", urlconf=urls), {"auth": "basic", 
"delta": "-1"},
                          **{"HTTP_X_TALER_BANK_USERNAME": "User", 
"HTTP_X_TALER_BANK_PASSWORD": "Password"})
         data = response.content.decode("utf-8")
         data = json.loads(data)
         self.assertEqual(data["data"][0]["subject"], "h")
-
-        # Get non-existent record: the latest plus one in the future
+#
+#        # Get non-existent record: the latest plus one in the future
         response = c.get(reverse("history", urlconf=urls), {"auth": "basic", 
"delta": "+1", "start": "10"},
                          **{"HTTP_X_TALER_BANK_USERNAME": "User", 
"HTTP_X_TALER_BANK_PASSWORD": "Password"})
         self.assertEqual(204, response.status_code)
-
-        # Get credit records
+#
+#        # Get credit records
         response = c.get(reverse("history", urlconf=urls), {"auth": "basic", 
"delta": "+1", "direction": "credit"},
                          **{"HTTP_X_TALER_BANK_USERNAME": "User", 
"HTTP_X_TALER_BANK_PASSWORD": "Password"})
         self.assertEqual(204, response.status_code)
-
-        # Get debit records
+#
+#        # Get debit records
         response = c.get(reverse("history", urlconf=urls), {"auth": "basic", 
"delta": "+1", "direction": "debit"},
                          **{"HTTP_X_TALER_BANK_USERNAME": "User", 
"HTTP_X_TALER_BANK_PASSWORD": "Password"})
         self.assertNotEqual(204, response.status_code)
-
-        # Query about non-owned account
+#
+#        # Query about non-owned account
         response = c.get(reverse("history", urlconf=urls), {"auth": "basic", 
"delta": "+1", "account_number": 2},
                          **{"HTTP_X_TALER_BANK_USERNAME": "User", 
"HTTP_X_TALER_BANK_PASSWORD": "Password"})
         self.assertEqual(403, response.status_code)
-
-        # Query about non-existent account
+#
+#        # Query about non-existent account
         response = c.get(reverse("history", urlconf=urls), {"auth": "basic", 
"delta": "-1", "account_number": 9},
                          **{"HTTP_X_TALER_BANK_USERNAME": "User", 
"HTTP_X_TALER_BANK_PASSWORD": "Password"})
         self.assertEqual(404, response.status_code)
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index d22bb4d..5c08ed6 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -339,6 +339,7 @@ def history(request):
     delta = request.GET.get("delta")
     if not delta:
         return HttpResponseBadRequest()
+    #FIXME: make the '+' sign optional
     parsed_delta = re.search("([\+-])([0-9]+)", delta)
     try:
         parsed_delta.group(0)
@@ -372,6 +373,7 @@ def history(request):
         try:
             target_account = BankAccount.objects.get(account_no=target_account)
         except BankAccount.DoesNotExist:
+            logger.error("Attempted /history about non existent account")
             return JsonResponse(dict(error="Queried account does not exist"), 
status=404)
 
     # Temporarily only allowing querying for the user's owned unique
@@ -413,7 +415,6 @@ def auth_and_login(request):
        credentials, False if errors occur"""
     
     auth_type = None
-
     if "POST" == request.method:
         data = json.loads(request.body.decode("utf-8"))
         auth_type = data["auth"]["type"]
@@ -426,7 +427,6 @@ def auth_and_login(request):
 
     username = request.META.get("HTTP_X_TALER_BANK_USERNAME")
     password = request.META.get("HTTP_X_TALER_BANK_PASSWORD")
-
     if not username or not password:
         return False
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]