mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-03 08:22:18 +02:00
formatted for code readability
This commit is contained in:
parent
4a06bb1d0f
commit
9586ebffcb
2 changed files with 13 additions and 13 deletions
|
@ -20,14 +20,14 @@ class GetDomainsJsonTest(TestWithUser, WebTest):
|
|||
UserDomainRole.objects.create(user=self.user, domain=self.domain3)
|
||||
|
||||
def test_get_domains_json_unauthenticated(self):
|
||||
""" for an unauthenticated user, test that the user is redirected for auth """
|
||||
"""for an unauthenticated user, test that the user is redirected for auth"""
|
||||
self.app.reset()
|
||||
|
||||
response = self.client.get(reverse("get_domains_json"))
|
||||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
def test_get_domains_json_authenticated(self):
|
||||
""" Test that an authenticated user gets the list of 3 domains."""
|
||||
"""Test that an authenticated user gets the list of 3 domains."""
|
||||
response = self.app.get(reverse("get_domains_json"))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
data = response.json
|
||||
|
@ -46,7 +46,7 @@ class GetDomainsJsonTest(TestWithUser, WebTest):
|
|||
self.assertIn(self.domain3.id, domain_ids)
|
||||
|
||||
def test_pagination(self):
|
||||
""" Test that pagination is correct in the response """
|
||||
"""Test that pagination is correct in the response"""
|
||||
response = self.app.get(reverse("get_domains_json"), {"page": 1})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
data = response.json
|
||||
|
@ -58,7 +58,7 @@ class GetDomainsJsonTest(TestWithUser, WebTest):
|
|||
self.assertEqual(data["num_pages"], 1)
|
||||
|
||||
def test_sorting(self):
|
||||
""" test that sorting works properly in the response """
|
||||
"""test that sorting works properly in the response"""
|
||||
response = self.app.get(reverse("get_domains_json"), {"sort_by": "expiration_date", "order": "desc"})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
data = response.json
|
||||
|
@ -76,7 +76,7 @@ class GetDomainsJsonTest(TestWithUser, WebTest):
|
|||
self.assertEqual(expiration_dates, sorted(expiration_dates))
|
||||
|
||||
def test_sorting_by_state_display(self):
|
||||
""" test that the state_display sorting works properly """
|
||||
"""test that the state_display sorting works properly"""
|
||||
response = self.app.get(reverse("get_domains_json"), {"sort_by": "state_display", "order": "asc"})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
data = response.json
|
||||
|
|
|
@ -13,7 +13,7 @@ class DomainRequestViewTest(TestWithUser, WebTest):
|
|||
self.domain_requests = [
|
||||
DomainRequest.objects.create(
|
||||
creator=self.user,
|
||||
requested_domain=None,
|
||||
requested_domain=None,
|
||||
submission_date="2024-01-01",
|
||||
status=DomainRequest.DomainRequestStatus.STARTED,
|
||||
created_at="2024-01-01",
|
||||
|
@ -41,7 +41,7 @@ class DomainRequestViewTest(TestWithUser, WebTest):
|
|||
),
|
||||
DomainRequest.objects.create(
|
||||
creator=self.user,
|
||||
requested_domain=None,
|
||||
requested_domain=None,
|
||||
submission_date="2024-05-01",
|
||||
status=DomainRequest.DomainRequestStatus.STARTED,
|
||||
created_at="2024-05-01",
|
||||
|
@ -69,7 +69,7 @@ class DomainRequestViewTest(TestWithUser, WebTest):
|
|||
),
|
||||
DomainRequest.objects.create(
|
||||
creator=self.user,
|
||||
requested_domain=None,
|
||||
requested_domain=None,
|
||||
submission_date="2024-09-01",
|
||||
status=DomainRequest.DomainRequestStatus.STARTED,
|
||||
created_at="2024-09-01",
|
||||
|
@ -98,7 +98,7 @@ class DomainRequestViewTest(TestWithUser, WebTest):
|
|||
]
|
||||
|
||||
def test_get_domain_requests_json_authenticated(self):
|
||||
""" test that domain requests are returned properly for an authenticated user """
|
||||
"""test that domain requests are returned properly for an authenticated user"""
|
||||
response = self.app.get(reverse("get_domain_requests_json"))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
data = response.json
|
||||
|
@ -115,8 +115,8 @@ class DomainRequestViewTest(TestWithUser, WebTest):
|
|||
self.assertNotEqual(domain_request["status"], "Approved")
|
||||
|
||||
def test_pagination(self):
|
||||
""" Test that pagination works properly. There are 11 total non-approved requests and
|
||||
a page size of 10 """
|
||||
"""Test that pagination works properly. There are 11 total non-approved requests and
|
||||
a page size of 10"""
|
||||
response = self.app.get(reverse("get_domain_requests_json"), {"page": 1})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
data = response.json
|
||||
|
@ -138,7 +138,7 @@ class DomainRequestViewTest(TestWithUser, WebTest):
|
|||
self.assertEqual(data["num_pages"], 2)
|
||||
|
||||
def test_sorting(self):
|
||||
""" test that sorting works properly on the result set """
|
||||
"""test that sorting works properly on the result set"""
|
||||
response = self.app.get(reverse("get_domain_requests_json"), {"sort_by": "submission_date", "order": "desc"})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
data = response.json
|
||||
|
@ -156,7 +156,7 @@ class DomainRequestViewTest(TestWithUser, WebTest):
|
|||
self.assertEqual(submission_dates, sorted(submission_dates))
|
||||
|
||||
def test_filter_approved_excluded(self):
|
||||
""" test that approved requests are excluded from result set. """
|
||||
"""test that approved requests are excluded from result set."""
|
||||
# sort in reverse chronological order of submission date, since most recent request is approved
|
||||
response = self.app.get(reverse("get_domain_requests_json"), {"sort_by": "submission_date", "order": "desc"})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue