Ejemplo n.º 1
0
    def test_add_steps_to_job(self):
        service = JobService(self.testdb)
        service.add_job('Test title', 'Test description')

        jobs = service.get_jobs()
        job_id = jobs[0].id

        step1_parameter1 = TaskParameter(key='step1_key1',
                                         value='step1_value1')
        step1_parameter2 = TaskParameter(key='step1_key2',
                                         value='step1_value2')

        step1 = Step('Test step 1', job_id)
        step1.parameters = [step1_parameter1, step1_parameter2]

        step2_parameter1 = TaskParameter(key='step2_key1',
                                         value='step2_value1')
        step2_parameter2 = TaskParameter(key='step2_key2',
                                         value='step2_value2')
        step2_parameter3 = TaskParameter(key='step2_key3',
                                         value='step2_value3')

        step2 = Step('Test step 2', job_id)
        step2.parameters = [
            step2_parameter1, step2_parameter2, step2_parameter3
        ]

        service.add_steps(job_id, [step1, step2])

        steps = service.get_steps(job_id)
        self.assertEqual(2, len(steps))
        self.assertEqual('Test step 1', steps[0].title)
Ejemplo n.º 2
0
    def test_add_job(self):
        service = JobService(self.testdb)
        service.add_job('Test title', 'Test description')

        jobs = service.get_jobs()
        self.assertEqual(1, len(jobs))
        self.assertEqual(jobs[0].title, 'Test title')
Ejemplo n.º 3
0
    def test_queue_build(self):
        build_service = BuildService(self.testdb)
        job_service = JobService(self.testdb)

        job_service.add_job('Test job')
        job = job_service.get_jobs()[0]

        self.assertIsNotNone(job)

        build_service.queueBuild(job.id)
        build_service.queueBuild(job.id)

        builds = build_service.get_queue_builds(job.id)

        self.assertEqual(2, len(builds))
        self.assertFalse(builds[0].id == builds[1].id)
Ejemplo n.º 4
0
    def test_add_job_without_title(self):
        service = JobService(self.testdb)
        service.add_job(None)

        jobs = service.get_jobs()
        self.assertEqual(0, len(jobs))