mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-18 18:39:21 +02:00
Updated tests for new fk FederalAgency
This commit is contained in:
parent
98183a961f
commit
1adf513db6
3 changed files with 16 additions and 6 deletions
|
@ -744,6 +744,7 @@ class MockDb(TestCase):
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
UserDomainRole.objects.all().delete()
|
UserDomainRole.objects.all().delete()
|
||||||
DomainInvitation.objects.all().delete()
|
DomainInvitation.objects.all().delete()
|
||||||
|
FederalAgency.objects.all().delete()
|
||||||
|
|
||||||
|
|
||||||
def mock_user():
|
def mock_user():
|
||||||
|
|
|
@ -11,6 +11,7 @@ from registrar.models import (
|
||||||
TransitionDomain,
|
TransitionDomain,
|
||||||
DomainInformation,
|
DomainInformation,
|
||||||
UserDomainRole,
|
UserDomainRole,
|
||||||
|
FederalAgency
|
||||||
)
|
)
|
||||||
|
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
|
@ -42,6 +43,7 @@ class TestProcessedMigrations(TestCase):
|
||||||
DomainInformation.objects.all().delete()
|
DomainInformation.objects.all().delete()
|
||||||
DomainInvitation.objects.all().delete()
|
DomainInvitation.objects.all().delete()
|
||||||
TransitionDomain.objects.all().delete()
|
TransitionDomain.objects.all().delete()
|
||||||
|
FederalAgency.objects.all().delete()
|
||||||
|
|
||||||
# Delete users
|
# Delete users
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
|
@ -329,6 +331,7 @@ class TestOrganizationMigration(TestCase):
|
||||||
|
|
||||||
# Lets test the first one
|
# Lets test the first one
|
||||||
transition = transition_domains.first()
|
transition = transition_domains.first()
|
||||||
|
federal_agency, _ = FederalAgency.objects.get_or_create(agency="Department of Commerce")
|
||||||
expected_transition_domain = TransitionDomain(
|
expected_transition_domain = TransitionDomain(
|
||||||
username="alexandra.bobbitt5@test.com",
|
username="alexandra.bobbitt5@test.com",
|
||||||
domain_name="fakewebsite2.gov",
|
domain_name="fakewebsite2.gov",
|
||||||
|
@ -337,7 +340,7 @@ class TestOrganizationMigration(TestCase):
|
||||||
generic_org_type="Federal",
|
generic_org_type="Federal",
|
||||||
organization_name="Fanoodle",
|
organization_name="Fanoodle",
|
||||||
federal_type="Executive",
|
federal_type="Executive",
|
||||||
federal_agency="Department of Commerce",
|
federal_agency=federal_agency,
|
||||||
epp_creation_date=datetime.date(2004, 5, 7),
|
epp_creation_date=datetime.date(2004, 5, 7),
|
||||||
epp_expiration_date=datetime.date(2023, 9, 30),
|
epp_expiration_date=datetime.date(2023, 9, 30),
|
||||||
first_name="Seline",
|
first_name="Seline",
|
||||||
|
@ -392,6 +395,7 @@ class TestOrganizationMigration(TestCase):
|
||||||
# == Third, test that we've loaded data as we expect == #
|
# == Third, test that we've loaded data as we expect == #
|
||||||
_domain = Domain.objects.filter(name="fakewebsite2.gov").get()
|
_domain = Domain.objects.filter(name="fakewebsite2.gov").get()
|
||||||
domain_information = DomainInformation.objects.filter(domain=_domain).get()
|
domain_information = DomainInformation.objects.filter(domain=_domain).get()
|
||||||
|
federal_agency, _ = FederalAgency.objects.get_or_create(agency="Department of Commerce")
|
||||||
|
|
||||||
expected_creator = User.objects.filter(username="System").get()
|
expected_creator = User.objects.filter(username="System").get()
|
||||||
expected_ao = Contact.objects.filter(
|
expected_ao = Contact.objects.filter(
|
||||||
|
@ -400,7 +404,7 @@ class TestOrganizationMigration(TestCase):
|
||||||
expected_domain_information = DomainInformation(
|
expected_domain_information = DomainInformation(
|
||||||
creator=expected_creator,
|
creator=expected_creator,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="Department of Commerce",
|
federal_agency=federal_agency,
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
organization_name="Fanoodle",
|
organization_name="Fanoodle",
|
||||||
address_line1="93001 Arizona Drive",
|
address_line1="93001 Arizona Drive",
|
||||||
|
@ -447,6 +451,7 @@ class TestOrganizationMigration(TestCase):
|
||||||
# == Fourth, test that no data is overwritten as we expect == #
|
# == Fourth, test that no data is overwritten as we expect == #
|
||||||
_domain = Domain.objects.filter(name="fakewebsite2.gov").get()
|
_domain = Domain.objects.filter(name="fakewebsite2.gov").get()
|
||||||
domain_information = DomainInformation.objects.filter(domain=_domain).get()
|
domain_information = DomainInformation.objects.filter(domain=_domain).get()
|
||||||
|
federal_agency, _ = FederalAgency.objects.get_or_create(agency="Department of Commerce")
|
||||||
|
|
||||||
expected_creator = User.objects.filter(username="System").get()
|
expected_creator = User.objects.filter(username="System").get()
|
||||||
expected_ao = Contact.objects.filter(
|
expected_ao = Contact.objects.filter(
|
||||||
|
@ -455,7 +460,7 @@ class TestOrganizationMigration(TestCase):
|
||||||
expected_domain_information = DomainInformation(
|
expected_domain_information = DomainInformation(
|
||||||
creator=expected_creator,
|
creator=expected_creator,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="Department of Commerce",
|
federal_agency=federal_agency,
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
organization_name="Fanoodle",
|
organization_name="Fanoodle",
|
||||||
address_line1="93001 Galactic Way",
|
address_line1="93001 Galactic Way",
|
||||||
|
|
|
@ -16,6 +16,7 @@ from registrar.models import (
|
||||||
Contact,
|
Contact,
|
||||||
User,
|
User,
|
||||||
Website,
|
Website,
|
||||||
|
FederalAgency
|
||||||
)
|
)
|
||||||
from registrar.views.domain_request import DomainRequestWizard, Step
|
from registrar.views.domain_request import DomainRequestWizard, Step
|
||||||
|
|
||||||
|
@ -178,7 +179,8 @@ class DomainRequestTests(TestWithUser, WebTest):
|
||||||
org_contact_page = federal_result.follow()
|
org_contact_page = federal_result.follow()
|
||||||
org_contact_form = org_contact_page.forms[0]
|
org_contact_form = org_contact_page.forms[0]
|
||||||
# federal agency so we have to fill in federal_agency
|
# federal agency so we have to fill in federal_agency
|
||||||
org_contact_form["organization_contact-federal_agency"] = "General Services Administration"
|
federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration")
|
||||||
|
org_contact_form["organization_contact-federal_agency"] = federal_agency
|
||||||
org_contact_form["organization_contact-organization_name"] = "Testorg"
|
org_contact_form["organization_contact-organization_name"] = "Testorg"
|
||||||
org_contact_form["organization_contact-address_line1"] = "address 1"
|
org_contact_form["organization_contact-address_line1"] = "address 1"
|
||||||
org_contact_form["organization_contact-address_line2"] = "address 2"
|
org_contact_form["organization_contact-address_line2"] = "address 2"
|
||||||
|
@ -2020,7 +2022,8 @@ class DomainRequestTests(TestWithUser, WebTest):
|
||||||
org_contact_page = federal_result.follow()
|
org_contact_page = federal_result.follow()
|
||||||
org_contact_form = org_contact_page.forms[0]
|
org_contact_form = org_contact_page.forms[0]
|
||||||
# federal agency so we have to fill in federal_agency
|
# federal agency so we have to fill in federal_agency
|
||||||
org_contact_form["organization_contact-federal_agency"] = "General Services Administration"
|
federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration")
|
||||||
|
org_contact_form["organization_contact-federal_agency"] = federal_agency
|
||||||
org_contact_form["organization_contact-organization_name"] = "Testorg"
|
org_contact_form["organization_contact-organization_name"] = "Testorg"
|
||||||
org_contact_form["organization_contact-address_line1"] = "address 1"
|
org_contact_form["organization_contact-address_line1"] = "address 1"
|
||||||
org_contact_form["organization_contact-address_line2"] = "address 2"
|
org_contact_form["organization_contact-address_line2"] = "address 2"
|
||||||
|
@ -2091,7 +2094,8 @@ class DomainRequestTests(TestWithUser, WebTest):
|
||||||
org_contact_page = federal_result.follow()
|
org_contact_page = federal_result.follow()
|
||||||
org_contact_form = org_contact_page.forms[0]
|
org_contact_form = org_contact_page.forms[0]
|
||||||
# federal agency so we have to fill in federal_agency
|
# federal agency so we have to fill in federal_agency
|
||||||
org_contact_form["organization_contact-federal_agency"] = "General Services Administration"
|
federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration")
|
||||||
|
org_contact_form["organization_contact-federal_agency"] = federal_agency
|
||||||
org_contact_form["organization_contact-organization_name"] = "Testorg"
|
org_contact_form["organization_contact-organization_name"] = "Testorg"
|
||||||
org_contact_form["organization_contact-address_line1"] = "address 1"
|
org_contact_form["organization_contact-address_line1"] = "address 1"
|
||||||
org_contact_form["organization_contact-address_line2"] = "address 2"
|
org_contact_form["organization_contact-address_line2"] = "address 2"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue