MCPcopy Create free account
hub / github.com/HzaCode/OneCite / test_success

Method test_success

tests/test_pipeline_unit.py:643–660  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

641class TestIdentifierDataCite:
642
643 def test_success(self):
644 ident = IdentifierModule()
645 payload = {"data": {"attributes": {
646 "titles": [{"title": "My Dataset"}],
647 "creators": [{"name": "Doe, Jane"}],
648 "publicationYear": 2022, "publisher": "Zenodo",
649 "url": "https://doi.org/10.1234/data",
650 "types": {"resourceTypeGeneral": "Dataset"},
651 }}}
652
653 with patch("onecite.pipeline.requests.get",
654 return_value=DummyResponse(json_data=payload)):
655 r = ident._query_datacite("10.1234/data")
656
657 assert r["title"] == "My Dataset"
658 assert r["source"] == "datacite"
659 assert r["year"] == 2022
660 assert "Doe, Jane" in r["authors"]
661
662 def test_404_returns_none(self):
663 ident = IdentifierModule()

Callers

nothing calls this directly

Calls 3

_query_dataciteMethod · 0.95
IdentifierModuleClass · 0.90
DummyResponseClass · 0.85

Tested by

no test coverage detected