@@ -40,22 +40,21 @@ def test_write_default_params(self, httpserver: HTTPServer):
4040 method = "POST" , uri = "/api/v2/write" ,
4141 query_string = {"org" : "ORG" , "bucket" : "DB" , "precision" : "ns" }))
4242
43- # def test_write_with_path_prefix(self):
44- # httpserver = HTTPServer(host="localhost", port=8086, ssl_context=None)
45- # httpserver.start()
46- # httpserver.expect_request("/prefix/prefix1/api/v2/write").respond_with_data(status=200)
47- #
48- # with InfluxDBClient3(
49- # host=(httpserver.url_for("/prefix/prefix1")), org="ORG", database="DB", token="TOKEN",
50- # write_client_options=write_client_options(
51- # write_options=WriteOptions(write_type=WriteType.synchronous)
52- # )
53- # ) as client:
54- # client.write(self.SAMPLE_RECORD)
55- #
56- # self.assert_request_made(httpserver, RequestMatcher(
57- # method="POST", uri="/prefix/prefix1/api/v2/write",
58- # query_string={"org": "ORG", "bucket": "DB", "precision": "ns"}))
43+ def test_write_with_path_prefix (self ):
44+ with HTTPServer (host = "localhost" , port = 8086 , ssl_context = None ) as httpserver :
45+ httpserver .expect_request ("/prefix/prefix1/api/v2/write" ).respond_with_data (status = 200 )
46+
47+ with InfluxDBClient3 (
48+ host = (httpserver .url_for ("/prefix/prefix1" )), org = "ORG" , database = "DB" , token = "TOKEN" ,
49+ write_client_options = write_client_options (
50+ write_options = WriteOptions (write_type = WriteType .synchronous )
51+ )
52+ ) as client :
53+ client .write (self .SAMPLE_RECORD )
54+
55+ self .assert_request_made (httpserver , RequestMatcher (
56+ method = "POST" , uri = "/prefix/prefix1/api/v2/write" ,
57+ query_string = {"org" : "ORG" , "bucket" : "DB" , "precision" : "ns" }))
5958
6059 def test_write_with_write_options (self , httpserver : HTTPServer ):
6160 self .set_response_status (httpserver , 200 )
0 commit comments