def test_version(self): """ `ref --version` should return version string """ args = self.parser.parse_args(["--version"]) refmanage.cli_args_dispatcher(args) self.assertEqual(refmanage.__version__, self.stdout.getvalue())
def test_parseable(self): """ `ref test -p *.bib` should print list of parseable files """ args = self.parser.parse_args(["-t", "-p", "test/controls/*.bib"]) refmanage.cli_args_dispatcher(args) output_text = "test/controls/empty.bib\n test/controls/one.bib\n test/controls/two.bib\n" self.assertEqual(output_text, self.stdout.getvalue())
def test_default(self): """ `ref test *.bib` without flags should default to --unparseable and print list of unparseable files """ args = self.parser.parse_args(["-t", "test/controls/*.bib"]) refmanage.cli_args_dispatcher(args) output_text = "test/controls/10.1371__journal.pone.0115069.bib\n test/controls/invalid.bib\n test/controls/one_valid_one_invalid.bib\n" self.assertEqual(output_text, self.stdout.getvalue())
def test_parseable_with_unparseable_file(self): """ `ref test -p unparseable.bib` should return nothing """ args = self.parser.parse_args(["-t", "-p", "test/controls/invalid.bib"]) refmanage.cli_args_dispatcher(args) output_text = "" self.assertEqual(output_text, self.stdout.getvalue())