Exemplo n.º 1
0
 def test_should_set_sync_end_time_after_posting_to_elasticsearch(self, mock_post, mock_get, mock_now, *_):
     fake_end_time = FakeDatetime.now()
     mock_now.return_value = fake_end_time
     mock_post.return_value = FakeResponse({}, status_code=HTTP_200_OK)
     mock_get.return_value = FakeResponse({}, status_code=HTTP_200_OK)
     run()
     self.assertEqual(SyncInfo.objects.last().end_time, fake_end_time)
Exemplo n.º 2
0
    def test_should_schedule_flow_to_start_at_specific_time_after_expected_date_of_delivery(self):
        with patch('eums.services.flow_scheduler.datetime') as mock_datetime:
            mock_datetime.datetime.now.return_value = FakeDatetime.now()
            mock_datetime.datetime.combine.side_effect = datetime.datetime.combine
            mock_datetime.datetime.min.time.side_effect = datetime.datetime.min.time
            mock_datetime.timedelta.side_effect = datetime.timedelta

            schedule_run_for(self.node)

            self.assertEqual(mock_celery.invoked_after, 604800.0)
Exemplo n.º 3
0
    def test_should_schedule_flow_to_start_at_specific_time_after_expected_date_of_delivery(
            self):
        with patch('eums.services.flow_scheduler.datetime') as mock_datetime:
            mock_datetime.datetime.now.return_value = FakeDatetime.now()
            mock_datetime.datetime.combine.side_effect = datetime.datetime.combine
            mock_datetime.datetime.min.time.side_effect = datetime.datetime.min.time
            mock_datetime.timedelta.side_effect = datetime.timedelta

            self.flow_scheduler.schedule_run_for(self.node)

            self.assertEqual(self.mock_celery.invoked_after, 604800.0)