Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions gooddata-pipelines/gooddata_pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from .backup_and_restore.backup_manager import BackupManager
from .backup_and_restore.models.storage import (
BackupRestoreConfig,
LocalStorageConfig,
S3StorageConfig,
StorageType,
)
from .backup_and_restore.storage.local_storage import LocalStorage
Expand Down Expand Up @@ -51,6 +53,8 @@
"UserIncrementalLoad",
"UserGroupIncrementalLoad",
"PermissionFullLoad",
"LocalStorageConfig",
"S3StorageConfig",
"PermissionIncrementalLoad",
"UserFullLoad",
"UserGroupFullLoad",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def create_from_profile(
) -> TProvisioning:
"""Creates a provisioner instance using a GoodData profile file."""
content = profile_content(profile, profiles_path)
return cls(**content)
return cls(host=content["host"], token=content["token"])

@staticmethod
def _validate_credentials(host: str, token: str) -> None:
Expand Down Expand Up @@ -165,5 +165,4 @@ def _handle_fatal_exception(self, e: Exception) -> None:

self.logger.error(exception_message)

if not self.logger.subscribers:
raise Exception(exception_message)
raise Exception(exception_message)
4 changes: 4 additions & 0 deletions gooddata-pipelines/tests/data/profiles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# (C) 2025 GoodData Corporation
mock_profile:
host: http://localhost:3000
token: some_user_token
14 changes: 14 additions & 0 deletions gooddata-pipelines/tests/provisioning/test_provisioning.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# (C) 2025 GoodData Corporation
from pathlib import Path

import pytest

from gooddata_pipelines import (
Expand All @@ -14,6 +16,8 @@
from gooddata_pipelines.provisioning.entities.workspaces.models import (
WorkspaceIncrementalLoad,
)
from gooddata_pipelines.provisioning.provisioning import Provisioning
from tests.conftest import TEST_DATA_DIR

WORKSPACE_DATA_TO_FAIL = [
WorkspaceFullLoad(
Expand Down Expand Up @@ -102,3 +106,13 @@ def test_fail_type_validation(
)

assert "Not all elements in source data are instances of" in str(e)


def test_create_from_profile() -> None:
"""Test creating a provisioner from a profile."""
provisioner: Provisioning = Provisioning.create_from_profile(
profile="mock_profile",
profiles_path=Path(f"{TEST_DATA_DIR}/profiles.yaml"),
)
assert provisioner._api._domain == "http://localhost:3000"
assert provisioner._api._token == "some_user_token"
Loading