summaryrefslogtreecommitdiff
path: root/novaclient/tests/unit/test_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/tests/unit/test_client.py')
-rw-r--r--novaclient/tests/unit/test_client.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/novaclient/tests/unit/test_client.py b/novaclient/tests/unit/test_client.py
index f816115..2c7f7ea 100644
--- a/novaclient/tests/unit/test_client.py
+++ b/novaclient/tests/unit/test_client.py
@@ -24,7 +24,7 @@ import requests
24import novaclient.client 24import novaclient.client
25import novaclient.extension 25import novaclient.extension
26from novaclient.tests.unit import utils 26from novaclient.tests.unit import utils
27import novaclient.v1_1.client 27import novaclient.v2.client
28 28
29 29
30class ClientConnectionPoolTest(utils.TestCase): 30class ClientConnectionPoolTest(utils.TestCase):
@@ -138,57 +138,57 @@ class ClientTest(utils.TestCase):
138 138
139 def test_get_client_class_v3(self): 139 def test_get_client_class_v3(self):
140 output = novaclient.client.get_client_class('3') 140 output = novaclient.client.get_client_class('3')
141 self.assertEqual(output, novaclient.v1_1.client.Client) 141 self.assertEqual(output, novaclient.v2.client.Client)
142 142
143 def test_get_client_class_v2(self): 143 def test_get_client_class_v2(self):
144 output = novaclient.client.get_client_class('2') 144 output = novaclient.client.get_client_class('2')
145 self.assertEqual(output, novaclient.v1_1.client.Client) 145 self.assertEqual(output, novaclient.v2.client.Client)
146 146
147 def test_get_client_class_v2_int(self): 147 def test_get_client_class_v2_int(self):
148 output = novaclient.client.get_client_class(2) 148 output = novaclient.client.get_client_class(2)
149 self.assertEqual(output, novaclient.v1_1.client.Client) 149 self.assertEqual(output, novaclient.v2.client.Client)
150 150
151 def test_get_client_class_v1_1(self): 151 def test_get_client_class_v1_1(self):
152 output = novaclient.client.get_client_class('1.1') 152 output = novaclient.client.get_client_class('1.1')
153 self.assertEqual(output, novaclient.v1_1.client.Client) 153 self.assertEqual(output, novaclient.v2.client.Client)
154 154
155 def test_get_client_class_unknown(self): 155 def test_get_client_class_unknown(self):
156 self.assertRaises(novaclient.exceptions.UnsupportedVersion, 156 self.assertRaises(novaclient.exceptions.UnsupportedVersion,
157 novaclient.client.get_client_class, '0') 157 novaclient.client.get_client_class, '0')
158 158
159 def test_client_with_os_cache_enabled(self): 159 def test_client_with_os_cache_enabled(self):
160 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 160 cs = novaclient.v2.client.Client("user", "password", "project_id",
161 auth_url="foo/v2", os_cache=True) 161 auth_url="foo/v2", os_cache=True)
162 self.assertEqual(True, cs.os_cache) 162 self.assertEqual(True, cs.os_cache)
163 self.assertEqual(True, cs.client.os_cache) 163 self.assertEqual(True, cs.client.os_cache)
164 164
165 def test_client_with_os_cache_disabled(self): 165 def test_client_with_os_cache_disabled(self):
166 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 166 cs = novaclient.v2.client.Client("user", "password", "project_id",
167 auth_url="foo/v2", os_cache=False) 167 auth_url="foo/v2", os_cache=False)
168 self.assertEqual(False, cs.os_cache) 168 self.assertEqual(False, cs.os_cache)
169 self.assertEqual(False, cs.client.os_cache) 169 self.assertEqual(False, cs.client.os_cache)
170 170
171 def test_client_with_no_cache_enabled(self): 171 def test_client_with_no_cache_enabled(self):
172 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 172 cs = novaclient.v2.client.Client("user", "password", "project_id",
173 auth_url="foo/v2", no_cache=True) 173 auth_url="foo/v2", no_cache=True)
174 self.assertEqual(False, cs.os_cache) 174 self.assertEqual(False, cs.os_cache)
175 self.assertEqual(False, cs.client.os_cache) 175 self.assertEqual(False, cs.client.os_cache)
176 176
177 def test_client_with_no_cache_disabled(self): 177 def test_client_with_no_cache_disabled(self):
178 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 178 cs = novaclient.v2.client.Client("user", "password", "project_id",
179 auth_url="foo/v2", no_cache=False) 179 auth_url="foo/v2", no_cache=False)
180 self.assertEqual(True, cs.os_cache) 180 self.assertEqual(True, cs.os_cache)
181 self.assertEqual(True, cs.client.os_cache) 181 self.assertEqual(True, cs.client.os_cache)
182 182
183 def test_client_set_management_url_v1_1(self): 183 def test_client_set_management_url_v1_1(self):
184 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 184 cs = novaclient.v2.client.Client("user", "password", "project_id",
185 auth_url="foo/v2") 185 auth_url="foo/v2")
186 cs.set_management_url("blabla") 186 cs.set_management_url("blabla")
187 self.assertEqual("blabla", cs.client.management_url) 187 self.assertEqual("blabla", cs.client.management_url)
188 188
189 def test_client_get_reset_timings_v1_1(self): 189 def test_client_get_reset_timings_v1_1(self):
190 cs = novaclient.v1_1.client.Client("user", "password", "project_id", 190 cs = novaclient.v2.client.Client("user", "password", "project_id",
191 auth_url="foo/v2") 191 auth_url="foo/v2")
192 self.assertEqual(0, len(cs.get_timings())) 192 self.assertEqual(0, len(cs.get_timings()))
193 cs.client.times.append("somevalue") 193 cs.client.times.append("somevalue")
194 self.assertEqual(1, len(cs.get_timings())) 194 self.assertEqual(1, len(cs.get_timings()))
@@ -201,8 +201,8 @@ class ClientTest(utils.TestCase):
201 def test_contextmanager_v1_1(self, mock_http_client): 201 def test_contextmanager_v1_1(self, mock_http_client):
202 fake_client = mock.Mock() 202 fake_client = mock.Mock()
203 mock_http_client.return_value = fake_client 203 mock_http_client.return_value = fake_client
204 with novaclient.v1_1.client.Client("user", "password", "project_id", 204 with novaclient.v2.client.Client("user", "password", "project_id",
205 auth_url="foo/v2"): 205 auth_url="foo/v2"):
206 pass 206 pass
207 self.assertTrue(fake_client.open_session.called) 207 self.assertTrue(fake_client.open_session.called)
208 self.assertTrue(fake_client.close_session.called) 208 self.assertTrue(fake_client.close_session.called)