rtutil: Fix parsing server URLs that include /REST/.
This commit is contained in:
parent
a3630ab04e
commit
e8e7137216
2 changed files with 7 additions and 1 deletions
|
@ -50,7 +50,7 @@ class RT:
|
||||||
self.rt = rt_client
|
self.rt = rt_client
|
||||||
urlparts = urlparse.urlparse(rt_client.url)
|
urlparts = urlparse.urlparse(rt_client.url)
|
||||||
try:
|
try:
|
||||||
index = urlparts.path.index('/REST/')
|
index = urlparts.path.rindex('/REST/')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
base_path = urlparts.path.rstrip('/') + '/'
|
base_path = urlparts.path.rstrip('/') + '/'
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -121,3 +121,9 @@ def test_exists_caches(new_client):
|
||||||
])
|
])
|
||||||
def test_parse(rt, link, expected):
|
def test_parse(rt, link, expected):
|
||||||
assert rt.parse(link) == expected
|
assert rt.parse(link) == expected
|
||||||
|
|
||||||
|
def test_uncommon_server_url_parsing():
|
||||||
|
url = 'https://example.org/REST/1.0/'
|
||||||
|
client = testutil.RTClient(url + 'REST/1.0/')
|
||||||
|
rt = rtutil.RT(client)
|
||||||
|
assert rt.url(1).startswith(url)
|
||||||
|
|
Loading…
Reference in a new issue