Ejemplo n.º 1
0
 def _hasPotteryCompatibleSetup(cls, branch):
     if cls.fake_pottery_compatibility is None:
         # No fake compatibility setting call the real method.
         return TranslationTemplatesBuildJob._hasPotteryCompatibleSetup(
             branch)
     else:
         # Fake pottery compatibility.
         return cls.fake_pottery_compatibility
 def _hasPotteryCompatibleSetup(cls, branch):
     if cls.fake_pottery_compatibility is None:
         # No fake compatibility setting call the real method.
         return TranslationTemplatesBuildJob._hasPotteryCompatibleSetup(
             branch)
     else:
         # Fake pottery compatibility.
         return cls.fake_pottery_compatibility
Ejemplo n.º 3
0
    def test_has_Job(self):
        # Associated with each TranslationTemplateBuildJob is a Job.
        base_job = self.specific_job.job
        self.assertIsInstance(base_job, Job)

        # From a Job, the TranslationTemplatesBuildJobSource can find the
        # TranslationTemplatesBuildJob back for us.
        specific_job_for_base_job = removeSecurityProxy(
            TranslationTemplatesBuildJob.getByJob(base_job))
        self.assertEqual(self.specific_job, specific_job_for_base_job)
    def test_has_Job(self):
        # Associated with each TranslationTemplateBuildJob is a Job.
        base_job = self.specific_job.job
        self.assertIsInstance(base_job, Job)

        # From a Job, the TranslationTemplatesBuildJobSource can find the
        # TranslationTemplatesBuildJob back for us.
        specific_job_for_base_job = removeSecurityProxy(
            TranslationTemplatesBuildJob.getByJob(base_job))
        self.assertEqual(self.specific_job, specific_job_for_base_job)
Ejemplo n.º 5
0
 def test_scheduleTranslationTemplatesBuild_subscribed(self):
     # If the feature is enabled, a TipChanged event for a branch that
     # generates templates will schedule a templates build.
     branch = self._makeTranslationBranch()
     removeSecurityProxy(branch).last_scanned_id = 'null:'
     commit = DirectBranchCommit(branch)
     commit.writeFile('POTFILES.in', 'foo')
     commit.commit('message')
     notify(events.TipChanged(branch, None, False))
     branchjobs = list(TranslationTemplatesBuildJob.iterReady())
     self.assertEqual(1, len(branchjobs))
     self.assertEqual(branch, branchjobs[0].branch)
 def test_scheduleTranslationTemplatesBuild_subscribed(self):
     # If the feature is enabled, a TipChanged event for a branch that
     # generates templates will schedule a templates build.
     branch = self._makeTranslationBranch()
     removeSecurityProxy(branch).last_scanned_id = 'null:'
     commit = DirectBranchCommit(branch)
     commit.writeFile('POTFILES.in', 'foo')
     commit.commit('message')
     notify(events.TipChanged(branch, None, False))
     branchjobs = list(TranslationTemplatesBuildJob.iterReady())
     self.assertEqual(1, len(branchjobs))
     self.assertEqual(branch, branchjobs[0].branch)
Ejemplo n.º 7
0
    def makeJob(self):
        """See `IBuildFarmJobOld`."""
        store = IStore(BranchJob)

        # Pass public HTTP URL for the branch.
        metadata = {
            'branch_url': self.branch.composePublicURL(),
            'build_id': self.id,
        }
        branch_job = BranchJob(self.branch,
                               BranchJobType.TRANSLATION_TEMPLATES_BUILD,
                               metadata)
        store.add(branch_job)
        return TranslationTemplatesBuildJob(branch_job)
Ejemplo n.º 8
0
    def test_cleanUp(self):
        # TranslationTemplatesBuildJob has its own customized cleanup
        # behaviour, since it's actually a BranchJob.
        job = removeSecurityProxy(self.specific_job.job)
        buildqueue = IStore(BuildQueue).find(BuildQueue, job=job).one()

        job_id = job.id
        store = Store.of(job)
        branch_name = self.branch.unique_name

        buildqueue.destroySelf()

        # BuildQueue is gone.
        self.assertIs(None,
                      store.find(BuildQueue, BuildQueue.job == job_id).one())
        # Job is gone.
        self.assertIs(None, store.find(Job, Job.id == job_id).one())
        # TranslationTemplatesBuildJob is gone.
        self.assertIs(None, TranslationTemplatesBuildJob.getByJob(job_id))
        # Branch is still here.
        branch_set = getUtility(IBranchSet)
        self.assertEqual(self.branch, branch_set.getByUniqueName(branch_name))
    def test_cleanUp(self):
        # TranslationTemplatesBuildJob has its own customized cleanup
        # behaviour, since it's actually a BranchJob.
        job = removeSecurityProxy(self.specific_job.job)
        buildqueue = IStore(BuildQueue).find(BuildQueue, job=job).one()

        job_id = job.id
        store = Store.of(job)
        branch_name = self.branch.unique_name

        buildqueue.destroySelf()

        # BuildQueue is gone.
        self.assertIs(
            None, store.find(BuildQueue, BuildQueue.job == job_id).one())
        # Job is gone.
        self.assertIs(None, store.find(Job, Job.id == job_id).one())
        # TranslationTemplatesBuildJob is gone.
        self.assertIs(None, TranslationTemplatesBuildJob.getByJob(job_id))
        # Branch is still here.
        branch_set = getUtility(IBranchSet)
        self.assertEqual(self.branch, branch_set.getByUniqueName(branch_name))