bucket-policy: Delete policy should remove policy properly. (#1456)

This commit is contained in:
Harshavardhana 2016-05-02 16:58:10 -07:00 committed by Anand Babu (AB) Periasamy
parent afd59c45dc
commit ac7a7cec20
2 changed files with 12 additions and 0 deletions

View File

@ -101,6 +101,9 @@ func removeBucketPolicy(bucket string) error {
}
return err
}
if err := os.Remove(bucketPolicyFile); err != nil {
return err
}
return nil
}

View File

@ -350,6 +350,15 @@ func (s *MyAPISuite) TestBucketPolicy(c *C) {
response, err = client.Do(request)
c.Assert(err, IsNil)
c.Assert(response.StatusCode, Equals, http.StatusNoContent)
// Verify if the policy was indeed deleted.
request, err = s.newRequest("GET", testAPIFSCacheServer.URL+"/policybucket?policy", 0, nil)
c.Assert(err, IsNil)
client = http.Client{}
response, err = client.Do(request)
c.Assert(err, IsNil)
c.Assert(response.StatusCode, Equals, http.StatusNotFound)
}
func (s *MyAPISuite) TestDeleteBucket(c *C) {