Beispiel #1
0
        def modifyTestObject(self, req, objtype, id, attributes={}):
            """ Modifies the test object of the specified type identified
            by the given id.
            Returns True if successful, False otherwise. """

            try:
                # Check the object exists
                obj = None
                if objtype == "testcatalog":
                    req.perm.require("TEST_MODIFY")
                    obj = TestCatalog(self.env, id)
                elif objtype == "testcase":
                    req.perm.require("TEST_MODIFY")
                    obj = TestCase(self.env, id)
                elif objtype == "testplan":
                    req.perm.require("TEST_PLAN_ADMIN")
                    obj = TestPlan(self.env, id)

                if not obj.exists:
                    self.env.log.error("Input test object of type %s with ID %s not found." % (objtype, id))
                    return False

                author = get_reporter_id(req, "author")

                for k, v in attributes.iteritems():
                    if k == "title":
                        obj.title = v
                    elif k == "description":
                        obj.description = v
                    else:
                        obj[k] = v

                obj.author = author
                obj.remote_addr = req.remote_addr
                obj.save_changes(author, "Changed through RPC.")

            except:
                self.env.log.error("Error modifying test object of type %s with ID %s." % (objtype, id))
                self.env.log.error(formatExceptionInfo())
                return False

            return True
Beispiel #2
0
        def modifyTestObject(self, req, objtype, id, attributes={}):
            """ Modifies the test object of the specified type identified
            by the given id.
            Returns True if successful, False otherwise. """

            try:
                # Check the object exists
                obj = None
                if objtype == 'testcatalog':
                    req.perm.require('TEST_MODIFY')
                    obj = TestCatalog(self.env, id)
                elif objtype == 'testcase':
                    req.perm.require('TEST_MODIFY')
                    obj = TestCase(self.env, id)
                elif objtype == 'testplan':
                    req.perm.require('TEST_PLAN_ADMIN')
                    obj = TestPlan(self.env, id)

                if not obj.exists:
                    self.env.log.error("Input test object of type %s with ID %s not found." % (objtype, id))
                    return False

                author = get_reporter_id(req, 'author')

                for k, v in attributes.iteritems():
                    if k == 'title':
                        obj.title = v
                    elif k == 'description':
                        obj.description = v
                    else:
                        obj[k] = v
                    
                obj.author = author
                obj.remote_addr = req.remote_addr
                obj.save_changes(author, "Changed through RPC.")

            except:
                self.env.log.error("Error modifying test object of type %s with ID %s." % (objtype, id))
                self.env.log.error(formatExceptionInfo())
                return False
            
            return True
Beispiel #3
0
        def createTestCatalog(self, req, parent_catalog_id, title, description):
            """ Creates a new test catalog, in the parent catalog specified, 
            with the specified title and description.
            To create a root catalog, specify '' as the parent catalog.
            Returns the generated object ID, or '-1' if an error occurs. """

            result = "-1"
            try:
                id = self.testmanagersys.get_next_id("catalog")

                pagename = None
                if parent_catalog_id is not None and parent_catalog_id != "":
                    # Check parent catalog really exists, and get its page_name
                    tcat = TestCatalog(self.env, parent_catalog_id)
                    if not tcat.exists:
                        self.env.log.error("Input parent test catalog with ID %s not found." % parent_catalog_id)
                        return result

                    pagename = tcat["page_name"] + "_TT" + id
                else:
                    pagename = "TC_TT" + id

                author = get_reporter_id(req, "author")

                new_tc = TestCatalog(self.env, id, pagename, title, description)
                new_tc.author = author
                new_tc.remote_addr = req.remote_addr
                # This also creates the Wiki page
                new_tc.insert()
                result = id

            except:
                self.env.log.error(
                    "Error adding test catalog with title '%s' in catalog with ID %s!" % (title, parent_catalog_id)
                )
                self.env.log.error(formatExceptionInfo())

            return id
Beispiel #4
0
        def createTestCatalog(self, req, parent_catalog_id, title, description):
            """ Creates a new test catalog, in the parent catalog specified, 
            with the specified title and description.
            To create a root catalog, specify '' as the parent catalog.
            Returns the generated object ID, or '-1' if an error occurs. """
            
            result = '-1'
            try:
                id = self.testmanagersys.get_next_id('catalog')

                pagename = None
                if parent_catalog_id is not None and parent_catalog_id != '':
                    # Check parent catalog really exists, and get its page_name
                    tcat = TestCatalog(self.env, parent_catalog_id)
                    if not tcat.exists:
                        self.env.log.error("Input parent test catalog with ID %s not found." % parent_catalog_id)
                        return result
                        
                    pagename = tcat['page_name'] + '_TT' + id
                else:
                    pagename = 'TC_TT' + id

                author = get_reporter_id(req, 'author')
                
                new_tc = TestCatalog(self.env, id, pagename, title, description)
                new_tc.author = author
                new_tc.remote_addr = req.remote_addr
                # This also creates the Wiki page
                new_tc.insert()
                result = id
                
            except:
                self.env.log.error("Error adding test catalog with title '%s' in catalog with ID %s!" % (title, parent_catalog_id))
                self.env.log.error(formatExceptionInfo())
            
            return id