def test_not_a_dealer_no_app(self): session = Session().session with request_cached_context(): session.add(Group(tables=0, cost=10, status=c.UNAPPROVED)) session.commit() assert c.DEALER_APPS == 0
def test_free_dealer_no_app(self): session = Session().session with request_cached_context(): session.add(Group(tables=1, cost=0, auto_recalc=False, status=c.UNAPPROVED)) session.commit() assert c.DEALER_APPS == 0
def test_waitlisted_dealer_not_app(self): session = Session().session with request_cached_context(): session.add(Group(tables=1, cost=10, status=c.WAITLISTED)) session.commit() assert c.DEALER_APPS == 0
def test_free_badge_no_price_bump(self): session = Session().session assert c.BADGES_SOLD == 0 with request_cached_context(): session.add(Attendee(paid=c.NEED_NOT_PAY, badge_status=c.COMPLETED_STATUS)) session.commit() assert c.BADGES_SOLD == 0 assert 40 == c.get_attendee_price()
def test_invalid_badge_no_price_bump(self): session = Session().session assert c.BADGES_SOLD == 0 with request_cached_context(): session.add(Attendee(paid=c.HAS_PAID, badge_status=c.INVALID_STATUS)) session.commit() assert c.BADGES_SOLD == 0 assert 40 == c.get_attendee_price()
def test_refunded_badge_price_bump_before_event(self, monkeypatch): monkeypatch.setattr(c, 'EPOCH', localized_now() + timedelta(days=1)) session = Session().session assert c.BADGES_SOLD == 0 with request_cached_context(): session.add(Attendee(paid=c.REFUNDED, badge_status=c.COMPLETED_STATUS)) session.commit() assert c.BADGES_SOLD == 1 assert 50 == c.get_attendee_price()
def test_over_limit_price_bump_during_event(self, monkeypatch): monkeypatch.setattr(c, 'EPOCH', localized_now() - timedelta(days=1)) session = Session().session assert c.BADGES_SOLD == 0 with request_cached_context(): session.add(Attendee(paid=c.HAS_PAID, badge_status=c.COMPLETED_STATUS)) session.commit() assert c.BADGES_SOLD == 1 assert 40 == c.get_attendee_price()
def session(request): session = Session().session request.addfinalizer(session.close) check_ranges(session) for badge_type, badge_name in [(c.STAFF_BADGE, 'Staff'), (c.CONTRACTOR_BADGE, 'Contractor')]: for number in ['One', 'Two', 'Three', 'Four', 'Five']: setattr(session, '{}_{}'.format(badge_name, number).lower(), session.attendee(badge_type=badge_type, first_name=number)) setattr(session, 'regular_attendee', session.attendee(first_name='Regular', last_name='Attendee')) session.regular_attendee.paid = c.HAS_PAID session.regular_attendee.checked_in = datetime.now(UTC) session.regular_attendee.badge_num = 3000 session.commit() return session