Exemplo n.º 1
0
    def test_unicode_serialization(self):
        unicode_query = u"יוניקוד"
        job = Job(redis_connection, query=unicode_query, priority=self.priority)

        self.assertEquals(job.query, unicode_query)

        job.save()
        loaded_job = Job.load(redis_connection, job.id)
        self.assertEquals(loaded_job.query, unicode_query)
Exemplo n.º 2
0
    def test_cancel_job_with_no_process(self):
        job = Job(redis_connection, query=self.query, priority=self.priority)
        job.status = Job.PROCESSING
        job.process_id = 699999
        job.save()

        job.cancel()

        job = Job.load(redis_connection, job.id)

        self.assertEquals(job.status, Job.FAILED)
Exemplo n.º 3
0
    def test_job_loading(self):
        job = Job(redis_connection, query=self.query, priority=self.priority)
        job.save()

        loaded_job = Job.load(redis_connection, job.id)

        self.assertFalse(loaded_job.new_job)

        self.assertEquals(loaded_job.id, job.id)
        self.assertEquals(loaded_job.wait_time, job.wait_time)
        self.assertEquals(loaded_job.query_time, job.query_time)
        self.assertEquals(loaded_job.process_id, job.process_id)
        self.assertEquals(loaded_job.status, job.status)
        self.assertEquals(loaded_job.priority, job.priority)
        self.assertEquals(loaded_job.query_hash, job.query_hash)
        self.assertEquals(loaded_job.query, job.query)
        self.assertEquals(loaded_job.error, job.error)
        self.assertEquals(loaded_job.query_result_id, job.query_result_id)