Skip to content

Commit

Permalink
add slash if not existant in base url
Browse files Browse the repository at this point in the history
This adds a slash if one is not added in the configured value. It
removes one possibility of user error.

Signed-off-by: Arnaud Fiorini <[email protected]>
  • Loading branch information
arfio committed Jul 10, 2024
1 parent 29ba74a commit 35b3019
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions test_tsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ def test_fetch_traces(self):
self._delete_experiments()
self._delete_traces()

def test_fetch_with_other_client(self):
"""Expect client without end slash to respond with no traces"""
tsp_client = TspClient('http://localhost:8080/tsp/api')
response = tsp_client.fetch_traces()
assert response.status_code == 200
assert not response.model.traces

def test_fetch_traces_none(self):
"""Expect no traces without opening any."""
response = self.tsp_client.fetch_traces()
Expand Down
2 changes: 1 addition & 1 deletion tsp/tsp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, base_url):
'''
Constructor
'''
self.base_url = base_url
self.base_url = base_url if base_url.endswith('/') else base_url + '/'

def fetch_traces(self):
'''
Expand Down

0 comments on commit 35b3019

Please sign in to comment.