def test_command_extrate(self, mk_extract_all_data):

        migrate_articlemeta_parser(
            ["extract",
             os.path.join(SAMPLES_PATH, "documents_pids.txt")])
        mk_extract_all_data.assert_called_once_with(
            ["S0021-25712009000400001\n", "S0021-25712009000400002"])
Ejemplo n.º 2
0
    def test_command_conversion_arg_pathFile_and_spy(self,
                                                     mk_convert_article_xml):

        migrate_articlemeta_parser(
            ["convert", "--file", "/tmp/example.xml", "--spy"])
        mk_convert_article_xml.assert_called_once_with("/tmp/example.xml",
                                                       spy=True)
Ejemplo n.º 3
0
 def test_command_pack_sps_arg_pathFile(self, mk_pack_article_xml):
     with utils.environ(
             SOURCE_PDF_FILE=os.path.join(os.path.dirname(__file__),
                                          "samples"),
             SOURCE_IMG_FILE=os.path.join(os.path.dirname(__file__),
                                          "samples"),
     ):
         migrate_articlemeta_parser(["pack", "--file", "/tmp/example.xml"])
         mk_pack_article_xml.assert_called_once_with("/tmp/example.xml")
Ejemplo n.º 4
0
 def test_command_pack_sps(self, mk_pack_article_ALLxml):
     with utils.environ(
             SOURCE_PDF_FILE=os.path.join(os.path.dirname(__file__),
                                          "samples"),
             SOURCE_IMG_FILE=os.path.join(os.path.dirname(__file__),
                                          "samples"),
     ):
         migrate_articlemeta_parser(["pack"])
         mk_pack_article_ALLxml.assert_called_once_with()
Ejemplo n.º 5
0
 def test_command_pack_sps_without_source_pdf_and_img(
         self, mk_sys, mock_pack_article_ALLxml):
     with utils.environ(
             SOURCE_PDF_FILE=os.path.join(os.path.dirname(__file__),
                                          "nonexistent"),
             SOURCE_IMG_FILE=os.path.join(os.path.dirname(__file__),
                                          "nonexistent"),
     ):
         migrate_articlemeta_parser(["pack"])
         mk_sys.assert_called()
    def test_command_import(self, mk_import_documents_to_kernel):

        migrate_articlemeta_parser([
            "import", "--uri",
            "mongodb://*****:*****@mongodb-host/?authSource=admin", "--db",
            "document-store", "--minio_host", "localhost:9000",
            "--minio_access_key", "minio", "--minio_secret_key", "minio123",
            "--output", "/tmp/docs.json"
        ])
        mk_import_documents_to_kernel.assert_called_once_with(session_db=ANY,
                                                              storage=ANY,
                                                              folder=ANY,
                                                              output_path=ANY)
Ejemplo n.º 7
0
    def test_command_link_documents_issues(
            self, mk_register_documents_in_documents_bundle):

        migrate_articlemeta_parser([
            "link_documents_issues",
            "--uri",
            "mongodb://*****:*****@mongodb-host/?authSource=admin",
            "--db",
            "document-store",
            "/tmp/docs.json",
            "/tmp/jornal.json",
        ])
        mk_register_documents_in_documents_bundle.assert_called_once_with(
            session_db=ANY, file_documents=ANY, file_journals=ANY)
    def test_not_arg(self):

        with self.assertRaises(SystemExit) as cm:
            migrate_articlemeta_parser([])
            self.assertEqual("Vc deve escolher algum parametro",
                             str(cm.exception))
    def test_command_pack_sps_arg_pathFile(self, mk_pack_article_xml):

        migrate_articlemeta_parser(["pack", "--file", "/tmp/example.xml"])
        mk_pack_article_xml.assert_called_once_with("/tmp/example.xml")
    def test_command_pack_sps(self, mk_pack_article_ALLxml):

        migrate_articlemeta_parser(["pack"])
        mk_pack_article_ALLxml.assert_called_once_with()
    def test_command_validation_arg_validateFile(self,
                                                 mk_validate_article_xml):

        migrate_articlemeta_parser(["validate", "--file", "/tmp/example.xml"])
        mk_validate_article_xml.assert_called_once_with("/tmp/example.xml")
    def test_command_validation(self, mk_validate_article_ALLxml):

        migrate_articlemeta_parser(["validate"])
        mk_validate_article_ALLxml.assert_called_once_with(False, False)
    def test_command_conversion(self, mk_convert_article_ALLxml):

        migrate_articlemeta_parser(["convert"])
        mk_convert_article_ALLxml.assert_called_once_with()
Ejemplo n.º 14
0
    def test_command_conversion_with_spy_true(self, mk_convert_article_ALLxml):

        migrate_articlemeta_parser(["convert", "--spy"])
        mk_convert_article_ALLxml.assert_called_once_with(True)