From 711831a53c3c4c4d54cf6d70021ce8ad83d3494f Mon Sep 17 00:00:00 2001 From: Jon Wayne Parrott Date: Fri, 14 Aug 2015 09:24:58 -0700 Subject: [PATCH] Upgrading mock and fixing flask asserts --- tests/test_flask_util.py | 7 +++---- tox.ini | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_flask_util.py b/tests/test_flask_util.py index 7309aee..0331de2 100644 --- a/tests/test_flask_util.py +++ b/tests/test_flask_util.py @@ -225,8 +225,8 @@ class FlaskOAuth2Tests(unittest.TestCase): self.assertTrue('/return_url' in rv.headers['Location']) self.assertTrue(self.oauth2.client_secret in http.body) self.assertTrue('codez' in http.body) - self.oauth2.storage.put.assert_called() - self.oauth2.authorize_callback.assert_called() + self.assertTrue(self.oauth2.storage.put.called) + self.assertTrue(self.oauth2.authorize_callback.called) def test_callback_view_errors(self): # Error supplied to callback @@ -317,13 +317,12 @@ class FlaskOAuth2Tests(unittest.TestCase): def test_refresh(self): with self.app.test_request_context(): - with mock.patch('flask.session') as mock_session: + with mock.patch('flask.session'): self.oauth2.storage.put(self._generate_credentials()) self.oauth2.credentials.refresh( Http2Mock(access_token='new_token')) - mock_session.__setitem__.assert_called() self.assertEqual( self.oauth2.storage.get().access_token, 'new_token') diff --git a/tox.ini b/tox.ini index d42202c..342f512 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ envlist = py26,py27,py33,py34,pypy,cover [testenv] basedeps = keyring - mock==1.0.1 + mock>=1.3.0 pycrypto>=2.6 cryptography>=1.0 pyopenssl>=0.14