mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-15 17:17:02 +02:00
Add test alphabetical sorting test
This commit is contained in:
parent
a9e252bced
commit
d72e704ba4
1 changed files with 20 additions and 0 deletions
|
@ -843,6 +843,26 @@ class TestDomainApplicationAdmin(MockEppLib):
|
|||
with self.assertRaises(DomainInformation.DoesNotExist):
|
||||
domain_information.refresh_from_db()
|
||||
|
||||
def test_table_sorted_alphabetically(self):
|
||||
"""Tests if DomainApplicationAdmin table is sorted alphabetically"""
|
||||
self.max_diff = None
|
||||
# Creates a list of DomainApplications in scrambled order
|
||||
multiple_unalphabetical_domain_objects("application")
|
||||
request = self.factory.get("/")
|
||||
request.user = self.superuser
|
||||
|
||||
# Get the expected list of alphabetically sorted DomainApplications
|
||||
expected_order = DomainApplication.objects.order_by('requested_domain__name')
|
||||
|
||||
# Get the returned queryset
|
||||
queryset = self.admin.get_queryset(request)
|
||||
|
||||
# Check the order
|
||||
self.assertEqual(
|
||||
list(queryset),
|
||||
list(expected_order),
|
||||
)
|
||||
|
||||
def test_has_correct_filters(self):
|
||||
"""Tests if DomainApplicationAdmin has the correct filters"""
|
||||
request = self.factory.get("/")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue