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
This commit is contained in:
Janie Richling 2015-02-09 18:16:25 -06:00
parent b54532ca05
commit f96b8e412d
2 changed files with 11 additions and 1 deletions

View File

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

View File

@ -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',