From ae5d42862a2c8332ee0bbac8f30bbae9a3ae34cb Mon Sep 17 00:00:00 2001 From: Lukas Graf Date: Mon, 2 Mar 2020 09:54:40 +0100 Subject: [PATCH] Smoketests: Test that POST requests never get answered with index.html. --- rewrite_rule_smoketests/smoketests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/rewrite_rule_smoketests/smoketests.py b/rewrite_rule_smoketests/smoketests.py index 6f5faa06c76..429f3658b64 100644 --- a/rewrite_rule_smoketests/smoketests.py +++ b/rewrite_rule_smoketests/smoketests.py @@ -183,6 +183,22 @@ def test_gever_front_page_logged_in_old_ui(browser, admin_unit): assert_equal(admin_unit.url, logo.attrib['href']) +@on_admin_unit +def test_anonymous_post_requests_always_hit_gever(browser, admin_unit): + """This is a regression test for a case, where simple POST requests got + answered with the new frontend's index.html. + """ + target_url = '/'.join((admin_unit.front_page_url, 'doesnt-exist')) + + browser.raise_http_errors = False + browser.open(target_url, method='POST') + + assert_equal(404, browser.status_code) + + # Assert we hit Plone by checking for the presence of the logo + assert_equal(1, len(browser.css('#portal-logo'))) + + def main(): prompt_credentials = False if '--prompt-credentials' in sys.argv: