diff options
-rw-r--r-- | tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -391,6 +391,7 @@ class UPS2018ParserTestCase(TestCase): def test_get_event(self): get_event = self.parser._Parser__get_event + count = Course.objects.count() event = get_event( {"start": "2018-09-21T10:00:00", "end": "2018-09-21T12:00:00", @@ -419,6 +420,9 @@ class UPS2018ParserTestCase(TestCase): self.assertEqual(event.end, timezone.make_aware( datetime.datetime(2018, 9, 21, 12, 0, 0))) + self.assertEqual(count, Course.objects.count() - 1) + count += 1 + events = [ { "text": "(10:00-12:00)<br>COURS/TD<br>Cours quelconque" @@ -505,6 +509,9 @@ class UPS2018ParserTestCase(TestCase): else: self.assertIsNone(event.notes) + self.assertEqual(count, Course.objects.count() - 1) + count += 1 + event = get_event( {"start": "2018-09-21T10:00:00", "end": "2018-09-21T12:00:00", "text": "Global Event"}, @@ -513,6 +520,7 @@ class UPS2018ParserTestCase(TestCase): timezone.make_aware(datetime.datetime(2018, 10, 1)), 2018, 38) self.assertIsNone(event) + self.assertEqual(count, Course.objects.count()) event = get_event( {"start": "2018-09-21T10:00:00", "end": "2018-09-21T12:00:00", @@ -522,6 +530,7 @@ class UPS2018ParserTestCase(TestCase): timezone.make_aware(datetime.datetime(2018, 10, 1)), 2018, 39) self.assertIsNone(event) + self.assertEqual(count, Course.objects.count()) @mock.patch("requests.get", side_effect=mock_requests_get) def test_get_events(self, *args, **kwargs): |