Esempio n. 1
0
    def test_event_daterange(self):
        date_from = timezone.now()
        date_to = date_from + datetime.timedelta(days=3)
        location = models.Location(title='test schedule location',
                                   street='test_street',
                                   city='test_city',
                                   postcode='000000',
                                   state='test_state',
                                   capacity=20)
        event = models.Event(title='test_event',
                             description='test',
                             event_type=Event.CONFERENCE,
                             status=Event.PUBLISHED,
                             location=location,
                             date_from=date_from,
                             date_to=date_to)

        entry = models.Schedule(start=timezone.now(), duration=10, event=event)
        self.assertTrue(entry.full_clean)

        entry = models.Schedule(start=date_from - datetime.timedelta(days=1),
                                duration=10,
                                event=event)
        self.assertRaises(ValidationError, entry.full_clean)

        entry = models.Schedule(start=date_from + datetime.timedelta(days=10),
                                duration=10,
                                event=event)
        self.assertRaises(ValidationError, entry.full_clean)
Esempio n. 2
0
 def setUp(self):
     time = timezone.now()
     location = models.Location(title='test_title',
                                street='test_street',
                                city='test_city',
                                postcode='000000',
                                state='test_state',
                                capacity=20)
     location.save()
     event = models.Event(title='test_event',
                          description='test',
                          event_type='meetup',
                          status=models.event.PUBLISHED,
                          location=location,
                          date_from=time,
                          date_to=time)
     event.save()
     self.ticket_type = models.TicketType(title='test',
                                          description='test',
                                          price=100,
                                          event=event,
                                          date_from=time,
                                          date_to=time)
     self.ticket_type.save()
     self.ticket_type_2 = models.TicketType(title='secondType',
                                            description='otherType',
                                            price=7,
                                            event=event,
                                            date_from=time,
                                            date_to=time)
     self.ticket_type_2.save()
     self.discount_code = models.DiscountCode(title='test discount',
                                              hash='test',
                                              discount=60,
                                              date_from=time,
                                              date_to=time,
                                              usage=1,
                                              ticket_type=self.ticket_type)
     self.discount_code.save()
     self.discount_code_2 = models.DiscountCode(
         title='discount_2',
         hash='otherCode',
         discount=4,
         date_from=time,
         date_to=time,
         usage=100,
         ticket_type=self.ticket_type_2)
Esempio n. 3
0
 def setUp(self):
     location = models.Location(title='test_title',
                                street='test_street',
                                city='test_city',
                                postcode='000000',
                                country='test_country',
                                capacity=20)
     location.save()
     event = models.Event(title='test_event',
                          description='test',
                          event_type='Event.meetup',
                          cfp_allowed=False,
                          status=models.event.Event.PUBLISHED,
                          location=location,
                          date_from=now,
                          date_to=later)
     event.save()
     self.ticket_type = models.TicketType(title='test',
                                          description='test',
                                          price=100,
                                          event=event,
                                          date_from=now,
                                          date_to=later)
     self.ticket_type.save()
     self.ticket_type_2 = models.TicketType(title='secondType',
                                            description='otherType',
                                            price=7,
                                            event=event,
                                            date_from=now,
                                            date_to=later)
     self.ticket_type_2.save()
     self.discount_code = models.DiscountCode(title='test discount',
                                              hash='test',
                                              discount=60,
                                              date_from=now,
                                              date_to=later,
                                              usage=1,
                                              ticket_type=self.ticket_type)
     self.discount_code.save()
     self.discount_code_2 = models.DiscountCode(
         title='discount_2',
         hash='otherCode',
         discount=4,
         usage=100,
         date_from=now,
         date_to=later,
         ticket_type=self.ticket_type_2)
Esempio n. 4
0
 def test_automatic_order_generator(self):
     time = timezone.now()
     location = models.Location(title='test_title', street='test_street', city='test_city', postcode=000000,
                                state='test_state', capacity=20)
     location.save()
     event = models.Event(title='test_event', description='test', event_type='meetup',
                          status=models.event.PUBLISHED, location=location, date_from=time, date_to=time)
     event.save()
     ticket_type = models.TicketType(title='test', description='test', price=100, event=event,
                                     date_from=timezone.now(), date_to=timezone.now())
     ticket_type.save()
     discount_code = models.DiscountCode(title='test discount', hash='test', discount=60,
                                         date_from=time, date_to=time, usage=1,
                                         ticket_type=ticket_type)
     discount_code.save()
     ticket = models.Ticket(status='requested', title='mr', first_name="test", last_name="Test", type=ticket_type,
                            email='*****@*****.**', phone='0912345678', discount_code=discount_code)
     ticket.save()
     self.assertEquals(ticket.order.status, 'awaiting_payment')
     self.assertEquals(ticket.order.price, ticket_type.price)
     self.assertEquals(ticket.order.discount, 60)
Esempio n. 5
0
 def test_string_representation(self):
     entry = models.Location(title="Test Location title")
     self.assertEqual(str(entry), entry.title)