From 45d43aa3d7d55daa25198411dfdc1177e411e220 Mon Sep 17 00:00:00 2001 From: kritisingh1 Date: Sun, 23 Sep 2018 16:36:00 +0530 Subject: [PATCH] Issue #2587 - Adds subpath parameter to the wellknown function --- tests/unit/test_rendering.py | 7 +++++++ tests/unit/test_urls.py | 2 +- webcompat/views.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_rendering.py b/tests/unit/test_rendering.py index 1eb1c1251..e428b3f02 100644 --- a/tests/unit/test_rendering.py +++ b/tests/unit/test_rendering.py @@ -113,5 +113,12 @@ def test_form_rendering(self): self.assertTrue('Mac OS X 10.13' in rv.data) self.assertTrue('http://example.com/' in rv.data) + def test_wellknown_subpath(self): + """Test that the /.wellknown/subpath route gets 404.""" + rv = self.app.get('/.well-known/test-route') + expected = 'test-route' + self.assertEqual(rv.status_code, 404) + self.assertTrue(expected in rv.data) + if __name__ == '__main__': unittest.main() diff --git a/tests/unit/test_urls.py b/tests/unit/test_urls.py index c5bec0aea..724ec91ce 100644 --- a/tests/unit/test_urls.py +++ b/tests/unit/test_urls.py @@ -193,7 +193,7 @@ def test_csp_report_uri_bad_content_type(self): self.assertEqual(rv.status_code, 400) def test_tools_cssfixme(self): - """Test that the /tools/cssfixme route gets 200.""" + """Test that the /tools/cssfixme route gets 410.""" rv = self.app.get('/tools/cssfixme') self.assertEqual(rv.status_code, 410) diff --git a/webcompat/views.py b/webcompat/views.py index 3420d503d..24dca5a87 100644 --- a/webcompat/views.py +++ b/webcompat/views.py @@ -486,7 +486,7 @@ def log_csp_report(): @app.route('/.well-known/') @cache_policy(private=False, uri_max_age=31104000, must_revalidate=False) -def wellknown(): +def wellknown(subpath): """Route for returning 404 for the currently unused well-known routes.""" msg = """ Sorry dear bot,