From 59c67a70d27d92e25ba7f645f9930b11a6a4c8cb Mon Sep 17 00:00:00 2001 From: Neil Martinsen-Burrell Date: Mon, 30 Jan 2023 11:22:04 -0600 Subject: [PATCH] Revert "Mark test as an expected failure for now." This reverts commit 604557e96c260e6710ca6318df8080626a23f5b3. --- src/registrar/tests/test_views.py | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index 2c8938763..71fb3f155 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -758,6 +758,43 @@ class DomainApplicationTests(TestWithUser, WebTest): # and the step is on the sidebar list. self.assertContains(tribal_government_page, self.TITLES[Step.TRIBAL_GOVERNMENT]) + def test_application_tribal_explanation(self): + """Unrecognized tribes have to answer an additional question.""" + type_page = self.app.get(reverse("application:")).follow() + # django-webtest does not handle cookie-based sessions well because it keeps + # resetting the session key on each new request, thus destroying the concept + # of a "session". We are going to do it manually, saving the session ID here + # and then setting the cookie on each request. + session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] + type_form = type_page.form + type_form[ + "organization_type-organization_type" + ] = DomainApplication.OrganizationChoices.TRIBAL + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + type_result = type_page.form.submit() + # the tribal government page comes immediately afterwards + self.assertIn("/tribal_government", type_result.headers["Location"]) + # follow first redirect + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + tribal_government_page = type_result.follow() + + # Enter a tribe name but don't check either state or federal recognition + tribal_government_page.form["tribal_government-tribe_name"] = "Tribe name" + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + tribal_government_result = tribal_government_page.form.submit() + + # should be a redirect to tribal_more_information + self.assertIn("/tribal_more_information", tribal_government_result.headers["Location"]) + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + tribal_more_information_page = tribal_government_result.follow() + + # put an explanation and submit + tribal_more_information_page.form["tribal_more_information-more_organization_information"] = "Some explanation" + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + result = tribal_more_information_page.form.submit() + # result should be a success + self.assertEqual(result.status_code, 200) + def test_application_ao_dynamic_text(self): type_page = self.app.get(reverse("application:")).follow() # django-webtest does not handle cookie-based sessions well because it keeps