web: Remove bucket policy when we have no more statements. (#2779)

This commit is contained in:
Harshavardhana
2016-09-26 03:11:22 -07:00
committed by GitHub
parent be0e06c0aa
commit cfbab22237
2 changed files with 12 additions and 1 deletions

View File

@@ -983,6 +983,10 @@ func testWebSetBucketPolicyHandler(obj ObjectLayer, instanceType string, t TestE
{bucketName, "", "foo", false},
// Valid parameters
{bucketName, "", "readwrite", true},
// None is valid and policy should be removed.
{bucketName, "", "none", true},
// Setting none again meants should return an error.
{bucketName, "", "none", false},
}
for i, testCase := range testCases {
@@ -995,7 +999,7 @@ func testWebSetBucketPolicyHandler(obj ObjectLayer, instanceType string, t TestE
}
apiRouter.ServeHTTP(rec, req)
// Check if we have 200 OK
if rec.Code != http.StatusOK {
if testCase.pass && rec.Code != http.StatusOK {
t.Fatalf("Test %d: Expected the response status to be 200, but instead found `%d`", i+1, rec.Code)
}
// Parse RPC response