summaryrefslogtreecommitdiff
path: root/glanceclient/tests/unit/v2/test_images.py
diff options
context:
space:
mode:
Diffstat (limited to 'glanceclient/tests/unit/v2/test_images.py')
-rw-r--r--glanceclient/tests/unit/v2/test_images.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/glanceclient/tests/unit/v2/test_images.py b/glanceclient/tests/unit/v2/test_images.py
index 199d6ec..60ddb3a 100644
--- a/glanceclient/tests/unit/v2/test_images.py
+++ b/glanceclient/tests/unit/v2/test_images.py
@@ -1201,7 +1201,7 @@ class TestController(testtools.TestCase):
body = ''.join([b for b in body])
self.assertEqual('GOODCHECKSUM', body)
- def test_image_import(self):
+ def test_image_import_web_download(self):
uri = 'http://example.com/image.qcow'
data = [('method', {'name': 'web-download',
'uri': uri})]
@@ -1211,6 +1211,24 @@ class TestController(testtools.TestCase):
data)]
self.assertEqual(expect, self.api.calls)
+ def test_image_import_glance_download(self):
+ region = 'REGION2'
+ remote_image_id = '75baf7b6-253a-11ed-8307-4b1057986a78'
+ image_id = '606b0e88-7c5a-4d54-b5bb-046105d4de6f'
+ service_interface = 'public'
+ data = [('method',
+ {'name': 'glance-download',
+ 'glance_region': region,
+ 'glance_image_id': remote_image_id,
+ 'glance_service_interface': service_interface})]
+ self.controller.image_import(
+ image_id, 'glance-download', remote_region=region,
+ remote_image_id=remote_image_id,
+ remote_service_interface=service_interface)
+ expect = [('POST', '/v2/images/%s/import' % image_id, {},
+ data)]
+ self.assertEqual(expect, self.api.calls)
+
def test_download_no_data(self):
resp = utils.FakeResponse(headers={}, status_code=204)
self.controller.controller.http_client.get = mock.Mock(