added tests for generic pages
This commit is contained in:
parent
2d3a925fc5
commit
fb18a2a715
2 changed files with 27 additions and 1 deletions
|
|
@ -284,7 +284,7 @@
|
||||||
key: ARVE_API_KEY
|
key: ARVE_API_KEY
|
||||||
name: arve-api
|
name: arve-api
|
||||||
- name: EXTRA_PAGES
|
- 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'
|
image: '${PROJECT_NAME}/calculator-app'
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
|
|
|
||||||
|
|
@ -137,3 +137,29 @@ class TestError500(tornado.testing.AsyncHTTPTestCase):
|
||||||
response = self.fetch('/')
|
response = self.fetch('/')
|
||||||
assert response.code == 500
|
assert response.code == 500
|
||||||
assert 'Unfortunately an error occurred when processing your request' in response.body.decode()
|
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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue