Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

Commit

Permalink
Client: handle trailing slashs
Browse files Browse the repository at this point in the history
  • Loading branch information
eplaut committed Jun 26, 2016
1 parent 195cd7b commit bc8d99e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion butler/__version__.py
@@ -1 +1 @@
__version__ = '0.2.1' # pragma: no cover
__version__ = '0.2.2' # pragma: no cover
2 changes: 1 addition & 1 deletion butler/client.py
Expand Up @@ -13,7 +13,7 @@ def __init__(self, butler, url):
:param server: Butler instance
"""
self.url = url
self.url = url.rstrip('/')
self.butler = butler
self.functions = {}
self.session = requests.Session()
Expand Down
1 change: 1 addition & 0 deletions butler/server.py
Expand Up @@ -24,6 +24,7 @@ def __init__(self, butler, url):
self._app = Flask(__name__)

# register functions to app routes
self.butler = butler
self.functions = butler.functions
self._register_urls()

Expand Down
8 changes: 8 additions & 0 deletions tests/test_client.py
Expand Up @@ -32,3 +32,11 @@ def test_client_not_exits_function(butler_client):
def test_client_unsupported_function(butler_client):
with slash.assert_raises(AttributeError):
butler_client.init_functions()

def test_client_rstrip_url(butler_client):
r = butler_client.get_test_get()
assert r.status_code == 200

new_butler_client = butler_client.butler.Client('http://localhost:8888/')
r = new_butler_client.get_test_get()
assert r.status_code == 200

0 comments on commit bc8d99e

Please sign in to comment.