Ejemplo n.º 1
0
 def test_011_customfield_object(self):
     """This test does the following:
     * gets a TestRun
     * Adds a Plan to it
     * Verifies that the plan was added
     * Verifies that a non valid plan cant be added
     """
     tr = TestRun(project_id=DEFAULT_PROJ, test_run_id=TEST_RUN_ID)
     with self.assertRaises(PylarionLibException):
         tr.plannedin = "not_valid"
     tr.plannedin = self.NEW_PLAN
     self.assertEquals(tr.plannedin, self.NEW_PLAN)
     tr.update()
Ejemplo n.º 2
0
    def update_run(self,
                   run,
                   template=None,
                   plannedin=None,
                   assignee=None,
                   status=None,
                   description=None,
                   is_template=False):

        run = run.strip()
        query_ful = 'project.id:%s AND id:%s' % (TestRun.default_project, run)

        fields = [
            'query', 'created', 'test_run_id', 'select_test_cases_by',
            'status', 'plannedin', 'assignee', 'author'
        ]
        st = TestRun.search(query_ful, fields, 'created', -1, is_template)

        # Update run if exists, otherwise create it.
        if st:
            print('Update the existing run: %s' % run)
            tr = TestRun(run, None, TestRun.default_project)

            # set fields
            if assignee != 'None':
                tr.assignee = assignee
                print('%4sSet Assignee to %s' % ('', assignee))
            if plannedin is not None:
                tr.plannedin = plannedin
                print('%4sSet Plannedin to %s' % ('', plannedin))
            if status is not None:
                tr.status = status
                print('%4sSet Status to %s' % ('', status))
            if description is not None:
                tr.description = description
                print('%4sSet Description to %s' % ('', description))
            tr.update()

        else:
            tr = TestRun.create(TestRun.default_project,
                                run,
                                template,
                                assignee=assignee,
                                plannedin=plannedin,
                                status=status,
                                description=description)
            # display fields
            if assignee != 'None':
                print('%4sSet Assignee to %s' % ('', assignee))
            if plannedin is not None:
                print('%4sSet Plannedin to %s' % ('', plannedin))
            if status is not None:
                print('%4sSet Status to %s' % ('', status))
            if description is not None:
                print('%4sSet Description to %s' % ('', description))
            print('Created %s:' % run)
Ejemplo n.º 3
0
    def update_run(self,
                   run,
                   template=None,
                   plannedin=None,
                   assignee=None,
                   is_template=False):

        qrun = run.replace('-', '\-')
        query_ful = 'project.id:%s AND id:%s' % (TestRun.default_project,
                                                 qrun.strip())

        fields = ['query',
                  'created',
                  'test_run_id',
                  'select_test_cases_by',
                  'status',
                  'plannedin',
                  'assignee',
                  'author']
        st = TestRun.search(query_ful,
                            fields,
                            'created',
                            -1,
                            is_template)

        # Update run if exists, otherwise create it.
        if st:
            print 'Update the existing run: %s' % run
            tr = TestRun(run.strip(),
                         None,
                         TestRun.default_project)
        else:
            tr = TestRun.create(TestRun.default_project,
                                run.strip(),
                                template)
            print '\nCreated %s:' % run

        # set customer filed of plannedin
        if plannedin:
            tr.plannedin = plannedin
            print '%4sSet Plannedin to %s' % ('', plannedin)

        if assignee == 'None':
            tr.assignee = TestRun.logged_in_user_id
        else:
            tr.assignee = assignee

        print '%4sSet Assignee to %s' % ('', tr.assignee)
        tr.update()