mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-10 06:24:45 +02:00
Update tests on common.py
This commit is contained in:
parent
98e61d606d
commit
763e7b6351
4 changed files with 21 additions and 19 deletions
|
@ -13,7 +13,7 @@ from registrar.forms.utility.wizard_form_helper import (
|
||||||
BaseYesNoForm,
|
BaseYesNoForm,
|
||||||
BaseDeletableRegistrarForm,
|
BaseDeletableRegistrarForm,
|
||||||
)
|
)
|
||||||
from registrar.models import Contact, DomainRequest, DraftDomain, Domain
|
from registrar.models import Contact, DomainRequest, DraftDomain, Domain, FederalAgency
|
||||||
from registrar.templatetags.url_helpers import public_site_url
|
from registrar.templatetags.url_helpers import public_site_url
|
||||||
from registrar.utility.enums import ValidationReturnType
|
from registrar.utility.enums import ValidationReturnType
|
||||||
|
|
||||||
|
@ -97,13 +97,16 @@ class OrganizationElectionForm(RegistrarForm):
|
||||||
|
|
||||||
class OrganizationContactForm(RegistrarForm):
|
class OrganizationContactForm(RegistrarForm):
|
||||||
# for federal agencies we also want to know the top-level agency.
|
# for federal agencies we also want to know the top-level agency.
|
||||||
federal_agency = forms.ChoiceField(
|
federal_agency = forms.ModelChoiceField(
|
||||||
label="Federal agency",
|
label="Federal agency",
|
||||||
# not required because this field won't be filled out unless
|
# not required because this field won't be filled out unless
|
||||||
# it is a federal agency. Use clean to check programatically
|
# it is a federal agency. Use clean to check programatically
|
||||||
# if it has been filled in when required.
|
# if it has been filled in when required.
|
||||||
required=False,
|
# uncomment to see if modelChoiceField can be an arg later
|
||||||
choices=[("", "--Select--")] + DomainRequest.AGENCY_CHOICES,
|
# required=False,
|
||||||
|
queryset=FederalAgency.objects.all(),
|
||||||
|
empty_label="--Select--",
|
||||||
|
# choices=[("", "--Select--")] + DomainRequest.AGENCY_CHOICES,
|
||||||
)
|
)
|
||||||
organization_name = forms.CharField(
|
organization_name = forms.CharField(
|
||||||
label="Organization name",
|
label="Organization name",
|
||||||
|
|
|
@ -29,9 +29,6 @@ class DomainInformation(TimeStampedModel):
|
||||||
|
|
||||||
BranchChoices = DomainRequest.BranchChoices
|
BranchChoices = DomainRequest.BranchChoices
|
||||||
|
|
||||||
# TODO for #1975: Delete this after we run the new migration
|
|
||||||
AGENCY_CHOICES = DomainRequest.AGENCY_CHOICES
|
|
||||||
|
|
||||||
federal_agency = models.ForeignKey(
|
federal_agency = models.ForeignKey(
|
||||||
"registrar.FederalAgency",
|
"registrar.FederalAgency",
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
|
|
|
@ -26,6 +26,7 @@ from registrar.models import (
|
||||||
DomainInformation,
|
DomainInformation,
|
||||||
PublicContact,
|
PublicContact,
|
||||||
Domain,
|
Domain,
|
||||||
|
FederalAgency
|
||||||
)
|
)
|
||||||
from epplibwrapper import (
|
from epplibwrapper import (
|
||||||
commands,
|
commands,
|
||||||
|
@ -539,6 +540,9 @@ class MockDb(TestCase):
|
||||||
self.end_date = current_date + timedelta(days=2)
|
self.end_date = current_date + timedelta(days=2)
|
||||||
self.start_date = current_date - timedelta(days=2)
|
self.start_date = current_date - timedelta(days=2)
|
||||||
|
|
||||||
|
self.federal_agency_1, _ = FederalAgency.get_or_create(name="World War I Centennial Commission")
|
||||||
|
self.federal_agency_2, _ = FederalAgency.get_or_create(name="Armed Forces Retirement Home")
|
||||||
|
|
||||||
self.domain_1, _ = Domain.objects.get_or_create(
|
self.domain_1, _ = Domain.objects.get_or_create(
|
||||||
name="cdomain1.gov", state=Domain.State.READY, first_ready=timezone.now()
|
name="cdomain1.gov", state=Domain.State.READY, first_ready=timezone.now()
|
||||||
)
|
)
|
||||||
|
@ -582,7 +586,7 @@ class MockDb(TestCase):
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
domain=self.domain_1,
|
domain=self.domain_1,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="World War I Centennial Commission",
|
federal_agency=federal_agency_1,
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
)
|
)
|
||||||
|
@ -593,63 +597,63 @@ class MockDb(TestCase):
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
domain=self.domain_3,
|
domain=self.domain_3,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="Armed Forces Retirement Home",
|
federal_agency=federal_agency_2,
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
)
|
)
|
||||||
self.domain_information_4, _ = DomainInformation.objects.get_or_create(
|
self.domain_information_4, _ = DomainInformation.objects.get_or_create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
domain=self.domain_4,
|
domain=self.domain_4,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="Armed Forces Retirement Home",
|
federal_agency=federal_agency_2,
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
)
|
)
|
||||||
self.domain_information_5, _ = DomainInformation.objects.get_or_create(
|
self.domain_information_5, _ = DomainInformation.objects.get_or_create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
domain=self.domain_5,
|
domain=self.domain_5,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="Armed Forces Retirement Home",
|
federal_agency=federal_agency_2,
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
)
|
)
|
||||||
self.domain_information_6, _ = DomainInformation.objects.get_or_create(
|
self.domain_information_6, _ = DomainInformation.objects.get_or_create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
domain=self.domain_6,
|
domain=self.domain_6,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="Armed Forces Retirement Home",
|
federal_agency=federal_agency_2,
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
)
|
)
|
||||||
self.domain_information_7, _ = DomainInformation.objects.get_or_create(
|
self.domain_information_7, _ = DomainInformation.objects.get_or_create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
domain=self.domain_7,
|
domain=self.domain_7,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="Armed Forces Retirement Home",
|
federal_agency=federal_agency_2,
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
)
|
)
|
||||||
self.domain_information_8, _ = DomainInformation.objects.get_or_create(
|
self.domain_information_8, _ = DomainInformation.objects.get_or_create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
domain=self.domain_8,
|
domain=self.domain_8,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="Armed Forces Retirement Home",
|
federal_agency=federal_agency_2,
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
)
|
)
|
||||||
self.domain_information_9, _ = DomainInformation.objects.get_or_create(
|
self.domain_information_9, _ = DomainInformation.objects.get_or_create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
domain=self.domain_9,
|
domain=self.domain_9,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="Armed Forces Retirement Home",
|
federal_agency=federal_agency_2,
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
)
|
)
|
||||||
self.domain_information_10, _ = DomainInformation.objects.get_or_create(
|
self.domain_information_10, _ = DomainInformation.objects.get_or_create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
domain=self.domain_10,
|
domain=self.domain_10,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="Armed Forces Retirement Home",
|
federal_agency=federal_agency_2,
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
)
|
)
|
||||||
self.domain_information_11, _ = DomainInformation.objects.get_or_create(
|
self.domain_information_11, _ = DomainInformation.objects.get_or_create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
domain=self.domain_11,
|
domain=self.domain_11,
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_agency="World War I Centennial Commission",
|
federal_agency=federal_agency_1,
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1989,8 +1989,6 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
"updated_at",
|
"updated_at",
|
||||||
"status",
|
"status",
|
||||||
"rejection_reason",
|
"rejection_reason",
|
||||||
"updated_federal_agency",
|
|
||||||
# TODO: once approved, we'll have to remove above from test
|
|
||||||
"creator",
|
"creator",
|
||||||
"investigator",
|
"investigator",
|
||||||
"generic_org_type",
|
"generic_org_type",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue