def test_get_index_paths01(self): self.create_general_config() book = Book(Host(self.test_root)) self.assertEqual(book.get_index_paths('20200101000000000/index.html'), ['index.html']) self.assertEqual(book.get_index_paths('20200101000000000.html'), ['20200101000000000.html']) self.assertEqual(book.get_index_paths('20200101000000000.htz'), ['index.html'])
def test_get_index_paths04(self): """MAFF with no page""" self.create_general_config() os.makedirs(os.path.join(self.test_root, 'data')) archive_file = os.path.join(self.test_root, 'data', '20200101000000000.maff') with zipfile.ZipFile(archive_file, 'w') as zh: pass book = Book(Host(self.test_root)) self.assertEqual(book.get_index_paths('20200101000000000.maff'), [])
def test_get_index_paths02(self): """MAFF with single page""" self.create_general_config() os.makedirs(os.path.join(self.test_root, 'data')) archive_file = os.path.join(self.test_root, 'data', '20200101000000000.maff') with zipfile.ZipFile(archive_file, 'w') as zh: zh.writestr('20200101000000000/index.html', """dummy""") book = Book(Host(self.test_root)) self.assertEqual(book.get_index_paths('20200101000000000.maff'), ['20200101000000000/index.html'])