@@ -19,6 +19,8 @@ class GlobalData:
19
19
token : str = None
20
20
sys_db_name : str = "_system"
21
21
username : str = generate_username ()
22
+ cluster : bool = False
23
+ enterprise : bool = False
22
24
23
25
24
26
global_data = GlobalData ()
@@ -40,6 +42,12 @@ def pytest_addoption(parser):
40
42
parser .addoption (
41
43
"--secret" , action = "store" , default = "secret" , help = "ArangoDB JWT secret"
42
44
)
45
+ parser .addoption (
46
+ "--cluster" , action = "store_true" , help = "Run tests in a cluster setup"
47
+ )
48
+ parser .addoption (
49
+ "--enterprise" , action = "store_true" , help = "Run tests in an enterprise setup"
50
+ )
43
51
44
52
45
53
def pytest_configure (config ):
@@ -52,6 +60,8 @@ def pytest_configure(config):
52
60
global_data .password = config .getoption ("password" )
53
61
global_data .secret = config .getoption ("secret" )
54
62
global_data .token = JwtToken .generate_token (global_data .secret )
63
+ global_data .cluster = config .getoption ("cluster" )
64
+ global_data .enterprise = config .getoption ("enterprise" )
55
65
56
66
57
67
@pytest .fixture
@@ -74,6 +84,16 @@ def basic_auth_root(root, password):
74
84
return Auth (username = root , password = password )
75
85
76
86
87
+ @pytest .fixture
88
+ def clusetr ():
89
+ return global_data .cluster
90
+
91
+
92
+ @pytest .fixture
93
+ def enterprise ():
94
+ return global_data .enterprise
95
+
96
+
77
97
@pytest .fixture
78
98
def username ():
79
99
return global_data .username
@@ -126,18 +146,18 @@ async def sys_db(arango_client, sys_db_name, basic_auth_root):
126
146
127
147
128
148
@pytest_asyncio .fixture
129
- async def test_db (arango_client , sys_db , password ):
149
+ async def test_db (arango_client , sys_db , username , password ):
130
150
tst_db_name = generate_db_name ()
131
151
tst_user = UserInfo (
132
- user = generate_username () ,
152
+ user = username ,
133
153
password = password ,
134
154
active = True ,
135
155
)
136
156
await sys_db .create_database (tst_db_name , users = [tst_user ])
137
157
yield await arango_client .db (
138
158
tst_db_name ,
139
159
auth_method = "basic" ,
140
- auth = Auth (username = tst_user . user , password = password ),
160
+ auth = Auth (username = username , password = password ),
141
161
verify = False ,
142
162
)
143
163
await sys_db .delete_database (tst_db_name )
0 commit comments