Skip to content

Commit

Permalink
Remove tests of underlying library functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
MatMoore committed Jan 17, 2024
1 parent 6a43861 commit 4e89ba1
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 380 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

67 changes: 0 additions & 67 deletions python-libraries/data-platform-catalogue/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,76 +11,9 @@
DataProductMetadata,
TableMetadata,
)
from datahub.api.entities.dataproduct.dataproduct import DataProduct
from freezegun import freeze_time
from tests.test_helpers.graph_helpers import MockDataHubGraph
from tests.test_helpers.mce_helpers import check_golden_file

FROZEN_TIME = "2023-04-14 07:00:00"


@freeze_time(FROZEN_TIME)
@pytest.mark.parametrize(
"data_product_filename, upsert,golden_filename",
[
("dataproduct.yaml", False, "golden_dataproduct_out.json"),
("dataproduct_upsert.yaml", True, "golden_dataproduct_out_upsert.json"),
],
ids=["update", "upsert"],
)
def test_dataproduct_from_yaml(
pytestconfig: pytest.Config,
test_snapshots_dir: Path,
tmp_path: Path,
base_mock_graph: MockDataHubGraph,
data_product_filename: str,
upsert: bool,
golden_filename: str,
) -> None:
data_product_file = test_snapshots_dir / data_product_filename
mock_graph = base_mock_graph
data_product = DataProduct.from_yaml(data_product_file, mock_graph)
assert data_product._resolved_domain_urn == "urn:li:domain:12345"
assert data_product.assets is not None
assert len(data_product.assets) == 3

for mcp in data_product.generate_mcp(upsert=upsert):
mock_graph.emit(mcp)

output_file = Path(tmp_path / "test_dataproduct_out.json")
mock_graph.sink_to_file(output_file)
golden_file = Path(test_snapshots_dir / golden_filename)
check_golden_file(pytestconfig, output_file, golden_file)


@freeze_time(FROZEN_TIME)
def test_dataproduct_from_datahub(
pytestconfig: pytest.Config,
test_snapshots_dir: Path,
tmp_path: Path,
base_mock_graph: MockDataHubGraph,
) -> None:
mock_graph = base_mock_graph
golden_file = Path(test_snapshots_dir / "golden_dataproduct_out.json")
mock_graph.import_file(golden_file)

data_product: DataProduct = DataProduct.from_datahub(
mock_graph, id="urn:li:dataProduct:pet_of_the_week"
)
assert data_product.domain == "urn:li:domain:12345"
assert data_product.assets is not None
assert len(data_product.assets) == 3

# validate that output looks exactly the same

for mcp in data_product.generate_mcp(upsert=False):
mock_graph.emit(mcp)

output_file = Path(tmp_path / "test_dataproduct_to_datahub_out.json")
mock_graph.sink_to_file(output_file)
golden_file = Path(test_snapshots_dir / "golden_dataproduct_out.json")
check_golden_file(pytestconfig, output_file, golden_file)


class TestCatalogueClient:
def mock_service_response(self, fqn):
Expand Down

0 comments on commit 4e89ba1

Please sign in to comment.