test: Add test case to validate forward_query_parameters functionality
This commit is contained in:
parent
c399a057b2
commit
4bec26bb90
1 changed files with 9 additions and 0 deletions
|
|
@ -180,6 +180,10 @@ class TestWebsite(IntegrationTestCase):
|
|||
"route_redirects",
|
||||
{"source": "/testdoc307", "target": "/testtarget", "redirect_http_status": 307},
|
||||
)
|
||||
website_settings.append(
|
||||
"route_redirects",
|
||||
{"source": "/test-query", "target": "/test-query-new", "forward_query_parameters": 1},
|
||||
)
|
||||
website_settings.save()
|
||||
|
||||
set_request(method="GET", path="/testfrom")
|
||||
|
|
@ -226,6 +230,11 @@ class TestWebsite(IntegrationTestCase):
|
|||
self.assertEqual(response.status_code, 307)
|
||||
self.assertEqual(response.headers.get("Location"), "/test")
|
||||
|
||||
set_request(method="GET", path="/test-query?param=123")
|
||||
response = get_response()
|
||||
self.assertEqual(response.status_code, 301)
|
||||
self.assertEqual(response.headers.get("Location"), "/test-query-new?param=123")
|
||||
|
||||
delattr(frappe.hooks, "website_redirects")
|
||||
frappe.client_cache.delete_value("app_hooks")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue