mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 01:11:55 +02:00
Update test_models.py
This commit is contained in:
parent
932f32b3dc
commit
d978211c6d
1 changed files with 57 additions and 0 deletions
|
@ -611,6 +611,33 @@ class TestDomainApplication(TestCase):
|
|||
except TransitionNotAllowed:
|
||||
self.fail("TransitionNotAllowed was raised, but it was not expected.")
|
||||
|
||||
def test_reject_transition_not_allowed_with_no_investigator(self):
|
||||
"""
|
||||
Tests for attempting to transition without an investigator
|
||||
"""
|
||||
|
||||
test_cases = [
|
||||
(self.in_review_application, TransitionNotAllowed),
|
||||
(self.action_needed_application, TransitionNotAllowed),
|
||||
(self.approved_application, TransitionNotAllowed),
|
||||
]
|
||||
|
||||
# Set all investigators to none
|
||||
self.in_review_application.investigator = None
|
||||
self.action_needed_application.investigator = None
|
||||
self.approved_application.investigator = None
|
||||
|
||||
# Save changes
|
||||
self.in_review_application.save()
|
||||
self.action_needed_application.save()
|
||||
self.approved_application.save()
|
||||
|
||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client), less_console_noise():
|
||||
for application, exception_type in test_cases:
|
||||
with self.subTest(application=application, exception_type=exception_type):
|
||||
with self.assertRaises(exception_type):
|
||||
application.reject()
|
||||
|
||||
def test_reject_transition_not_allowed(self):
|
||||
"""
|
||||
Test that calling action_needed against transition rules raises TransitionNotAllowed.
|
||||
|
@ -650,6 +677,36 @@ class TestDomainApplication(TestCase):
|
|||
except TransitionNotAllowed:
|
||||
self.fail("TransitionNotAllowed was raised, but it was not expected.")
|
||||
|
||||
def test_reject_with_prejudice_transition_not_allowed_with_no_investigator(self):
|
||||
"""
|
||||
Tests for attempting to transition without an investigator
|
||||
"""
|
||||
|
||||
test_cases = [
|
||||
(self.in_review_application, TransitionNotAllowed),
|
||||
(self.action_needed_application, TransitionNotAllowed),
|
||||
(self.approved_application, TransitionNotAllowed),
|
||||
(self.rejected_application, TransitionNotAllowed),
|
||||
]
|
||||
|
||||
# Set all investigators to none
|
||||
self.in_review_application.investigator = None
|
||||
self.action_needed_application.investigator = None
|
||||
self.approved_application.investigator = None
|
||||
self.rejected_application.investigator = None
|
||||
|
||||
# Save changes
|
||||
self.in_review_application.save()
|
||||
self.action_needed_application.save()
|
||||
self.approved_application.save()
|
||||
self.rejected_application.save()
|
||||
|
||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client), less_console_noise():
|
||||
for application, exception_type in test_cases:
|
||||
with self.subTest(application=application, exception_type=exception_type):
|
||||
with self.assertRaises(exception_type):
|
||||
application.reject_with_prejudice()
|
||||
|
||||
def test_reject_with_prejudice_transition_not_allowed(self):
|
||||
"""
|
||||
Test that calling action_needed against transition rules raises TransitionNotAllowed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue