def __init__(self, name=None, notes=None, is_open=False, active=False, creation_ts=None, closed_on_date=None, release_date=None, parent_testplan=None, api=None, **kwargs): TestlinkObject.__init__(self, kwargs.get('id'), name, api) self.active = bool(int(active)) self.open = bool(int(is_open)) self.notes = unicode(notes) try: self.creation_ts = strptime(str(creation_ts), TestlinkObject.DATETIME_FORMAT) except ValueError: self.creation_ts = datetime.datetime.min try: self.release_date = strptime(str(release_date), TestlinkObject.DATETIME_FORMAT) except ValueError: self.release_date = datetime.datetime.min try: self.closed_on_date = strptime(str(closed_on_date), TestlinkObject.DATETIME_FORMAT) except ValueError: self.closed_on_date = datetime.datetime.min self._parent_testplan = parent_testplan
def __init__(self, risk_doc_id=None, name='', description='', author_id=-1, creation_ts=str(datetime.datetime.min), modifier_id=-1, modification_ts=str(datetime.datetime.min), requirement_id=-1, cross_coverage='', api=None, **kwargs): """Initializes a new Risk with the specified parameters @todo: doc """ TestlinkObject.__init__(self, kwargs.get('id', -1), name, api) self.doc_id = unicode(risk_doc_id) self.description = description self.author_id = int(author_id) try: self.creation_ts = strptime(str(creation_ts), TestlinkObject.DATETIME_FORMAT) except ValueError: self.creation_ts = datetime.datetime.min try: self.modifier_id = int(modifier_id) except ValueError: self.modifier_id = -1 try: self.modification_ts = strptime(str(modification_ts), TestlinkObject.DATETIME_FORMAT) except ValueError: self.modification_ts = datetime.datetime.min self._requirement_id = requirement_id self.cross_coverage = str(cross_coverage)
def __init__(self, doc_id='', title='', typ=REQSPEC_TYPE.SECTION, scope='', testproject_id=-1, author_id=-1, creation_ts=str(datetime.datetime.min), modifier_id=-1, modification_ts=str(datetime.datetime.min), total_req=0, node_order=0, api=None, parent_testproject=None, parent_requirement_specification=None, **kwargs): """Initializes a new Requirement Specification with the specified parameters. @todo: doc """ TestlinkObject.__init__(self, kwargs.get('id', -1), title, api) IAttachmentGetter.__init__(self) self.doc_id = unicode(doc_id) self.typ = int(typ) self.scope = scope self.testproject_id = int(testproject_id) self.author_id = int(author_id) try: self.modifier_id = int(modifier_id) except ValueError: self.modifier_id = -1 self.total_req = int(total_req) self.node_order = int(node_order) try: self.creation_ts = strptime(str(creation_ts), TestlinkObject.DATETIME_FORMAT) except ValueError: self.creation_ts = datetime.datetime.min try: self.modification_ts = strptime(str(modification_ts), TestlinkObject.DATETIME_FORMAT) except ValueError: self.modification_ts = datetime.datetime.min self._parent_testproject = parent_testproject self._parent_requirement_specification = parent_requirement_specification
def test_datetime_conversion(self): """Datetime Backwards compatability Python 2.5<""" from datetime import datetime from testlink.objects.tl_object import TestlinkObject from testlink.objects.tl_object import strptime date_string = "2000-12-23 12:34:45" datetime_obj = datetime.strptime(date_string, TestlinkObject.DATETIME_FORMAT) strptime_obj = strptime(date_string, TestlinkObject.DATETIME_FORMAT) self.assertEquals(datetime_obj, strptime_obj)
def __init__(self, title, file_type, content="", date_added=None, api=None, **kwargs): TestlinkObject.__init__(self, kwargs.get('id'), title, api) self.file_name = kwargs.get("name", "") self.file_type = str(file_type) self.content = str(content) self.length = 0 if self.content is not None: self.length = len(self.content) try: self.date_added = strptime(str(date_added), TestlinkObject.DATETIME_FORMAT) except ValueError: self.date_added = datetime.datetime.min
def __init__( self,\ testplan_id=-1,\ platform_id=-1,\ build_id=-1,\ tcversion_id=-1,\ tcversion_number=0,\ status='',\ notes="",\ execution_type=ExecutionType.MANUAL,\ execution_ts=str(datetime.datetime.min),\ tester_id=-1,\ execution_duration=0.0,\ api=None,\ **kwargs\ ): TestlinkObject.__init__(self, kwargs.get('id'), kwargs.get('id', "None"), api) IAttachmentGetter.__init__(self, foreign_key_table="executions") self.testplan_id = int(testplan_id) self.platform_id = int(platform_id) self.build_id = int(build_id) self.tcversion_id = int(tcversion_id) self.tcversion_number = int(tcversion_number) self.status = status self.notes = notes self.execution_type = int(execution_type) try: self.execution_ts = strptime(str(execution_ts), TestlinkObject.DATETIME_FORMAT) except ValueError: self.execution_ts = datetime.datetime.min self.tester_id = int(tester_id) self.__tester = None try: self.duration = float(execution_duration) except ValueError: self.duration = float(0.0)
def __init__(self, srs_id=None, req_doc_id='', title='', req_spec_title=None, version=-1, version_id=-1, revision=-1, revision_id=-1, scope='', status=REQUIREMENT_STATUS.DRAFT, node_order=0, is_open="1", active="1", expected_coverage=1, testproject_id=-1, author=None, author_id=-1, creation_ts=str(datetime.datetime.min), modifier=None, modifier_id=-1, modification_ts=str(datetime.datetime.min), api=None, parent_testproject=None, parent_requirement_specification=None, **kwargs): """Initializes a new Requirement with the specified parameters @todo: doc """ TestlinkObject.__init__(self, kwargs.get('id', -1), title, api) IAttachmentGetter.__init__(self) self.srs_id = str(srs_id) self.req_doc_id = unicode(req_doc_id) self.req_spec_title = req_spec_title self.type = int(kwargs.get('type', REQUIREMENT_TYPE.INFO)) self.version = int(version) self.version_id = int(version_id) self.revision = int(revision) self.revision_id = int(revision_id) self.scope = scope self.status = str(status) self.node_order = int(node_order) self.is_open = bool(int(is_open)) self.active = bool(int(active)) self.expected_coverage = int(expected_coverage) self.testproject_id = int(testproject_id) self.author = unicode(author) self.author_id = int(author_id) self.modifier = unicode(modifier) try: self.modifier_id = int(modifier_id) except ValueError: self.modifier_id = -1 try: self.creation_ts = strptime(str(creation_ts), TestlinkObject.DATETIME_FORMAT) except ValueError: self.creation_ts = datetime.datetime.min try: self.modification_ts = strptime(str(modification_ts), TestlinkObject.DATETIME_FORMAT) except ValueError: self.modification_ts = datetime.datetime.min self._parent_testproject = parent_testproject self._parent_requirement_specification = parent_requirement_specification
def __init__(\ self,\ srs_id=None,\ req_doc_id='',\ title='',\ req_spec_title=None,\ version=-1,\ version_id=-1,\ revision=-1,\ revision_id=-1,\ scope='',\ status=RequirementStatus.DRAFT,\ node_order=0,\ is_open="1",\ active="1",\ expected_coverage=1,\ testproject_id=-1,\ author=None,\ author_id=-1,\ creation_ts=str(datetime.datetime.min),\ modifier=None,\ modifier_id=-1,\ modification_ts=str(datetime.datetime.min),\ api=None,\ parent_testproject=None,\ parent_requirement_specification=None,\ **kwargs\ ): """Initializes a new Requirement with the specified parameters @todo: doc """ TestlinkObject.__init__(self, kwargs.get('id'), title, api) IAttachmentGetter.__init__(self) self.srs_id = str(srs_id) self.req_doc_id = unicode(req_doc_id) self.req_spec_title = req_spec_title self.type = int(kwargs.get('type', RequirementType.INFO)) self.version = int(version) self.version_id = int(version_id) self.revision = int(revision) self.revision_id = int(revision_id) self.scope = scope self.status = str(status) self.node_order = int(node_order) self.is_open = bool(int(is_open)) self.active = bool(int(active)) self.expected_coverage = int(expected_coverage) self.testproject_id = int(testproject_id) self.author = unicode(author) self.author_id = int(author_id) self.modifier = unicode(modifier) try: self.modifier_id = int(modifier_id) except ValueError: self.modifier_id = -1 try: self.creation_ts = strptime(str(creation_ts), TestlinkObject.DATETIME_FORMAT) except ValueError: self.creation_ts = datetime.datetime.min try: self.modification_ts = strptime(str(modification_ts), TestlinkObject.DATETIME_FORMAT) except ValueError: self.modification_ts = datetime.datetime.min self._parent_testproject = parent_testproject self._parent_requirement_specification = parent_requirement_specification