From f32578bbb8f1eb05f9b7d5800afa663bc3dcaf45 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 3 Jul 2017 12:13:56 +0800 Subject: [PATCH] move HttpNtlmAuth from runner to client --- ate/client.py | 6 ++++++ ate/runner.py | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ate/client.py b/ate/client.py index 8004e57c..986b445b 100644 --- a/ate/client.py +++ b/ate/client.py @@ -97,6 +97,12 @@ class HttpSession(requests.Session): request_meta["method"] = method request_meta["start_time"] = time.time() + if "HttpNtlmAuth" in kwargs: + from requests_ntlm import HttpNtlmAuth + auth_account = kwargs.pop("HttpNtlmAuth") + kwargs["auth"] = HttpNtlmAuth( + auth_account["username"], auth_account["password"]) + response = self._send_request_safe_mode(method, url, **kwargs) request_meta["url"] = (response.history and response.history[0] or response)\ .request.path_url diff --git a/ate/runner.py b/ate/runner.py index 9275c7d3..ac1ca0ef 100644 --- a/ate/runner.py +++ b/ate/runner.py @@ -78,12 +78,6 @@ class TestRunner(object): except KeyError: raise exception.ParamsError("URL or METHOD missed!") - if "HttpNtlmAuth" in parsed_request: - from requests_ntlm import HttpNtlmAuth - auth_account = parsed_request.pop("HttpNtlmAuth") - parsed_request["auth"] = HttpNtlmAuth( - auth_account["username"], auth_account["password"]) - resp = self.client.request(url=url, method=method, **parsed_request) resp_obj = response.ResponseObject(resp)