Esempio n. 1
0
 def test_get_job(self):
     job = simcity.get_job()
     assert_equals(job.id, self.test_id)
     simcity.set_current_job_id(None)
     assert_raises(EnvironmentError, simcity.get_job)
     otherJob = simcity.get_job(self.test_other_id)
     assert_equals(otherJob.id, self.test_other_id)
     assert_equals(type(otherJob), type(Job({'_id': 'aaaa'})))
Esempio n. 2
0
 def test_queue_job(self):
     job = simcity.queue_job(Job({'_id': 'aaaa'}), 'ssh')
     assert_true(job['queue'] > 0)
     assert_equals(len(self.db.saved), 1)
     job = simcity.queue_job(simcity.get_job(), 'ssh')
     assert_true(job['queue'] > 0)
     assert_true(simcity.get_job()['queue'] > 0)
     job = simcity.finish_job(job)
     assert_true(job['archive'] > 0)
Esempio n. 3
0
 def test_start_job(self):
     job = simcity.start_job()
     assert_equals(job.id, self.test_id)
     assert_true(job['start'] > 0)
     assert_true(simcity.get_job()['start'] > 0)
     assert_equals(job['queue'], 0)
     assert_equals(job['done'], 0)
Esempio n. 4
0
 def test_finish_job(self):
     job = simcity.start_job()
     simcity.finish_job(job)
     assert_true(job['start'] > 0)
     assert_true(job['done'] > 0)
     assert_true(simcity.get_job()['done'] > 0)
     job = simcity.queue_job(job, 'ssh')
     assert_true(job['archive'] > 0)
Esempio n. 5
0
 def test_archive_job(self):
     job = simcity.get_job()
     self.db.save(job)
     job = simcity.archive_job(simcity.get_job())
     assert_not_equals(job.id, self.test_id)