-
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 and docs): added new test for open datasoft session start …
…and ammended documentation [2024-11-26]
- Loading branch information
1 parent
8ef8910
commit c87c435
Showing
2 changed files
with
43 additions
and
10 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
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,30 @@ | ||
import pytest | ||
from HerdingCats.session.cat_session import CatSession | ||
|
||
@pytest.fixture | ||
def domain(): | ||
return "ukpowernetworks.opendatasoft.com" | ||
|
||
def test_cat_session_creation(domain): | ||
""" | ||
Check that a valid Ckan session can be created | ||
""" | ||
try: | ||
session = CatSession(domain) | ||
assert isinstance( | ||
session, CatSession | ||
), "OpenDataSoftCatSession object should be created" | ||
assert session.domain == domain, "OpenDataSoftCatSession should have the correct domain" | ||
assert ( | ||
session.base_url == f"https://{domain}" | ||
), "OpenDataSoftCatSession should have the correct base URL" | ||
except Exception as e: | ||
pytest.fail(f"Failed to create OpenDataSoftCatSession: {str(e)}") | ||
|
||
|
||
def test_cat_session_start(domain): | ||
try: | ||
with CatSession(domain) as session: | ||
assert session.session is not None, "Session object should be created" | ||
except Exception as e: | ||
pytest.fail(f"Failed to start CkanCatSession: {str(e)}") |