1
0
mirror of https://github.com/ilri/csv-metadata-quality.git synced 2025-05-08 06:06:00 +02:00

Add support for validating subjects against AGROVOC

Checks values in the dc.subject or dcterms.subject field against the
AGROVOC REST API hosted by FAO. Code borrowed from agrovoc-lookup.py.

See: http://agrovoc.uniroma2.it/agrovoc/agrovoc/en/
See: https://github.com/ilri/DSpace/blob/5_x-prod/agrovoc-lookup.py
This commit is contained in:
2019-07-30 00:30:31 +03:00
parent bb882315f1
commit 1f65a28307
7 changed files with 129 additions and 1 deletions

View File

@ -169,3 +169,24 @@ def test_check_invalid_language(capsys):
captured = capsys.readouterr()
assert captured.out == f'Invalid language: {value}\n'
def test_check_invalid_agrovoc(capsys):
'''Test invalid AGROVOC subject.'''
value = 'FOREST'
check.agrovoc(value)
captured = capsys.readouterr()
assert captured.out == f'Invalid AGROVOC subject: {value}\n'
def test_check_valid_agrovoc():
'''Test valid AGROVOC subject.'''
value = 'FORESTS'
result = check.agrovoc(value)
assert result == value