Add unittest for slo_etag

Related-Change-Id: I67478923619b00ec1a37d56b6fec6a218453dafc

Change-Id: Ibaa630b5b4251cc4f821c01d3c09a8b8a6be342c
This commit is contained in:
Clay Gerrard 2018-07-11 22:51:06 -05:00
parent c4c98eb64d
commit f8b9c24a1c
1 changed files with 26 additions and 0 deletions

View File

@ -307,6 +307,32 @@ class TestSloMiddleware(SloTestCase):
self.assertIsNone(parsed[0]['size_bytes'])
self.assertEqual([(0, 40)], parsed[0]['range'].ranges)
def test_container_listing(self):
listing_json = json.dumps([{
"bytes": 104857600,
"content_type": "application/x-troff-me",
"hash": "8de7b0b1551660da51d8d96a53b85531; "
"slo_etag=dc9947c2b53a3f55fe20c1394268e216",
"last_modified": "2018-07-12T03:14:39.532020",
"name": "test.me"
}])
self.app.register(
'GET', '/v1/a/c',
swob.HTTPOk,
{'Content-Type': 'application/json',
'Content-Length': len(listing_json)},
listing_json)
req = Request.blank('/v1/a/c', method='GET')
status, headers, body = self.call_slo(req)
self.assertEqual(json.loads(body), [{
"slo_etag": '"dc9947c2b53a3f55fe20c1394268e216"',
"hash": "8de7b0b1551660da51d8d96a53b85531",
"name": "test.me",
"bytes": 104857600,
"last_modified": "2018-07-12T03:14:39.532020",
"content_type": "application/x-troff-me",
}])
class TestSloPutManifest(SloTestCase):