Merge "Fix incorrect variable name"

This commit is contained in:
Jenkins 2015-01-06 19:52:00 +00:00 committed by Gerrit Code Review
commit 9c1ec1d19c
2 changed files with 14 additions and 1 deletions
cinderclient

@ -66,7 +66,7 @@ def get_volume_api_from_url(url):
return version[1:]
msg = "Invalid client version '%s'. must be one of: %s" % (
(version, ', '.join(valid_versions)))
(version, ', '.join(_VALID_VERSIONS)))
raise exceptions.UnsupportedVersion(msg)

@ -61,3 +61,16 @@ class ClientTest(utils.TestCase):
self.assertNotIn("fakePassword", output[1])
self.assertIn("fakeUser", output[1])
def test_versions(self):
v1_url = 'http://fakeurl/v1/tenants'
v2_url = 'http://fakeurl/v2/tenants'
unknown_url = 'http://fakeurl/v9/tenants'
self.assertEqual('1',
cinderclient.client.get_volume_api_from_url(v1_url))
self.assertEqual('2',
cinderclient.client.get_volume_api_from_url(v2_url))
self.assertRaises(cinderclient.exceptions.UnsupportedVersion,
cinderclient.client.get_volume_api_from_url,
unknown_url)