diff --git a/app-config/openshift/deploymentconfig.yaml b/app-config/openshift/deploymentconfig.yaml index a646d7ca..d5a0c966 100644 --- a/app-config/openshift/deploymentconfig.yaml +++ b/app-config/openshift/deploymentconfig.yaml @@ -284,7 +284,7 @@ key: ARVE_API_KEY name: arve-api - name: EXTRA_PAGES - value: [{"url":"/about","filename":"about", "is_root":True},{"url":"/user-guide","filename":"userguide","is_root":False}] + value: [{"url":"/about","filename":"about","is_root":True},{"url":"/user-guide","filename":"userguide","is_root":False}] image: '${PROJECT_NAME}/calculator-app' ports: - containerPort: 8080 diff --git a/caimira/tests/apps/calculator/test_webapp.py b/caimira/tests/apps/calculator/test_webapp.py index 3bd3c362..de29246a 100644 --- a/caimira/tests/apps/calculator/test_webapp.py +++ b/caimira/tests/apps/calculator/test_webapp.py @@ -137,3 +137,29 @@ class TestError500(tornado.testing.AsyncHTTPTestCase): response = self.fetch('/') assert response.code == 500 assert 'Unfortunately an error occurred when processing your request' in response.body.decode() + + +class TestCERNGenericPage(tornado.testing.AsyncHTTPTestCase): + def get_app(self): + cern_theme = Path(caimira.apps.calculator.__file__).parent.parent / 'themes' / 'cern' + app = caimira.apps.calculator.make_app(theme_dir=cern_theme) + pages = [ + (r'/calculator/user-guide', caimira.apps.calculator.GenericExtraPage, {'active_page': 'userguide', 'filename': 'userguide'}), + (r'/about', caimira.apps.calculator.GenericExtraPage, {'active_page': 'about', 'filename': 'about'}), + ] + + return tornado.web.Application(pages, **app.settings) + + @tornado.testing.gen_test(timeout=_TIMEOUT) + def test_user_guide(self): + response = yield self.http_client.fetch(self.get_url('/calculator/user-guide')) + self.assertEqual(response.code, 200) + + @tornado.testing.gen_test(timeout=_TIMEOUT) + def test_about(self): + response = yield self.http_client.fetch(self.get_url('/about')) + self.assertEqual(response.code, 200) + + def test_calculator_404(self): + response = self.fetch('/calculator') + assert response.code == 404