From 002cfba35bff031c6512935cb08f80727d4abbc6 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Thu, 2 May 2024 13:54:37 -0700 Subject: [PATCH] Fix tests in domain requests --- src/registrar/forms/domain_request_wizard.py | 2 +- src/registrar/tests/test_views_request.py | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/registrar/forms/domain_request_wizard.py b/src/registrar/forms/domain_request_wizard.py index 46d7b35c4..9d16a30de 100644 --- a/src/registrar/forms/domain_request_wizard.py +++ b/src/registrar/forms/domain_request_wizard.py @@ -103,7 +103,7 @@ class OrganizationContactForm(RegistrarForm): # it is a federal agency. Use clean to check programatically # if it has been filled in when required. # uncomment to see if modelChoiceField can be an arg later - # required=False, + required=False, queryset=FederalAgency.objects.all(), empty_label="--Select--", # choices=[("", "--Select--")] + DomainRequest.AGENCY_CHOICES, diff --git a/src/registrar/tests/test_views_request.py b/src/registrar/tests/test_views_request.py index 1a8387ce8..7f1e2ac7f 100644 --- a/src/registrar/tests/test_views_request.py +++ b/src/registrar/tests/test_views_request.py @@ -180,7 +180,7 @@ class DomainRequestTests(TestWithUser, WebTest): org_contact_form = org_contact_page.forms[0] # federal agency so we have to fill in federal_agency 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-federal_agency"] = federal_agency.id org_contact_form["organization_contact-organization_name"] = "Testorg" org_contact_form["organization_contact-address_line1"] = "address 1" org_contact_form["organization_contact-address_line2"] = "address 2" @@ -690,7 +690,6 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) contact_result = org_contact_form.submit() - # the post request should return a redirect to the # about your organization page if it was successful. self.assertEqual(contact_result.status_code, 302) @@ -2023,14 +2022,9 @@ class DomainRequestTests(TestWithUser, WebTest): org_contact_form = org_contact_page.forms[0] # federal agency so we have to fill in federal_agency federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration") - print("!!! org_contact_form displayed", org_contact_form.__dict__) - print("!!! Federal agency is", federal_agency) - org_contact_form["organization_contact-federal_agency"] = "67" - # org_contact_form["organization_contact-federal_agency"] = federal_agency + org_contact_form["organization_contact-federal_agency"] = federal_agency.id org_contact_form["organization_contact-organization_name"] = "Testorg" - print("!!! GET PAST Organization name") org_contact_form["organization_contact-address_line1"] = "address 1" - print("!!! GET PAST Address Line 1") org_contact_form["organization_contact-address_line2"] = "address 2" org_contact_form["organization_contact-city"] = "NYC" org_contact_form["organization_contact-state_territory"] = "NY" @@ -2038,11 +2032,9 @@ class DomainRequestTests(TestWithUser, WebTest): org_contact_form["organization_contact-urbanization"] = "URB Royal Oaks" self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - print("!!! Before submit") org_contact_result = org_contact_form.submit() # ---- AO CONTACT PAGE ---- - print("!!! After submit") self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) ao_page = org_contact_result.follow() self.assertContains(ao_page, "Executive branch federal agencies") @@ -2102,7 +2094,7 @@ class DomainRequestTests(TestWithUser, WebTest): org_contact_form = org_contact_page.forms[0] # federal agency so we have to fill in federal_agency 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-federal_agency"] = federal_agency.id org_contact_form["organization_contact-organization_name"] = "Testorg" org_contact_form["organization_contact-address_line1"] = "address 1" org_contact_form["organization_contact-address_line2"] = "address 2"