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)
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} } })
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)
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)
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)
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)
def test_should_do_nothing_on_empty(self): body = {} TransferJobPreprocessor(body=body).process_body() self.assertEqual(body, {})