From ce51893bfc445c97b13819d37c8afae48e340142 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Wed, 10 Oct 2018 09:01:14 -0700 Subject: [PATCH] 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 --- test/functional/swift_test_client.py | 4 ++-- test/functional/tests.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/functional/swift_test_client.py b/test/functional/swift_test_client.py index 6bb3f7ffb1..0cd440f3cb 100644 --- a/test/functional/swift_test_client.py +++ b/test/functional/swift_test_client.py @@ -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)) diff --git a/test/functional/tests.py b/test/functional/tests.py index 20a154b2d9..4779a7adb4 100644 --- a/test/functional/tests.py +++ b/test/functional/tests.py @@ -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())