Ejemplo n.º 1
0
    def test_finish_auth_bad_response(self):
        app.session['oauth_token'] = 'test_oauth_token'
        app.session['oauth_token_secret'] = 'test_oauth_token_secret'

        with patch("flask_app.app.get_oauth_client") as client:
            with pytest.raises(Exception):
                client().request.return_value = ({'status': None}, None)
                app.finish_auth()
Ejemplo n.º 2
0
    def test_finish_auth(self):
        app.session['oauth_token'] = 'test_oauth_token'
        app.session['oauth_token_secret'] = 'test_oauth_token_secret'

        with patch("flask_app.app.get_oauth_client") as client:
            client().request.return_value = ({'status': '200'}, "oauth_token=qwerty")
            assert 302 == app.finish_auth().status_code

            assert app.session['evernote_token'] == 'qwerty'