@@ -22,6 +22,7 @@ def rule():
22
22
"Resources" : {
23
23
"MyBucket" : {"Type" : "AWS::S3::Bucket" },
24
24
"MyCodePipeline" : {"Type" : "AWS::CodePipeline::Pipeline" },
25
+ "DocDBCluster" : {"Type" : "AWS::DocDB::DBCluster" },
25
26
},
26
27
"Parameters" : {
27
28
"MyResourceParameter" : {"Type" : "String" , "Default" : "MyBucket" },
@@ -92,7 +93,10 @@ def validate(self, validator, s, instance, schema):
92
93
{},
93
94
[
94
95
ValidationError (
95
- "'Foo' is not one of ['MyBucket', 'MyCodePipeline']" ,
96
+ (
97
+ "'Foo' is not one of ['MyBucket', "
98
+ "'MyCodePipeline', 'DocDBCluster']"
99
+ ),
96
100
path = deque (["Fn::GetAtt" , 0 ]),
97
101
schema_path = deque (["enum" ]),
98
102
validator = "fn_getatt" ,
@@ -152,6 +156,14 @@ def validate(self, validator, s, instance, schema):
152
156
{},
153
157
[],
154
158
),
159
+ (
160
+ "Valid GetAtt with exception type" ,
161
+ {"Fn::GetAtt" : "DocDBCluster.Port" },
162
+ {"type" : ["string" ]},
163
+ _template ,
164
+ {},
165
+ [],
166
+ ),
155
167
# (
156
168
# "Invalid GetAtt with integer to string",
157
169
# {"Fn::GetAtt": "MyCodePipeline.Version"},
@@ -224,7 +236,8 @@ def validate(self, validator, s, instance, schema):
224
236
[
225
237
ValidationError (
226
238
(
227
- "'Arn' is not one of ['MyBucket', 'MyCodePipeline'] when "
239
+ "'Arn' is not one of ['MyBucket', "
240
+ "'MyCodePipeline', 'DocDBCluster'] when "
228
241
"{'Ref': 'MyAttributeParameter'} is resolved"
229
242
),
230
243
path = deque (["Fn::GetAtt" , 0 ]),
@@ -248,9 +261,7 @@ def validate(self, validator, s, instance, schema):
248
261
],
249
262
indirect = ["template" ],
250
263
)
251
- def test_validate (
252
- name , instance , schema , template , child_rules , expected , validator , rule
253
- ):
264
+ def test_validate (name , instance , schema , child_rules , expected , validator , rule ):
254
265
rule .child_rules = child_rules
255
266
errs = list (rule .fn_getatt (validator , schema , instance , {}))
256
267
0 commit comments