From f8b9c24a1cb5946e41bb7e54d4e159128bb21868 Mon Sep 17 00:00:00 2001 From: Clay Gerrard Date: Wed, 11 Jul 2018 22:51:06 -0500 Subject: [PATCH] Add unittest for slo_etag Related-Change-Id: I67478923619b00ec1a37d56b6fec6a218453dafc Change-Id: Ibaa630b5b4251cc4f821c01d3c09a8b8a6be342c --- test/unit/common/middleware/test_slo.py | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/unit/common/middleware/test_slo.py b/test/unit/common/middleware/test_slo.py index 40f157e3dd..6767e4a1fa 100644 --- a/test/unit/common/middleware/test_slo.py +++ b/test/unit/common/middleware/test_slo.py @@ -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):