diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2018-01-06 12:46:14 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2018-01-06 12:46:14 +0100 |
commit | 584339f507bf94d3c9ff28f483a3e6acf94d408b (patch) | |
tree | 28862cfa34542aeb3d5db0ed85b96ed24d3d6a23 | |
parent | c65f735ba2a0b80ca2de3b46c67ce9e7155ce166 (diff) | |
download | backoffice-584339f507bf94d3c9ff28f483a3e6acf94d408b.tar.gz backoffice-584339f507bf94d3c9ff28f483a3e6acf94d408b.tar.bz2 backoffice-584339f507bf94d3c9ff28f483a3e6acf94d408b.zip |
test homepage shows the instances menu
-rw-r--r-- | Makefile.in | 5 | ||||
-rwxr-xr-x | setup.py | 3 | ||||
-rw-r--r-- | talerbackoffice/helpers.py | 2 | ||||
-rw-r--r-- | talerbackoffice/tests.conf | 3 | ||||
-rw-r--r-- | talerbackoffice/tests.py | 10 |
5 files changed, 17 insertions, 6 deletions
diff --git a/Makefile.in b/Makefile.in index 58f454d..730071d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -49,8 +49,9 @@ install: $(templates) install-data .PHONY: check check: @export TALER_CONFIG_FILE=@abs_srcdir@/talerbackoffice/tests.conf; \ - python3 setup.py test + export BACKOFFICE_BACKEND="http://backend.example.com/"; \ + export BACKOFFICE_INSTANCES="MusicShop"; python3 setup.py nosetests -s -.PHONY: pyliny +.PHONY: pylint pylint: @pylint talerbackoffice/ @@ -9,7 +9,8 @@ setup(name='talerbackoffice', license='GPL', packages=find_packages(), install_requires=["Flask>=0.10"], - tests_require=["nose", "mock"], + tests_require=["nose", "mock", + "beautifulsoup4"], test_suite="nose.collector", package_data={ '':[ diff --git a/talerbackoffice/helpers.py b/talerbackoffice/helpers.py index 614e463..d574126 100644 --- a/talerbackoffice/helpers.py +++ b/talerbackoffice/helpers.py @@ -25,7 +25,7 @@ LOGGER = logging.getLogger(__name__) TC = TalerConfig.from_env() BACKEND_URL = TC["frontends"]["backend"].value_string(required=True) -NDIGITS = TC["frontends"]["NDIGITS"].value_int() +NDIGITS = 2 CURRENCY = TC["taler"]["CURRENCY"].value_string() FRACTION_BASE = 1e8 diff --git a/talerbackoffice/tests.conf b/talerbackoffice/tests.conf index 6043401..bd5e3cf 100644 --- a/talerbackoffice/tests.conf +++ b/talerbackoffice/tests.conf @@ -1,4 +1,7 @@ [taler] CURRENCY = TESTKUDOS +[frontends] +BACKEND = http://backend.com/ + # Need right values here for testing. diff --git a/talerbackoffice/tests.py b/talerbackoffice/tests.py index 6fa15cb..82269a1 100644 --- a/talerbackoffice/tests.py +++ b/talerbackoffice/tests.py @@ -4,6 +4,7 @@ import unittest from mock import patch, MagicMock from talerbackoffice.backoffice import backoffice from talerbackoffice.talerconfig import TalerConfig +from bs4 import BeautifulSoup TC = TalerConfig.from_env() CURRENCY = TC["taler"]["currency"].value_string(required=True) @@ -12,9 +13,14 @@ class BackofficeTestCase(unittest.TestCase): def setUp(self): backoffice.app.testing = True self.app = backoffice.app.test_client() - - def test_responsive(self): + # Check whether the homepage UI shows the instances + # in the drop-down menu. Instances are read from the + # environment. + def test_instances_are_shown(self): response = self.app.get("/") + soup = BeautifulSoup(response.data, "html.parser") + self.assertEqual("MusicShop", + soup.find("select").option.contents[0]) self.assertEqual(response.status_code, 200) if __name__ == "__main__": |