mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-02 17:23:32 +02:00
added test cases
This commit is contained in:
parent
5a5fbefa6a
commit
130bea44e3
1 changed files with 80 additions and 0 deletions
|
@ -1130,3 +1130,83 @@ class TestDomainDetail(TestWithDomainPermissions, WebTest):
|
|||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
success_page = success_result.follow()
|
||||
self.assertContains(success_page, "mayor@igorville.gov")
|
||||
|
||||
class TestApplicationStatus(TestCase)
|
||||
def _completed_application(
|
||||
self,
|
||||
has_other_contacts=True,
|
||||
has_current_website=True,
|
||||
has_alternative_gov_domain=True,
|
||||
has_type_of_work=True,
|
||||
has_anything_else=True,
|
||||
):
|
||||
"""A completed domain application."""
|
||||
user = get_user_model().objects.create(username="username")
|
||||
ao, _ = Contact.objects.get_or_create(
|
||||
first_name="Testy",
|
||||
last_name="Tester",
|
||||
title="Chief Tester",
|
||||
email="testy@town.com",
|
||||
phone="(555) 555 5555",
|
||||
)
|
||||
domain, _ = Domain.objects.get_or_create(name="citystatus.gov")
|
||||
alt, _ = Website.objects.get_or_create(website="city1.gov")
|
||||
current, _ = Website.objects.get_or_create(website="city.com")
|
||||
you, _ = Contact.objects.get_or_create(
|
||||
first_name="Testy you",
|
||||
last_name="Tester you",
|
||||
title="Admin Tester",
|
||||
email="testy-admin@town.com",
|
||||
phone="(555) 555 5556",
|
||||
)
|
||||
other, _ = Contact.objects.get_or_create(
|
||||
first_name="Testy2",
|
||||
last_name="Tester2",
|
||||
title="Another Tester",
|
||||
email="testy2@town.com",
|
||||
phone="(555) 555 5557",
|
||||
)
|
||||
domain_application_kwargs = dict(
|
||||
organization_type="federal",
|
||||
federal_type="executive",
|
||||
purpose="Purpose of the site",
|
||||
is_policy_acknowledged=True,
|
||||
organization_name="Testorg",
|
||||
address_line1="address 1",
|
||||
address_line2="address 2",
|
||||
state_territory="NY",
|
||||
zipcode="10002",
|
||||
authorizing_official=ao,
|
||||
requested_domain=domain,
|
||||
submitter=you,
|
||||
creator=user,
|
||||
status=submitted,
|
||||
)
|
||||
if has_type_of_work:
|
||||
domain_application_kwargs["type_of_work"] = "e-Government"
|
||||
if has_anything_else:
|
||||
domain_application_kwargs["anything_else"] = "There is more"
|
||||
|
||||
application, _ = DomainApplication.objects.get_or_create(
|
||||
**domain_application_kwargs
|
||||
)
|
||||
|
||||
if has_other_contacts:
|
||||
application.other_contacts.add(other)
|
||||
if has_current_website:
|
||||
application.current_websites.add(current)
|
||||
if has_alternative_gov_domain:
|
||||
application.alternative_domains.add(alt)
|
||||
|
||||
return application
|
||||
|
||||
def test_application_status(self)
|
||||
"""Checking application status page"""
|
||||
home_page = self.app.get("/")
|
||||
self.assertContains(home_page, "citystatus.gov")
|
||||
# click the "Manage" link
|
||||
detail_page = home_page.click("Manage")
|
||||
self.assertContains(detail_page, "city.gov")
|
||||
self.assertContains(detail_page, "Chief Tester")
|
||||
self.assertContains(detail_page, "testy@town.com")
|
||||
self.assertContains(detail_page, "Admin Tester")
|
Loading…
Add table
Add a link
Reference in a new issue