-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(tests): added test for get orgs list for ckan [2024-11-26]
- Loading branch information
1 parent
c8b6918
commit 942bcd7
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import pytest | ||
from HerdingCats.session.cat_session import CatSession | ||
from HerdingCats.explorer.cat_explore import CkanCatExplorer | ||
import requests | ||
from loguru import logger | ||
|
||
CATALOGUES = [ | ||
"https://data.london.gov.uk", | ||
"https://data.humdata.org" | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("catalogue_url", CATALOGUES) | ||
def test_package_list_dictionary(catalogue_url): | ||
""" | ||
Test the package list functionality for predefined data catalogues | ||
""" | ||
with CatSession(catalogue_url) as cat_session: | ||
explorer = CkanCatExplorer(cat_session) | ||
try: | ||
results = explorer.get_organisation_list() | ||
|
||
print(results) | ||
|
||
# Assert that we got a result | ||
assert results is not None, f"No results returned for {catalogue_url}" | ||
|
||
logger.info(f"Org list search test passed for {catalogue_url}") | ||
except requests.RequestException as e: | ||
pytest.fail( | ||
f"Failed to perform Org list search for {catalogue_url}: {str(e)}" | ||
) | ||
except AssertionError as e: | ||
pytest.fail(str(e)) |