@@ -4631,11 +4631,10 @@ def test_ps_s3_list_topics_v1():
46314631 tenant_topic_conf .del_config (tenant_topic_arn2 )
46324632
46334633
4634- @attr ('basic_test' )
4635- def test_ps_s3_topic_permissions ():
4634+ def ps_s3_topic_permissions (another_tenant = "" ):
46364635 """ test s3 topic set/get/delete permissions """
46374636 conn1 = connection ()
4638- conn2 , arn2 = another_user ()
4637+ conn2 , arn2 = another_user (tenant = another_tenant )
46394638 zonegroup = get_config_zonegroup ()
46404639 bucket_name = gen_bucket_name ()
46414640 topic_name = bucket_name + TOPIC_SUFFIX
@@ -4658,17 +4657,20 @@ def test_ps_s3_topic_permissions():
46584657 topic_arn = topic_conf .set_config ()
46594658
46604659 topic_conf2 = PSTopicS3 (conn2 , topic_name , zonegroup , endpoint_args = endpoint_args )
4661- try :
4662- # 2nd user tries to override the topic
4663- topic_arn = topic_conf2 .set_config ()
4664- assert False , "'AuthorizationError' error is expected"
4665- except ClientError as err :
4666- if 'Error' in err .response :
4667- assert_equal (err .response ['Error' ]['Code' ], 'AuthorizationError' )
4668- else :
4669- assert_equal (err .response ['Code' ], 'AuthorizationError' )
4670- except Exception as err :
4671- print ('unexpected error type: ' + type (err ).__name__ )
4660+ # only on the same tenant we can try to override the topic
4661+ if another_tenant == "" :
4662+ try :
4663+ # 2nd user tries to override the topic
4664+ topic_arn = topic_conf2 .set_config ()
4665+ assert False , "'AuthorizationError' error is expected"
4666+ except ClientError as err :
4667+ if 'Error' in err .response :
4668+ assert_equal (err .response ['Error' ]['Code' ], 'AuthorizationError' )
4669+ else :
4670+ assert_equal (err .response ['Code' ], 'AuthorizationError' )
4671+ except Exception as err :
4672+ print ('unexpected error type: ' + type (err ).__name__ )
4673+ assert False , "'AuthorizationError' error is expected"
46724674
46734675 # 2nd user tries to fetch the topic
46744676 _ , status = topic_conf2 .get_config (topic_arn = topic_arn )
@@ -4685,6 +4687,7 @@ def test_ps_s3_topic_permissions():
46854687 assert_equal (err .response ['Code' ], 'AuthorizationError' )
46864688 except Exception as err :
46874689 print ('unexpected error type: ' + type (err ).__name__ )
4690+ assert False , "'AuthorizationError' error is expected"
46884691
46894692 # create bucket for conn2 and try publishing notification to topic
46904693 _ = conn2 .create_bucket (bucket_name )
@@ -4703,6 +4706,7 @@ def test_ps_s3_topic_permissions():
47034706 assert_equal (err .response ['Code' ], 'AccessDenied' )
47044707 except Exception as err :
47054708 print ('unexpected error type: ' + type (err ).__name__ )
4709+ assert False , "'AuthorizationError' error is expected"
47064710
47074711 try :
47084712 # 2nd user tries to delete the topic
@@ -4715,9 +4719,10 @@ def test_ps_s3_topic_permissions():
47154719 assert_equal (err .response ['Code' ], 'AuthorizationError' )
47164720 except Exception as err :
47174721 print ('unexpected error type: ' + type (err ).__name__ )
4722+ assert False , "'AuthorizationError' error is expected"
47184723
47194724 # Topic policy is now added by the 1st user to allow 2nd user.
4720- topic_policy = topic_policy .replace ("Deny" , "Allow" )
4725+ topic_policy = topic_policy .replace ("Deny" , "Allow" )
47214726 topic_conf = PSTopicS3 (conn1 , topic_name , zonegroup , endpoint_args = endpoint_args , policy_text = topic_policy )
47224727 topic_arn = topic_conf .set_config ()
47234728 # 2nd user try to fetch topic again
@@ -4740,6 +4745,16 @@ def test_ps_s3_topic_permissions():
47404745 conn2 .delete_bucket (bucket_name )
47414746
47424747
4748+ @attr ('basic_test' )
4749+ def test_ps_s3_topic_permissions_same_tenant ():
4750+ ps_s3_topic_permissions ()
4751+
4752+
4753+ @attr ('basic_test' )
4754+ def test_ps_s3_topic_permissions_cross_tenant ():
4755+ ps_s3_topic_permissions (another_tenant = "boom" )
4756+
4757+
47434758@attr ('basic_test' )
47444759def test_ps_s3_topic_no_permissions ():
47454760 """ test s3 topic set/get/delete permissions """
0 commit comments