summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Šplíchal <psplicha@redhat.com>2011-07-27 17:22:50 +0200
committerPetr Šplíchal <psplicha@redhat.com>2011-07-27 17:22:50 +0200
commit5ddaaabbd5d538b68586d0f4e248cc8dd234ce20 (patch)
tree9c2cbb348cf14e4dd706bcaecae223ea91c619fa
parent9eaf54202a3ce512be8a310b0ddb5fab61c0d040 (diff)
downloadpython-nitrate-5ddaaabbd5d538b68586d0f4e248cc8dd234ce20.tar.gz
python-nitrate-5ddaaabbd5d538b68586d0f4e248cc8dd234ce20.tar.xz
python-nitrate-5ddaaabbd5d538b68586d0f4e248cc8dd234ce20.zip
Nitrate: Parent support in the test plan creation
-rw-r--r--Nitrate.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/Nitrate.py b/Nitrate.py
index 06bc31f..e82df46 100644
--- a/Nitrate.py
+++ b/Nitrate.py
@@ -1450,16 +1450,14 @@ class TestPlan(Mutable):
def __init__(self, id=None, name=None, product=None, version=None,
type=None, **kwargs):
+ """
+ Initialize a test plan or create a new one.
- """ Initialize a test plan or create a new one.
-
- Provide id to initialize an existing plan, name, product, version
- and type to create a new plan.
- Other parameters are optional and have following defaults:
+ Provide id to initialize an existing test plan or name, product,
+ version and type to create a new plan. Other parameters are optional.
- document .... ""
- parent ...... None
- is_active ... 1
+ document .... Test plan document (default: '')
+ parent ...... Parent test plan (object or id, default: None)
"""
@@ -1482,9 +1480,11 @@ class TestPlan(Mutable):
self._get(testplanhash=testplanhash)
# Create a new test plan based on provided name, type and product
elif name and type and product:
- self._create(name=name, product=product, version=version, type=type, **kwargs)
+ self._create(name=name, product=product, version=version,
+ type=type, **kwargs)
else:
- raise NitrateError("Need either id or name, product, version and type")
+ raise NitrateError(
+ "Need either id or name, product, version and type")
def __iter__(self):
""" Provide test cases as the default iterator. """
@@ -1528,6 +1528,13 @@ class TestPlan(Mutable):
type = PlanType(type)
hash["type"] = type.id
+ # Parent
+ parent = kwargs.get("parent")
+ if parent is not None:
+ if isinstance(parent, int):
+ parent = TestPlan(parent)
+ hash["parent"] = parent.id
+
# Document - if not explicitly specified, put empty text
hash["text"] = kwargs.get("document", " ")