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 (7d6e222 -> d65529d)


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] branch master updated (7d6e222 -> d65529d)
Date: Sat, 18 Nov 2017 11:25:46 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a change to branch master
in repository bank.

    from 7d6e222  +details about wire transfer errors
     new 6810ea2  check money was actually transferred via testcase
     new d65529d  check status code after wire transfer

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 talerbank/app/tests.py | 56 +++++++++++++++++++++++++++++---------------------
 1 file changed, 33 insertions(+), 23 deletions(-)

diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index 55bea32..7e1ea26 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -65,9 +65,7 @@ class WithdrawTestCase(TestCase):
           "reserve_pub": "UVZ789",
           "wire_details": wire_details.replace("\n", "").replace(" ", "")
         }
-        client.post(reverse("login", urlconf=urls),
-                    {"username": "test_user",
-                     "password": "test_password"})
+        client.login(username="test_user", password="test_password")
 
         response = client.get(reverse("pin-question", urlconf=urls),
                               params)
@@ -99,6 +97,33 @@ class WithdrawTestCase(TestCase):
         
mocked_post.assert_called_with("http://exchange.example/admin/add/incoming";,
                                        json=expected_json)
 
+    def tearDown(self):
+        clear_db()
+
+class InternalWireTransferTestCase(TestCase):
+
+    def setUp(self):
+        gm = BankAccount(user=User.objects.create_user(username='give_money',
+                                                       password="gm"))
+        gm.save()
+        tm = BankAccount(user=User.objects.create_user(username='take_money'),
+                         account_no=88)
+        tm.save()
+
+    def test_internal_wire_transfer(self):
+        client = Client()
+        client.login(username="give_money", password="gm")
+        response = client.post(reverse("profile", urlconf=urls),
+                               {"amount": 3.0,
+                                "counterpart": 88,
+                                "subject": "charity"})
+        tm = BankAccount.objects.get(account_no=88)
+        self.assertEqual(0, Amount.cmp(Amount(settings.TALER_CURRENCY, 3), 
tm.amount))
+        self.assertEqual(200, response.status_code)
+
+    def tearDown(self):
+        clear_db()
+
 class RegisterTestCase(TestCase):
     """User registration"""
 
@@ -125,8 +150,8 @@ class RegisterTestCase(TestCase):
 class RegisterWrongCurrencyTestCase(TestCase):
     """User registration"""
 
-    # Activating this user with a faulty currency.
     def setUp(self):
+        # Note, config has KUDOS as currency.
         user_bankaccount = BankAccount(
             user=User.objects.create_user(username='Bank'),
             amount=Amount('WRONGCURRENCY'),
@@ -142,10 +167,6 @@ class RegisterWrongCurrencyTestCase(TestCase):
                                {"username": "test_register",
                                 "password": "test_register"},
                                follow=True)
-        # A currency mismatch is expected when the 100 KUDOS will be
-        # attempted to be given to the new user.
-        # This scenario expects a 500 Internal server error response to
-        # be returned.
         self.assertEqual(500, response.status_code)
 
 class LoginTestCase(TestCase):
@@ -162,21 +183,10 @@ class LoginTestCase(TestCase):
 
     def test_login(self):
         client = Client()
-        response = client.post(reverse("login", urlconf=urls),
-                               {"username": "test_user",
-                                "password": "test_password"},
-                               follow=True)
-        self.assertIn(("/profile", 302), response.redirect_chain)
-
-        # Send wrong password
-        response = client.post(reverse("login", urlconf=urls),
-                               {"username": "test_user",
-                                "password": "test_passwordoo"},
-                               follow=True)
-        # The current logic -- django's default -- returns 200 OK
-        # even when the login didn't succeed.
-        # So the test here ensures that the bank just doesn't crash.
-        self.assertEqual(200, response.status_code)
+        self.assertTrue(client.login(username="test_user",
+                                     password="test_password"))
+        self.assertFalse(client.login(username="test_user",
+                                      password="test_passwordii"))
 
 class AmountTestCase(TestCase):
 

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



reply via email to

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