Skip to content

Commit db688c7

Browse files
update tests and parameterise list_domains fixture
1 parent 65670d7 commit db688c7

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

lib/datahub-client/tests/test_integration_with_datahub_server.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131
TagRef,
3232
UsageRestrictions,
3333
)
34-
from data_platform_catalogue.search_types import MultiSelectFilter, ResultType
34+
from data_platform_catalogue.search_types import (
35+
ListDomainOption,
36+
MultiSelectFilter,
37+
ResultType,
38+
)
3539

3640
jwt_token = os.environ.get("CATALOGUE_TOKEN")
3741
api_url = os.environ.get("CATALOGUE_URL", "")
@@ -43,6 +47,9 @@ def test_list_domains():
4347
client = DataHubCatalogueClient(jwt_token=jwt_token, api_url=api_url)
4448
response = client.list_domains()
4549
assert len(response) > 0
50+
domain = response[0]
51+
assert isinstance(domain, ListDomainOption)
52+
assert "urn:li:domain" in domain.urn
4653

4754

4855
@runs_on_development_server

tests/conftest.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -297,17 +297,22 @@ def mock_catalogue(request, example_database):
297297
ListDomainOption(
298298
urn="urn:li:domain:prisons",
299299
name="Prisons",
300-
total=fake.random_int(min=0, max=100),
300+
total=fake.random_int(min=1, max=100),
301301
),
302302
ListDomainOption(
303303
urn="urn:li:domain:courts",
304304
name="Courts",
305-
total=fake.random_int(min=0, max=100),
305+
total=fake.random_int(min=1, max=100),
306306
),
307307
ListDomainOption(
308308
urn="urn:li:domain:finance",
309309
name="Finance",
310-
total=fake.random_int(min=0, max=100),
310+
total=fake.random_int(min=1, max=100),
311+
),
312+
ListDomainOption(
313+
urn="urn:li:domain:hq",
314+
name="HQ",
315+
total=0,
311316
),
312317
],
313318
)
@@ -437,8 +442,8 @@ def search_facets():
437442

438443

439444
@pytest.fixture
440-
def list_domains():
441-
return ListDomainFetcher().fetch()
445+
def list_domains(filter_zero_entities):
446+
return ListDomainFetcher(filter_zero_entities).fetch()
442447

443448

444449
@pytest.fixture

0 commit comments

Comments
 (0)