3 Commits

Author SHA1 Message Date
  Alban Gruin f2b114d05e fixup! tests: [WIP] on dirait que ça a amélioré des trucs 3 months ago
  Alban Gruin d28352e665 fixup! fixup! UPS2018: ajout du champ celcat_id 3 months ago
  Alban Gruin ea599562b3 fixup! tests: [WIP] on dirait que ça a amélioré des trucs 3 months ago
2 changed files with 8 additions and 4 deletions
  1. 1
    1
      management/parsers/ups2018.py
  2. 7
    3
      tests.py

+ 1
- 1
management/parsers/ups2018.py View File

@@ -114,7 +114,7 @@ class Parser(AbstractParser):
114 114
             return
115 115
 
116 116
         course = Course.objects.create(
117
-            source=self.source, begin=begin, end=end, celcat_id=event["id"]
117
+            source=self.source, begin=begin, end=end, celcat_id=int(event["id"])
118 118
         )
119 119
 
120 120
         min_i = 0

+ 7
- 3
tests.py View File

@@ -1,4 +1,4 @@
1
-#    Copyright (C) 2017-2018  Alban Gruin
1
+#    Copyright (C) 2017-2019  Alban Gruin
2 2
 #
3 3
 #    celcatsanitizer is free software: you can redistribute it and/or modify
4 4
 #    it under the terms of the GNU Affero General Public License as published
@@ -562,11 +562,13 @@ class UPS2018ParserTestCase(TestCase):
562 562
             {"begin":
563 563
              timezone.make_aware(datetime.datetime(2018, 9, 21, 10, 00, 00)),
564 564
              "end":
565
-             timezone.make_aware(datetime.datetime(2018, 9, 21, 12, 00, 00))},
565
+             timezone.make_aware(datetime.datetime(2018, 9, 21, 12, 00, 00)),
566
+             "id": 0},
566 567
             {"begin":
567 568
              timezone.make_aware(datetime.datetime(2018, 10, 22, 10, 00, 00)),
568 569
              "end":
569
-             timezone.make_aware(datetime.datetime(2018, 10, 22, 12, 00, 00))}
570
+             timezone.make_aware(datetime.datetime(2018, 10, 22, 12, 00, 00)),
571
+             "id": 2}
570 572
         ]
571 573
 
572 574
         for i, course in enumerate(self.parser.get_events(
@@ -580,6 +582,8 @@ class UPS2018ParserTestCase(TestCase):
580 582
             self.assertIsNone(course.notes)
581 583
             self.assertEqual(course.begin, courses[i]["begin"])
582 584
             self.assertEqual(course.end, courses[i]["end"])
585
+            self.assertEqual(course.celcat_id, courses[i]["id"])
586
+            self.assertEqual(course.module, None)
583 587
 
584 588
         self.assertEqual(i, len(courses) - 1)
585 589