@@ -646,6 +646,71 @@ def test_function_concurrency(self):
646
646
647
647
testutil .delete_lambda_function (name = function_name )
648
648
649
+ def test_function_code_singing_config (self ):
650
+ lambda_client = aws_stack .connect_to_service ('lambda' )
651
+ function_name = 'lambda_func-{}' .format (short_uid ())
652
+
653
+ testutil .create_lambda_function (
654
+ handler_file = TEST_LAMBDA_ECHO_FILE ,
655
+ func_name = function_name ,
656
+ runtime = LAMBDA_RUNTIME_PYTHON36
657
+ )
658
+
659
+ response = lambda_client .create_code_signing_config (
660
+ Description = 'Testing CodeSigning Config' ,
661
+ AllowedPublishers = {
662
+ 'SigningProfileVersionArns' : [
663
+ 'arn:aws:signer:us-east-1:000000000000:/signing-profiles/test' ,
664
+ ]
665
+ },
666
+ CodeSigningPolicies = {
667
+ 'UntrustedArtifactOnDeployment' : 'Enforce'
668
+ }
669
+ )
670
+
671
+ self .assertIn ('Description' , response ['CodeSigningConfig' ])
672
+ self .assertIn ('SigningProfileVersionArns' , response ['CodeSigningConfig' ]['AllowedPublishers' ])
673
+ self .assertIn ('UntrustedArtifactOnDeployment' , response ['CodeSigningConfig' ]['CodeSigningPolicies' ])
674
+
675
+ code_signing_arn = response ['CodeSigningConfig' ]['CodeSigningConfigArn' ]
676
+ response = lambda_client .update_code_signing_config (
677
+ CodeSigningConfigArn = code_signing_arn ,
678
+ CodeSigningPolicies = {
679
+ 'UntrustedArtifactOnDeployment' : 'Warn'
680
+ }
681
+ )
682
+
683
+ self .assertEqual (response ['CodeSigningConfig' ]['CodeSigningPolicies' ]['UntrustedArtifactOnDeployment' ], 'Warn' )
684
+ response = lambda_client .get_code_signing_config (
685
+ CodeSigningConfigArn = code_signing_arn
686
+ )
687
+ self .assertEqual (response ['ResponseMetadata' ]['HTTPStatusCode' ], 200 )
688
+
689
+ response = lambda_client .put_function_code_signing_config (
690
+ CodeSigningConfigArn = code_signing_arn ,
691
+ FunctionName = function_name
692
+ )
693
+ self .assertEqual (response ['ResponseMetadata' ]['HTTPStatusCode' ], 200 )
694
+
695
+ response = lambda_client .get_function_code_signing_config (
696
+ FunctionName = function_name
697
+ )
698
+ self .assertEqual (response ['ResponseMetadata' ]['HTTPStatusCode' ], 200 )
699
+ self .assertEqual (response ['CodeSigningConfigArn' ], code_signing_arn )
700
+ self .assertEqual (response ['FunctionName' ], function_name )
701
+
702
+ response = lambda_client .delete_function_code_signing_config (
703
+ FunctionName = function_name
704
+ )
705
+ self .assertEqual (response ['ResponseMetadata' ]['HTTPStatusCode' ], 204 )
706
+
707
+ response = lambda_client .delete_code_signing_config (
708
+ CodeSigningConfigArn = code_signing_arn
709
+ )
710
+ self .assertEqual (response ['ResponseMetadata' ]['HTTPStatusCode' ], 204 )
711
+
712
+ testutil .delete_lambda_function (name = function_name )
713
+
649
714
650
715
class TestPythonRuntimes (LambdaTestBase ):
651
716
@classmethod
0 commit comments