From b2d7e09a10629b70879d688b493460a52d954a42 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 14 Aug 2015 21:30:06 +0200 Subject: [PATCH] Fixed two failing tests --- doc/development/api/restriction.rst | 2 ++ src/pretix/plugins/timerestriction/signals.py | 2 ++ src/tests/plugins/test_timerestriction.py | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/development/api/restriction.rst b/doc/development/api/restriction.rst index c45894b9e..d634c65be 100644 --- a/doc/development/api/restriction.rst +++ b/doc/development/api/restriction.rst @@ -163,6 +163,8 @@ In our example, the implementation could look like this:: var_restrictions.append(restriction) if not var_restrictions: + v['available'] = True + v['price'] = None continue # If this point is reached, there ARE time restrictions for this item diff --git a/src/pretix/plugins/timerestriction/signals.py b/src/pretix/plugins/timerestriction/signals.py index 5edbbeaae..af850b4bf 100644 --- a/src/pretix/plugins/timerestriction/signals.py +++ b/src/pretix/plugins/timerestriction/signals.py @@ -67,6 +67,8 @@ def availability_handler(sender, **kwargs): var_restrictions.append(restriction) if not var_restrictions: + v['available'] = True + v['price'] = None continue # If this point is reached, there ARE time restrictions for this item diff --git a/src/tests/plugins/test_timerestriction.py b/src/tests/plugins/test_timerestriction.py index d1706e124..60ca16bef 100644 --- a/src/tests/plugins/test_timerestriction.py +++ b/src/tests/plugins/test_timerestriction.py @@ -239,7 +239,7 @@ class TimeRestrictionTest(TestCase): self.assertTrue(v['available']) self.assertEqual(v['price'], 12) else: - self.assertFalse(v['available']) + self.assertTrue(v['available']) def test_variation_specifics(self): self.item.properties.add(self.property) @@ -281,5 +281,7 @@ class TimeRestrictionTest(TestCase): if 'variation' in v and v['variation'].pk == self.variation1.pk: self.assertTrue(v['available']) self.assertEqual(v['price'], 8) - else: + elif 'variation' in v and v['variation'].pk == self.variation3.pk: self.assertFalse(v['available']) + else: + self.assertTrue(v['available'])