Exemplo n.º 1
0
 def test_convert_only_jas(self):
     """Runs the converter and verifies the output."""
     # test with the English OBS
     zip_file = os.path.join(self.resources_dir, 'eight_bible_books.zip')
     # zip_file = self.make_duplicate_zip_that_can_be_deleted(zip_file)
     # out_zip_file = tempfile.NamedTemporaryFile(suffix='.zip', dir=self.temp_dir, delete=False).name
     self.in_dir = tempfile.mkdtemp(prefix='udb_in_', dir=self.temp_dir)
     unzip(zip_file, self.in_dir)
     source_url = 'http://test.com/preconvert/22f3d09f7a.zip?convert_only=60-JAS.usfm'
     with closing(Usfm2HtmlConverter('Bible', self.in_dir)) as tx:
         # tx.input_zip_file = zip_file
         results = tx.run()
     # verify the output
     # self.assertTrue(os.path.isfile(out_zip_file), "There was no output zip file produced.")
     self.assertIsNotNone(results)
     # self.out_dir = tempfile.mkdtemp(prefix='udb_out_', dir=self.temp_dir)
     # unzip(out_zip_file, self.out_dir)
     # files_to_verify = ['60-JAS.html']
     # for file_to_verify in files_to_verify:
     #     file_name = os.path.join(self.out_dir, file_to_verify)
     #     self.assertTrue(os.path.isfile(file_name), 'UDB HTML file not found: {0}'.format(file_name))
     # files_to_not_verify = ['61-1PE.html', '62-2PE.html', '63-1JN.html', '64-2JN.html', '65-3JN.html',
     #                        '66-JUD.html', '67-REV.html']
     # for file_to_verify in files_to_not_verify:
     #     file_name = os.path.join(self.out_dir, file_to_verify)
     #     self.assertFalse(os.path.isfile(file_name), 'UDB HTML file not found: {0}'.format(file_name))
     # self.assertEqual(tx.source, source_url.split('?')[0])
     self.assertTrue(isinstance(results,dict))
     print("results2", results)
     self.assertTrue(results['success'])
Exemplo n.º 2
0
 def test_matt_complete_with_backslash(self):
     """
     Runs the converter and verifies the output
     """
     zip_file = os.path.join(self.resources_dir, 'kpb_mat_text_udb.zip')
     # zip_file = self.make_duplicate_zip_that_can_be_deleted(zip_file)
     # out_zip_file = tempfile.NamedTemporaryFile(suffix='.zip', dir=self.temp_dir, delete=False).name
     self.in_dir = tempfile.mkdtemp(prefix='udb_in_', dir=self.temp_dir)
     unzip(zip_file, self.in_dir)
     with closing(Usfm2HtmlConverter('Bible', self.in_dir)) as tx:
         # tx.input_zip_file = zip_file
         results = tx.run()
     # verify the output
     # self.assertTrue(os.path.isfile(out_zip_file), "There was no output zip file produced.")
     self.assertIsNotNone(results)
     # self.out_dir = tempfile.mkdtemp(prefix='udb_out_', dir=self.temp_dir)
     # unzip(out_zip_file, self.out_dir)
     # files_to_verify = ['41-MAT.html']
     # self.verify_files(files_to_verify)
     self.assertTrue(isinstance(results,dict))
     print("results6", results)
     self.assertTrue(results['success'])
Exemplo n.º 3
0
 def test_bad_source(self):
     """This tests giving a bad source to the converter"""
     with closing(Usfm2HtmlConverter('bad_subject', 'bad_resource')) as tx:
         result = tx.run()
     self.assertFalse(result['success'])
     self.assertEqual(result['errors'], ['No such folder: bad_resource'])