Skip to content

Commit

Permalink
adding failing three tests back with attr @fails_on_rgw (#10)
Browse files Browse the repository at this point in the history
Signed-off-by: Ravindra Choudhari <ravindra.choudhari@seagate.com>
  • Loading branch information
ravindrachoudhari authored Jun 10, 2022
1 parent 652a16d commit 563f3ea
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions s3tests_boto3/functional/test_iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def test_put_user_policy_parameter_limit():
@attr(operation='Verify Put User Policy using invalid policy document elements')
@attr(assertion='succeeds')
@attr('user-policy')
@attr('fails_on_rgw')
def test_put_user_policy_invalid_element():
client = get_iam_client()

Expand All @@ -105,6 +106,36 @@ def test_put_user_policy_invalid_element():
status = _get_status(e.response)
eq(status, 400)

# With no Statement
policy_document = json.dumps(
{
"Version": "2012-10-17",
}
)
e = assert_raises(ClientError, client.put_user_policy, PolicyDocument=policy_document,
PolicyName='AllAccessPolicy', UserName=get_alt_user_id())
status = _get_status(e.response)
eq(status, 400)

# with same Sid for 2 statements
policy_document = json.dumps(
{"Version": "2012-10-17",
"Statement": [
{"Sid": "98AB54CF",
"Effect": "Allow",
"Action": "*",
"Resource": "*"},
{"Sid": "98AB54CF",
"Effect": "Allow",
"Action": "*",
"Resource": "*"}]
}
)
e = assert_raises(ClientError, client.put_user_policy, PolicyDocument=policy_document,
PolicyName='AllAccessPolicy', UserName=get_alt_user_id())
status = _get_status(e.response)
eq(status, 400)

# with Principal
policy_document = json.dumps(
{"Version": "2012-10-17",
Expand Down Expand Up @@ -232,6 +263,56 @@ def test_get_user_policy_invalid_user():
client.delete_user_policy(PolicyName='AllAccessPolicy', UserName=get_alt_user_id())


@attr(resource='user-policy')
@attr(method='get')
@attr(operation='Verify Get User Policy with invalid policy name')
@attr(assertion='succeeds')
@attr('user-policy')
@attr('fails_on_rgw')
def test_get_user_policy_invalid_policy_name():
client = get_iam_client()

policy_document = json.dumps(
{"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": "*",
"Resource": "*"}}
)
client.put_user_policy(PolicyDocument=policy_document, PolicyName='AllAccessPolicy',
UserName=get_alt_user_id())
e = assert_raises(ClientError, client.get_user_policy, PolicyName='non-existing-policy-name',
UserName=get_alt_user_id())
status = _get_status(e.response)
eq(status, 404)
client.delete_user_policy(PolicyName='AllAccessPolicy', UserName=get_alt_user_id())


@attr(resource='user-policy')
@attr(method='get')
@attr(operation='Verify Get Deleted User Policy')
@attr(assertion='succeeds')
@attr('user-policy')
@attr('fails_on_rgw')
def test_get_deleted_user_policy():
client = get_iam_client()

policy_document = json.dumps(
{"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": "*",
"Resource": "*"}}
)
client.put_user_policy(PolicyDocument=policy_document, PolicyName='AllAccessPolicy',
UserName=get_alt_user_id())
client.delete_user_policy(PolicyName='AllAccessPolicy', UserName=get_alt_user_id())
e = assert_raises(ClientError, client.get_user_policy, PolicyName='AllAccessPolicy',
UserName=get_alt_user_id())
status = _get_status(e.response)
eq(status, 404)


@attr(resource='user-policy')
@attr(method='get')
@attr(operation='Verify Get a policy from multiple policies for a user')
Expand Down

0 comments on commit 563f3ea

Please sign in to comment.