-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3069 from cisagov/ad/1604-allow-analysts-to-view-…
…cancelled-invitations #1604 allow analysts to view cancelled invitations - [AD]
- Loading branch information
Showing
11 changed files
with
84 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/registrar/migrations/0138_alter_domaininvitation_status.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 4.2.10 on 2024-11-18 16:47 | ||
|
||
from django.db import migrations | ||
import django_fsm | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("registrar", "0137_suborganization_city_suborganization_state_territory"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="domaininvitation", | ||
name="status", | ||
field=django_fsm.FSMField( | ||
choices=[("invited", "Invited"), ("retrieved", "Retrieved"), ("canceled", "Canceled")], | ||
default="invited", | ||
max_length=50, | ||
protected=True, | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -726,21 +726,18 @@ def test_domain_invitation_cancel(self): | |
"""Posting to the delete view deletes an invitation.""" | ||
email_address = "[email protected]" | ||
invitation, _ = DomainInvitation.objects.get_or_create(domain=self.domain, email=email_address) | ||
mock_client = MockSESClient() | ||
with boto3_mocking.clients.handler_for("sesv2", mock_client): | ||
self.client.post(reverse("invitation-delete", kwargs={"pk": invitation.id})) | ||
mock_client.EMAILS_SENT.clear() | ||
with self.assertRaises(DomainInvitation.DoesNotExist): | ||
DomainInvitation.objects.get(id=invitation.id) | ||
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 delete view when invitation retrieved returns an error message""" | ||
"""Posting to the cancel view when invitation retrieved returns an error message""" | ||
email_address = "[email protected]" | ||
invitation, _ = DomainInvitation.objects.get_or_create( | ||
domain=self.domain, email=email_address, status=DomainInvitation.DomainInvitationStatus.RETRIEVED | ||
) | ||
response = self.client.post(reverse("invitation-delete", kwargs={"pk": invitation.id}), follow=True) | ||
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 | ||
|
@@ -751,7 +748,7 @@ def test_domain_invitation_cancel_retrieved_invitation(self): | |
|
||
@less_console_noise_decorator | ||
def test_domain_invitation_cancel_no_permissions(self): | ||
"""Posting to the delete view as a different user should fail.""" | ||
"""Posting to the cancel view as a different user should fail.""" | ||
email_address = "[email protected]" | ||
invitation, _ = DomainInvitation.objects.get_or_create(domain=self.domain, email=email_address) | ||
|
||
|
@@ -760,7 +757,7 @@ def test_domain_invitation_cancel_no_permissions(self): | |
self.client.force_login(other_user) | ||
mock_client = MagicMock() | ||
with boto3_mocking.clients.handler_for("sesv2", mock_client): | ||
result = self.client.post(reverse("invitation-delete", kwargs={"pk": invitation.id})) | ||
result = self.client.post(reverse("invitation-cancel", kwargs={"pk": invitation.id})) | ||
|
||
self.assertEqual(result.status_code, 403) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters