|
|
@ -367,11 +367,17 @@ class TestJob(RQTestCase):
|
|
|
|
self.assertDictEqual(serialized, serialized2)
|
|
|
|
self.assertDictEqual(serialized, serialized2)
|
|
|
|
|
|
|
|
|
|
|
|
def test_unpickleable_result(self):
|
|
|
|
def test_unpickleable_result(self):
|
|
|
|
"""Unpickleable job result doesn't crash job.to_dict()"""
|
|
|
|
"""Unpickleable job result doesn't crash job.save() and job.refresh()"""
|
|
|
|
job = Job.create(func=fixtures.say_hello, args=('Lionel',))
|
|
|
|
job = Job.create(func=fixtures.say_hello, args=('Lionel',))
|
|
|
|
job._result = queue.Queue()
|
|
|
|
job._result = queue.Queue()
|
|
|
|
data = job.to_dict()
|
|
|
|
job.save()
|
|
|
|
self.assertEqual(data['result'], 'Unpickleable return value')
|
|
|
|
self.assertEqual(
|
|
|
|
|
|
|
|
self.testconn.hget(job.key, 'result').decode('utf-8'),
|
|
|
|
|
|
|
|
'Unpickleable return value'
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
job = Job.fetch(job.id)
|
|
|
|
|
|
|
|
self.assertEqual(job.result, 'Unpickleable return value')
|
|
|
|
|
|
|
|
|
|
|
|
def test_result_ttl_is_persisted(self):
|
|
|
|
def test_result_ttl_is_persisted(self):
|
|
|
|
"""Ensure that job's result_ttl is set properly"""
|
|
|
|
"""Ensure that job's result_ttl is set properly"""
|
|
|
|