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:
@ -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
|
||||
|
Reference in New Issue
Block a user