Merge pull request #539 from brownstein/test-coverage-for-unicode-args

Added test coverage for unicode keyword argument support
main
Selwin Ong 10 years ago
commit 8703dbeb17

@ -11,7 +11,7 @@ import time
from rq import Connection, get_current_job from rq import Connection, get_current_job
from rq.decorators import job from rq.decorators import job
from rq.compat import PY2
def say_pid(): def say_pid():
return os.getpid() return os.getpid()
@ -78,6 +78,14 @@ class CallableObject(object):
return u"I'm callable" return u"I'm callable"
class UnicodeStringObject(object):
def __repr__(self):
if PY2:
return u'é'.encode('utf-8')
else:
return u'é'
with Connection(): with Connection():
@job(queue='default') @job(queue='default')
def decorated_job(x, y): def decorated_job(x, y):

@ -399,3 +399,11 @@ class TestJob(RQTestCase):
job.perform() job.perform()
self.assertRaises(TypeError, queue.enqueue, fixtures.say_hello, job_id=1234) self.assertRaises(TypeError, queue.enqueue, fixtures.say_hello, job_id=1234)
def test_get_call_string_unicode(self):
"""test call string with unicode keyword arguments"""
queue = Queue(connection=self.testconn)
job = queue.enqueue(fixtures.echo, arg_with_unicode=fixtures.UnicodeStringObject())
self.assertIsNotNone(job.get_call_string())
job.perform()
Loading…
Cancel
Save