def testCreateAndStop(self): # From closing tagasauris job view there is no difference between those # jobs - sample gather & voting voting_key, voting_hit = create_sample_gather(self.tc, self.job) sample_gathering_key, sample_gathering_hit = create_sample_gather( self.tc, self.job) tj, new = TagasaurisJobs.objects.\ get_or_create(urlannotator_job=self.job) TagasaurisJobs.objects.filter(pk=tj.pk).update( sample_gathering_key=sample_gathering_key, sample_gathering_hit=sample_gathering_hit, voting_key=voting_key, voting_hit=voting_hit ) result = self.tc.get_job(external_id=voting_key) self.assertNotEqual(result['state'], 'stopped') result = self.tc.get_job(external_id=sample_gathering_key) self.assertNotEqual(result['state'], 'stopped') self.c.login(username='******', password='******') resp = self.c.get('%sadmin/job/%d/stop_sample_gathering/?format=json' % (self.api_url, self.job.id)) self.assertEqual(resp.status_code, 200) array = json.loads(resp.content) self.assertEqual(array['result'], 'SUCCESS') result = self.tc.get_job(external_id=sample_gathering_key) self.assertEqual(result['state'], 'stopped') result = self.tc.get_job(external_id=voting_key) self.assertNotEqual(result['state'], 'stopped') resp = self.c.get('%sadmin/job/%d/stop_voting/?format=json' % (self.api_url, self.job.id)) self.assertEqual(resp.status_code, 200) array = json.loads(resp.content) self.assertEqual(array['result'], 'SUCCESS') result = self.tc.get_job(external_id=sample_gathering_key) self.assertEqual(result['state'], 'stopped') result = self.tc.get_job(external_id=voting_key) self.assertEqual(result['state'], 'stopped')
def testCreateAndStop(self): voting_key, voting_hit = create_sample_gather(self.tc, self.job) result = self.tc.get_job(external_id=voting_key) self.assertNotEqual(result['state'], 'stopped') stop_job(voting_key) result = self.tc.get_job(external_id=voting_key) self.assertEqual(result['state'], 'stopped')
def testCreateAndStop(self): # From closing tagasauris job view there is no difference between those # jobs - sample gather & voting voting_key, voting_hit = create_sample_gather(self.tc, self.job) sample_gathering_key, sample_gathering_hit = create_sample_gather( self.tc, self.job) tj, new = TagasaurisJobs.objects.\ get_or_create(urlannotator_job=self.job) TagasaurisJobs.objects.filter(pk=tj.pk).update( sample_gathering_key=sample_gathering_key, sample_gathering_hit=sample_gathering_hit, voting_key=voting_key, voting_hit=voting_hit) result = self.tc.get_job(external_id=voting_key) self.assertNotEqual(result['state'], 'stopped') result = self.tc.get_job(external_id=sample_gathering_key) self.assertNotEqual(result['state'], 'stopped') self.c.login(username='******', password='******') resp = self.c.get('%sadmin/job/%d/stop_sample_gathering/?format=json' % (self.api_url, self.job.id)) self.assertEqual(resp.status_code, 200) array = json.loads(resp.content) self.assertEqual(array['result'], 'SUCCESS') result = self.tc.get_job(external_id=sample_gathering_key) self.assertEqual(result['state'], 'stopped') result = self.tc.get_job(external_id=voting_key) self.assertNotEqual(result['state'], 'stopped') resp = self.c.get('%sadmin/job/%d/stop_voting/?format=json' % (self.api_url, self.job.id)) self.assertEqual(resp.status_code, 200) array = json.loads(resp.content) self.assertEqual(array['result'], 'SUCCESS') result = self.tc.get_job(external_id=sample_gathering_key) self.assertEqual(result['state'], 'stopped') result = self.tc.get_job(external_id=voting_key) self.assertEqual(result['state'], 'stopped')
def testCreateAndStop(self): voting_key, voting_hit = create_sample_gather(self.tc, self.job) result = self.tc.get_job(external_id=voting_key) self.assertNotEqual(result['state'], 'stopped') stop_job(voting_key) result = self.tc.get_job(external_id=voting_key) self.assertEqual(result['state'], 'stopped')
def testJobDistinctHID(self): voting_key_1, voting_hit_1 = create_sample_gather(self.tc, self.job) voting_key_2, voting_hit_2 = create_sample_gather(self.tc, self.job) self.assertNotEqual(voting_key_1, voting_key_2) self.assertNotEqual(voting_hit_1, voting_hit_2)
def testCreateJob(self): voting_key, voting_hit = create_sample_gather(self.tc, self.job) self.assertEqual(len(voting_hit), 32) self.assertEqual(len(voting_key), 32)
def testJobDistinctHID(self): voting_key_1, voting_hit_1 = create_sample_gather(self.tc, self.job) voting_key_2, voting_hit_2 = create_sample_gather(self.tc, self.job) self.assertNotEqual(voting_key_1, voting_key_2) self.assertNotEqual(voting_hit_1, voting_hit_2)
def testCreateJob(self): voting_key, voting_hit = create_sample_gather(self.tc, self.job) self.assertEqual(len(voting_hit), 32) self.assertEqual(len(voting_key), 32)