Merge pull request #269 from jonparrott/master

Upgrading mock and fixing flask asserts
This commit is contained in:
Danny Hermes
2015-08-14 10:05:46 -07:00
2 changed files with 4 additions and 5 deletions

View File

@@ -225,8 +225,8 @@ class FlaskOAuth2Tests(unittest.TestCase):
self.assertTrue('/return_url' in rv.headers['Location']) self.assertTrue('/return_url' in rv.headers['Location'])
self.assertTrue(self.oauth2.client_secret in http.body) self.assertTrue(self.oauth2.client_secret in http.body)
self.assertTrue('codez' in http.body) self.assertTrue('codez' in http.body)
self.oauth2.storage.put.assert_called() self.assertTrue(self.oauth2.storage.put.called)
self.oauth2.authorize_callback.assert_called() self.assertTrue(self.oauth2.authorize_callback.called)
def test_callback_view_errors(self): def test_callback_view_errors(self):
# Error supplied to callback # Error supplied to callback
@@ -317,13 +317,12 @@ class FlaskOAuth2Tests(unittest.TestCase):
def test_refresh(self): def test_refresh(self):
with self.app.test_request_context(): 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.storage.put(self._generate_credentials())
self.oauth2.credentials.refresh( self.oauth2.credentials.refresh(
Http2Mock(access_token='new_token')) Http2Mock(access_token='new_token'))
mock_session.__setitem__.assert_called()
self.assertEqual( self.assertEqual(
self.oauth2.storage.get().access_token, 'new_token') self.oauth2.storage.get().access_token, 'new_token')

View File

@@ -3,7 +3,7 @@ envlist = py26,py27,py33,py34,pypy,cover
[testenv] [testenv]
basedeps = keyring basedeps = keyring
mock==1.0.1 mock>=1.3.0
pycrypto>=2.6 pycrypto>=2.6
cryptography>=1.0 cryptography>=1.0
pyopenssl>=0.14 pyopenssl>=0.14