redirect() doesn't work with a mock object in version 2

42 views
Skip to first unread message

S.j. Sakib

unread,
Feb 11, 2018, 8:41:25 AM2/11/18
to Django users
Hello,
When I try to call the django.shortcuts.redirect function with a Mock() object from unittest.mock, it results in error. I've found that, the problem happens in iri_to_uri function in django.utils.encoding. It used to use force_bytes in earlier versions of django.
Any idea how to use a mock object with the redirect object?

Thanks!

Question asked in stackoverflow
Reply all
Reply to author
Forward
0 new messages