def test_parse_user_data_missing_variable(self): """Test parse user data missing variable.""" with self.assertRaises(MissingVariable): variables = { "name": "tom", } raw_user_data = "name: ${name}, last: $last and $$" blueprint_name = "test" parse_user_data(variables, raw_user_data, blueprint_name)
def test_parse_user_data_missing_variable(self): """Test parse user data missing variable.""" variables = { 'name': 'tom', } raw_user_data = 'name: ${name}, last: $last and $$' blueprint_name = 'test' with self.assertRaises(MissingVariable): parse_user_data(variables, raw_user_data, blueprint_name)
def test_parse_user_data(self): """Test parse user data.""" expected = "name: tom, last: taubkin and $" variables = {"name": "tom", "last": "taubkin"} raw_user_data = "name: ${name}, last: $last and $$" blueprint_name = "test" res = parse_user_data(variables, raw_user_data, blueprint_name) self.assertEqual(res, expected)
def test_parse_user_data(self): """Test parse user data.""" expected = 'name: tom, last: taubkin and $' variables = {'name': 'tom', 'last': 'taubkin'} raw_user_data = 'name: ${name}, last: $last and $$' blueprint_name = 'test' res = parse_user_data(variables, raw_user_data, blueprint_name) self.assertEqual(res, expected)
def test_parse_user_data() -> None: """Test parse_user_data.""" assert ( parse_user_data( {"name": CFNParameter("name", "tom"), "last": "smith"}, "name: ${name}, last: $last and $$", "test", ) == "name: tom, last: smith and $" )
def test_parse_user_data_invalid_placeholder(self): """Test parse user data invalid placeholder.""" with self.assertRaises(InvalidUserdataPlaceholder): raw_user_data = "$100" blueprint_name = "test" parse_user_data({}, raw_user_data, blueprint_name)
def test_parse_user_data_raise_missing_variable() -> None: """Test parse_user_data.""" with pytest.raises(MissingVariable): parse_user_data({"name": "tom"}, "name: ${name}, last: $last and $$", "test")
def test_parse_user_data_raise_invalid_placeholder() -> None: """Test parse_user_data.""" with pytest.raises(InvalidUserdataPlaceholder): parse_user_data({}, "$100", "test")
def test_parse_user_data_invalid_placeholder(self): """Test parse user data invalid placeholder.""" raw_user_data = '$100' blueprint_name = 'test' with self.assertRaises(InvalidUserdataPlaceholder): parse_user_data({}, raw_user_data, blueprint_name)