Commit 9a844f0a authored by Patrick Kimber's avatar Patrick Kimber

Move 'get_initial' to 'EnquiryCreateMixin'

parent a8c78d9b
Pipeline #24150745 passed with stage
in 1 minute and 24 seconds
......@@ -47,8 +47,8 @@ def test_create(client):
@pytest.mark.django_db
def test_create_get_logged_in(client):
"""check enquiry."""
consent = ConsentFactory(
"""User is logged in - form should be pre-filled with the name and email."""
ConsentFactory(
slug=Enquiry.GDPR_CONTACT_SLUG,
message="Your phone number...",
show_checkbox=True,
......@@ -69,16 +69,18 @@ def test_create_get_logged_in(client):
@pytest.mark.django_db
def test_create_get_logged_in_not(client):
"""check enquiry."""
consent = ConsentFactory(
"""User is not logged in - form should not be filled with name and email."""
ConsentFactory(
slug=Enquiry.GDPR_CONTACT_SLUG,
message="Your phone number...",
show_checkbox=True,
)
response = client.get(reverse("example.enquiry.create"))
# initial
assert "email" not in response.context
assert "name" not in response.context
assert "form" in response.context
form = response.context["form"]
assert "email" not in form.initial
assert "name" not in form.initial
@pytest.mark.django_db
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment