コード例 #1
0
def test_group_badge_status_cascade():
    g = Group(cost=0, auto_recalc=False)
    taken = Attendee(
        group_id=g.id, paid=c.PAID_BY_GROUP, badge_status=c.NEW_STATUS, first_name='Liam', last_name='Neeson')
    floating = Attendee(group_id=g.id, paid=c.PAID_BY_GROUP, badge_status=c.NEW_STATUS)
    g.attendees = [taken, floating]
    g.presave_adjustments()
    assert taken.badge_status == c.COMPLETED_STATUS and floating.badge_status == c.NEW_STATUS
コード例 #2
0
def test_approved_presave_adjustment():
    g = Group()
    g.presave_adjustments()
    assert g.approved is None

    g.status = c.APPROVED
    g.presave_adjustments()
    assert g.approved is not None
コード例 #3
0
def test_cost_presave_adjustment():
    g = Group(cost=123, auto_recalc=False)
    g.presave_adjustments()
    assert g.cost == 123

    g.auto_recalc = True
    g.presave_adjustments()
    assert g.cost == 0

    g.auto_recalc = False
    g.cost = ''
    g.presave_adjustments()
    assert g.cost == 0

    g.auto_recalc = False
    g.cost = 10
    g.presave_adjustments()
    assert g.cost == 10

    g.amount_paid = ''
    g.presave_adjustments()
    assert g.amount_paid == 0

    g.amount_refunded = ''
    g.presave_adjustments()
    assert g.amount_refunded == 0