Add test alphabetical sorting test

This commit is contained in:
zandercymatics 2023-12-15 08:49:57 -07:00
parent a9e252bced
commit d72e704ba4
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -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("/")