From 9fe90554ff1c8c7aea9e1e1e210419a845579edd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 20 Apr 2018 20:07:03 +0200 Subject: [PATCH] Store duration in http requests --- store.py | 2 ++ tests/test_store.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/store.py b/store.py index 45a5233..0c018e0 100644 --- a/store.py +++ b/store.py @@ -211,6 +211,7 @@ class ReportStore: "body": body, "headers": headers, "status": response.status_code, + "duration": response.elapsed.total_seconds(), "response": None, "response_same_as": self.last_http["date"] }) @@ -222,6 +223,7 @@ class ReportStore: "body": body, "headers": headers, "status": response.status_code, + "duration": response.elapsed.total_seconds(), "response": response.text, "response_same_as": None, }) 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): response = mock.Mock() response.status_code = 200 response.text = "Hey" + response.elapsed.total_seconds.return_value = 120 report_store.log_http_request("method", "url", "body", "headers", response) @@ -840,6 +841,7 @@ class ReportStoreTest(WebMockTestCase): 'body': 'body', 'headers': 'headers', 'status': 200, + 'duration': 120, 'response': 'Hey', 'response_same_as': None, }) -- 2.41.0