Skip to content

Commit 56b0bb5

Browse files
fix: add test for URL path prefix handling in test_write_with_path_prefix
1 parent e7eca1a commit 56b0bb5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_write_local_server.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ 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+
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+
).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"}))
58+
4359
def test_write_with_write_options(self, httpserver: HTTPServer):
4460
self.set_response_status(httpserver, 200)
4561

0 commit comments

Comments
 (0)