Changeset View
Changeset View
Standalone View
Standalone View
swh/search/tests/test_journal_client.py
Show First 20 Lines • Show All 270 Lines • ▼ Show 20 Lines | worker_fn( | ||||
] | ] | ||||
} | } | ||||
) | ) | ||||
search_mock.origin_update.assert_called_once_with( | search_mock.origin_update.assert_called_once_with( | ||||
[{"url": "http://foobar.baz", "visit_types": ["git"]}] | [{"url": "http://foobar.baz", "visit_types": ["git"]}] | ||||
) | ) | ||||
def test_journal_client_origin_metadata_from_journal(): | @pytest.mark.parametrize( | ||||
"key", ["origin_intrinsic_metadata", "origin_extrinsic_metadata"] | |||||
) | |||||
def test_journal_client_origin_metadata_from_journal(key): | |||||
search_mock = MagicMock() | search_mock = MagicMock() | ||||
worker_fn = functools.partial( | worker_fn = functools.partial( | ||||
process_journal_objects, | process_journal_objects, | ||||
search=search_mock, | search=search_mock, | ||||
) | ) | ||||
worker_fn( | worker_fn( | ||||
{ | { | ||||
"origin_intrinsic_metadata": [ | key: [ | ||||
{ | { | ||||
"id": "http://foobar.baz", | "id": "http://foobar.baz", | ||||
"metadata": { | "metadata": { | ||||
"@context": "https://doi.org/10.5063/schema/codemeta-2.0", | "@context": "https://doi.org/10.5063/schema/codemeta-2.0", | ||||
"description": "foo bar", | "description": "foo bar", | ||||
"programmingLanguage": "python", | "programmingLanguage": "python", | ||||
"license": "MIT", | "license": "MIT", | ||||
}, | }, | ||||
Show All 22 Lines |