Tighten status code assertions for object POST
Now that POST-as-COPY is dead and gone, 202 should be the only successful response code for an object POST. Note that there are already tests requiring 202s in test/functional/test_object.py. Change-Id: I33c8d2c031f8dfdf1e789bb8d6e6908bfff4d739
This commit is contained in:
parent
a4376a43de
commit
ce51893bfc
@ -966,7 +966,7 @@ class File(Base):
|
||||
self.conn.make_request('POST', self.path, hdrs=headers,
|
||||
parms=parms, cfg=cfg)
|
||||
|
||||
if self.conn.response.status not in (201, 202):
|
||||
if self.conn.response.status != 202:
|
||||
raise ResponseError(self.conn.response, 'POST',
|
||||
self.conn.make_path(self.path))
|
||||
|
||||
@ -1103,7 +1103,7 @@ class File(Base):
|
||||
self.conn.make_request('POST', self.path, hdrs=headers,
|
||||
parms=parms, cfg=cfg)
|
||||
|
||||
if self.conn.response.status not in (201, 202):
|
||||
if self.conn.response.status != 202:
|
||||
raise ResponseError(self.conn.response, 'POST',
|
||||
self.conn.make_path(self.path))
|
||||
|
||||
|
@ -1922,7 +1922,7 @@ class TestFile(Base):
|
||||
self.assertTrue(file_item.write())
|
||||
self.assert_status(201)
|
||||
self.assertTrue(file_item.sync_metadata())
|
||||
self.assert_status((201, 202))
|
||||
self.assert_status(202)
|
||||
else:
|
||||
self.assertRaises(ResponseError, file_item.write)
|
||||
self.assert_status(400)
|
||||
@ -2355,7 +2355,7 @@ class TestFile(Base):
|
||||
|
||||
file_item.metadata = metadata
|
||||
self.assertTrue(file_item.sync_metadata())
|
||||
self.assert_status((201, 202))
|
||||
self.assert_status(202)
|
||||
|
||||
file_item = self.env.container.file(file_item.name)
|
||||
self.assertTrue(file_item.initialize())
|
||||
|
Loading…
Reference in New Issue
Block a user