Add test for POST to DLO manifest file
In the past, a POST to a DLO manifest file when object_post_as_copy was true resulted in the manifest file contents being replaced by the concatenation of the DLO segments. This no longer happens, but tests for this case are missing. This patch adds a functional test to assert that the manifest file is preserved in a POST request. Change-Id: I90546014a7dcc7266f0d0e0ff6339688b7954b96 Related-bug: #1487791 Related-bug: #1514317
This commit is contained in:
parent
f1817802bd
commit
13747021a8
@ -2668,6 +2668,41 @@ class TestDlo(Base):
|
||||
contents,
|
||||
"ffffffffffgggggggggghhhhhhhhhhiiiiiiiiiijjjjjjjjjj")
|
||||
|
||||
def test_dlo_post_with_manifest_header(self):
|
||||
# verify that performing a POST to a DLO manifest
|
||||
# preserves the fact that it is a manifest file.
|
||||
|
||||
# create a new manifest for this test to avoid test coupling.
|
||||
x_o_m = self.env.container.file('man1').info()['x_object_manifest']
|
||||
file_item = self.env.container.file(Utils.create_name())
|
||||
file_item.write('manifest-contents', hdrs={"X-Object-Manifest": x_o_m})
|
||||
|
||||
# sanity checks
|
||||
manifest_contents = file_item.read(parms={'multipart-manifest': 'get'})
|
||||
self.assertEqual('manifest-contents', manifest_contents)
|
||||
expected_contents = ''.join([(c * 10) for c in 'abcde'])
|
||||
contents = file_item.read(parms={})
|
||||
self.assertEqual(expected_contents, contents)
|
||||
|
||||
# POST to the manifest file
|
||||
# include the x-object-manifest in case running with fast-post
|
||||
file_item.post({'x-object-meta-foo': 'bar',
|
||||
'x-object-manifest': x_o_m})
|
||||
|
||||
# Verify x-object-manifest still intact
|
||||
file_item.info()
|
||||
resp_headers = file_item.conn.response.getheaders()
|
||||
self.assertIn(('x-object-manifest', x_o_m), resp_headers)
|
||||
self.assertIn(('x-object-meta-foo', 'bar'), resp_headers)
|
||||
|
||||
# verify that manifest content was not changed
|
||||
manifest_contents = file_item.read(parms={'multipart-manifest': 'get'})
|
||||
self.assertEqual('manifest-contents', manifest_contents)
|
||||
|
||||
# verify that manifest still points to original content
|
||||
contents = file_item.read(parms={})
|
||||
self.assertEqual(expected_contents, contents)
|
||||
|
||||
|
||||
class TestDloUTF8(Base2, TestDlo):
|
||||
set_up = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user