Exemple #1
0
 def test_set_sort_title(self, mock_stops):
     testWork = Work()
     testWork.title = 'A Test Title'
     mock_lang = MagicMock()
     mock_lang.iso_3 = 'eng'
     testWork.language = set(mock_lang)
     testWork.setSortTitle()
     self.assertEqual(testWork.sort_title, 'test title')
Exemple #2
0
 def test_work_add_title(self):
     testWork = Work()
     # Attempt to insert NFD unicode string, should convert to NFC
     testTitle = unicodedata.normalize('NFD', 'tésting')
     testWork.title = testTitle
     self.assertNotEqual(testWork.title, testTitle)
     self.assertEqual(testWork.title,
                      unicodedata.normalize('NFC', testTitle))
Exemple #3
0
 def test_item_update(self):
     testData = {'title': 'Title', 'series': 'newSeries'}
     testWork = Work()
     testWork.title = 'Title'
     testWork.series = 'oldSeries'
     testWork.epubsToLoad = []
     with patch.multiple(Work,
                         createTmpRelations=DEFAULT,
                         addImportJson=DEFAULT,
                         addTitles=DEFAULT,
                         updateIdentifiers=DEFAULT,
                         updateInstances=DEFAULT,
                         updateAgents=DEFAULT,
                         updateSubjects=DEFAULT,
                         updateMeasurements=DEFAULT,
                         updateLinks=DEFAULT,
                         updateDates=DEFAULT,
                         updateLanguages=DEFAULT,
                         removeTmpRelations=DEFAULT) as item_mocks:
         newEpubs = testWork.update(testData)
         self.assertEqual(testWork.series, 'newSeries')
         self.assertEqual(newEpubs, [])
Exemple #4
0
 def test_work_init(self):
     testWork = Work()
     testWork.title = 'Testing'
     self.assertEqual(str(testWork), '<Work(title=Testing)>')
Exemple #5
0
 def test_work_init(self):
     testWork = Work()
     testWork.summary = 'Summary'
     testWork.title = 'Testing'
     self.assertEqual(testWork.summary, 'Summary')
     self.assertEqual(str(testWork), '<Work(title=Testing)>')