Fix incorrect variable name

valid_versions does not exist here, it is obviously supposed to mean
_VALID_VERSIONS.

Closes-Bug: #1386232
Change-Id: I477baa7642feba72f80d884d6183512185b02cf1
This commit is contained in:
Jamie Lennox 2014-10-27 15:34:18 +01:00
parent 8428ffd099
commit 384b8825b4
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)