def test_no_tickets_this_conference(self): ''' list of tickets is empty, so there should be no match ''' checklist_items = get_checklist_items_for_tickets( self.purchaser, self.conference, []) nt.assert_equal(len(checklist_items), 0)
def test_no_ticket_condition(self): ''' purchaser tickets have no conditions ''' checklist_items = get_checklist_items_for_tickets( self.purchaser, self.conference, []) nt.assert_equal(len(checklist_items), 0)
def test_no_tickets_this_conference(self): ''' list of tickets is empty, so there should be no match ''' checklist_items = get_checklist_items_for_tickets( self.purchaser, self.conference, []) nt.assert_equal(len(checklist_items), 0)
def test_no_ticket_condition(self): ''' purchaser tickets have no conditions ''' checklist_items = get_checklist_items_for_tickets( self.purchaser, self.conference, []) nt.assert_equal(len(checklist_items), 0)
def test_ticket_is_excluded(self): ''' there's a match, but also an exclusion ''' match_condition = TicketingEligibilityConditionFactory( tickets=[self.transaction.ticket_item]) exclusion = TicketingExclusionFactory( condition=match_condition, tickets=[self.transaction.ticket_item]) checklist_items = get_checklist_items_for_tickets( self.purchaser, self.conference, []) nt.assert_equal(len(checklist_items), 0)
def test_ticket_is_excluded(self): ''' there's a match, but also an exclusion ''' match_condition = TicketingEligibilityConditionFactory( tickets=[self.transaction.ticket_item]) exclusion = TicketingExclusionFactory( condition=match_condition, tickets=[self.transaction.ticket_item]) checklist_items = get_checklist_items_for_tickets( self.purchaser, self.conference, []) nt.assert_equal(len(checklist_items), 0)
def test_ticket_match_happens(self): ''' feeding in the matching ticket, gives an item ''' match_condition = TicketingEligibilityConditionFactory( tickets=[self.transaction.ticket_item]) checklist_items = get_checklist_items_for_tickets( self.purchaser, self.conference, [self.transaction.ticket_item]) nt.assert_equal(len(checklist_items), 1) nt.assert_equal(checklist_items[0]['count'], 1) nt.assert_equal(checklist_items[0]['ticket'], self.transaction.ticket_item.title) nt.assert_equal(checklist_items[0]['items'], [match_condition.checklistitem])
def test_ticket_match_happens(self): ''' feeding in the matching ticket, gives an item ''' match_condition = TicketingEligibilityConditionFactory( tickets=[self.transaction.ticket_item]) checklist_items = get_checklist_items_for_tickets( self.purchaser, self.conference, [self.transaction.ticket_item]) nt.assert_equal(len(checklist_items), 1) nt.assert_equal(checklist_items[0]['count'], 1) nt.assert_equal(checklist_items[0]['ticket'], self.transaction.ticket_item.title) nt.assert_equal(checklist_items[0]['items'], [match_condition.checklistitem])
def test_ticket_match_two_conditions(self): ''' two conditions match this circumstance ''' match_condition = TicketingEligibilityConditionFactory( tickets=[self.transaction.ticket_item]) another_match = TicketingEligibilityConditionFactory( tickets=[self.transaction.ticket_item]) checklist_items = get_checklist_items_for_tickets( self.purchaser, self.conference, [self.transaction.ticket_item]) nt.assert_equal(len(checklist_items), 1) nt.assert_equal(checklist_items[0]['count'], 1) nt.assert_equal(checklist_items[0]['ticket'], self.transaction.ticket_item.title) nt.assert_equal( checklist_items[0]['items'], [match_condition.checklistitem, another_match.checklistitem])
def test_ticket_match_two_conditions(self): ''' two conditions match this circumstance ''' match_condition = TicketingEligibilityConditionFactory( tickets=[self.transaction.ticket_item]) another_match = TicketingEligibilityConditionFactory( tickets=[self.transaction.ticket_item]) checklist_items = get_checklist_items_for_tickets( self.purchaser, self.conference, [self.transaction.ticket_item]) nt.assert_equal(len(checklist_items), 1) nt.assert_equal(checklist_items[0]['count'], 1) nt.assert_equal(checklist_items[0]['ticket'], self.transaction.ticket_item.title) nt.assert_equal(checklist_items[0]['items'], [match_condition.checklistitem, another_match.checklistitem])