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: Tests.


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] branch master updated: Tests.
Date: Thu, 04 Apr 2019 17:56:00 +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 4a131f6  Tests.
4a131f6 is described below

commit 4a131f632f936eb49adb7f608851a0b47a25a56d
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Apr 4 17:55:33 2019 +0200

    Tests.
---
 talerbank/app/tests.py | 27 +++++++++++++++++++++------
 talerbank/settings.py  |  6 ++++--
 2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index c820b0b..20dccc7 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -18,6 +18,7 @@
 #  @author Marcello Stanisci
 
 import json
+import time
 import timeit
 import logging
 from urllib.parse import unquote
@@ -408,14 +409,28 @@ class HistoryTestCase(TestCase):
         self.assertEqual(expected_data, response_data)
 
     def test_history_range(self):
+        now = int(time.time())
 
-        ctx = HistoryContext(expected_resp={"status": 204},
-                             start = 1, end = 2, direction="both")
+        for ctx in (
 
-        response = self.client.get(
-            reverse("history-range", urlconf=urls), ctx.urlargs,
-            **{"HTTP_X_TALER_BANK_USERNAME": "User",
-               "HTTP_X_TALER_BANK_PASSWORD": "Password"})
+            # Expect empty results, range too ancient.
+            HistoryContext(expected_resp={"status": 204},
+                           start = 1, end = 2, direction="both"),
+
+            # Expect empty results, range too ahead.
+            HistoryContext(expected_resp={"status": 200},
+                           start = now + 40, end = now + 50,
+                           direction="both"),
+
+            # Expect non empty results.
+            HistoryContext(expected_resp={"status": 200},
+                           start = now - 30, end = now + 30,
+                           direction="both")):
+
+            response = self.client.get(
+                reverse("history-range", urlconf=urls), ctx.urlargs,
+                **{"HTTP_X_TALER_BANK_USERNAME": "User",
+                   "HTTP_X_TALER_BANK_PASSWORD": "Password"})
 
         self.assert_result(response, ctx)
 
diff --git a/talerbank/settings.py b/talerbank/settings.py
index 159a24c..232eb5c 100644
--- a/talerbank/settings.py
+++ b/talerbank/settings.py
@@ -165,8 +165,10 @@ USE_I18N = True
 
 USE_L10N = True
 
-USE_TZ = True
-
+##
+# Set to False to silence this error:
+# 
https://stackoverflow.com/questions/18622007/runtimewarning-datetimefield-received-a-naive-datetime
+USE_TZ = False
 
 # Static files (CSS, JavaScript, Images)
 # https://docs.djangoproject.com/en/1.9/howto/static-files/

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



reply via email to

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