def test_create(self): fmf_node = Tree(self.tmpdir).find("/new_testcase") self.assertNotIn("extra-nitrate", fmf_node.data) os.chdir(self.tmpdir / "new_testcase") runner = CliRunner() self.runner_output = runner.invoke(tmt.cli.main, [ "test", "export", "--nitrate", "--create", "--general", "."]) # Reload the node data to see if it appears there fmf_node = Tree(self.tmpdir).find("/new_testcase") self.assertIn("extra-nitrate", fmf_node.data)
def test_existing(self): fmf_node = Tree(self.tmpdir).find("/existing_testcase") self.assertEqual(fmf_node.data["extra-nitrate"], "TC#0609686") os.chdir(self.tmpdir / "existing_testcase") runner = CliRunner() self.runner_output = runner.invoke( tmt.cli.main, ["test", "export", "--nitrate", "--create", "--general", "."]) fmf_node = Tree(self.tmpdir).find("/existing_testcase") self.assertEqual(fmf_node.data["extra-nitrate"], "TC#0609686")
def test_coverage_bugzilla(self): fmf_node = Tree(self.tmpdir).find("/existing_testcase") self.assertEqual(fmf_node.data["extra-nitrate"], "TC#0609686") os.chdir(self.tmpdir / "existing_testcase") runner = CliRunner() self.runner_output = runner.invoke( tmt.cli.main, ["test", "export", "--nitrate", "--bugzilla", "."]) assert self.runner_output.exit_code == 0
def test_import_manual_proposed(self): runner = CliRunner() self.runner_output = runner.invoke( tmt.cli.main, ['--root', self.tmpdir / "import_case", "test", "import", "--nitrate", "--manual", "--case=609705"]) self.assertEqual(self.runner_output.exit_code, 0) # TODO: This is strange, expect at least some output in # case there is proper case, just case is not CONFIRMED # I can imagine also e.g. at least raise error but not pass, # with no output self.assertEqual(self.runner_output.output.strip(), "") fmf_node = Tree(self.tmpdir).find("/import_case") self.assertEqual(fmf_node, None)
def get_tree(name=""): path = get_path() + "/" + get_dir_from_name(name) tree = Tree(path) tree.grow(path) return tree