File tree Expand file tree Collapse file tree
terminusdb_client/tests/integration_tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " terminusdb-client"
3- version = " 12.0.3 "
3+ version = " 12.0.5 "
44description = " Python client for Terminus DB"
55authors = [" TerminusDB group" ]
66license = " Apache Software License"
Original file line number Diff line number Diff line change @@ -145,9 +145,7 @@ def docker_url(pytestconfig):
145145 """
146146 # Check if a server is already running (port 6363)
147147 if is_local_server_running ():
148- print (
149- "\n ✓ Using existing TerminusDB server at http://127.0.0.1:6363"
150- )
148+ print ("\n ✓ Using existing TerminusDB server at http://127.0.0.1:6363" )
151149 yield "http://127.0.0.1:6363"
152150 return # Don't clean up - server was already running
153151
Original file line number Diff line number Diff line change 1212
1313test_user_agent = "terminusdb-client-python-tests"
1414
15+ _CLIENT_TEST_DBS = ["test_diff_ops" ]
16+ _CLIENT_TEST_ORGS = ["testOrg235091" ]
17+
18+
19+ @pytest .fixture (scope = "module" , autouse = True )
20+ def cleanup_client_resources (docker_url ):
21+ """Delete stale databases and organizations before the module and clean up after."""
22+ client = Client (docker_url , user_agent = test_user_agent )
23+ client .connect ()
24+
25+ def _cleanup ():
26+ for db in _CLIENT_TEST_DBS :
27+ try :
28+ client .delete_database (db )
29+ except Exception :
30+ pass
31+ for org in _CLIENT_TEST_ORGS :
32+ # Ensure admin has access so we can list and delete databases
33+ try :
34+ client .change_capabilities (
35+ {
36+ "operation" : "grant" ,
37+ "scope" : f"Organization/{ org } " ,
38+ "user" : "User/admin" ,
39+ "roles" : ["Role/admin" ],
40+ }
41+ )
42+ except Exception :
43+ pass
44+ try :
45+ dbs = client .get_organization_user_databases (org = org , username = "admin" )
46+ for db in dbs :
47+ try :
48+ client .delete_database (db ["name" ], team = org )
49+ except Exception :
50+ pass
51+ except Exception :
52+ pass
53+ # Revoke capabilities before deleting org
54+ try :
55+ client .change_capabilities (
56+ {
57+ "operation" : "revoke" ,
58+ "scope" : f"Organization/{ org } " ,
59+ "user" : "User/admin" ,
60+ "roles" : ["Role/admin" ],
61+ }
62+ )
63+ except Exception :
64+ pass
65+ try :
66+ client .delete_organization (org )
67+ except Exception :
68+ pass
69+
70+ _cleanup ()
71+ yield
72+ _cleanup ()
73+
1574
1675def test_not_ok ():
1776 client = Client ("http://localhost:6363" )
Original file line number Diff line number Diff line change 88
99test_user_agent = "terminusdb-client-python-tests"
1010
11+ _SCHEMA_TEST_DBS = [
12+ "test_docapi" ,
13+ "test_docapi2" ,
14+ "test_datetime" ,
15+ "test_compress_data" ,
16+ "test_repeated_load" ,
17+ "test_repeated_load_fails" ,
18+ ]
19+
20+
21+ @pytest .fixture (scope = "module" , autouse = True )
22+ def cleanup_schema_databases (docker_url ):
23+ """Delete stale databases before the module and clean up after."""
24+ client = Client (docker_url , user_agent = test_user_agent )
25+ client .connect ()
26+ for db in _SCHEMA_TEST_DBS :
27+ try :
28+ client .delete_database (db )
29+ except Exception :
30+ pass
31+ yield
32+ for db in _SCHEMA_TEST_DBS :
33+ try :
34+ client .delete_database (db )
35+ except Exception :
36+ pass
37+
1138
1239def test_create_schema (docker_url , test_schema ):
1340 my_schema = test_schema
You can’t perform that action at this time.
0 commit comments