def test_base_entry(self): self.maxDiff = 5000 entry = Entry(request=Request(method="GET", url="http://example.com/")) out = entry.dump().data self.assertEqual( out, { "pageref": None, "startedDateTime": None, "time": -1, "request": { "method": "GET", "url": "http://example.com/", "httpVersion": "HTTP/1.0", "headerSize": -1, "bodySize": -1, "cookies": [], "headers": [], "queryString": [], "postData": unittest.mock.ANY, "comment": "", }, "response": None, "cache": None, "timings": None, "serverIPAddress": None, "connection": None, "comment": "", })
def test_cache(self): entry = Entry(cache=Cache()) out = entry.dump().data self.assertEqual(out["cache"], { "beforeRequest": None, "afterRequest": None, "comment": "", })
def test_timings(self): entry = Entry(timings=Timings( blocked=12, dns=3, connect=15, send=20, wait=38, receive=12)) out = entry.dump().data self.assertEqual( out["timings"], { "blocked": 12, "dns": 3, "connect": 15, "send": 20, "wait": 38, "receive": 12, "ssl": -1, "comment": "", })
def test_response(self): entry = Entry(response=Response( status=200, status_text="OK", http_version="HTTP/1.0")) out = entry.dump().data self.assertEqual( out["response"], { "status": 200, "statusText": "OK", "httpVersion": "HTTP/1.0", "cookies": [], "headers": [], "content": unittest.mock.ANY, "redirectURL": "", "headerSize": -1, "bodySize": -1, "comment": "", })