Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LGA-3553: Rename bsl-start to start-bsl #157

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/main/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
8 changes: 4 additions & 4 deletions tests/functional_tests/test_entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ 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)
assert url.endswith("/bsl-start"), url
url = url_for("main.start_bsl", _external=True)
assert url.endswith("/start-bsl"), url
page.goto(url)
expect(page.get_by_role("heading", name="Contact us")).to_be_visible()


@pytest.mark.usefixtures("live_server")
def test_bsl_route_welsh(page: Page):
url = url_for("main.bsl_start", locale="cy_GB", _external=True)
assert url.endswith("/bsl-start?locale=cy_GB"), url
url = url_for("main.start_bsl", locale="cy_GB", _external=True)
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}"
10 changes: 5 additions & 5 deletions tests/unit_tests/test_entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading