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
- Use the python package nose (https://nose.readthedocs.org/en/latest/)
- Create a
testdirectory in the modules one.
- Create a file
- 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)
- 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, ...