Skip to content

Commit f129d57

Browse files
committed
fix: read settings from special vars in e2e tests
We do this so that the usual environment variables do not interfere with other tests where the settings class automatically reads them.
1 parent 27616e4 commit f129d57

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

tests/test_e2e/test_client.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,25 @@
1616
"""Ensure a consistent public package interface."""
1717

1818

19-
import gzip
19+
import os
2020

2121
import pytest
2222

2323
from structurizr import StructurizrClient, StructurizrClientSettings, Workspace
2424

2525

26+
if not (
27+
os.getenv("SECRET_WORKSPACE_ID")
28+
and os.getenv("SECRET_API_KEY")
29+
and os.getenv("SECRET_API_SECRET")
30+
):
31+
pytest.skip(
32+
"The e2e tests require setting the secret environment variables with the "
33+
"workspace credentials.",
34+
allow_module_level=True,
35+
)
36+
37+
2638
@pytest.fixture(scope="module")
2739
def archive_location(tmp_path_factory):
2840
location = tmp_path_factory.mktemp("structurizr")
@@ -32,7 +44,12 @@ def archive_location(tmp_path_factory):
3244
@pytest.fixture(scope="module")
3345
def settings(archive_location):
3446
"""Provide the settings with values taken from the environment."""
35-
return StructurizrClientSettings(workspace_archive_location=archive_location)
47+
return StructurizrClientSettings(
48+
workspace_id=os.getenv("SECRET_WORKSPACE_ID"),
49+
api_key=os.getenv("SECRET_API_KEY"),
50+
api_secret=os.getenv("SECRET_API_SECRET"),
51+
workspace_archive_location=archive_location,
52+
)
3653

3754

3855
def test_empty_workspace_without_encryption(settings):

0 commit comments

Comments
 (0)