
Deprecates the old --no-cache option in favor of --os-cache. The old CLI args (--no_cache and --no-cache) and ENV option (OS_NO_CACHE) are still supported but no longer show up in help. The new option for --os-cache can also be set via the OS_CACHE ENV variable... which now defaults to False. This should be much more user friendly. Fixes LP Bug #1087776. Change-Id: I3cea089c7e11ce75f22c2d7f3242b02b80441323
51 lines
2.0 KiB
Python
51 lines
2.0 KiB
Python
|
|
import novaclient.client
|
|
import novaclient.v1_1.client
|
|
from tests import utils
|
|
|
|
|
|
class ClientTest(utils.TestCase):
|
|
|
|
def setUp(self):
|
|
pass
|
|
|
|
def test_get_client_class_v2(self):
|
|
output = novaclient.client.get_client_class('2')
|
|
self.assertEqual(output, novaclient.v1_1.client.Client)
|
|
|
|
def test_get_client_class_v2_int(self):
|
|
output = novaclient.client.get_client_class(2)
|
|
self.assertEqual(output, novaclient.v1_1.client.Client)
|
|
|
|
def test_get_client_class_v1_1(self):
|
|
output = novaclient.client.get_client_class('1.1')
|
|
self.assertEqual(output, novaclient.v1_1.client.Client)
|
|
|
|
def test_get_client_class_unknown(self):
|
|
self.assertRaises(novaclient.exceptions.UnsupportedVersion,
|
|
novaclient.client.get_client_class, '0')
|
|
|
|
def test_client_with_os_cache_enabled(self):
|
|
cs = novaclient.v1_1.client.Client("user", "password", "project_id",
|
|
auth_url="foo/v2", os_cache=True)
|
|
self.assertEqual(True, cs.os_cache)
|
|
self.assertEqual(True, cs.client.os_cache)
|
|
|
|
def test_client_with_os_cache_disabled(self):
|
|
cs = novaclient.v1_1.client.Client("user", "password", "project_id",
|
|
auth_url="foo/v2", os_cache=False)
|
|
self.assertEqual(False, cs.os_cache)
|
|
self.assertEqual(False, cs.client.os_cache)
|
|
|
|
def test_client_with_no_cache_enabled(self):
|
|
cs = novaclient.v1_1.client.Client("user", "password", "project_id",
|
|
auth_url="foo/v2", no_cache=True)
|
|
self.assertEqual(False, cs.os_cache)
|
|
self.assertEqual(False, cs.client.os_cache)
|
|
|
|
def test_client_with_no_cache_disabled(self):
|
|
cs = novaclient.v1_1.client.Client("user", "password", "project_id",
|
|
auth_url="foo/v2", no_cache=False)
|
|
self.assertEqual(True, cs.os_cache)
|
|
self.assertEqual(True, cs.client.os_cache)
|