@@ -593,3 +593,69 @@ def test_exclude_actions_from_crud_output(self):
593
593
]
594
594
}
595
595
self .assertDictEqual (results , expected_result )
596
+
597
+
598
+ def test_exclude_actions_empty_sid_from_crud_output (self ):
599
+ sid_group = SidGroup ()
600
+ crud_with_exclude_actions_empty_sid = os .path .abspath (
601
+ os .path .join (
602
+ os .path .dirname (__file__ ),
603
+ os .path .pardir ,
604
+ os .path .pardir ,
605
+ "examples" ,
606
+ "yml" ,
607
+ "crud-with-exclude-actions-empty-sid.yml" ,
608
+ )
609
+ )
610
+
611
+ with open (crud_with_exclude_actions_empty_sid , "r" ) as this_yaml_file :
612
+ crud_with_exclude_actions_empty_sid_cfg = yaml .safe_load (this_yaml_file )
613
+ # crud_with_exclude_actions_empty_sid_cfg = {
614
+ # "mode": "crud",
615
+ # "write": [
616
+ # "arn:aws:s3:::test"
617
+ # ],
618
+ # "exclude-actions": [
619
+ # "iam:Pass*"
620
+ # ]
621
+ # }
622
+
623
+ # print(json.dumps(crud_with_exclude_actions_empty_sid_cfg, indent=4))
624
+ sid_group .process_template (crud_with_exclude_actions_empty_sid_cfg )
625
+ result = sid_group .get_rendered_policy (crud_with_exclude_actions_empty_sid_cfg )
626
+ # print(json.dumps(result, indent=4))
627
+ expected_result = {
628
+ "Version" : "2012-10-17" ,
629
+ "Statement" : [
630
+ {
631
+ "Sid" : "S3WriteBucket" ,
632
+ "Effect" : "Allow" ,
633
+ "Action" : [
634
+ "s3:CreateBucket" ,
635
+ "s3:DeleteBucket" ,
636
+ "s3:DeleteBucketOwnershipControls" ,
637
+ "s3:DeleteBucketWebsite" ,
638
+ "s3:PutAccelerateConfiguration" ,
639
+ "s3:PutAnalyticsConfiguration" ,
640
+ "s3:PutBucketCORS" ,
641
+ "s3:PutBucketLogging" ,
642
+ "s3:PutBucketNotification" ,
643
+ "s3:PutBucketObjectLockConfiguration" ,
644
+ "s3:PutBucketOwnershipControls" ,
645
+ "s3:PutBucketRequestPayment" ,
646
+ "s3:PutBucketVersioning" ,
647
+ "s3:PutBucketWebsite" ,
648
+ "s3:PutEncryptionConfiguration" ,
649
+ "s3:PutIntelligentTieringConfiguration" ,
650
+ "s3:PutInventoryConfiguration" ,
651
+ "s3:PutLifecycleConfiguration" ,
652
+ "s3:PutMetricsConfiguration" ,
653
+ "s3:PutReplicationConfiguration"
654
+ ],
655
+ "Resource" : [
656
+ "arn:aws:s3:::test"
657
+ ]
658
+ }
659
+ ]
660
+ }
661
+ self .assertDictEqual (result , expected_result )
0 commit comments