Develop unit tests for the class Record
- The harvester is the critical part of this application.
- Procedures have to be developed to make them robust and to ensure that they are working before releasing a new version.
- The first step is to develop unit tests for the class
Record
- Use the python package nose (https://nose.readthedocs.org/en/latest/)
- Create a
test
directory in the modules one.
- Create a file
test_record_article.py
- Recuperate a well known record from a store:
from invenio_tools import InvenioStore, Marc12
host = 'cds.cern.ch'
record_id = 1951625
store = InvenioStore(host)
xml = store.get_record(record_id)
record = Marc12(xml)[0]
- For each method of the class
Record
, making sense for the article category, develop a test function:
def test_collaboration()
assert record.collaboration() == "LHCb Collaboration"
- Develop the test file for the others categories Proceeding, Talk, Report, ...