summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Šplíchal <psplicha@redhat.com>2011-12-07 16:12:34 +0100
committerPetr Šplíchal <psplicha@redhat.com>2011-12-07 16:12:34 +0100
commit0550ec113dae1de66fe3d13859370e221f35bcbb (patch)
tree29c46cfe47e2fd91a8c159dc852f4779597770bd
parentc80d6f4c552ae281b2e429fb63619b9d55e77c84 (diff)
downloadpython-nitrate-0550ec113dae1de66fe3d13859370e221f35bcbb.zip
python-nitrate-0550ec113dae1de66fe3d13859370e221f35bcbb.tar.gz
python-nitrate-0550ec113dae1de66fe3d13859370e221f35bcbb.tar.xz
Nitrate: Ignore disabled cases when creating a new test run [BZ#746220]
-rw-r--r--Nitrate.py40
1 files changed, 38 insertions, 2 deletions
diff --git a/Nitrate.py b/Nitrate.py
index 593d5f9..4581e80 100644
--- a/Nitrate.py
+++ b/Nitrate.py
@@ -2361,8 +2361,9 @@ class TestRun(Mutable):
hash["manager"] = manager.id
hash["default_tester"] = tester.id
- # Include all test cases and tag with supplied tags
- hash["case"] = [case.id for case in testplan]
+ # Include all CONFIRMED test cases and tag with supplied tags
+ hash["case"] = [case.id for case in testplan
+ if case.status == CaseStatus("CONFIRMED")]
if tags: hash["tag"] = ",".join(tags)
# Submit to the server and initialize
@@ -2436,6 +2437,41 @@ class TestRun(Mutable):
# Update self (if modified)
Mutable.update(self)
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ # Test Run Self Test
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ class _test(unittest.TestCase):
+ def setUp(self):
+ """ Set up test plan from the config """
+ self.testplan = Nitrate()._config.testplan
+ self.testcase = Nitrate()._config.testcase
+
+ def testCreateInvalid(self):
+ """ Create a new test run (missing required parameters) """
+ self.assertRaises(NitrateError, TestRun, summary="Test run")
+
+ def testCreateValid(self):
+ """ Create a new test run (valid) """
+ testrun = TestRun(summary="Test run", testplan=self.testplan.id)
+ self.assertTrue(isinstance(testrun, TestRun))
+ self.assertEqual(testrun.summary, "Test run")
+
+ def testDisabledCasesOmitted(self):
+ """ Disabled test cases should be omitted """
+ # Prepare disabled test case
+ testcase = TestCase(self.testcase.id)
+ original = testcase.status
+ testcase.status = CaseStatus("DISABLED")
+ testcase.update()
+ # Create the test run, make sure the test case is not there
+ testrun = TestRun(testplan=self.testplan.id)
+ self.assertTrue(testcase.id not in
+ [caserun.testcase.id for caserun in testrun])
+ # Restore the original status
+ testcase.status = original
+ testcase.update()
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Test Case Class