-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
75 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,36 @@ | ||
import pytest | ||
from harvester.load.ckan import create_ckan_entrypoint | ||
import credentials | ||
|
||
|
||
@pytest.fixture | ||
def ckan_entrypoint(): | ||
return create_ckan_entrypoint( | ||
"http://localhost:5000", credentials.ckan_catalog_dev_api_key | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def test_ckan_package_id(): | ||
return "e875348b-a7c3-47eb-b0c3-168d978b0c0f" | ||
|
||
|
||
@pytest.fixture | ||
def test_ckan_package(test_ckan_package_id): | ||
return { | ||
"name": "package_test", | ||
"title": "title_test", | ||
"owner_org": "test_org", | ||
"tag_string": "test", | ||
"id": test_ckan_package_id, | ||
} | ||
|
||
|
||
@pytest.fixture | ||
def test_ckan_update_package(test_ckan_package_id): | ||
return {"author": "test author", "id": test_ckan_package_id} | ||
|
||
|
||
@pytest.fixture | ||
def test_ckan_patch_package(test_ckan_package_id): | ||
return {"author_email": "test@gmail.com", "id": test_ckan_package_id} |
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,39 @@ | ||
import pytest | ||
from harvester.load.ckan import ( | ||
create_ckan_package, | ||
delete_ckan_package, | ||
patch_ckan_package, | ||
update_ckan_package, | ||
) | ||
|
||
|
||
def test_create_package(ckan_entrypoint, test_ckan_package): | ||
try: | ||
create_ckan_package(ckan_entrypoint, test_ckan_package) | ||
assert True | ||
except: | ||
assert False | ||
|
||
|
||
def test_update_package(ckan_entrypoint, test_ckan_update_package): | ||
try: | ||
update_ckan_package(ckan_entrypoint, test_ckan_update_package) | ||
assert True | ||
except: | ||
assert False | ||
|
||
|
||
def test_patch_package(ckan_entrypoint, test_ckan_patch_package): | ||
try: | ||
patch_ckan_package(ckan_entrypoint, test_ckan_patch_package) | ||
assert True | ||
except: | ||
assert False | ||
|
||
|
||
def test_delete_package(ckan_entrypoint, test_ckan_package_id): | ||
try: | ||
delete_ckan_package(ckan_entrypoint, {"id": test_ckan_package_id}) | ||
assert True | ||
except: | ||
assert False |