Fix pagination on matmat, don't allow empty matmat search and add htmx pagination

This commit is contained in:
2025-12-17 00:05:18 +01:00
parent f24e39ccb7
commit a2243e5e9a
6 changed files with 52 additions and 10 deletions

View File

@@ -33,3 +33,27 @@ class TestMatmatronch(TestCase):
)
assert response.status_code == 200
assert list(response.context_data["object_list"]) == [self.users[2]]
def test_empty_search(self):
self.client.force_login(subscriber_user.make())
response = self.client.get(reverse("matmat:search"))
assert response.status_code == 200
assert list(response.context_data["object_list"]) == []
assert not response.context_data["form"].is_valid()
response = self.client.get(
reverse(
"matmat:search",
query={
"promo": "",
"role": "",
"department": "",
"semester": "",
"date_of_birth": "",
},
)
)
assert response.status_code == 200
assert list(response.context_data["object_list"]) == []
assert not response.context_data["form"].is_valid()
assert "Empty search" in response.context_data["form"].non_field_errors()