Merge "Extend remove_version_from_href support"

This commit is contained in:
Zuul 2020-03-19 14:03:16 +00:00 committed by Gerrit Code Review
commit cc340090a8
2 changed files with 4 additions and 2 deletions

View File

@ -202,7 +202,7 @@ def remove_version_from_href(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
expression = re.compile(r'^v([0-9]+|[0-9]+\.[0-9]+)(/.*|$)')

View File

@ -261,7 +261,9 @@ class MiscFunctionsTest(test.TestCase):
('http://cinder.example.com/v1.1/images/v10.5',
'http://cinder.example.com/images/v10.5'),
('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
def test_remove_version_from_href(self, fixture, expected):
"""Test for removing version from href