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 2017/04/22 02:35:15 UTC
[2/9] libcloud git commit: update test to validate custom host servce
endpoint and fix issue
update test to validate custom host servce endpoint and fix issue
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3fd07eb5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3fd07eb5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3fd07eb5
Branch: refs/heads/trunk
Commit: 3fd07eb590f1cf5898a329a9649df881a6c0f12f
Parents: b8ba6c1
Author: Anthony Shaw <an...@apache.org>
Authored: Fri Apr 21 20:00:33 2017 +1000
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Apr 21 20:00:33 2017 +1000
----------------------------------------------------------------------
libcloud/common/openstack.py | 1 +
libcloud/test/compute/test_openstack.py | 12 +++++-------
2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3fd07eb5/libcloud/common/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/common/openstack.py b/libcloud/common/openstack.py
index 07796b5..1350205 100644
--- a/libcloud/common/openstack.py
+++ b/libcloud/common/openstack.py
@@ -297,6 +297,7 @@ class OpenStackBaseConnection(ConnectionUserAndKey):
def _set_up_connection_info(self, url):
result = self._tuple_from_url(url)
(self.host, self.port, self.secure, self.request_path) = result
+ self.connect()
def _populate_hosts_and_request_paths(self):
"""
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3fd07eb5/libcloud/test/compute/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py
index 9dcfb53..b42f43d 100644
--- a/libcloud/test/compute/test_openstack.py
+++ b/libcloud/test/compute/test_openstack.py
@@ -63,19 +63,17 @@ class OpenStackAuthTests(unittest.TestCase):
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',
+ '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()
+ d.connection._populate_hosts_and_request_paths()
+ self.assertEqual(d.connection.host, 'test_endpoint.com')
class OpenStack_1_0_Tests(TestCaseMixin):