Merge "Extend remove_version_from_href support"
This commit is contained in:
commit
cc340090a8
@ -202,7 +202,7 @@ def remove_version_from_href(href):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
parsed_url = urllib.parse.urlsplit(href)
|
parsed_url = urllib.parse.urlsplit(href)
|
||||||
url_parts = parsed_url.path.split('/', 2)
|
url_parts = parsed_url.path.split('/')
|
||||||
|
|
||||||
# NOTE: this should match vX.X or vX
|
# NOTE: this should match vX.X or vX
|
||||||
expression = re.compile(r'^v([0-9]+|[0-9]+\.[0-9]+)(/.*|$)')
|
expression = re.compile(r'^v([0-9]+|[0-9]+\.[0-9]+)(/.*|$)')
|
||||||
|
@ -261,7 +261,9 @@ class MiscFunctionsTest(test.TestCase):
|
|||||||
('http://cinder.example.com/v1.1/images/v10.5',
|
('http://cinder.example.com/v1.1/images/v10.5',
|
||||||
'http://cinder.example.com/images/v10.5'),
|
'http://cinder.example.com/images/v10.5'),
|
||||||
('http://cinder.example.com/cinder/v2',
|
('http://cinder.example.com/cinder/v2',
|
||||||
'http://cinder.example.com/cinder'))
|
'http://cinder.example.com/cinder'),
|
||||||
|
('http://cinder.example.com/volume/v2/123',
|
||||||
|
'http://cinder.example.com/volume/123'))
|
||||||
@ddt.unpack
|
@ddt.unpack
|
||||||
def test_remove_version_from_href(self, fixture, expected):
|
def test_remove_version_from_href(self, fixture, expected):
|
||||||
"""Test for removing version from href
|
"""Test for removing version from href
|
||||||
|
Loading…
Reference in New Issue
Block a user