MCPcopy Create free account
hub / github.com/Kaggle/docker-python / HTTPHandler

Class HTTPHandler

tests/test_bigquery.py:21–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 API_BASE_URL = "http://127.0.0.1:2121"
20 def _test_integration(self, client):
21 class HTTPHandler(BaseHTTPRequestHandler):
22 called = False
23 bearer_header_found = False
24
25 def do_HEAD(self):
26 self.send_response(200)
27
28 def do_GET(self):
29 HTTPHandler.called = True
30 HTTPHandler.bearer_header_found = any(
31 k for k in self.headers if k == "authorization" and self.headers[k] == "Bearer secret")
32 self.send_response(200)
33 self.send_header("Content-type", "application/json")
34 self.end_headers()
35 sample_dataset = {
36 "id": "bigqueryproject:datasetname",
37 "datasetReference": {
38 "datasetId": "datasetname",
39 "projectId": "bigqueryproject"
40 }
41 }
42 self.wfile.write(json.dumps({"kind": "bigquery#datasetList", "datasets": [sample_dataset]}).encode("utf-8"))
43
44 server_address = urlparse(self.API_BASE_URL)
45 with HTTPServer((server_address.hostname, server_address.port), HTTPHandler) as httpd:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected