(self, path, data=None)
| 3029 | ) |
| 3030 | |
| 3031 | def http_post(self, path, data=None): |
| 3032 | # Note, the connection to the mock server needs to be closed after |
| 3033 | # each request because the server is single threaded. |
| 3034 | ctx = ssl.create_default_context(cafile=CA_PEM) |
| 3035 | ctx.load_cert_chain(CLIENT_PEM) |
| 3036 | ctx.check_hostname = False |
| 3037 | ctx.verify_mode = ssl.CERT_NONE |
| 3038 | conn = http.client.HTTPSConnection("127.0.0.1:9003", context=ctx) |
| 3039 | try: |
| 3040 | if data is not None: |
| 3041 | headers = {"Content-type": "application/json"} |
| 3042 | body = json.dumps(data) |
| 3043 | else: |
| 3044 | headers = {} |
| 3045 | body = None |
| 3046 | conn.request("POST", path, body, headers) |
| 3047 | res = conn.getresponse() |
| 3048 | res.read() |
| 3049 | finally: |
| 3050 | conn.close() |
| 3051 | |
| 3052 | def _test(self, provider, master_key): |
| 3053 | self.http_post("/reset") |
no test coverage detected