I have a method that calls the set_status api of the webapp2.Response class:
class RequestHandler(webapp2.RequestHandler):
some_method(self):
self.response.set_status(200)
I am writing tests for some_method()
and mocking the set_status
method:
class BaseTest(unittest.TestCase):
def setUp(self):
# Set up stuff.
@mock.patch.object(Response, 'set_status')
def testSomeMethod()
some_method()
However when I run the test I get:
'NoneType' object has no attribute 'set_status'
Why is the call to set_status()
not getting mocked?