From 9aae97a6c11a1fbbe1037732c6c8725127e5afd5 Mon Sep 17 00:00:00 2001 From: Ben Millar Date: Mon, 24 Feb 2025 16:19:22 +0000 Subject: [PATCH 1/2] Rename bsl-start to start-bsl --- app/main/routes.py | 4 ++-- tests/functional_tests/test_entry_points.py | 4 ++-- tests/unit_tests/test_entry_points.py | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/main/routes.py b/app/main/routes.py index 5e1d18b87..1bf4b1af8 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -44,8 +44,8 @@ def start(): return response -@bp.get("/bsl-start") -def bsl_start(): +@bp.get("/start-bsl") +def start_bsl(): """This an entry point for the service from www.gov.uk/check-legal-aid This is a route for users who need to contact us via BSL, they are routed directly to the contact us page """ diff --git a/tests/functional_tests/test_entry_points.py b/tests/functional_tests/test_entry_points.py index 64f8eff3e..ae1e26e73 100644 --- a/tests/functional_tests/test_entry_points.py +++ b/tests/functional_tests/test_entry_points.py @@ -24,7 +24,7 @@ def test_start_route_welsh(page: Page): @pytest.mark.usefixtures("live_server") def test_bsl_route(page: Page): - url = url_for("main.bsl_start", _external=True) + url = url_for("main.start_bsl", _external=True) assert url.endswith("/bsl-start"), url page.goto(url) expect(page.get_by_role("heading", name="Contact us")).to_be_visible() @@ -32,7 +32,7 @@ def test_bsl_route(page: Page): @pytest.mark.usefixtures("live_server") def test_bsl_route_welsh(page: Page): - url = url_for("main.bsl_start", locale="cy_GB", _external=True) + url = url_for("main.start_bsl", locale="cy_GB", _external=True) assert url.endswith("/bsl-start?locale=cy_GB"), url page.goto(url) locale = page.locator("html").get_attribute("lang") diff --git a/tests/unit_tests/test_entry_points.py b/tests/unit_tests/test_entry_points.py index 7eb7fa94a..6eb9b8faf 100644 --- a/tests/unit_tests/test_entry_points.py +++ b/tests/unit_tests/test_entry_points.py @@ -44,30 +44,30 @@ def test_bsl_start_clears_session(self, app, client): with client.session_transaction() as session: session["test_key"] = "test_value" - client.get("/bsl-start") + client.get("/start-bsl") with client.session_transaction() as session: assert "test_key" not in session def test_bsl_start_redirects_to_contact_us(self, client): - response = client.get("/bsl-start") + response = client.get("/start-bsl") assert response.status_code == 302 assert response.location == url_for("contact.contact_us") def test_bsl_start_sets_locale_cookie_when_provided(self, client): - response = client.get("/bsl-start?locale=cy_GB") + response = client.get("/start-bsl?locale=cy_GB") # Verify cookie is set cookies = response.headers.getlist("Set-Cookie") assert any("locale=cy" in cookie for cookie in cookies) def test_bsl_start_no_locale_cookie_when_not_provided(self, client): - response = client.get("/bsl-start") + response = client.get("/start-bsl") # Verify no locale cookie is set cookies = response.headers.getlist("Set-Cookie") assert not any("locale=" in cookie for cookie in cookies) def test_bsl_start_with_invalid_locale(self, client): - response = client.get("/bsl-start?locale=invalid") + response = client.get("/start-bsl?locale=invalid") assert response.status_code == 404 From faefe258bfbc06c1073c9d514a31dcfa0a14e803 Mon Sep 17 00:00:00 2001 From: Ben Millar Date: Mon, 24 Feb 2025 16:28:38 +0000 Subject: [PATCH 2/2] Rename URL in functionality tests --- tests/functional_tests/test_entry_points.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional_tests/test_entry_points.py b/tests/functional_tests/test_entry_points.py index ae1e26e73..68b47bfc5 100644 --- a/tests/functional_tests/test_entry_points.py +++ b/tests/functional_tests/test_entry_points.py @@ -25,7 +25,7 @@ def test_start_route_welsh(page: Page): @pytest.mark.usefixtures("live_server") def test_bsl_route(page: Page): url = url_for("main.start_bsl", _external=True) - assert url.endswith("/bsl-start"), url + assert url.endswith("/start-bsl"), url page.goto(url) expect(page.get_by_role("heading", name="Contact us")).to_be_visible() @@ -33,7 +33,7 @@ def test_bsl_route(page: Page): @pytest.mark.usefixtures("live_server") def test_bsl_route_welsh(page: Page): url = url_for("main.start_bsl", locale="cy_GB", _external=True) - assert url.endswith("/bsl-start?locale=cy_GB"), url + assert url.endswith("/start-bsl?locale=cy_GB"), url page.goto(url) locale = page.locator("html").get_attribute("lang") assert locale == "cy", f"Expected 'cy' but got {locale}"