Commit e9e1e86f authored by Christos Stavrakakis's avatar Christos Stavrakakis

cyclades: Update tests for images/snapshots

parent 01e9f6d6
......@@ -618,7 +618,7 @@ class ServerCreateAPITest(ComputeAPITest):
self.assertEqual(volume.source, "image:%s" % fixed_image()["id"])
self.assertEqual(volume.delete_on_termination, True)
self.assertEqual(volume.userid, user)
self.assertEqual(volume.origin, "pithos:" + fixed_image()["mapfile"])
self.assertEqual(volume.origin, fixed_image()["mapfile"])
# Test using a snapshot
request["server"]["block_device_mapping_v2"] = [
......
......@@ -104,7 +104,7 @@ class ServerCreationTest(TransactionTestCase):
name, args, kwargs = mrapi().CreateInstance.mock_calls[-1]
self.assertEqual(kwargs["disks"][0],
{"provider": "archipelago",
"origin": "pithos:test_mapfile",
"origin": "test_mapfile",
"name": vm.volumes.all()[0].backend_volume_uuid,
"foo": "mpaz",
"lala": "lolo",
......
......@@ -103,7 +103,10 @@ class PlanktonTest(BaseAPITest):
backend().get_object_meta.return_value = {"uuid": "1234-1234-1234",
"bytes": 42,
"hash": "unique_hash"}
"is_snapshot": True,
"hash": "unique_mapfile",
"is_snapshot": True,
"mapfile": "unique_mapfile"}
headers = deepcopy(required)
headers["HTTP_X_IMAGE_META_SIZE"] = "foo"
response = self.post(IMAGES_URL, **headers)
......@@ -132,10 +135,14 @@ class PlanktonTest(BaseAPITest):
backend().get_object_meta.side_effect = \
[{"uuid": "1234-1234-1234",
"bytes": 42,
"hash": "unique_hash"},
"is_snapshot": True,
"hash": "unique_mapfile",
"mapfile": "unique_mapfile"},
{"uuid": "1234-1234-1234",
"bytes": 42,
"hash": "unique_hash",
"mapfile": "unique_mapfile",
"is_snapshot": True,
"hash": "unique_mapfile",
"version": 42,
'version_timestamp': Decimal('1392487853.863673'),
"plankton:name": u"TestImage\u2602",
......@@ -153,7 +160,7 @@ class PlanktonTest(BaseAPITest):
self.assertEqual(response["x-image-meta-is-public"], "False")
self.assertEqual(response["x-image-meta-owner"], "4321-4321")
self.assertEqual(response["x-image-meta-size"], "42")
self.assertEqual(response["x-image-meta-checksum"], "unique_hash")
self.assertEqual(response["x-image-meta-checksum"], "unique_mapfile")
self.assertEqual(urllib.unquote(response["x-image-meta-name"]),
u"TestImage\u2602".encode("utf-8"))
self.assertEqual(response["x-image-meta-container-format"], "bare")
......@@ -167,10 +174,14 @@ class PlanktonTest(BaseAPITest):
backend().get_object_meta.side_effect = \
[{"uuid": "1234-1234-1234",
"bytes": 42,
"hash": "unique_hash"},
"is_snapshot": True,
"hash": "unique_mapfile",
"mapfile": "unique_mapfile"},
{"uuid": "1234-1234-1234",
"bytes": 42,
"hash": "unique_hash",
"is_snapshot": True,
"hash": "unique_mapfile",
"mapfile": "unique_mapfile",
"version": 42,
'version_timestamp': Decimal('1392487853.863673'),
"plankton:name": u"TestImage\u2602",
......@@ -252,8 +263,10 @@ class PlanktonTest(BaseAPITest):
backend().get_object_meta.return_value = \
{"uuid": "img_uuid",
"bytes": 42,
"hash": "unique_hash",
"version": 42,
"is_snapshot": True,
"hash": "unique_mapfile",
"mapfile": "unique_mapfile",
"version": 42,
'version_timestamp': Decimal('1392487853.863673'),
"plankton:name": u"TestImage\u2602",
"plankton:container_format": "bare",
......@@ -271,7 +284,7 @@ class PlanktonTest(BaseAPITest):
self.assertEqual(response["x-image-meta-is-public"], "True")
self.assertEqual(response["x-image-meta-owner"], "img_owner")
self.assertEqual(response["x-image-meta-size"], "42")
self.assertEqual(response["x-image-meta-checksum"], "unique_hash")
self.assertEqual(response["x-image-meta-checksum"], "unique_mapfile")
self.assertEqual(urllib.unquote(response["x-image-meta-name"]),
u"TestImage\u2602".encode("utf-8"))
self.assertEqual(response["x-image-meta-container-format"], "bare")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment