|
|
@ -913,7 +913,7 @@ func TestBucketPolicyConditionMatch(t *testing.T) { |
|
|
|
statementCondition: getStatementWithCondition("StringNotEquals", "s3:prefix", "Asia/"), |
|
|
|
statementCondition: getStatementWithCondition("StringNotEquals", "s3:prefix", "Asia/"), |
|
|
|
condition: getInnerMap("prefix", "Asia/"), |
|
|
|
condition: getInnerMap("prefix", "Asia/"), |
|
|
|
|
|
|
|
|
|
|
|
expectedMatch: true, |
|
|
|
expectedMatch: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
// Test case - 6.
|
|
|
|
// Test case - 6.
|
|
|
|
// StringNotEquals condition doesn't match.
|
|
|
|
// StringNotEquals condition doesn't match.
|
|
|
@ -922,7 +922,7 @@ func TestBucketPolicyConditionMatch(t *testing.T) { |
|
|
|
statementCondition: getStatementWithCondition("StringNotEquals", "s3:prefix", "Asia/"), |
|
|
|
statementCondition: getStatementWithCondition("StringNotEquals", "s3:prefix", "Asia/"), |
|
|
|
condition: getInnerMap("prefix", "Africa/"), |
|
|
|
condition: getInnerMap("prefix", "Africa/"), |
|
|
|
|
|
|
|
|
|
|
|
expectedMatch: false, |
|
|
|
expectedMatch: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
// Test case - 7.
|
|
|
|
// Test case - 7.
|
|
|
|
// StringNotEquals condition matches.
|
|
|
|
// StringNotEquals condition matches.
|
|
|
@ -931,7 +931,7 @@ func TestBucketPolicyConditionMatch(t *testing.T) { |
|
|
|
statementCondition: getStatementWithCondition("StringNotEquals", "s3:max-keys", "Asia/"), |
|
|
|
statementCondition: getStatementWithCondition("StringNotEquals", "s3:max-keys", "Asia/"), |
|
|
|
condition: getInnerMap("max-keys", "Asia/"), |
|
|
|
condition: getInnerMap("max-keys", "Asia/"), |
|
|
|
|
|
|
|
|
|
|
|
expectedMatch: true, |
|
|
|
expectedMatch: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
// Test case - 8.
|
|
|
|
// Test case - 8.
|
|
|
|
// StringNotEquals condition doesn't match.
|
|
|
|
// StringNotEquals condition doesn't match.
|
|
|
@ -940,7 +940,7 @@ func TestBucketPolicyConditionMatch(t *testing.T) { |
|
|
|
statementCondition: getStatementWithCondition("StringNotEquals", "s3:max-keys", "Asia/"), |
|
|
|
statementCondition: getStatementWithCondition("StringNotEquals", "s3:max-keys", "Asia/"), |
|
|
|
condition: getInnerMap("max-keys", "Africa/"), |
|
|
|
condition: getInnerMap("max-keys", "Africa/"), |
|
|
|
|
|
|
|
|
|
|
|
expectedMatch: false, |
|
|
|
expectedMatch: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
// Test case - 9.
|
|
|
|
// Test case - 9.
|
|
|
|
// StringLike condition matches.
|
|
|
|
// StringLike condition matches.
|
|
|
@ -977,7 +977,8 @@ func TestBucketPolicyConditionMatch(t *testing.T) { |
|
|
|
// call the function under test and assert the result with the expected result.
|
|
|
|
// call the function under test and assert the result with the expected result.
|
|
|
|
doesMatch := bucketPolicyConditionMatch(tc.condition, tc.statementCondition) |
|
|
|
doesMatch := bucketPolicyConditionMatch(tc.condition, tc.statementCondition) |
|
|
|
if tc.expectedMatch != doesMatch { |
|
|
|
if tc.expectedMatch != doesMatch { |
|
|
|
t.Errorf("Expected the match to be `%v`; got `%v`.", tc.expectedMatch, doesMatch) |
|
|
|
t.Errorf("Expected the match to be `%v`; got `%v` - %v %v.", |
|
|
|
|
|
|
|
tc.expectedMatch, doesMatch, tc.condition, tc.statementCondition) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|