Unit test for import image

Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4189872d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4189872d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4189872d

Branch: refs/heads/trunk
Commit: 4189872dac0d5b58158fc968bcc127fca140a139
Parents: 1bafa61
Author: Samuel Chong <samuelcho...@gmail.com>
Authored: Thu Nov 17 11:02:15 2016 +1100
Committer: Samuel Chong <samuelcho...@gmail.com>
Committed: Thu Nov 17 11:02:15 2016 +1100

----------------------------------------------------------------------
 .../dimensiondata/2.4/import_image_response.xml    |  8 ++++++++
 libcloud/test/compute/test_dimensiondata_v2_4.py   | 17 +++++++++++++++++
 2 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4189872d/libcloud/test/compute/fixtures/dimensiondata/2.4/import_image_response.xml
----------------------------------------------------------------------
diff --git 
a/libcloud/test/compute/fixtures/dimensiondata/2.4/import_image_response.xml 
b/libcloud/test/compute/fixtures/dimensiondata/2.4/import_image_response.xml
new file mode 100644
index 0000000..b51b0bf
--- /dev/null
+++ b/libcloud/test/compute/fixtures/dimensiondata/2.4/import_image_response.xml
@@ -0,0 +1,8 @@
+<response requestId= 
"na/2014-04-14T13:37:20/62f06368-c3fb-11e3-b29c-001517c4643e"
+xmlns= "urn:didata.com:api:cloud:types" >
+   <operation>IMPORT_IMAGE</operation>
+   <responseCode>IN_PROGRESS</responseCode>
+   <message>Request to import image has been accepted and is being
+processed.</message>
+   <info name="imageId" value="3389ffe8-c3fc-11e3-b29c-001517c4643e"/>
+</response>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4189872d/libcloud/test/compute/test_dimensiondata_v2_4.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_dimensiondata_v2_4.py 
b/libcloud/test/compute/test_dimensiondata_v2_4.py
index 30f5642..7a2ba63 100644
--- a/libcloud/test/compute/test_dimensiondata_v2_4.py
+++ b/libcloud/test/compute/test_dimensiondata_v2_4.py
@@ -2028,6 +2028,16 @@ class DimensionData_v2_4_Tests(unittest.TestCase, 
TestCaseMixin):
             ex_portlist=portlist.id)
         self.assertTrue(success)
 
+    def test_import_image(self):
+        tag_dictionaries = {'tagkey1_name': 'dev test', 'tagkey2_name': None}
+        success = self.driver.import_image(
+            ovf_package_name='aTestGocToNGoc2_export2.mf',
+            name='Libcloud NGOCImage_New 2',
+            description='test',
+            cluster_id='QA1_N2_VMWARE_1-01',
+            is_guest_os_customization='false',
+            tagkey_name_value_dictionaries=tag_dictionaries)
+        self.assertTrue(success)
 
 class InvalidRequestError(Exception):
     def __init__(self, tag):
@@ -3285,5 +3295,12 @@ class DimensionDataMockHttp(StorageMockHttp, MockHttp):
         )
         return httplib.OK, body, {}, httplib.responses[httplib.OK]
 
+    def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_importImage(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            '2.4/import_image_response.xml'
+        )
+        return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
 if __name__ == '__main__':
     sys.exit(unittest.main())

Reply via email to