Esempio n. 1
0
    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)
Esempio n. 2
0
    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)
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)
Esempio n. 5
0
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 $"
    )
Esempio n. 6
0
 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)
Esempio n. 7
0
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")
Esempio n. 8
0
def test_parse_user_data_raise_invalid_placeholder() -> None:
    """Test parse_user_data."""
    with pytest.raises(InvalidUserdataPlaceholder):
        parse_user_data({}, "$100", "test")
Esempio n. 9
0
 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)