mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
Add tests for Events
This commit is contained in:
committed by
Raphael Michel
parent
5ea35aa76f
commit
142750f8c2
@@ -576,6 +576,32 @@ class ItemTest(TestCase):
|
||||
assert not i.is_available()
|
||||
|
||||
|
||||
class EventTest(TestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
cls.organizer = Organizer.objects.create(name='Dummy', slug='dummy')
|
||||
|
||||
def test_event_end_before_start(self):
|
||||
event = Event(
|
||||
organizer=self.organizer, name='Dummy', slug='dummy',
|
||||
date_from=now(), date_to=now() - timedelta(hours=1)
|
||||
)
|
||||
with self.assertRaises(ValidationError) as context:
|
||||
event.clean()
|
||||
|
||||
self.assertIn('date_to', str(context.exception))
|
||||
|
||||
def test_presale_end_before_start(self):
|
||||
event = Event(
|
||||
organizer=self.organizer, name='Dummy', slug='dummy',
|
||||
presale_start=now(), presale_end=now() - timedelta(hours=1)
|
||||
)
|
||||
with self.assertRaises(ValidationError) as context:
|
||||
event.clean()
|
||||
|
||||
self.assertIn('presale_end', str(context.exception))
|
||||
|
||||
|
||||
class CachedFileTestCase(TestCase):
|
||||
def test_file_handling(self):
|
||||
cf = CachedFile()
|
||||
|
||||
Reference in New Issue
Block a user