コード例 #1
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_id_refs(
            input, self.supported_resource_id_refs)

        self.assertEqual(expected, output)
コード例 #2
0
    def test_return_value_if_cannot_handle(self, can_handle_mock):
        input = {"Fn::GetAtt": ["id1", "Arn"]}
        expected = {"Fn::GetAtt": ["id1", "Arn"]}

        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_id_refs(input,
                                            self.supported_resource_id_refs))
コード例 #3
0
    def test_must_resolve_refs_with_many_attributes(self):
        input = {"Fn::GetAtt": ["id1", "Arn1", "Arn2", "Arn3"]}

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

        getatt = GetAttAction()
        output = getatt.resolve_resource_id_refs(
            input, self.supported_resource_id_refs)

        self.assertEqual(expected, output)
コード例 #4
0
    def test_must_resolve_simple_refs(self):
        input = {"Fn::GetAtt": ["id1", "Arn"]}

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

        getatt = GetAttAction()
        output = getatt.resolve_resource_id_refs(
            input, self.supported_resource_id_refs)

        self.assertEquals(expected, output)
コード例 #5
0
    def test_return_value_if_cannot_handle(self, can_handle_mock):
        input = {
            "Fn::GetAtt": ["id1", "Arn"]
        }
        expected = {
            "Fn::GetAtt": ["id1", "Arn"]
        }

        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_id_refs(input, self.supported_resource_id_refs))
コード例 #6
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_id_refs(input, self.supported_resource_id_refs)

        self.assertEqual(expected, output)
コード例 #7
0
    def test_must_resolve_refs_with_many_attributes(self):
        input = {
            "Fn::GetAtt": ["id1", "Arn1", "Arn2", "Arn3"]
        }

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

        getatt = GetAttAction()
        output = getatt.resolve_resource_id_refs(input, self.supported_resource_id_refs)

        self.assertEqual(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_id_refs(
            input, self.supported_resource_id_refs)

        self.assertEqual(expected, output)
コード例 #9
0
    def test_must_resolve_simple_refs(self):
        input = {
            "Fn::GetAtt": ["id1", "Arn"]
        }

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

        getatt = GetAttAction()
        output = getatt.resolve_resource_id_refs(input, self.supported_resource_id_refs)

        self.assertEquals(expected, output)
コード例 #10
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_id_refs(input, self.supported_resource_id_refs)

        self.assertEqual(expected, output)