def test_self_service_refunds_payment_status(monkeypatch, paid, expected): monkeypatch.setattr(config.Config, 'SELF_SERVICE_REFUNDS_OPEN', property(lambda s: True)) attendee = Attendee(paid=paid, amount_paid=10) txn = StripeTransaction(amount=1000) attendee.stripe_txn_share_logs = [ StripeTransactionAttendee(attendee_id=attendee.id, txn_id=txn.id, share=1000)] assert attendee.can_self_service_refund_badge == expected
def test_self_service_refunds_if_on(monkeypatch, open, expected): monkeypatch.setattr(config.Config, 'SELF_SERVICE_REFUNDS_OPEN', property(open)) attendee = Attendee(paid=c.HAS_PAID, amount_paid=10) txn = StripeTransaction(amount=1000) attendee.stripe_txn_share_logs = [ StripeTransactionAttendee(attendee_id=attendee.id, txn_id=txn.id, share=1000)] assert attendee.can_self_service_refund_badge == expected
def test_self_service_refunds_group_leader(monkeypatch): monkeypatch.setattr(config.Config, 'SELF_SERVICE_REFUNDS_OPEN', property(lambda s: True)) attendee = Attendee(paid=c.HAS_PAID, amount_paid=10) attendee.group = Group(leader_id=attendee.id) txn = StripeTransaction(amount=1000) attendee.stripe_txn_share_logs = [ StripeTransactionAttendee(attendee_id=attendee.id, txn_id=txn.id, share=1000)] assert not attendee.can_self_service_refund_badge
def test_self_service_refunds_misc(monkeypatch, amount_paid, checked_in, expected): monkeypatch.setattr(config.Config, 'SELF_SERVICE_REFUNDS_OPEN', property(lambda s: True)) attendee = Attendee(paid=c.HAS_PAID, amount_paid=amount_paid) txn = StripeTransaction(amount=1000) attendee.stripe_txn_share_logs = [ StripeTransactionAttendee(attendee_id=attendee.id, txn_id=txn.id, share=1000)] attendee.checked_in = checked_in assert attendee.can_self_service_refund_badge == expected