File tree 3 files changed +2
-30
lines changed 3 files changed +2
-30
lines changed Original file line number Diff line number Diff line change @@ -465,16 +465,13 @@ def get_list_database(self):
465
465
"""
466
466
return list (self .query ("SHOW DATABASES" ).get_points ())
467
467
468
- def create_database (self , dbname , if_not_exists = False ):
468
+ def create_database (self , dbname ):
469
469
"""Create a new database in InfluxDB.
470
470
471
471
:param dbname: the name of the database to create
472
472
:type dbname: str
473
473
"""
474
- if if_not_exists :
475
- self .query ("CREATE DATABASE IF NOT EXISTS \" %s\" " % dbname )
476
- else :
477
- self .query ("CREATE DATABASE \" %s\" " % dbname )
474
+ self .query ("CREATE DATABASE \" %s\" " % dbname )
478
475
479
476
def drop_database (self , dbname ):
480
477
"""Drop a database from InfluxDB.
Original file line number Diff line number Diff line change @@ -418,19 +418,6 @@ def test_create_database(self):
418
418
'create database "new_db"'
419
419
)
420
420
421
- def test_create_database_with_exist_check (self ):
422
- with requests_mock .Mocker () as m :
423
- m .register_uri (
424
- requests_mock .GET ,
425
- "http://localhost:8086/query" ,
426
- text = '{"results":[{}]}'
427
- )
428
- self .cli .create_database ('new_db' , if_not_exists = True )
429
- self .assertEqual (
430
- m .last_request .qs ['q' ][0 ],
431
- 'create database if not exists "new_db"'
432
- )
433
-
434
421
def test_create_numeric_named_database (self ):
435
422
with requests_mock .Mocker () as m :
436
423
m .register_uri (
Original file line number Diff line number Diff line change @@ -133,18 +133,6 @@ def test_create_database(self):
133
133
[{'name' : 'new_db_1' }, {'name' : 'new_db_2' }]
134
134
)
135
135
136
- def test_create_database_twice_if_not_exist (self ):
137
- self .assertIsNone (self .cli .create_database ('new_db' ))
138
- self .assertIsNone (
139
- self .cli .create_database ('new_db' , if_not_exists = True ))
140
-
141
- def test_create_database_twice_fails (self ):
142
- self .assertIsNone (self .cli .create_database ('new_db' ))
143
- with self .assertRaises (InfluxDBClientError ) as ctx :
144
- self .cli .create_database ('new_db' )
145
- self .assertEqual ('database already exists' ,
146
- ctx .exception .content )
147
-
148
136
def test_get_list_series_empty (self ):
149
137
rsp = self .cli .get_list_series ()
150
138
self .assertEqual ([], rsp )
You can’t perform that action at this time.
0 commit comments