[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] branch master updated (1c74d4f -> 5b8a6f3)
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] branch master updated (1c74d4f -> 5b8a6f3) |
Date: |
Thu, 13 Jul 2017 10:50:07 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a change to branch master
in repository bank.
from 1c74d4f readme
new 5968328 Testing against bad db string in config
new 5b8a6f3 fix filename
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:
Makefile.am | 5 +++-
README | 3 ---
bank-check-alt.conf => bank-check-alt-baddb.conf | 2 +-
run_tests_err.py => run_tests_alt_dbstring.py | 5 +++-
talerbank/app/tests.py | 2 +-
talerbank/app/tests_alt.py | 33 ++++++++++++++++++++++++
talerbank/settings.py | 2 +-
7 files changed, 44 insertions(+), 8 deletions(-)
rename bank-check-alt.conf => bank-check-alt-baddb.conf (83%)
rename run_tests_err.py => run_tests_alt_dbstring.py (73%)
create mode 100644 talerbank/app/tests_alt.py
diff --git a/Makefile.am b/Makefile.am
index 37268e6..dd1deea 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,10 +23,13 @@ pkgdata_DATA = \
install-dev:
@$(PYTHON) ./install-dev.py
-# The wrapper catches very hard errors (like no DB in place). Can the
wrapper-less way catch those errors as well?
+# The wrapper is meant to catch hard errors (like no DB in place). Can the
wrapper-less way catch those errors as well?
check:
@export DJANGO_SETTINGS_MODULE="talerbank.settings"
TALER_PREFIX="@prefix@" TALER_CONFIG_FILE="bank-check.conf" && python3
run_tests.py
+ @printf --
"\n\n----------------------------------------------------------------------\nTesting
against non existent config file\n\n"
@export DJANGO_SETTINGS_MODULE="talerbank.settings"
TALER_PREFIX="@prefix@" TALER_CONFIG_FILE="non-existent.conf" && python3
run_tests.py || true
+ @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 run_tests_alt_dbstring.py ; test 2 = $$?
# install into prefix
install-exec-hook:
diff --git a/README b/README
index d38cba8..7c5d3e4 100644
--- a/README
+++ b/README
@@ -91,9 +91,6 @@ FRACTION = 100000000
# if not given.
DATABASE = postgres:///talerlocal
-# The following sections are to configure the "admin" part of
-# the bank
-
# See above
UWSGI_SERVE = unix
diff --git a/bank-check-alt.conf b/bank-check-alt-baddb.conf
similarity index 83%
rename from bank-check-alt.conf
rename to bank-check-alt-baddb.conf
index 2d830f8..6861623 100644
--- a/bank-check-alt.conf
+++ b/bank-check-alt-baddb.conf
@@ -8,7 +8,7 @@ CURRENCY = KUDOS
[bank]
# Which database should we use?
-DATABASE = postgres:///nonexistenttalerdb
+DATABASE = bad db string
# FIXME
MAX_DEBT = KUDOS:50
diff --git a/run_tests_err.py b/run_tests_alt_dbstring.py
similarity index 73%
rename from run_tests_err.py
rename to run_tests_alt_dbstring.py
index f6d44c6..44babf6 100755
--- a/run_tests_err.py
+++ b/run_tests_alt_dbstring.py
@@ -1,5 +1,8 @@
#!/usr/bin/env python3
+# This wrapper launches tests for badly written config
+# files.
+
from django.core.management import call_command
from django.db.utils import OperationalError
import django
@@ -10,7 +13,7 @@ django.setup()
logger = logging.getLogger(__name__)
try:
- call_command("test", "talerbank.app.tests_err")
+ call_command("test", "talerbank.app.tests_alt")
except OperationalError:
logger.error("Catching DB hard error, skipping the test")
sys.exit(0)
diff --git a/talerbank/app/tests.py b/talerbank/app/tests.py
index 5ccc660..feff213 100644
--- a/talerbank/app/tests.py
+++ b/talerbank/app/tests.py
@@ -315,7 +315,7 @@ class DebitTestCase(TestCase):
self.assertEqual(0, amounts.amount_cmp(ub0.balance_obj, tmp))
-class TestParseAmount(TestCase):
+class ParseAmountTestCase(TestCase):
def test_parse_amount(self):
ret = amounts.parse_amount("KUDOS:4")
self.assertJSONEqual('{"value": 4, "fraction": 0, "currency":
"KUDOS"}', json.dumps(ret))
diff --git a/talerbank/app/tests_alt.py b/talerbank/app/tests_alt.py
new file mode 100644
index 0000000..6893344
--- /dev/null
+++ b/talerbank/app/tests_alt.py
@@ -0,0 +1,33 @@
+# This file is part of TALER
+# (C) 2014, 2015, 2016 INRIA
+#
+# TALER is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free
Software
+# Foundation; either version 3, or (at your option) any later version.
+#
+# TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+#
+# @author Marcello Stanisci
+
+from django.test import TestCase, Client
+from django.core.urlresolvers import reverse
+from django.conf import settings
+from django.contrib.auth.models import User
+from .models import BankAccount, BankTransaction
+from . import urls
+from . import amounts
+from .views import wire_transfer
+import json
+
+import logging
+
+logger = logging.getLogger(__name__)
+
+class BadDatabaseStringTestCase(TestCase):
+ def test_baddbstring():
+ pass
diff --git a/talerbank/settings.py b/talerbank/settings.py
index 6bbbc46..9840020 100644
--- a/talerbank/settings.py
+++ b/talerbank/settings.py
@@ -103,7 +103,7 @@ logger.info("dbname: %s" % dbname)
check_dbstring_format = re.search("[a-z]+:///[a-z]+", dbname)
if not check_dbstring_format:
logger.error("Bad db string given, respect the format 'dbtype:///dbname'")
- sys.exit(1)
+ sys.exit(2)
dbconfig = {}
db_url = urllib.parse.urlparse(dbname)
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-bank] branch master updated (1c74d4f -> 5b8a6f3),
gnunet <=