1
1
import random
2
2
import string
3
+
3
4
from terminusdb_client .woqlclient .connectionConfig import ConnectionConfig
4
5
5
6
@@ -9,9 +10,10 @@ class TestConnectionConfig:
9
10
local_user = "admin"
10
11
# Set of random string values that can as replacements for dummy id valuess
11
12
# i.e accountid,branchid,refid etc
12
- id_value = '' .join (random .choice (
13
- string .ascii_uppercase + string .ascii_lowercase
14
- ) for _ in range (16 ))
13
+ id_value = "" .join (
14
+ random .choice (string .ascii_uppercase + string .ascii_lowercase )
15
+ for _ in range (16 )
16
+ )
15
17
# to be review !!!!!
16
18
connection_config = ConnectionConfig (
17
19
start_server_url ,
@@ -50,8 +52,11 @@ def test_set_remote_auth(self):
50
52
auth_dict = {type : "jwt" , "key" : "eyJhbGciOiJIUzI1NiIsInR5c" }
51
53
self .connection_config .set_remote_auth (auth_dict )
52
54
assert self .connection_config .remote_auth == auth_dict
53
- auth_dict = {type : "basic" , "user" : self .local_user ,
54
- "key" : "admin_testDB_Password" }
55
+ auth_dict = {
56
+ type : "basic" ,
57
+ "user" : self .local_user ,
58
+ "key" : "admin_testDB_Password" ,
59
+ }
55
60
self .connection_config .update (remote_auth = auth_dict )
56
61
assert self .connection_config .remote_auth == auth_dict
57
62
@@ -98,24 +103,46 @@ def test_db_url_fragmen(self):
98
103
self .connection_config .update (db = self .id_value )
99
104
self .connection_config .update (account = self .id_value )
100
105
db_url_fragment = self .connection_config .db_url_fragment ()
101
- assert db_url_fragment == f' { self .id_value } /{ self .id_value } '
106
+ assert db_url_fragment == f" { self .id_value } /{ self .id_value } "
102
107
103
108
def test_db_base (self ):
104
109
self .connection_config .update (db = self .id_value )
105
110
self .connection_config .update (account = self .id_value )
106
- db_base = self .connection_config .db_base ('push' )
107
- assert (
108
- db_base
109
- == f"http://localhost:6363/push/{ self .id_value } /{ self .id_value } "
110
- )
111
+ db_base = self .connection_config .db_base ("push" )
112
+ assert db_base == f"http://localhost:6363/push/{ self .id_value } /{ self .id_value } "
111
113
112
114
def test_repo_base (self ):
113
115
self .connection_config .update (db = self .id_value )
114
116
self .connection_config .update (account = self .id_value )
115
- db_base = self .connection_config .db_base ('pull' )
116
- default_base = self .connection_config .repo_base ('pull' )
117
- assert default_base == f"http://localhost:6363/pull/{ self .id_value } /{ self .id_value } /local"
117
+ self .connection_config .db_base ("pull" )
118
+ default_base = self .connection_config .repo_base ("pull" )
119
+ assert (
120
+ default_base
121
+ == f"http://localhost:6363/pull/{ self .id_value } /{ self .id_value } /local"
122
+ )
118
123
self .connection_config .update (repo = self .id_value )
119
- updated_base = self .connection_config .db_base ('pull' )
120
- assert updated_base == f"http://localhost:6363/pull/{ self .id_value } /{ self .id_value } "
124
+ updated_base = self .connection_config .db_base ("pull" )
125
+ assert (
126
+ updated_base
127
+ == f"http://localhost:6363/pull/{ self .id_value } /{ self .id_value } "
128
+ )
121
129
130
+ def test_account (self ):
131
+ self .connection_config .account = self .id_value
132
+ assert self .connection_config .account == self .id_value
133
+
134
+ def test_db (self ):
135
+ self .connection_config .db = self .id_value
136
+ assert self .connection_config .db == self .id_value
137
+
138
+ def test_repo (self ):
139
+ self .connection_config .repo = self .id_value
140
+ assert self .connection_config .repo == self .id_value
141
+
142
+ def branch (self ):
143
+ self .connection_config .branch = self .id_value
144
+ assert self .connection_config .branch == self .id_value
145
+
146
+ def ref (self ):
147
+ self .connection_config .ref = self .id_value
148
+ assert self .connection_config .ref == self .id_value
0 commit comments