summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSabari Kumar Murugesan <smurugesan@vmware.com>2016-02-24 23:35:31 -0800
committerSabari <smurugesan@vmware.com>2016-02-25 08:27:56 +0000
commit3fb97373c448ca92466061598814eccfc637e461 (patch)
treef431c77b85ec05eeeabf3329363c81d3198b211b
parentd4eb2c9ed20644a583188ea9c078cdc023d4e3de (diff)
downloadglance_store-3fb97373c448ca92466061598814eccfc637e461.tar.gz
test_http_get_redirect is not testing redirects correctly
test_http_get_redirect is supposed to test redirects due to 302, 301 responses but due to a wrong mock setup is skipping both and directly just testing the 200 OK response scenario. Change-Id: I041ee5eb8bd6b800a44022c770a9cc830b4b1ea5
-rw-r--r--glance_store/tests/unit/test_http_store.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/glance_store/tests/unit/test_http_store.py b/glance_store/tests/unit/test_http_store.py
index 073e4b5..967a9fe 100644
--- a/glance_store/tests/unit/test_http_store.py
+++ b/glance_store/tests/unit/test_http_store.py
@@ -71,9 +71,9 @@ class TestHttpStore(base.StoreBaseTest,
self._mock_requests()
redirect1 = {"location": "http://example.com/teapot.img"}
redirect2 = {"location": "http://example.com/teapot_real.img"}
- responses = [utils.fake_response(status_code=302, headers=redirect1),
+ responses = [utils.fake_response(),
utils.fake_response(status_code=301, headers=redirect2),
- utils.fake_response()]
+ utils.fake_response(status_code=302, headers=redirect1)]
def getresponse(*args, **kwargs):
return responses.pop()
@@ -85,6 +85,7 @@ class TestHttpStore(base.StoreBaseTest,
loc = location.get_location_from_uri(uri, conf=self.conf)
(image_file, image_size) = self.store.get(loc)
+ self.assertEqual(0, len(responses))
self.assertEqual(image_size, 31)
chunks = [c for c in image_file]