def test_mk_vpc_config_missing_security_groups(self, prj): prj.train["vpc_config"] = {"subnets": ["a"]} with pytest.raises(ConfigError) as err: cli_utils.mk_vpc_config(prj.train) assert str(err.value) == ( "The vpc_config requires a dictionary with keys 'security_groups' and" " 'subnets'. Both the security_groups and subnets should contain lists" " of IDs.")
def test_mk_vpc_config_no_config(self, prj): assert cli_utils.mk_vpc_config(prj.train) is None assert cli_utils.mk_vpc_config(prj.deploy) is None
def test_mk_vpc_config_valid_config(self, prj): prj.train["vpc_config"] = {"security_groups": ["a"], "subnets": ["b"]} assert cli_utils.mk_vpc_config(prj.train) == { "SecurityGroupIds": ["a"], "Subnets": ["b"], }
def test_mk_vpc_config_empty_subnets(self, prj): prj.train["vpc_config"] = {"security_groups": ["a"], "subnets": []} with pytest.raises(ConfigError) as err: cli_utils.mk_vpc_config(prj.train) assert str(err.value) == ( "The vpc_config must contain at least one subnet id.")