Mocking Away The Url Object In Pylons
I want to test a method that calls the pylons.url object. However calling this in the tests leads to an error: TypeError: No object (name: url) has been registered for this thread
Solution 1:
In order for patch to work you need to give it the full path to the variable in the MODULE that you are actually patching. So rather than 'pylons.url' you would be patching 'my_project.my_module.url' and inside my_module.py you would be doing
from pylons import url
Does that make sense?
Post a Comment for "Mocking Away The Url Object In Pylons"