simplify the test
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8560d207 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8560d207 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8560d207 Branch: refs/heads/trunk Commit: 8560d2077873049a06e5fe62899d2197584c9d43 Parents: daaac0d Author: Anthony Shaw <anthonys...@apache.org> Authored: Sat Apr 22 08:30:49 2017 +1000 Committer: Anthony Shaw <anthonys...@apache.org> Committed: Sat Apr 22 08:30:49 2017 +1000 ---------------------------------------------------------------------- libcloud/test/compute/test_openstack.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/8560d207/libcloud/test/compute/test_openstack.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py index 3351db9..029db10 100644 --- a/libcloud/test/compute/test_openstack.py +++ b/libcloud/test/compute/test_openstack.py @@ -69,15 +69,13 @@ class OpenStackAuthTests(unittest.TestCase): 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 = ComputeFileFixtures('openstack').load('v1_slug_servers_ips.xml') body2 = ComputeFileFixtures('openstack').load('_v2_0__auth.json') - mock.register_uri('GET', 'https://test_endpoint.com/v2/1337/servers/test/ips', text=body1, - headers={'content-type': 'application/xml; 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.ex_list_ip_addresses('test') + d.connection._populate_hosts_and_request_paths() self.assertEqual(d.connection.host, 'test_endpoint.com')