Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
whoas cli test
Browse files Browse the repository at this point in the history
  • Loading branch information
ehanson8 committed Sep 22, 2020
1 parent 3e52ec1 commit 631459e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 3 additions & 1 deletion hoard/sources/whoas.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ def create_from_whoas_dim_xml(data: str) -> Dataset:
):
kwargs["productionPlace"] = field.text
if field.attrib["element"] == "relation" and "qualifier" not in field.attrib:
publications.append(Publication(publicationCitation=field.text))
publications.append(
Publication(publicationCitation=field.text, publicationIDType="url")
)
if (
field.attrib["element"] == "relation"
and "qualifier" in field.attrib
Expand Down
19 changes: 19 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,22 @@ def test_cli_ingests(requests_mock, jpal_oai_server, jpal_dataverse_server):
)
assert result.exit_code == 0
assert result.output == "2 records ingested from jpal\n"


def test_cli_whoas_ingests(requests_mock, whoas_oai_server):
requests_mock.post(
"http+mock://example.com/api/v1/dataverses/root/datasets",
json={"data": {"id": 1, "persistentId": "set1"}},
)
result = CliRunner().invoke(
main,
[
"ingest",
"whoas",
"http+mock://example.com/oai",
"--url",
"http+mock://example.com",
],
)
assert result.exit_code == 0
assert result.output == "2 records ingested from whoas\n"
6 changes: 5 additions & 1 deletion tests/test_whoas.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ def test_create_whoas_required_dim_xml(whoas_oai_server):
OtherId(otherIdValue="https://hdl.handle.net/1912/2368", otherIdAgency=None),
OtherId(otherIdValue="10.26025/8ke9-av98", otherIdAgency=None),
]
publications = [Publication(publicationCitation="Associated publication")]
publications = [
Publication(
publicationCitation="Associated publication", publicationIDType="url"
)
]
series = Series(seriesName="https://hdl.handle.net/1912/6867")

timePeriodsCovered = [
Expand Down

0 comments on commit 631459e

Please sign in to comment.