Пример #1
0
 def test_get_from_today_with_in_memory_repo(self):
     event_to_save = Event('asdf', datetime.today().date().isoformat(), \
         datetime.today().time().isoformat('seconds'), 'entrada')
     event_in_memory_repo = EventsInMemoryRepo()
     event_in_memory_repo.save(event_to_save)
     events_repo = EventsRepo(event_in_memory_repo)
     events = events_repo.get_from_today()
     self.assertListEqual(events.events, [event_to_save])
Пример #2
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)
Пример #3
0
 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)