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: Test against bad amount


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] branch master updated: Test against bad amount string in config
Date: Thu, 13 Jul 2017 12:01:30 +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 77d37fb  Test against bad amount string in config
77d37fb is described below

commit 77d37fb17fb9c4760e44af597032ec5474187fbc
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Jul 13 12:01:06 2017 +0200

    Test against bad amount string in config
---
 Makefile.am                   |  2 ++
 bank-check-alt-badamount.conf | 17 +++++++++++++++++
 talerbank/app/tests_alt.py    | 17 ++++++++++++++++-
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index bd561be..d8703f6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,6 +29,8 @@ check:
        @export DJANGO_SETTINGS_MODULE="talerbank.settings" 
TALER_PREFIX="@prefix@" TALER_CONFIG_FILE="non-existent.conf" && python3 -m 
django test talerbank.app.tests ; test 3 = $$?
        @printf -- 
"\n\n----------------------------------------------------------------------\nTesting
 against bad db string\n\n"
        @export DJANGO_SETTINGS_MODULE="talerbank.settings" 
TALER_PREFIX="@prefix@" TALER_CONFIG_FILE="bank-check-alt-baddb.conf" && 
python3 -m django test talerbank.app.tests_alt.BadDatabaseStringTestCase ; test 
2 = $$?
+       @printf -- 
"\n\n----------------------------------------------------------------------\nTesting
 against bad db string\n\n"
+       @export DJANGO_SETTINGS_MODULE="talerbank.settings" 
TALER_PREFIX="@prefix@" TALER_CONFIG_FILE="bank-check-alt-badamount.conf" && 
python3 -m django test talerbank.app.tests_alt.BadMaxDebtOptionTestCase
 
 # install into prefix
 install-exec-hook:
diff --git a/bank-check-alt-badamount.conf b/bank-check-alt-badamount.conf
new file mode 100644
index 0000000..757b827
--- /dev/null
+++ b/bank-check-alt-badamount.conf
@@ -0,0 +1,17 @@
+# Config file containing intentional errors, used
+# to test how the bank reacts.
+
+[taler]
+
+CURRENCY = KUDOS
+
+[bank]
+
+# Which database should we use?
+DATABASE = postgres:///talercheck
+
+# FIXME
+MAX_DEBT = 33 KUDOS
+
+# FIXME
+MAX_DEBT_BANK = KUDOS:0
diff --git a/talerbank/app/tests_alt.py b/talerbank/app/tests_alt.py
index 6893344..12adeb5 100644
--- a/talerbank/app/tests_alt.py
+++ b/talerbank/app/tests_alt.py
@@ -29,5 +29,20 @@ import logging
 logger = logging.getLogger(__name__)
 
 class BadDatabaseStringTestCase(TestCase):
-    def test_baddbstring():
+    def test_baddbstring(self):
         pass
+
+class BadMaxDebtOptionTestCase(TestCase):
+    def test_badmaxdebtoption(self):
+        try:
+            amounts.parse_amount(settings.TALER_MAX_DEBT)
+        except amounts.BadFormatAmount:
+            self.assertTrue(True)
+            return
+        try:
+            amounts.parse_amount(settings.TALER_MAX_DEBT_BANK)
+        except amounts.BadFormatAmount:
+            self.assertTrue(True)
+            return
+        # Force to have at least one bad amount in config
+        self.assertTrue(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]