Skip to content

Commit 727a64e

Browse files
authored
[test] allow env variable for opencti configuration in tests (#981)
1 parent 22f4979 commit 727a64e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tests/conftest.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import pytest
24
from pytest_cases import fixture
35

@@ -13,18 +15,22 @@
1315
@fixture(scope="session")
1416
def api_client(pytestconfig):
1517
if pytestconfig.getoption("--drone"):
16-
return OpenCTIApiClient(
17-
"http://opencti:4000",
18-
"bfa014e0-e02e-4aa6-a42b-603b19dcf159",
19-
ssl_verify=False,
18+
api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000")
19+
api_token = os.getenv(
20+
"OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159"
2021
)
2122
else:
22-
return OpenCTIApiClient(
23-
"http://localhost:4000",
24-
"d434ce02-e58e-4cac-8b4c-42bf16748e84",
25-
ssl_verify=False,
23+
api_url = os.getenv("OPENCTI_API_URL", "http://localhost:4000")
24+
api_token = os.getenv(
25+
"OPENCTI_API_TOKEN", "d434ce02-e58e-4cac-8b4c-42bf16748e84"
2626
)
2727

28+
return OpenCTIApiClient(
29+
api_url,
30+
api_token,
31+
ssl_verify=False,
32+
)
33+
2834

2935
@fixture(scope="session")
3036
def api_connector(api_client):

0 commit comments

Comments
 (0)