From f96b8e412db73721660aa8247430db76c3149508 Mon Sep 17 00:00:00 2001 From: Janie Richling Date: Mon, 9 Feb 2015 18:16:25 -0600 Subject: [PATCH] Included sysmeta in the object info The cached info object dict did not include the sysmeta. This patch fixes that, and adds a unit test. Change-Id: I092200e76586af322ed4ff7d194a1034b1ca0433 --- swift/proxy/controllers/base.py | 3 ++- test/unit/proxy/controllers/test_base.py | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/swift/proxy/controllers/base.py b/swift/proxy/controllers/base.py index a5972bd8e1..c3b133e45d 100644 --- a/swift/proxy/controllers/base.py +++ b/swift/proxy/controllers/base.py @@ -185,7 +185,8 @@ def headers_to_object_info(headers, status_int=HTTP_OK): 'length': headers.get('content-length'), 'type': headers.get('content-type'), 'etag': headers.get('etag'), - 'meta': meta + 'meta': meta, + 'sysmeta': sysmeta } return info diff --git a/test/unit/proxy/controllers/test_base.py b/test/unit/proxy/controllers/test_base.py index 04039fbf2a..2c2094ffed 100644 --- a/test/unit/proxy/controllers/test_base.py +++ b/test/unit/proxy/controllers/test_base.py @@ -523,6 +523,15 @@ class TestFuncs(unittest.TestCase): self.assertEquals(resp['meta']['whatevs'], 14) self.assertEquals(resp['meta']['somethingelse'], 0) + def test_headers_to_object_info_sys_meta(self): + prefix = get_sys_meta_prefix('object') + headers = {'%sWhatevs' % prefix: 14, + '%ssomethingelse' % prefix: 0} + resp = headers_to_object_info(headers.items(), 200) + self.assertEquals(len(resp['sysmeta']), 2) + self.assertEquals(resp['sysmeta']['whatevs'], 14) + self.assertEquals(resp['sysmeta']['somethingelse'], 0) + def test_headers_to_object_info_values(self): headers = { 'content-length': '1024',