def init_btm_gather(self, topic, description, no_of_urls, *args, **kwargs): lock_name = 'job_handler_init_btm_%d' % self.job.id with POSIXLock(lock_name): if self.job.tagasaurisjobs.beatthemachine_hit is not None: log.info( 'Tried to create new btm gathering job, but it already exists' ) return True tc = make_tagapi_client() key, hit = create_btm(tc, self.job, topic, description, no_of_urls) self.job.tagasaurisjobs.beatthemachine_key = key self.job.tagasaurisjobs.save() return key is not None
def testBTMCreation(self): btm_key, btm_hit = create_btm(self.tc, self.job, "topic", "description", 10) self.assertEqual(len(btm_hit), 32) self.assertEqual(len(btm_key), 32)