Skip to content

Commit

Permalink
add test for admin search
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed May 28, 2024
1 parent c92f378 commit 457af08
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions hordak/tests/admin/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ def test_account_list(self):
self.assertContains(res, '<td class="field-type_">Income</td>', html=True)
self.assertContains(res, '<td class="field-type_">Asset</td>', html=True)

def test_search_query(self):
"""Test that search query works"""
superuser = get_user_model().objects.create_superuser(username="superuser")
self.client.force_login(superuser)
url = reverse("admin:hordak_account_changelist")
res = self.client.get(url + "?q=Bank")
self.assertContains(
res,
f'<a href="/admin/hordak/account/{self.bank_account.id}/change/'
'?_changelist_filters=q%3DBank">Bank account</a>',
html=True,
)

def test_account_edit(self):
"""Test account edit page"""
superuser = get_user_model().objects.create_superuser(username="superuser")
Expand Down

0 comments on commit 457af08

Please sign in to comment.