diff options
| -rw-r--r-- | nova/api/openstack/common.py | 20 | ||||
| -rw-r--r-- | nova/tests/api/openstack/test_common.py | 18 |
2 files changed, 0 insertions, 38 deletions
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py index bb07b2b79..b1e31b0c7 100644 --- a/nova/api/openstack/common.py +++ b/nova/api/openstack/common.py @@ -254,26 +254,6 @@ def remove_version_from_href(href): return urlparse.urlunsplit(parsed_url) -def get_version_from_href(href): - """Returns the api version in the href. - - Returns the api version in the href. - If no version is found, '2' is returned - - Given: 'http://www.nova.com/123' - Returns: '2' - - Given: 'http://www.nova.com/v1.1' - Returns: '1.1' - - """ - try: - expression = r'/v([0-9]+|[0-9]+\.[0-9]+)(/|$)' - return re.findall(expression, href)[0][0] - except IndexError: - return '2' - - def check_img_metadata_properties_quota(context, metadata): if metadata is None: return diff --git a/nova/tests/api/openstack/test_common.py b/nova/tests/api/openstack/test_common.py index a22f4c05e..250a199e8 100644 --- a/nova/tests/api/openstack/test_common.py +++ b/nova/tests/api/openstack/test_common.py @@ -283,24 +283,6 @@ class MiscFunctionsTest(test.TestCase): expected = 'abc123' self.assertEqual(actual, expected) - def test_get_version_from_href(self): - fixture = 'http://www.testsite.com/v1.1/images' - expected = '1.1' - actual = common.get_version_from_href(fixture) - self.assertEqual(actual, expected) - - def test_get_version_from_href_2(self): - fixture = 'http://www.testsite.com/v1.1' - expected = '1.1' - actual = common.get_version_from_href(fixture) - self.assertEqual(actual, expected) - - def test_get_version_from_href_default(self): - fixture = 'http://www.testsite.com/images' - expected = '2' - actual = common.get_version_from_href(fixture) - self.assertEqual(actual, expected) - def test_raise_http_conflict_for_instance_invalid_state(self): # Correct args exc = exception.InstanceInvalidState(attr='fake_attr', |
