Skip to content

Commit c79653b

Browse files
committed
fix(gooddata-pipelines): fix create_from_profile constructor
1 parent e907728 commit c79653b

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

gooddata-pipelines/gooddata_pipelines/provisioning/provisioning.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def create_from_profile(
5050
) -> TProvisioning:
5151
"""Creates a provisioner instance using a GoodData profile file."""
5252
content = profile_content(profile, profiles_path)
53-
return cls(**content)
53+
return cls(host=content["host"], token=content["token"])
5454

5555
@staticmethod
5656
def _validate_credentials(host: str, token: str) -> None:
@@ -165,5 +165,4 @@ def _handle_fatal_exception(self, e: Exception) -> None:
165165

166166
self.logger.error(exception_message)
167167

168-
if not self.logger.subscribers:
169-
raise Exception(exception_message)
168+
raise Exception(exception_message)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# (C) 2025 GoodData Corporation
2+
mock_profile:
3+
host: http://localhost:3000
4+
token: some_user_token

gooddata-pipelines/tests/provisioning/test_provisioning.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# (C) 2025 GoodData Corporation
2+
from pathlib import Path
3+
24
import pytest
35

46
from gooddata_pipelines import (
@@ -14,6 +16,8 @@
1416
from gooddata_pipelines.provisioning.entities.workspaces.models import (
1517
WorkspaceIncrementalLoad,
1618
)
19+
from gooddata_pipelines.provisioning.provisioning import Provisioning
20+
from tests.conftest import TEST_DATA_DIR
1721

1822
WORKSPACE_DATA_TO_FAIL = [
1923
WorkspaceFullLoad(
@@ -102,3 +106,13 @@ def test_fail_type_validation(
102106
)
103107

104108
assert "Not all elements in source data are instances of" in str(e)
109+
110+
111+
def test_create_from_profile() -> None:
112+
"""Test creating a provisioner from a profile."""
113+
provisioner: Provisioning = Provisioning.create_from_profile(
114+
profile="mock_profile",
115+
profiles_path=Path(f"{TEST_DATA_DIR}/profiles.yaml"),
116+
)
117+
assert provisioner._api._domain == "http://localhost:3000"
118+
assert provisioner._api._token == "some_user_token"

0 commit comments

Comments
 (0)