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
13 changes: 13 additions & 0 deletions docs/INTEGRATION_TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ CLOUD_SDK_CFG_DATA_ANONYMIZATION_DEFAULT_DESTINATION_NAME=your-client-certificat

The destination must be configured with `ClientCertificateAuthentication` and reference a certificate bundle containing the client certificate and private key.

### DMS Integration Tests

For DMS (Document Management Service) integration tests, configure the following variables in `.env_integration_tests`:

```bash
# DMS Configuration
CLOUD_SDK_CFG_SDM_DEFAULT_URI=https://your-sdm-api-uri-here
CLOUD_SDK_CFG_SDM_DEFAULT_UAA='{"url":"https://your-auth-url","clientid":"your-client-id","clientsecret":"your-client-secret","identityzone":"your-identity-zone"}'
```

**Note**: The test fixture automatically onboards test repositories (standard and version-enabled) at session start and cleans them up on teardown. No pre-existing repositories are required.

### ADMS Integration Tests

For ADMS (Advanced Document Management Service) integration tests, configure the following variables in `.env_integration_tests`:
Expand Down Expand Up @@ -145,6 +157,7 @@ uv run pytest tests/core/integration/auditlog -v
uv run pytest tests/core/integration/data_anonymization -v
uv run pytest tests/objectstore/integration/ -v
uv run pytest tests/destination/integration/ -v
uv run pytest tests/dms/integration/ -v
uv run pytest tests/agent_memory/integration/ -v
uv run pytest tests/adms/integration/ -v
uv run pytest tests/agentgateway/integration/ -v
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "sap-cloud-sdk"
version = "0.26.0"
version = "0.26.1"
description = "SAP Cloud SDK for Python"
readme = "README.md"
license = "Apache-2.0"
Expand Down
4 changes: 1 addition & 3 deletions src/sap_cloud_sdk/dms/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ def __init__(
read_timeout=read_timeout,
)
self._telemetry_source: Optional[Module] = None
logger.debug(
"DMSClient initialized for instance '%s'", credentials.instance_name
)
logger.debug("DMSClient initialized")

@record_metrics(Module.DMS, Operation.DMS_ONBOARD_REPOSITORY)
def onboard_repository(
Expand Down
4 changes: 1 addition & 3 deletions src/sap_cloud_sdk/dms/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class BindingData:
uaa: JSON string containing XSUAA authentication credentials
"""

instance_name: str
uri: str
uaa: str

Expand Down Expand Up @@ -91,7 +90,6 @@ def to_credentials(self) -> DMSCredentials:
token_url = uaa_data["url"].rstrip("/") + "/oauth/token"

return DMSCredentials(
instance_name=self.instance_name,
uri=self.uri,
client_id=uaa_data["clientid"],
client_secret=uaa_data["clientsecret"],
Expand All @@ -114,7 +112,7 @@ def load_sdm_config_from_env_or_mount(instance: Optional[str] = None) -> DMSCred
"""
inst = instance or "default"
binding = BindingData(
uri="", uaa="", instance_name=""
uri="", uaa=""
) # Initialize with empty values; will be populated by resolver

try:
Expand Down
1 change: 0 additions & 1 deletion src/sap_cloud_sdk/dms/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def _to_dict_drop_none(obj: Any) -> dict[str, Any]:
class DMSCredentials:
"""Credentials for authenticating with the DMS service."""

instance_name: str
uri: str
client_id: str
client_secret: str
Expand Down
44 changes: 44 additions & 0 deletions tests/dms/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from sap_cloud_sdk.dms import create_client
from sap_cloud_sdk.dms.model import InternalRepoRequest
import pytest
import logging
from pathlib import Path
from dotenv import load_dotenv

logger = logging.getLogger(__name__)

_SDK_TEST_REPO_PREFIX = "sdk-integration-test-"


@pytest.fixture(scope="session")
def dms_client():
Expand All @@ -17,6 +23,44 @@ def dms_client():
pytest.skip(f"DMS integration tests require credentials: {e}")


@pytest.fixture(scope="session", autouse=True)
def _setup_test_repositories(dms_client):
"""Create test repositories for integration tests and clean up after.

Always onboards a standard and a version-enabled repository for the test
session, then deletes them on teardown.
"""
created_repos = []

logger.info("Onboarding test repositories")
repo = dms_client.onboard_repository(
InternalRepoRequest(
displayName=f"{_SDK_TEST_REPO_PREFIX}standard",
description="Auto-created by SDK integration tests",
)
)
created_repos.append(repo.id)

repo = dms_client.onboard_repository(
InternalRepoRequest(
displayName=f"{_SDK_TEST_REPO_PREFIX}versioned",
description="Auto-created by SDK integration tests (versioning)",
isVersionEnabled=True,
)
)
created_repos.append(repo.id)

yield

# Cleanup: delete repositories we created
for repo_id in created_repos:
try:
dms_client.delete_repository(repo_id)
logger.info("Cleaned up test repository %s", repo_id)
except Exception as e:
logger.warning("Failed to clean up test repository %s: %s", repo_id, e)


def _setup_cloud_mode():
"""Common setup for cloud mode integration tests."""
env_file = Path(__file__).parents[3] / ".env_integration_tests"
Expand Down
1 change: 0 additions & 1 deletion tests/dms/unit/test_client_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def client():
mock_http = Mock()
MockHttp.return_value = mock_http
creds = DMSCredentials(
instance_name="test-instance",
uri="https://api.example.com",
client_id="test-client",
client_secret="test-secret",
Expand Down
1 change: 0 additions & 1 deletion tests/dms/unit/test_client_cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def _mock_response(data):
def client():
"""Create a DMSClient with a mocked HttpInvoker."""
creds = DMSCredentials(
instance_name="test-instance",
uri="https://api.example.com",
client_id="test-client",
client_secret="test-secret",
Expand Down
Loading