diff options
author | NavaL <ayoyo@thoughtworks.com> | 2016-02-22 15:11:10 +0100 |
---|---|---|
committer | NavaL <ayoyo@thoughtworks.com> | 2016-02-22 15:11:10 +0100 |
commit | 82d4432b977e0960746bba1c6f03077fb6322263 (patch) | |
tree | a1a6e3d866c12f8485799b4a896e3ae7048139ce /service/test/unit/resources/test_login_resource.py | |
parent | 6239fa6a410bbb96d2121eea4f3559edca4fea66 (diff) |
Removes stacktrace errors from appearing on the login page.
Instead shows a generic: "invalid xml format" message
Issue #214
Diffstat (limited to 'service/test/unit/resources/test_login_resource.py')
-rw-r--r-- | service/test/unit/resources/test_login_resource.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/service/test/unit/resources/test_login_resource.py b/service/test/unit/resources/test_login_resource.py index 3cd9d3b2..d8194156 100644 --- a/service/test/unit/resources/test_login_resource.py +++ b/service/test/unit/resources/test_login_resource.py @@ -99,6 +99,29 @@ class TestLoginResource(unittest.TestCase): d.addCallback(tear_down) return d + def test_non_xml_compliant_banner_will_send_default_invalid_format_banner(self): + request = DummyRequest(['']) + + banner_file_name = 'banner.txt' + xml_invalid_banner = '<p>some unclosed paragraph' + self._write(banner_file_name, xml_invalid_banner) + + self.resource._disclaimer_banner = 'service/_trial_temp/' + banner_file_name + + d = self.web.get(request) + + def assert_default_invalid_banner_disclaimer_rendered(_): + self.assertEqual(200, request.responseCode) + written_response = ''.join(request.written) + self.assertIn("Invalid XML template format for service/_trial_temp/banner.txt.", written_response) + + def tear_down(_): + os.remove(banner_file_name) + + d.addCallback(assert_default_invalid_banner_disclaimer_rendered) + d.addCallback(tear_down) + return d + class TestLoginPOST(unittest.TestCase): def setUp(self): |