Merge "Tighten status code assertions for object POST"

This commit is contained in:
Zuul
2018-10-11 03:03:41 +00:00
committed by Gerrit Code Review
2 changed files with 4 additions and 4 deletions

View File

@@ -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))

View File

@@ -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())