@@ -1014,6 +1014,100 @@ def test_copy_artifact_uris_for_type_glue_job_dotted_path(self):
10141014 # Sibling keys preserved
10151015 self .assertEqual (original_props ["Command" ]["Name" ], "glueetl" )
10161016
1017+ def test_copy_artifact_uris_for_type_serverless_application (self ):
1018+ """Regression for #9005: Location URI must be copied for AWS::Serverless::Application."""
1019+ original_props = {"Location" : "./PublisherApi/template.yaml" }
1020+ exported_props = {"Location" : "https://s3.amazonaws.com/bucket/abc123.template" }
1021+ self .assertTrue (_copy_artifact_uris_for_type (
1022+ original_props , exported_props , "AWS::Serverless::Application"
1023+ ))
1024+ self .assertEqual (original_props ["Location" ], "https://s3.amazonaws.com/bucket/abc123.template" )
1025+
1026+ def test_copy_artifact_uris_for_type_cloudformation_stack (self ):
1027+ """TemplateURL must be copied for AWS::CloudFormation::Stack."""
1028+ original_props = {"TemplateURL" : "./child/template.yaml" }
1029+ exported_props = {"TemplateURL" : "https://s3.amazonaws.com/bucket/xyz789.template" }
1030+ self .assertTrue (_copy_artifact_uris_for_type (
1031+ original_props , exported_props , "AWS::CloudFormation::Stack"
1032+ ))
1033+ self .assertEqual (original_props ["TemplateURL" ], "https://s3.amazonaws.com/bucket/xyz789.template" )
1034+
1035+ def test_copy_artifact_uris_for_type_cloudformation_stackset (self ):
1036+ original_props = {"TemplateURL" : "./child.yaml" }
1037+ exported_props = {"TemplateURL" : "https://s3.amazonaws.com/b/k.template" }
1038+ self .assertTrue (_copy_artifact_uris_for_type (
1039+ original_props , exported_props , "AWS::CloudFormation::StackSet"
1040+ ))
1041+ self .assertEqual (original_props ["TemplateURL" ], "https://s3.amazonaws.com/b/k.template" )
1042+
1043+ def test_copy_artifact_uris_for_type_eb_application_version (self ):
1044+ original_props = {"SourceBundle" : "./bundle.zip" }
1045+ exported_props = {"SourceBundle" : {"S3Bucket" : "b" , "S3Key" : "k" }}
1046+ self .assertTrue (_copy_artifact_uris_for_type (
1047+ original_props , exported_props , "AWS::ElasticBeanstalk::ApplicationVersion"
1048+ ))
1049+ self .assertEqual (original_props ["SourceBundle" ], {"S3Bucket" : "b" , "S3Key" : "k" })
1050+
1051+ def test_copy_artifact_uris_for_type_appsync_graphql_schema (self ):
1052+ original_props = {"DefinitionS3Location" : "./schema.graphql" }
1053+ exported_props = {"DefinitionS3Location" : "s3://b/schema.graphql" }
1054+ self .assertTrue (_copy_artifact_uris_for_type (
1055+ original_props , exported_props , "AWS::AppSync::GraphQLSchema"
1056+ ))
1057+ self .assertEqual (original_props ["DefinitionS3Location" ], "s3://b/schema.graphql" )
1058+
1059+ def test_copy_artifact_uris_for_type_appsync_resolver_all_three (self ):
1060+ original_props = {
1061+ "RequestMappingTemplateS3Location" : "./req.vtl" ,
1062+ "ResponseMappingTemplateS3Location" : "./res.vtl" ,
1063+ "CodeS3Location" : "./code.js" ,
1064+ }
1065+ exported_props = {
1066+ "RequestMappingTemplateS3Location" : "s3://b/req.vtl" ,
1067+ "ResponseMappingTemplateS3Location" : "s3://b/res.vtl" ,
1068+ "CodeS3Location" : "s3://b/code.js" ,
1069+ }
1070+ self .assertTrue (_copy_artifact_uris_for_type (
1071+ original_props , exported_props , "AWS::AppSync::Resolver"
1072+ ))
1073+ self .assertEqual (original_props ["RequestMappingTemplateS3Location" ], "s3://b/req.vtl" )
1074+ self .assertEqual (original_props ["ResponseMappingTemplateS3Location" ], "s3://b/res.vtl" )
1075+ self .assertEqual (original_props ["CodeS3Location" ], "s3://b/code.js" )
1076+
1077+ def test_copy_artifact_uris_for_type_appsync_function_configuration (self ):
1078+ original_props = {"CodeS3Location" : "./code.js" }
1079+ exported_props = {"CodeS3Location" : "s3://b/code.js" }
1080+ self .assertTrue (_copy_artifact_uris_for_type (
1081+ original_props , exported_props , "AWS::AppSync::FunctionConfiguration"
1082+ ))
1083+ self .assertEqual (original_props ["CodeS3Location" ], "s3://b/code.js" )
1084+
1085+ def test_copy_artifact_uris_for_type_cloudformation_module_version (self ):
1086+ original_props = {"ModulePackage" : "./module.zip" }
1087+ exported_props = {"ModulePackage" : "s3://b/module.zip" }
1088+ self .assertTrue (_copy_artifact_uris_for_type (
1089+ original_props , exported_props , "AWS::CloudFormation::ModuleVersion"
1090+ ))
1091+ self .assertEqual (original_props ["ModulePackage" ], "s3://b/module.zip" )
1092+
1093+ def test_copy_artifact_uris_for_type_cloudformation_resource_version (self ):
1094+ original_props = {"SchemaHandlerPackage" : "./pkg.zip" }
1095+ exported_props = {"SchemaHandlerPackage" : "s3://b/pkg.zip" }
1096+ self .assertTrue (_copy_artifact_uris_for_type (
1097+ original_props , exported_props , "AWS::CloudFormation::ResourceVersion"
1098+ ))
1099+ self .assertEqual (original_props ["SchemaHandlerPackage" ], "s3://b/pkg.zip" )
1100+
1101+ def test_copy_artifact_uris_for_type_lambda_function_image_dotted (self ):
1102+ # AWS::Lambda::Function has both Code and Code.ImageUri (dotted path)
1103+ original_props = {"Code" : {"ImageUri" : "local-tag:latest" }}
1104+ exported_props = {"Code" : {"ImageUri" : "111.dkr.ecr.us-east-1.amazonaws.com/r:tag" }}
1105+ self .assertTrue (_copy_artifact_uris_for_type (
1106+ original_props , exported_props , "AWS::Lambda::Function"
1107+ ))
1108+ self .assertEqual (original_props ["Code" ]["ImageUri" ],
1109+ "111.dkr.ecr.us-east-1.amazonaws.com/r:tag" )
1110+
10171111
10181112class TestPackageContextMappingsIntegration (TestCase ):
10191113 """Test cases for the complete Mappings transformation integration in _export()"""
0 commit comments