Method not allowed is right response for DELETE() operations and add tests

This commit is contained in:
Harshavardhana
2015-07-16 14:08:33 -07:00
parent 52f21e6696
commit e605787e65
4 changed files with 59 additions and 2 deletions

View File

@@ -84,6 +84,25 @@ func (s *MyAPIDonutSuite) TearDownSuite(c *C) {
testAPIDonutServer.Close()
}
func (s *MyAPIDonutSuite) TestDeleteBucket(c *C) {
request, err := http.NewRequest("DELETE", testAPIDonutServer.URL+"/mybucket", nil)
c.Assert(err, IsNil)
client := &http.Client{}
response, err := client.Do(request)
c.Assert(err, IsNil)
c.Assert(response.StatusCode, Equals, http.StatusMethodNotAllowed)
}
func (s *MyAPIDonutSuite) TestDeleteObject(c *C) {
request, err := http.NewRequest("DELETE", testAPIDonutServer.URL+"/mybucket/myobject", nil)
c.Assert(err, IsNil)
client := &http.Client{}
response, err := client.Do(request)
c.Assert(err, IsNil)
c.Assert(response.StatusCode, Equals, http.StatusMethodNotAllowed)
}
func (s *MyAPIDonutSuite) TestNonExistantBucket(c *C) {
request, err := http.NewRequest("HEAD", testAPIDonutServer.URL+"/nonexistantbucket", nil)
c.Assert(err, IsNil)