diff --git a/hordak/tests/admin/test_admin.py b/hordak/tests/admin/test_admin.py index b9b9a5d..78f69bc 100644 --- a/hordak/tests/admin/test_admin.py +++ b/hordak/tests/admin/test_admin.py @@ -45,6 +45,42 @@ def test_account_list(self): self.assertContains(res, 'Income', html=True) self.assertContains(res, 'Asset', 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'Bank account', + html=True, + ) + self.assertContains(res, '

1 account

', html=True) + + def test_filter_query(self): + """Test that filter 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 + "?type__exact=AS") + self.assertContains( + res, + f'Bank account', + html=True, + ) + self.assertContains(res, '

1 account

', html=True) + + def test_filter_query_liability(self): + """Test that filter 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 + "?type__exact=LI") + self.assertContains(res, '

0 accounts

', html=True) + def test_account_edit(self): """Test account edit page""" superuser = get_user_model().objects.create_superuser(username="superuser")