Fix linting

This commit is contained in:
Neil Martinsen-Burrell 2023-01-25 11:55:46 -06:00
parent cc510138cb
commit 0c318e0eea
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
3 changed files with 19 additions and 10 deletions

View file

@ -498,11 +498,17 @@ class DomainApplication(TimeStampedModel):
def show_tribal_explanation(self) -> bool: def show_tribal_explanation(self) -> bool:
"""Show this step if the tribe is not federally or state recognized.""" """Show this step if the tribe is not federally or state recognized."""
user_choice = self.organization_type user_choice = self.organization_type
if (user_choice == DomainApplication.OrganizationChoices.TRIBAL): if user_choice == DomainApplication.OrganizationChoices.TRIBAL:
# did answer tribal, check the recognition answers # did answer tribal, check the recognition answers
if self.federally_recognized_tribe is not None and self.state_recognized_tribe is not None: if (
self.federally_recognized_tribe is not None
and self.state_recognized_tribe is not None
):
# have answered these questions # have answered these questions
if not self.federally_recognized_tribe and not self.state_recognized_tribe: if (
not self.federally_recognized_tribe
and not self.state_recognized_tribe
):
return True return True
return False return False

View file

@ -120,7 +120,9 @@ class DomainApplicationTests(TestWithUser, WebTest):
this test work. this test work.
""" """
num_pages_tested = 0 num_pages_tested = 0
SKIPPED_PAGES = 4 # elections, type_of_work, tribal_government, tribal_explanation SKIPPED_PAGES = (
4 # elections, type_of_work, tribal_government, tribal_explanation
)
num_pages = len(self.TITLES) - SKIPPED_PAGES num_pages = len(self.TITLES) - SKIPPED_PAGES
type_page = self.app.get(reverse("application:")).follow() type_page = self.app.get(reverse("application:")).follow()
@ -791,18 +793,21 @@ class DomainApplicationTests(TestWithUser, WebTest):
tribal_government_result = tribal_government_page.form.submit() tribal_government_result = tribal_government_page.form.submit()
# should be a redirect to tribal_more_information # should be a redirect to tribal_more_information
self.assertIn("/tribal_more_information", tribal_government_result.headers["Location"]) self.assertIn(
"/tribal_more_information", tribal_government_result.headers["Location"]
)
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
tribal_more_information_page = tribal_government_result.follow() tribal_more_information_page = tribal_government_result.follow()
# put an explanation and submit # put an explanation and submit
tribal_more_information_page.form["tribal_more_information-more_organization_information"] = "Some explanation" tribal_more_information_page.form[
"tribal_more_information-more_organization_information"
] = "Some explanation"
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = tribal_more_information_page.form.submit() result = tribal_more_information_page.form.submit()
# result should be a success # result should be a success
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
def test_application_ao_dynamic_text(self): def test_application_ao_dynamic_text(self):
type_page = self.app.get(reverse("application:")).follow() type_page = self.app.get(reverse("application:")).follow()
# django-webtest does not handle cookie-based sessions well because it keeps # django-webtest does not handle cookie-based sessions well because it keeps

View file

@ -96,9 +96,7 @@ class ApplicationWizard(LoginRequiredMixin, TemplateView):
Step.ORGANIZATION_FEDERAL: lambda w: w.from_model( Step.ORGANIZATION_FEDERAL: lambda w: w.from_model(
"show_organization_federal", False "show_organization_federal", False
), ),
Step.TRIBAL_GOVERNMENT: lambda w: w.from_model( Step.TRIBAL_GOVERNMENT: lambda w: w.from_model("show_tribal_government", False),
"show_tribal_government", False
),
Step.TRIBAL_EXPLANATION: lambda w: w.from_model( Step.TRIBAL_EXPLANATION: lambda w: w.from_model(
"show_tribal_explanation", False "show_tribal_explanation", False
), ),