예제 #1
0
    def test_return_value_if_cannot_handle(self, can_handle_mock):
        input = {"Fn::GetAtt": ["id1", "prop1"]}
        expected = {"Fn::GetAtt": ["id1", "prop1"]}

        getatt = GetAttAction()
        can_handle_mock.return_value = False  # Simulate failure to handle the input. Result should be same as input
        self.assertEqual(
            expected,
            getatt.resolve_resource_refs(input, self.supported_resource_refs))
예제 #2
0
    def test_must_ignore_missing_properties_with_dot_before(self):
        input = {"Fn::GetAtt": [".id1", "foo"]}
        expected = {"Fn::GetAtt": [".id1", "foo"]}

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input,
                                              self.supported_resource_refs)

        self.assertEqual(expected, output)
예제 #3
0
    def test_must_resolve_simple_refs(self):
        input = {"Fn::GetAtt": ["id1.prop1", "Arn"]}

        expected = {"Fn::GetAtt": ["value1", "Arn"]}

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input,
                                              self.supported_resource_refs)

        self.assertEquals(expected, output)
예제 #4
0
    def test_must_resolve_refs_with_many_attributes(self):
        input = {"Fn::GetAtt": ["id1.prop1", "Arn1", "Arn2", "Arn3"]}

        expected = {"Fn::GetAtt": ["value1", "Arn1", "Arn2", "Arn3"]}

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input,
                                              self.supported_resource_refs)

        self.assertEqual(expected, output)
    def test_return_value_if_cannot_handle(self, can_handle_mock):
        input = {
            "Fn::GetAtt": ["id1", "prop1"]
        }
        expected = {
            "Fn::GetAtt": ["id1", "prop1"]
        }

        getatt = GetAttAction()
        can_handle_mock.return_value = False # Simulate failure to handle the input. Result should be same as input
        self.assertEqual(expected, getatt.resolve_resource_refs(input, self.supported_resource_refs))
    def test_must_ignore_missing_properties_with_dot_before(self):
        input = {
            "Fn::GetAtt": [".id1", "foo"]
        }
        expected = {
            "Fn::GetAtt": [".id1", "foo"]
        }

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input, self.supported_resource_refs)

        self.assertEqual(expected, output)
    def test_must_resolve_simple_refs(self):
        input = {
            "Fn::GetAtt": ["id1.prop1", "Arn"]
        }

        expected = {
            "Fn::GetAtt": ["value1", "Arn"]
        }

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input, self.supported_resource_refs)

        self.assertEquals(expected, output)
예제 #8
0
    def test_must_ignore_invalid_value_array(self):
        input = {
            # No actual attributes
            "Fn::GetAtt": ["id1"]
        }

        expected = {"Fn::GetAtt": ["id1"]}

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input,
                                              self.supported_resource_refs)

        self.assertEqual(expected, output)
    def test_must_resolve_refs_with_many_attributes(self):
        input = {
            "Fn::GetAtt": ["id1.prop1", "Arn1", "Arn2", "Arn3"]
        }

        expected = {
            "Fn::GetAtt": ["value1", "Arn1", "Arn2", "Arn3"]
        }

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input, self.supported_resource_refs)

        self.assertEqual(expected, output)
예제 #10
0
    def test_must_ignore_refs_without_attributes_in_concatenated_form(self):
        input = {
            # No actual attributes. with just only one entry in array, the value never gets resolved
            "Fn::GetAtt": ["id1.prop1"]
        }

        expected = {"Fn::GetAtt": ["id1.prop1"]}

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input,
                                              self.supported_resource_refs)

        self.assertEqual(expected, output)
예제 #11
0
    def test_must_ignore_refs_without_attributes(self):
        input = {
            # No actual attributes. But since we have two entries in the array, we try to resolve them
            "Fn::GetAtt": ["id1", "prop1"]
        }

        expected = {"Fn::GetAtt": ["value1"]}

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input,
                                              self.supported_resource_refs)

        self.assertEqual(expected, output)
예제 #12
0
    def test_must_resolve_with_splitted_resource_refs(self):
        input = {
            # Reference to resource `id1.prop1` is split into different elements
            "Fn::GetAtt": ["id1", "prop1", "Arn1", "Arn2", "Arn3"]
        }

        expected = {"Fn::GetAtt": ["value1", "Arn1", "Arn2", "Arn3"]}

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input,
                                              self.supported_resource_refs)

        self.assertEqual(expected, output)
    def test_must_ignore_invalid_value_type(self):
        input = {
            # No actual attributes
            "Fn::GetAtt": {"a": "b"}
        }

        expected = {
            "Fn::GetAtt": {"a": "b"}
        }

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input, self.supported_resource_refs)

        self.assertEqual(expected, output)
    def test_must_ignore_refs_without_attributes_in_concatenated_form(self):
        input = {
            # No actual attributes. with just only one entry in array, the value never gets resolved
            "Fn::GetAtt": ["id1.prop1"]
        }

        expected = {
            "Fn::GetAtt": ["id1.prop1"]
        }

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input, self.supported_resource_refs)

        self.assertEqual(expected, output)
    def test_must_ignore_refs_without_attributes(self):
        input = {
            # No actual attributes. But since we have two entries in the array, we try to resolve them
            "Fn::GetAtt": ["id1", "prop1"]
        }

        expected = {
            "Fn::GetAtt": ["value1"]
        }

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input, self.supported_resource_refs)

        self.assertEqual(expected, output)
    def test_must_resolve_with_splitted_resource_refs(self):
        input = {
            # Reference to resource `id1.prop1` is split into different elements
            "Fn::GetAtt": ["id1", "prop1", "Arn1", "Arn2", "Arn3"]
        }

        expected = {
            "Fn::GetAtt": ["value1", "Arn1", "Arn2", "Arn3"]
        }

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input, self.supported_resource_refs)

        self.assertEqual(expected, output)
    def test_must_ignore_invalid_value_array(self):
        input = {
            # No actual attributes
            "Fn::GetAtt": ["id1"]
        }

        expected = {
            "Fn::GetAtt": ["id1"]
        }

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input, self.supported_resource_refs)

        self.assertEquals(expected, output)
예제 #18
0
    def test_must_ignore_invalid_value_type(self):
        input = {
            # No actual attributes
            "Fn::GetAtt": {
                "a": "b"
            }
        }

        expected = {"Fn::GetAtt": {"a": "b"}}

        getatt = GetAttAction()
        output = getatt.resolve_resource_refs(input,
                                              self.supported_resource_refs)

        self.assertEquals(expected, output)