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)
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))