def test_build_work(self): testRow = { 'title': 'Work Test', 'description': '1st of 4', 'bib_key': '0000000', 'htid': 'test.000000000', 'gov_doc': 'f', 'author': 'Author, Test', 'copyright_date': '2019' } workTest = HathiRecord(testRow) workTest.parseIdentifiers = MagicMock() workTest.parseAuthor = MagicMock() workTest.parseGovDoc = MagicMock() workTest.buildWork() self.assertIsInstance(workTest.work, WorkRecord) self.assertEqual(workTest.work.title, 'Work Test')
def test_build_data_model(self): testRow = { 'title': 'Work Test', 'description': '1st of 4', 'bib_key': '0000000', 'htid': 'test.000000000', 'gov_doc': 'f', 'author': 'Author, Test', 'copyright_date': '2019', 'rights': 'test_rights' } workTest = HathiRecord(testRow) workTest.buildWork = MagicMock() workTest.buildInstance = MagicMock() workTest.buildItem = MagicMock() workTest.createRights = MagicMock() workTest.buildDataModel('countryCodes') self.assertIsInstance(workTest, HathiRecord)