예제 #1
0
    def test_simple(self, get_implementation, sync_job):
        implementation = mock.Mock()
        get_implementation.return_value = implementation

        build = self.create_build(self.project)
        job = self.create_job(build)
        plan = self.create_plan()
        self.create_step(plan)
        self.create_job_plan(job, plan)

        create_job(
            job_id=job.id.hex,
            task_id=job.id.hex,
            parent_task_id=build.id.hex,
        )

        get_implementation.assert_called_once_with()

        implementation.execute.assert_called_once_with(job=job, )

        sync_job.delay.assert_called_once_with(
            job_id=job.id.hex,
            task_id=job.id.hex,
            parent_task_id=build.id.hex,
        )
예제 #2
0
    def test_simple(self, get_implementation, sync_job):
        implementation = mock.Mock()
        get_implementation.return_value = implementation

        project = self.create_project()
        build = self.create_build(project)
        job = self.create_job(build)
        plan = self.create_plan()
        self.create_step(plan)
        self.create_job_plan(job, plan)

        create_job(
            job_id=job.id.hex,
            task_id=job.id.hex,
            parent_task_id=build.id.hex,
        )

        get_implementation.assert_called_once_with()

        implementation.execute.assert_called_once_with(
            job=job,
        )

        sync_job.delay.assert_called_once_with(
            job_id=job.id.hex,
            task_id=job.id.hex,
            parent_task_id=build.id.hex,
        )
예제 #3
0
    def test_simple(self, get_implementation, sync_job):
        implementation = mock.Mock()
        get_implementation.return_value = implementation

        project = self.create_project()
        build = self.create_build(project)
        job = self.create_job(build)
        plan = self.create_plan(project)
        self.create_step(plan)
        self.create_job_plan(job, plan)

        with mock.patch.object(create_job, 'allow_absent_from_db', True):
            create_job(
                job_id=job.id.hex,
                task_id=job.id.hex,
                parent_task_id=build.id.hex,
            )

        get_implementation.assert_called_once_with()

        implementation.execute.assert_called_once_with(job=job, )

        sync_job.delay.assert_called_once_with(
            job_id=job.id.hex,
            task_id=job.id.hex,
            parent_task_id=build.id.hex,
        )