mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-13 04:02:34 +00:00
32 lines
821 B
Python
32 lines
821 B
Python
![]() |
from unittest.mock import Mock
|
||
|
|
||
|
import pytest
|
||
|
|
||
|
from datahub.errors import SdkUsageError
|
||
|
from datahub.ingestion.graph.client import DataHubGraph
|
||
|
from datahub.sdk.main_client import DataHubClient
|
||
|
|
||
|
|
||
|
@pytest.fixture
|
||
|
def mock_graph() -> Mock:
|
||
|
graph = Mock(spec=DataHubGraph)
|
||
|
graph.exists.return_value = False
|
||
|
return graph
|
||
|
|
||
|
|
||
|
@pytest.fixture
|
||
|
def client(mock_graph: Mock) -> DataHubClient:
|
||
|
return DataHubClient(graph=mock_graph)
|
||
|
|
||
|
|
||
|
def test_use_assertion_client_fails_if_not_installed(
|
||
|
client: DataHubClient, mock_graph: Mock
|
||
|
) -> None:
|
||
|
mock_graph.exists.return_value = True
|
||
|
|
||
|
with pytest.raises(
|
||
|
SdkUsageError,
|
||
|
match="AssertionClient is not installed, please install it with `pip install acryl-datahub-cloud`",
|
||
|
):
|
||
|
client.assertion.get_assertions(urn="urn:li:assertion:123")
|