def test_reasonable_required_args(self): response = _utils.create_processing_job_request( vars(self.parser.parse_args(required_args))) # Ensure all of the optional arguments have reasonable default values self.assertNotIn('VpcConfig', response['NetworkConfig']) self.assertEqual(response['Tags'], [])
def test_vpc_configuration(self): required_vpc_args = self.parser.parse_args(required_args + ['--vpc_security_group_ids', 'sg1,sg2', '--vpc_subnets', 'subnet1,subnet2']) response = _utils.create_processing_job_request(vars(required_vpc_args)) self.assertIn('VpcConfig', response['NetworkConfig']) self.assertIn('sg1', response['NetworkConfig']['VpcConfig']['SecurityGroupIds']) self.assertIn('sg2', response['NetworkConfig']['VpcConfig']['SecurityGroupIds']) self.assertIn('subnet1', response['NetworkConfig']['VpcConfig']['Subnets']) self.assertIn('subnet2', response['NetworkConfig']['VpcConfig']['Subnets'])
def test_container_entrypoint(self): entrypoint, arguments = ['/bin/bash'], ['arg1', 'arg2'] container_args = self.parser.parse_args(required_args + ['--container_entrypoint', json.dumps(entrypoint), '--container_arguments', json.dumps(arguments)]) response = _utils.create_processing_job_request(vars(container_args)) self.assertEqual(response['AppSpecification']['ContainerEntrypoint'], entrypoint) self.assertEqual(response['AppSpecification']['ContainerArguments'], arguments)
def test_environment_variables(self): env_vars = {'key1': 'val1', 'key2': 'val2'} environment_args = self.parser.parse_args( required_args + ['--environment', json.dumps(env_vars)]) response = _utils.create_processing_job_request(vars(environment_args)) self.assertEqual(response['Environment'], env_vars)
def test_tags(self): args = self.parser.parse_args(required_args + ['--tags', '{"key1": "val1", "key2": "val2"}']) response = _utils.create_processing_job_request(vars(args)) self.assertIn({'Key': 'key1', 'Value': 'val1'}, response['Tags']) self.assertIn({'Key': 'key2', 'Value': 'val2'}, response['Tags'])