Skip to content

Commit

Permalink
Fixed broken test. Fixes #431
Browse files Browse the repository at this point in the history
  • Loading branch information
heyman committed Jun 13, 2016
1 parent 9e202a3 commit 2d11678
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions locust/test/test_locust_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,11 @@ class MyUnauthorizedLocust(HttpLocust):
locust = MyLocust()
unauthorized = MyUnauthorizedLocust()
authorized = MyAuthorizedLocust()
self.assertEqual("Authorized", authorized.client.get("/basic_auth").text)
self.assertFalse(locust.client.get("/basic_auth"))
self.assertFalse(unauthorized.client.get("/basic_auth"))
response = authorized.client.get("/basic_auth")
self.assertEqual(200, response.status_code)
self.assertEqual("Authorized", response.text)
self.assertEqual(401, locust.client.get("/basic_auth").status_code)
self.assertEqual(401, unauthorized.client.get("/basic_auth").status_code)

def test_log_request_name_argument(self):
from locust.stats import RequestStats, global_stats
Expand Down
2 changes: 1 addition & 1 deletion locust/test/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def do_redirect():

@app.route("/basic_auth")
def basic_auth():
auth = base64.b64decode(request.headers.get("Authorization").replace("Basic ", "")).decode('utf-8')
auth = base64.b64decode(request.headers.get("Authorization", "").replace("Basic ", "")).decode('utf-8')
if auth == "locust:menace":
return "Authorized"
resp = make_response("401 Authorization Required", 401)
Expand Down

0 comments on commit 2d11678

Please sign in to comment.