libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [1/9] libcloud git commit: issues with LIBCLOUD-912
Date Sat, 22 Apr 2017 02:35:14 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk 660a144da -> 741032969


issues with LIBCLOUD-912


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

Branch: refs/heads/trunk
Commit: b8ba6c10accdf6d9ce8a40787e2300a594437ebe
Parents: 55e5e82
Author: Anthony Shaw <anthonyshaw@apache.org>
Authored: Fri Apr 21 17:21:55 2017 +1000
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Fri Apr 21 17:21:55 2017 +1000

----------------------------------------------------------------------
 libcloud/test/common/test_openstack.py          |  2 +-
 .../compute/fixtures/openstack/_v2_0__auth.json |  6 ++---
 libcloud/test/compute/test_openstack.py         | 23 ++++++++++++++++++++
 3 files changed, 27 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8ba6c10/libcloud/test/common/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/common/test_openstack.py b/libcloud/test/common/test_openstack.py
index 290ed3e..6780aa6 100644
--- a/libcloud/test/common/test_openstack.py
+++ b/libcloud/test/common/test_openstack.py
@@ -37,7 +37,7 @@ class OpenStackBaseConnectionTest(unittest.TestCase):
         self.assertEqual(self.connection.timeout, self.timeout)
         if PY25:
             self.connection.conn_class.assert_called_with(host='127.0.0.1',
-                                                               port=443)
+                                                          port=443)
         else:
             self.connection.conn_class.assert_called_with(host='127.0.0.1',
                                                           secure=1,

http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8ba6c10/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json b/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
index c40a8ee..3adb2cd 100644
--- a/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
+++ b/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
@@ -59,9 +59,9 @@
                     {
                         "region": "RegionOne",
                         "tenantId": "1337",
-                        "publicURL": "https://127.0.0.1/v2/1337",
-                        "versionInfo": "https://127.0.0.1/v2/",
-                        "versionList": "https://127.0.0.1/",
+                        "publicURL": "https://test_endpoint.com/v2/1337",
+                        "versionInfo": "https://test_endpoint.com/v2/",
+                        "versionList": "https://test_endpoint.com/",
                         "versionId": "2"
                     }
                 ],

http://git-wip-us.apache.org/repos/asf/libcloud/blob/b8ba6c10/libcloud/test/compute/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py
index 7611392..9dcfb53 100644
--- a/libcloud/test/compute/test_openstack.py
+++ b/libcloud/test/compute/test_openstack.py
@@ -27,6 +27,7 @@ except ImportError:
     import json
 
 from mock import Mock, patch
+import requests_mock
 
 from libcloud.utils.py3 import httplib
 from libcloud.utils.py3 import method_type
@@ -55,6 +56,28 @@ from libcloud.test.secrets import OPENSTACK_PARAMS
 BASE_DIR = os.path.abspath(os.path.split(__file__)[0])
 
 
+class OpenStackAuthTests(unittest.TestCase):
+    def setUp(self):
+        pass
+
+    def test_auth_host_passed(self):
+        forced_auth = 'http://x.y.z.y:5000'
+        d = OpenStack_1_0_NodeDriver(
+            'user', 'correct_password', 
+            ex_force_auth_version='2.0_password', 
+            ex_force_auth_url='http://x.y.z.y:5000', 
+            ex_tenant_name='admin')
+        self.assertEqual(d._ex_force_auth_url, forced_auth)
+        with requests_mock.Mocker() as mock:
+            body1 = "[]"
+            body2 = ComputeFileFixtures('openstack').load('_v2_0__auth.json')
+            mock.register_uri('GET', 'https://test_endpoint.com/v2/1337/servers/detail',
text=body1,
+                              headers={'content-type': 'application/json; charset=UTF-8'})
+            mock.register_uri('POST', 'http://x.y.z.y:5000/v2.0/tokens', text=body2,
+                              headers={'content-type': 'application/json; charset=UTF-8'})
+            d.list_nodes()
+
+
 class OpenStack_1_0_Tests(TestCaseMixin):
     should_list_locations = False
     should_list_volumes = False


Mime
View raw message