Merge pull request #438 from adamwen829/master

fix issue #437
main
Selwin Ong 10 years ago
commit 51f641698d

@ -69,7 +69,9 @@ else:
string_types = (str, unicode) string_types = (str, unicode)
def as_text(v): def as_text(v):
return v if v is None:
return None
return v.decode('utf-8')
def decode_redis_hash(h): def decode_redis_hash(h):
return h return h

@ -307,3 +307,14 @@ class TestWorker(RQTestCase):
# Updates worker statuses # Updates worker statuses
self.assertEqual(worker.state, 'busy') self.assertEqual(worker.state, 'busy')
self.assertEqual(worker.get_current_job_id(), job.id) self.assertEqual(worker.get_current_job_id(), job.id)
def test_work_unicode_friendly(self):
"""Worker processes work with unicode description, then quits."""
q = Queue('foo')
w = Worker([q])
job = q.enqueue('tests.fixtures.say_hello', name='Adam',
description='你好 世界!')
self.assertEquals(w.work(burst=True), True,
'Expected at least some work done.')
self.assertEquals(job.result, 'Hi there, Adam!')
self.assertEquals(job.description, '你好 世界!')

Loading…
Cancel
Save