@@ -19,6 +19,8 @@ class GlobalData:
1919 token : str = None
2020 sys_db_name : str = "_system"
2121 username : str = generate_username ()
22+ cluster : bool = False
23+ enterprise : bool = False
2224
2325
2426global_data = GlobalData ()
@@ -40,6 +42,12 @@ def pytest_addoption(parser):
4042 parser .addoption (
4143 "--secret" , action = "store" , default = "secret" , help = "ArangoDB JWT secret"
4244 )
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+ )
4351
4452
4553def pytest_configure (config ):
@@ -52,6 +60,8 @@ def pytest_configure(config):
5260 global_data .password = config .getoption ("password" )
5361 global_data .secret = config .getoption ("secret" )
5462 global_data .token = JwtToken .generate_token (global_data .secret )
63+ global_data .cluster = config .getoption ("cluster" )
64+ global_data .enterprise = config .getoption ("enterprise" )
5565
5666
5767@pytest .fixture
@@ -74,6 +84,16 @@ def basic_auth_root(root, password):
7484 return Auth (username = root , password = password )
7585
7686
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+
7797@pytest .fixture
7898def username ():
7999 return global_data .username
@@ -126,18 +146,18 @@ async def sys_db(arango_client, sys_db_name, basic_auth_root):
126146
127147
128148@pytest_asyncio .fixture
129- async def test_db (arango_client , sys_db , password ):
149+ async def test_db (arango_client , sys_db , username , password ):
130150 tst_db_name = generate_db_name ()
131151 tst_user = UserInfo (
132- user = generate_username () ,
152+ user = username ,
133153 password = password ,
134154 active = True ,
135155 )
136156 await sys_db .create_database (tst_db_name , users = [tst_user ])
137157 yield await arango_client .db (
138158 tst_db_name ,
139159 auth_method = "basic" ,
140- auth = Auth (username = tst_user . user , password = password ),
160+ auth = Auth (username = username , password = password ),
141161 verify = False ,
142162 )
143163 await sys_db .delete_database (tst_db_name )
0 commit comments