mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 18:56:15 +02:00
added test back
This commit is contained in:
parent
ddb56913aa
commit
1aa96cb700
2 changed files with 18 additions and 2 deletions
|
@ -709,7 +709,23 @@ class TestDomainManagers(TestDomainOverview):
|
|||
self.client.post(reverse("invitation-cancel", kwargs={"pk": invitation.id}))
|
||||
invitation = DomainInvitation.objects.get(id=invitation.id)
|
||||
self.assertEqual(invitation.status, DomainInvitation.DomainInvitationStatus.CANCELED)
|
||||
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_domain_invitation_cancel_retrieved_invitation(self):
|
||||
"""Posting to the cancel view when invitation retrieved returns an error message"""
|
||||
email_address = "mayor@igorville.gov"
|
||||
invitation, _ = DomainInvitation.objects.get_or_create(
|
||||
domain=self.domain, email=email_address, status=DomainInvitation.DomainInvitationStatus.RETRIEVED
|
||||
)
|
||||
response = self.client.post(reverse("invitation-cancel", kwargs={"pk": invitation.id}), follow=True)
|
||||
# Assert that an error message is displayed to the user
|
||||
self.assertContains(response, f"Invitation to {email_address} has already been retrieved.")
|
||||
# Assert that the Cancel link is not displayed
|
||||
self.assertNotContains(response, "Cancel")
|
||||
# Assert that the DomainInvitation is not deleted
|
||||
self.assertTrue(DomainInvitation.objects.filter(id=invitation.id).exists())
|
||||
DomainInvitation.objects.filter(email=email_address).delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_domain_invitation_cancel_no_permissions(self):
|
||||
"""Posting to the cancel view as a different user should fail."""
|
||||
|
|
|
@ -963,7 +963,7 @@ class DomainAddUserView(DomainFormBaseView):
|
|||
# Check to see if an invite has already been sent
|
||||
try:
|
||||
invite = DomainInvitation.objects.get(email=email, domain=self.object)
|
||||
# check if the invite has already been accepted
|
||||
# check if the invite has already been accepted or has a canceled invite
|
||||
add_success = self._check_invite_status(invite, email)
|
||||
except Exception:
|
||||
logger.error("An error occured")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue