def test_extract_subparser_requires_mst_file_path_and_output_file( self, error_mock, extract_isis_mock ): migrate_isis_parser("extract".split()) error_mock.assert_called_with( "the following arguments are required: file, --output" )
def test_merge_subparser_requires_json_paths_and_output_file( self, error_mock, link_documents_bundles_with_journals_mock ): migrate_isis_parser("link".split()) error_mock.assert_called_with( "the following arguments are required: journals, issues, --output" )
def test_import_should_call_issues_pipeline_when_import_type_is_issue( self, import_issues_mock ): migrate_isis_parser( """import /jsons/file.json --type issue --uri mongodb://uri --db db-name""".split() ) import_issues_mock.assert_called_once()
def test_link_command_should_link_journals_and_bundles( self, link_documents_bundles_with_journals_mock ): migrate_isis_parser("""link issues.json --output linked.json""".split()) link_documents_bundles_with_journals_mock.assert_called_once_with( "issues.json", "linked.json" )
def test_import_should_import_linked_journals_bundles( self, import_documents_bundles_link_with_journal_mock ): migrate_isis_parser( """import /jsons/file.json --type documents-bundles-link --uri mongodb://uri --db db-name""".split() ) import_documents_bundles_link_with_journal_mock.assert_called_once()
def test_extract_subparser_should_call_extract_isis_command( self, extract_isis_mock ): migrate_isis_parser( "extract /path/to/file.mst --output /jsons/file.json".split() ) extract_isis_mock.create_output_dir.assert_called_once_with("/jsons/file.json") extract_isis_mock.run.assert_called_once_with( "/path/to/file.mst", "/jsons/file.json" )
def test_should_print_help_if_arguments_does_not_match(self, print_help_mock): migrate_isis_parser([]) print_help_mock.assert_called()
def test_import_journals_should_call_pipeline(self, import_journals_mock): migrate_isis_parser( """import /jsons/file.json --type journal --uri mongodb://uri --db db-name""".split() ) import_journals_mock.assert_called_once()
def test_import_journals_requires_json_path_and_type_of_entity(self, error_mock): migrate_isis_parser("import".split()) error_mock.assert_called_with( "the following arguments are required: --uri, --db, file, --type" )