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)
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))
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)
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)
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))
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)
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)
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)
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)
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)