def __init__(self, id=None, name=None, product=None, **kwargs): """ Initialize by version id or product and version """ # Backward compatibility for 'version' argument (now called 'name') name = name if name is not None else kwargs.get("version") # Initialize (unless already done) id, ignore, inject, initialized = self._is_initialized(id) if initialized: return TCMS.__init__(self, id) # If inject given, fetch tag data from it if inject: self._fetch(inject) # Initialize by version name and product elif name is not None and product is not None: self._name = name # Convert product into object if necessary if isinstance(product, Product): self._product = product else: self._product = Product(product) # Index by name/product (but only when the product name is known) if self.product._name is not TCMSNone: self._index("{0}---in---{1}".format(self.name, self.product.name)) # Otherwise just make sure the version id was provided elif not id: raise TCMSError( "Need either version id or both product " "and version name to initialize the Version object.")
def __init__(self, id=None, name=None, product=None, **kwargs): """ Initialize by build id or product and build name """ # Backward compatibility for 'build' argument (now called 'name') name = name if name is not None else kwargs.get("build") # Initialize (unless already done) id, ignore, inject, initialized = self._is_initialized(id or name) if initialized: return TCMS.__init__(self, id) # If inject given, fetch build data from it if inject: self._fetch(inject) # Initialized by build name and product elif name is not None and product is not None: self._name = name # Detect product format if isinstance(product, Product): self._product = product else: self._product = Product(product) # Index by name-product (only when the product name is known) if self.product._name is not TCMSNone: self._index("{0}---in---{1}".format(self.name, self.product.name)) # Otherwise just check that the id was provided elif not id: raise TCMSError("Need either build id or both build name " "and product to initialize the Build object.")
def __init__(self, id=None, login=None, email=None): """ Initialize by user id, login or email Defaults to the current user if no id, login or email provided. If xmlrpc initial object dict provided as the first argument, data are initialized directly from it. """ # Initialize (unless already done) id, name, inject, initialized = self._is_initialized(id or login or email) if initialized: return TCMS.__init__(self, id, prefix="UID") # If inject given, fetch data from it if inject: self._fetch(inject) # Otherwise initialize by login or email elif name is not None: if "@" in name: self._email = name else: self._login = name self._index(name)
def __init__(self, id=None, name=None): """ Initialize the Product by id or name Examples: Product(60) Product(id=60) Product("Red Hat Enterprise Linux 6") Product(name="Red Hat Enterprise Linux 6") """ # Initialize (unless already done) id, name, inject, initialized = self._is_initialized(id or name) if initialized: return TCMS.__init__(self, id) # If inject given, fetch test case data from it if inject: self._fetch(inject) # Initialize by name elif name is not None: self._name = name self._index(name) # Otherwise just check that the product id was provided elif not id: raise TCMSError("Need id or name to initialize Product")
def __init__(self, id=None, name=None, product=None, **kwargs): """ Initialize by component id or component name and product """ # Initialize (unless already done) id, ignore, inject, initialized = self._is_initialized(id) if initialized: return TCMS.__init__(self, id) # If inject given, fetch component data from it if inject: self._fetch(inject) # Initialized by product and component name elif name is not None and product is not None: # Detect product format if isinstance(product, Product): self._product = product else: self._product = Product(product) self._name = name # Index by name-product (only when the product name is known) if self.product._name is not TCMSNone: self._index("{0}---in---{1}".format(self.name, self.product.name)) # Otherwise just check that the id was provided elif id is None: raise TCMSError( "Need either component id or both product " "and component name to initialize the Component object.")
def __init__(self, id=None, name=None): """ Initialize by test plan type id or name """ # Initialize (unless already done) id, name, inject, initialized = self._is_initialized(id or name) if initialized: return TCMS.__init__(self, id) # If inject given, fetch data from it if inject: self._fetch(inject) # Initialize by name elif name is not None: self._name = name self._index(name) # Otherwise just check that the test plan type id was provided elif not id: raise TCMSError( "Need either id or name to initialize the PlanType object")
def __init__(self, id=None, bug=None, system=1, **kwargs): """ Initialize the bug Provide external bug id, optionally bug system (Bugzilla by default). """ # Initialize (unless already done) id, ignore, inject, initialized = self._is_initialized(id) if initialized: return TCMS.__init__(self, id, prefix="BUG") # If inject given, fetch bug data from it if inject: self._fetch(inject) # Initialized by bug id and system id elif bug is not None and system is not None: self._bug = bug self._system = system # Otherwise just check that the id was provided elif id is None: raise TCMSError("Need bug id to initialize the Bug object.")
def __init__(self, id=None, prefix="ID"): """ Initially set up to unmodified state """ self._modified = False TCMS.__init__(self, id, prefix)