Skip to content

Commit

Permalink
Merge pull request #728 from cisagov/ik/fix-alt-domain
Browse files Browse the repository at this point in the history
Update attribute for alternate domains
  • Loading branch information
igorkorenfeld committed Jun 16, 2023
2 parents 7163f3b + 1c285b3 commit 14f6a92
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/registrar/forms/application_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def to_database(self, obj: DomainApplication):

@classmethod
def on_fetch(cls, query):
return [{"alternative_domain": Domain.sld(domain.name)} for domain in query]
return [{"alternative_domain": Domain.sld(domain.website)} for domain in query]

@classmethod
def from_database(cls, obj):
Expand Down
35 changes: 35 additions & 0 deletions src/registrar/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,41 @@ def test_application_form_submission(self):
# check that any new pages are added to this test
self.assertEqual(num_pages, num_pages_tested)

# This is the start of a test to check an existing application, it currently
# does not work and results in errors as noted in:
# https://github.com/cisagov/getgov/pull/728
@skip("WIP")
def test_application_form_started_allsteps(self):
num_pages_tested = 0
# elections, type_of_work, tribal_government, no_other_contacts
SKIPPED_PAGES = 4
DASHBOARD_PAGE = 1
num_pages = len(self.TITLES) - SKIPPED_PAGES + DASHBOARD_PAGE

application = completed_application(user=self.user)
application.save()
home_page = self.app.get("/")
self.assertContains(home_page, "city.gov")
self.assertContains(home_page, "Started")
num_pages_tested += 1

# TODO: For some reason this click results in a new application being generated
# This appraoch is an alternatie to using get as is being done below
#
# type_page = home_page.click("Edit")

session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
url = reverse("edit-application", kwargs={"id": application.pk})
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)

# TODO: The following line results in a django error on middleware
response = self.client.get(url, follow=True)
self.assertContains(response, "Type of organization")
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
# TODO: Step through the remaining pages

self.assertEqual(num_pages, num_pages_tested)

def test_application_form_conditional_federal(self):
"""Federal branch question is shown for federal organizations."""
type_page = self.app.get(reverse("application:")).follow()
Expand Down

0 comments on commit 14f6a92

Please sign in to comment.