fix account creation view tests

This commit is contained in:
Thomas Girod
2025-04-11 14:35:57 +02:00
parent 64085ac2a4
commit f4276d6be5
2 changed files with 15 additions and 10 deletions

View File

@ -100,8 +100,9 @@ class TestUserRegistration:
payload = valid_payload | payload_edit
response = client.post(reverse("core:register"), payload)
assert response.status_code == 200
error_html = f'<ul class="errorlist"><li>{expected_error}</li></ul>'
assertInHTML(error_html, str(response.content.decode()))
errors = BeautifulSoup(response.text, "lxml").find_all(class_="errorlist")
assert len(errors) == 1
assert errors[0].text == expected_error
assert not User.objects.filter(email=payload["email"]).exists()
def test_register_honeypot_fail(self, client: Client, valid_payload):