def _prepare_environment(self, func_details): # setup environment pre-defined variables for docker environment result = func_details.envvars.copy() # injecting aws credentials into docker environment if not provided aws_stack.inject_test_credentials_into_env(result) # injecting the region into the docker environment aws_stack.inject_region_into_env(result, func_details.region()) return result
def test_inject_region_into_env_already_with_region_overwrites_it(): env = {"AWS_REGION": "another-region"} region = "a-test-region" inject_region_into_env(env, region) assert env.get("AWS_REGION") == region
def test_inject_region_into_env_already_with_none_adds_region(): env = {} region = "a-test-region" inject_region_into_env(env, region) assert env.get("AWS_REGION") == region