Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! feat(api): allow requesting user_o…
Browse files Browse the repository at this point in the history
…verride token on sign-up
  • Loading branch information
peterthomassen committed Dec 17, 2024
1 parent be46a8e commit 17d269f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Welcome to deSEC!
Your invitation to deSEC DNS Hosting
14 changes: 10 additions & 4 deletions api/desecapi/tests/test_user_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,14 @@ def assertUserDoesNotExist(self, email):
with self.assertRaises(User.DoesNotExist):
User.objects.get(email=email)

def assertRegistrationEmail(self, recipient, reset=True):
def assertRegistrationEmail(self, recipient, domain=None, reset=True):
return self.assertEmailSent(
subject_contains="deSEC",
body_contains="Thank you for registering with deSEC!",
body_contains=(
"You are about to set up"
if domain
else "As we may need to contact you in the future"
),
recipient=[recipient],
reset=reset,
pattern=r"following link[^:]*:\s+([^\s]*)",
Expand Down Expand Up @@ -417,7 +421,9 @@ def _test_registration(
kwargs.get("outreach_preference", True),
)
self.assertPassword(email, password)
confirmation_link = self.assertRegistrationEmail(email)
confirmation_link = self.assertRegistrationEmail(
email, domain=kwargs.get("domain")
)
self.assertConfirmationLinkRedirect(confirmation_link)
response = self.client.verify(confirmation_link)
if late_captcha:
Expand Down Expand Up @@ -452,7 +458,7 @@ def _test_registration_with_domain(
self.assertIsNone(User.objects.get(email=email).is_active)
self.assertPassword(email, password)

confirmation_link = self.assertRegistrationEmail(email)
confirmation_link = self.assertRegistrationEmail(email, domain=domain)

if tampered_domain is not None:
self.assertNotEqual(domain, tampered_domain)
Expand Down

0 comments on commit 17d269f

Please sign in to comment.