예제 #1
0
    def test_should_inject_aws_credentials(self, mock_hook):
        mock_hook.return_value.get_credentials.return_value = Credentials(
            TEST_AWS_ACCESS_KEY_ID, TEST_AWS_ACCESS_SECRET, None
        )

        body = {TRANSFER_SPEC: deepcopy(SOURCE_AWS)}
        body = TransferJobPreprocessor(body=body).process_body()
        self.assertEqual(body[TRANSFER_SPEC][AWS_S3_DATA_SOURCE][AWS_ACCESS_KEY], TEST_AWS_ACCESS_KEY)
예제 #2
0
 def test_should_set_default_schedule(self):
     body = {}
     TransferJobPreprocessor(body=body, default_schedule=True).process_body()
     self.assertEqual(body, {
         SCHEDULE: {
             SCHEDULE_END_DATE: {'day': 15, 'month': 10, 'year': 2018},
             SCHEDULE_START_DATE: {'day': 15, 'month': 10, 'year': 2018}
         }
     })
예제 #3
0
 def test_should_not_change_time_for_dict(self):
     body = {SCHEDULE: {START_TIME_OF_DAY: DICT_TIME}}
     TransferJobPreprocessor(body=body).process_body()
     self.assertEqual(body[SCHEDULE][START_TIME_OF_DAY], DICT_TIME)
예제 #4
0
 def test_should_not_change_date_for_dict(self, field_attr):
     body = {SCHEDULE: {field_attr: DICT_DATE}}
     TransferJobPreprocessor(body=body).process_body()
     self.assertEqual(body[SCHEDULE][field_attr], DICT_DATE)
예제 #5
0
 def test_should_format_time_from_python_to_dict(self):
     body = {SCHEDULE: {START_TIME_OF_DAY: NATIVE_TIME}}
     TransferJobPreprocessor(body=body).process_body()
     self.assertEqual(body[SCHEDULE][START_TIME_OF_DAY], DICT_TIME)
예제 #6
0
 def test_should_format_date_from_python_to_dict(self, field_attr):
     body = {SCHEDULE: {field_attr: NATIVE_DATE}}
     TransferJobPreprocessor(body=body).process_body()
     self.assertEqual(body[SCHEDULE][field_attr], DICT_DATE)
예제 #7
0
 def test_should_do_nothing_on_empty(self):
     body = {}
     TransferJobPreprocessor(body=body).process_body()
     self.assertEqual(body, {})