Skip to content

Commit

Permalink
test request for a payday log
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Oct 13, 2023
1 parent 96dc8d0 commit bb1782a
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion tests/py/test_payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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')")
Expand Down

0 comments on commit bb1782a

Please sign in to comment.