From bb1782a8351b4f61e1fbfc46fb8226d4c84cebf5 Mon Sep 17 00:00:00 2001 From: Changaco Date: Fri, 13 Oct 2023 08:48:16 +0200 Subject: [PATCH] test request for a payday log --- tests/py/test_payday.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/py/test_payday.py b/tests/py/test_payday.py index ff4bbb3363..39c360a7f6 100644 --- a/tests/py/test_payday.py +++ b/tests/py/test_payday.py @@ -6,7 +6,7 @@ from liberapay.constants import EVENTS from liberapay.i18n.currencies import MoneyBasket from liberapay.models.participant import Participant -from liberapay.testing import EUR, JPY, USD, Foobar +from liberapay.testing import EUR, JPY, USD, Foobar, website from liberapay.testing.emails import EmailHarness @@ -57,6 +57,26 @@ def test_payday_can_be_restarted_after_crash(self, transfer_for_real, exec_payda transfer_for_real.side_effect = None Payday.start().run() + def test_payday_log_can_be_accessed(self): + _override_payday_checks = website.env.override_payday_checks + website.env.override_payday_checks = True + try: + alice = self.make_participant('alice', privileges=1) + r = self.client.PxST('/admin/payday', data={'action': 'run_payday'}, auth_as=alice) + assert r.code == 302 + assert r.headers[b'Location'] == b'/admin/payday/1' + finally: + website.env.override_payday_checks = _override_payday_checks + r = self.client.GET('/admin/payday/1', auth_as=alice) + assert r.code == 200 + r = self.client.GxT( + '/admin/payday/1.txt', + HTTP_RANGE=b'x-lines=0-', HTTP_ACCEPT=b'text/plain', + auth_as=alice, + ) + assert r.code == 206 + assert r.headers[b'Content-Type'] == b'text/plain' + def test_payday_id_is_serial(self): for i in range(1, 4): self.db.run("SELECT nextval('paydays_id_seq')")