You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2016/10/07 02:25:05 UTC

[09/12] libcloud git commit: Add tests and fixtures FCU DescribeProductTypes API

Add tests and fixtures FCU DescribeProductTypes API

Signed-off-by: Javier M. Mellid <jm...@igalia.com>


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

Branch: refs/heads/trunk
Commit: 426949097b52ea09c2cd0943e078d8f02e6c4fc9
Parents: 576673d
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Tue Oct 4 11:10:49 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100

----------------------------------------------------------------------
 .../fixtures/fcu/ex_describe_product_types.xml    | 18 ++++++++++++++++++
 libcloud/test/compute/test_ec2.py                 | 13 +++++++++++++
 2 files changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/42694909/libcloud/test/compute/fixtures/fcu/ex_describe_product_types.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/fcu/ex_describe_product_types.xml b/libcloud/test/compute/fixtures/fcu/ex_describe_product_types.xml
new file mode 100644
index 0000000..5901a63
--- /dev/null
+++ b/libcloud/test/compute/fixtures/fcu/ex_describe_product_types.xml
@@ -0,0 +1,18 @@
+<DescribeProductTypesResponse
+    xmlns="http://api.outscale.com/wsdl/fcuext/2014-04-15/">
+    <requestId>6f5287ac-2833-43d5-8675-b1ffd7b658d3</requestId>
+    <productTypeSet>
+        <item>
+            <productTypeId>0001</productTypeId>
+            <description>Linux/UNIX</description>
+        </item>
+        <item>
+            <productTypeId>0002</productTypeId>
+            <description>Windows</description>
+        </item>
+        <item>
+            <productTypeId>0003</productTypeId>
+            <description>MapR</description>
+        </item>
+    </productTypeSet>
+</DescribeProductTypesResponse>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/42694909/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 5d919fa..50aef44 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -1802,6 +1802,10 @@ class FCUMockHttp(EC2MockHttp):
         body = self.fixtures.load('ex_describe_quota.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _DescribeProductTypes(self, method, url, body, headers):
+        body = self.fixtures.load('ex_describe_product_types.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
 
 class OutscaleFCUTests(LibcloudTestCase):
 
@@ -1819,6 +1823,15 @@ class OutscaleFCUTests(LibcloudTestCase):
         self.assertTrue('global' in quota.keys())
         self.assertTrue('vpc-00000000' in quota.keys())
 
+    def test_ex_describe_product_types(self):
+        product_types = self.driver.ex_describe_product_types()
+        pt = {}
+        for e in product_types:
+            pt[e['productTypeId']] = e['description']
+        self.assertTrue('0001' in pt.keys())
+        self.assertTrue('MapR' in pt.values())
+        self.assertTrue(pt['0002'] == 'Windows')
+
 
 if __name__ == '__main__':
     sys.exit(unittest.main())