Convert customer refill to a fragment view

This commit is contained in:
2024-12-15 21:33:19 +01:00
parent 0f003870bb
commit e9361697f7
9 changed files with 148 additions and 52 deletions

View File

@ -67,17 +67,24 @@ class TestCounter(TestCase):
{"code": self.richard.customer.account_id, "counter_token": counter_token},
)
counter_url = response.get("location")
response = self.client.get(response.get("location"))
refill_url = reverse(
"counter:refilling_create",
kwargs={"customer_id": self.richard.customer.pk},
)
response = self.client.get(
response.get("location"),
)
assert ">Richard Batsbak</" in str(response.content)
self.client.post(
counter_url,
refill_url,
{
"action": "refill",
"amount": "5",
"payment_method": "CASH",
"bank": "OTHER",
},
HTTP_REFERER=counter_url,
)
self.client.post(counter_url, "action=code&code=BARB", content_type="text/xml")
self.client.post(
@ -110,15 +117,15 @@ class TestCounter(TestCase):
)
response = self.client.post(
counter_url,
refill_url,
{
"action": "refill",
"amount": "5",
"payment_method": "CASH",
"bank": "OTHER",
},
HTTP_REFERER=counter_url,
)
assert response.status_code == 200
assert response.status_code == 302
self.client.post(
reverse("counter:login", kwargs={"counter_id": self.foyer.id}),
@ -138,17 +145,23 @@ class TestCounter(TestCase):
{"code": self.richard.customer.account_id, "counter_token": counter_token},
)
counter_url = response.get("location")
refill_url = reverse(
"counter:refilling_create",
kwargs={
"customer_id": self.richard.customer.pk,
},
)
response = self.client.post(
counter_url,
refill_url,
{
"action": "refill",
"amount": "5",
"payment_method": "CASH",
"bank": "OTHER",
},
HTTP_REFERER=counter_url,
)
assert response.status_code == 200
assert response.status_code == 302
def test_annotate_has_barman_queryset(self):
"""Test if the custom queryset method `annotate_has_barman` works as intended."""