Skip to content

Commit dfec5c3

Browse files
committed
test: added test_url_attribute function
1 parent 626cefc commit dfec5c3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_InfluxDBClient.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,35 @@ def test_version(self):
323323
version = self.client.version()
324324
self.assertTrue(len(version) > 0)
325325

326+
def test_url_attribute(self):
327+
# Wrong URL attribute
328+
wrong_types = [
329+
None,
330+
True, False,
331+
123, 123.5,
332+
dict({"url" : "http://localhost:8086"}),
333+
list(["http://localhost:8086"]),
334+
tuple(("http://localhost:8086"))
335+
]
336+
correct_types = [
337+
"http://localhost:8086"
338+
]
339+
for url_type in wrong_types:
340+
try:
341+
client_not_running = InfluxDBClient(url=url_type, token="my-token", debug=True)
342+
status = True
343+
except ValueError as e:
344+
status = False
345+
self.assertFalse(status)
346+
for url_type in correct_types:
347+
try:
348+
client_not_running = InfluxDBClient(url=url_type, token="my-token", debug=True)
349+
status = True
350+
except ValueError as e:
351+
status = False
352+
self.assertTrue(status)
353+
354+
326355
def test_build(self):
327356
build = self.client.build()
328357
self.assertEqual('oss', build.lower())

0 commit comments

Comments
 (0)