attempting to fix tests broken in pipeline

This commit is contained in:
David Kennedy 2024-03-04 13:54:17 -05:00
parent 7fd664b94a
commit 579d1db2e3
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B

View file

@ -1816,41 +1816,41 @@ class ListHeaderAdminTest(TestCase):
self.superuser = create_superuser() self.superuser = create_superuser()
def test_changelist_view(self): def test_changelist_view(self):
with less_console_noise(): # with less_console_noise():
# Have to get creative to get past linter # Have to get creative to get past linter
p = "adminpass" p = "adminpass"
self.client.login(username="superuser", password=p) self.client.login(username="superuser", password=p)
# Mock a user # Mock a user
user = mock_user() user = mock_user()
# Make the request using the Client class # Make the request using the Client class
# which handles CSRF # which handles CSRF
# Follow=True handles the redirect # Follow=True handles the redirect
response = self.client.get( response = self.client.get(
"/admin/registrar/domainapplication/", "/admin/registrar/domainapplication/",
{
"status__exact": "started",
"investigator__id__exact": user.id,
"q": "Hello",
},
follow=True,
)
# Assert that the filters and search_query are added to the extra_context
self.assertIn("filters", response.context)
self.assertIn("search_query", response.context)
# Assert the content of filters and search_query
filters = response.context["filters"]
search_query = response.context["search_query"]
self.assertEqual(search_query, "Hello")
self.assertEqual(
filters,
[
{"parameter_name": "status", "parameter_value": "started"},
{ {
"status__exact": "started", "parameter_name": "investigator",
"investigator__id__exact": user.id, "parameter_value": user.first_name + " " + user.last_name,
"q": "Hello",
}, },
follow=True, ],
) )
# Assert that the filters and search_query are added to the extra_context
self.assertIn("filters", response.context)
self.assertIn("search_query", response.context)
# Assert the content of filters and search_query
filters = response.context["filters"]
search_query = response.context["search_query"]
self.assertEqual(search_query, "Hello")
self.assertEqual(
filters,
[
{"parameter_name": "status", "parameter_value": "started"},
{
"parameter_name": "investigator",
"parameter_value": user.first_name + " " + user.last_name,
},
],
)
def test_get_filters(self): def test_get_filters(self):
with less_console_noise(): with less_console_noise():