Verified Commit 7ca74821 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Split tests and add test for save

parent ee395fe0
......@@ -99,8 +99,14 @@ class PizzaEventTestCase(TestCase):
with self.subTest(msg="two events, within 8 hours, first ended"):
self.assertEqual(second_pizzaevent, PizzaEvent.current())
def test_clean(self):
"""Check if clean method works"""
def test_validate_unique(self):
"""Check if uniqueness validation is correct"""
self.pizzaEvent.start = self.pizzaEvent.start + datetime.timedelta(
minutes=10)
with self.subTest(msg="saving works"):
self.pizzaEvent.clean()
new = PizzaEvent(
event=self.event2,
start=self.pizzaEvent.start + datetime.timedelta(minutes=10),
......@@ -110,7 +116,13 @@ class PizzaEventTestCase(TestCase):
with self.assertRaises(ValidationError):
new.clean()
new.end = timezone.now() - datetime.timedelta(hours=100)
def test_clean(self):
"""Check if clean method works"""
new = PizzaEvent(
event=self.event2,
start=self.pizzaEvent.start + datetime.timedelta(minutes=10),
end=timezone.now() - datetime.timedelta(hours=100),
)
with self.subTest(msg="end before start"):
with self.assertRaises(ValidationError):
new.clean()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment