Exemple #1
0
 def test_save(self):
     event_to_save = Mock(date=datetime.today().date().isoformat())
     events_in_memory_repo = EventsInMemoryRepo()
     events_in_memory_repo.save(event_to_save)
     events_result = events_in_memory_repo.find_all()
     self.assertEqual(len(events_result.events), 9)
     events_result = events_in_memory_repo.get_from_date(datetime.today()\
                                                         .date().isoformat())
     self.assertEqual(len(events_result.events), 1)
 def test_save(self):
     event_to_save = Event(uuid='asdf', \
         date=datetime.today().date().isoformat(), \
         time=datetime.today().time().isoformat('seconds'), \
         event_type='entrada')
     events_in_memory_repo = EventsInMemoryRepo()
     saved = events_in_memory_repo.save(event_to_save)
     self.assertTrue(saved)
     events_results = events_in_memory_repo.find_all()
     self.assertEqual(len(events_results.events), 9)
     events = events_in_memory_repo.get_from_date(datetime.today().date()\
                                                  .isoformat())
     self.assertEqual(len(events.events), 1)
     event = events.events[0]
     self.assertEqual(event, event_to_save)
 def test_find_all(self):
     events_in_memory_repo = EventsInMemoryRepo()
     events_result = events_in_memory_repo.find_all()
     self.assertEqual(len(events_result.events), 8)
Exemple #4
0
 def test_find_all(self, events_mock, event_mock):
     events_in_memory_repo = EventsInMemoryRepo()
     events_in_memory_repo.find_all()
     self.assertEqual(event_mock.call_count, 8)
     args, kwargs = events_mock.call_args
     self.assertEqual(len(args[0]), 8)