Пример #1
0
 def test_unknown_event_type(self):
     e1 = {
         'event_type': 'unknown_event',
         'id': bson.ObjectId(),
     }
     with self.assertRaises(eduid_userdb.exceptions.BadEvent) as cm:
         EventList([e1])
     exc = cm.exception
     self.assertIn('Unknown event_type', exc.reason)
Пример #2
0
 def test_parse_cycle(self):
     """
     Tests that we output something we parsed back into the same thing we output.
     """
     for this in [self.one, self.two, self.three]:
         this_dict = this.to_list_of_dicts(mixed_format=True)
         eventlist_again = EventList(this_dict)
         self.assertEqual(
             eventlist_again.to_list_of_dicts(mixed_format=True),
             this.to_list_of_dicts(mixed_format=True))
Пример #3
0
 def setUp(self):
     self.empty = EventList([])
     self.one = EventList([_one_dict])
     self.two = EventList([_one_dict, _two_dict])
     self.three = EventList([_one_dict, _two_dict, _three_dict])
Пример #4
0
 def test_add_event(self):
     third = self.three.to_list()[-1]
     this = EventList([_one_dict, _two_dict, third])
     self.assertEqual(this.to_list_of_dicts(),
                      self.three.to_list_of_dicts())
Пример #5
0
 def test_init_bad_data(self):
     with self.assertRaises(eduid_userdb.element.UserDBValueError):
         EventList('bad input data')