diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-04-20 20:07:03 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-04-20 20:07:03 +0200 |
commit | 9fe90554ff1c8c7aea9e1e1e210419a845579edd (patch) | |
tree | 9e99cf16f322398aa00b681bbf1e70879883d65c | |
parent | 18de421e455ab4b125a6684d703a296562097e6b (diff) | |
download | Trader-9fe90554ff1c8c7aea9e1e1e210419a845579edd.tar.gz Trader-9fe90554ff1c8c7aea9e1e1e210419a845579edd.tar.zst Trader-9fe90554ff1c8c7aea9e1e1e210419a845579edd.zip |
Store duration in http requests
-rw-r--r-- | store.py | 2 | ||||
-rw-r--r-- | tests/test_store.py | 2 |
2 files changed, 4 insertions, 0 deletions
@@ -211,6 +211,7 @@ class ReportStore: | |||
211 | "body": body, | 211 | "body": body, |
212 | "headers": headers, | 212 | "headers": headers, |
213 | "status": response.status_code, | 213 | "status": response.status_code, |
214 | "duration": response.elapsed.total_seconds(), | ||
214 | "response": None, | 215 | "response": None, |
215 | "response_same_as": self.last_http["date"] | 216 | "response_same_as": self.last_http["date"] |
216 | }) | 217 | }) |
@@ -222,6 +223,7 @@ class ReportStore: | |||
222 | "body": body, | 223 | "body": body, |
223 | "headers": headers, | 224 | "headers": headers, |
224 | "status": response.status_code, | 225 | "status": response.status_code, |
226 | "duration": response.elapsed.total_seconds(), | ||
225 | "response": response.text, | 227 | "response": response.text, |
226 | "response_same_as": None, | 228 | "response_same_as": None, |
227 | }) | 229 | }) |
diff --git a/tests/test_store.py b/tests/test_store.py index 4232fc3..e281adb 100644 --- a/tests/test_store.py +++ b/tests/test_store.py | |||
@@ -830,6 +830,7 @@ class ReportStoreTest(WebMockTestCase): | |||
830 | response = mock.Mock() | 830 | response = mock.Mock() |
831 | response.status_code = 200 | 831 | response.status_code = 200 |
832 | response.text = "Hey" | 832 | response.text = "Hey" |
833 | response.elapsed.total_seconds.return_value = 120 | ||
833 | 834 | ||
834 | report_store.log_http_request("method", "url", "body", | 835 | report_store.log_http_request("method", "url", "body", |
835 | "headers", response) | 836 | "headers", response) |
@@ -840,6 +841,7 @@ class ReportStoreTest(WebMockTestCase): | |||
840 | 'body': 'body', | 841 | 'body': 'body', |
841 | 'headers': 'headers', | 842 | 'headers': 'headers', |
842 | 'status': 200, | 843 | 'status': 200, |
844 | 'duration': 120, | ||
843 | 'response': 'Hey', | 845 | 'response': 'Hey', |
844 | 'response_same_as': None, | 846 | 'response_same_as': None, |
845 | }) | 847 | }) |