mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-30 22:46:30 +02:00
Add tests for unlock_organization_contact
This commit is contained in:
parent
1f9efb7fc0
commit
bdb3875f12
1 changed files with 41 additions and 0 deletions
|
@ -3221,6 +3221,47 @@ class TestDomainRequestWizard(TestWithUser, WebTest):
|
||||||
federal_agency.delete()
|
federal_agency.delete()
|
||||||
domain_request.delete()
|
domain_request.delete()
|
||||||
|
|
||||||
|
@override_flag("organization_feature", active=True)
|
||||||
|
@override_flag("organization_requests", active=True)
|
||||||
|
@less_console_noise_decorator
|
||||||
|
def test_unlock_organization_contact_flags_enabled(self):
|
||||||
|
"""Tests unlock_organization_contact when agency exists in a portfolio"""
|
||||||
|
# Create a federal agency
|
||||||
|
federal_agency = FederalAgency.objects.create(agency="Portfolio Agency")
|
||||||
|
|
||||||
|
# Create a portfolio with matching organization name
|
||||||
|
Portfolio.objects.create(
|
||||||
|
creator=self.user,
|
||||||
|
organization_name=federal_agency.agency
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create domain request with the portfolio agency
|
||||||
|
domain_request = completed_domain_request(
|
||||||
|
federal_agency=federal_agency,
|
||||||
|
user=self.user
|
||||||
|
)
|
||||||
|
self.assertFalse(domain_request.unlock_organization_contact())
|
||||||
|
|
||||||
|
@override_flag("organization_feature", active=False)
|
||||||
|
@override_flag("organization_requests", active=False)
|
||||||
|
@less_console_noise_decorator
|
||||||
|
def test_unlock_organization_contact_flags_disabled(self):
|
||||||
|
"""Tests unlock_organization_contact when organization flags are disabled"""
|
||||||
|
# Create a federal agency
|
||||||
|
federal_agency = FederalAgency.objects.create(agency="Portfolio Agency")
|
||||||
|
|
||||||
|
# Create a portfolio with matching organization name
|
||||||
|
Portfolio.objects.create(
|
||||||
|
creator=self.user,
|
||||||
|
organization_name=federal_agency.agency
|
||||||
|
)
|
||||||
|
|
||||||
|
domain_request = completed_domain_request(
|
||||||
|
federal_agency=federal_agency,
|
||||||
|
user=self.user
|
||||||
|
)
|
||||||
|
self.assertTrue(domain_request.unlock_organization_contact())
|
||||||
|
|
||||||
|
|
||||||
class TestPortfolioDomainRequestViewonly(TestWithUser, WebTest):
|
class TestPortfolioDomainRequestViewonly(TestWithUser, WebTest):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue