Skip to content

Commit

Permalink
Added case where no error_uri is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanHuot committed Jul 26, 2018
1 parent 052eaee commit bd71fd6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,21 @@ def test(): return None
)
mocked.assert_called_once()

def test_fatal_error_no_page(self):
oauth = BottleOAuth2(self.app)
oauth.initialize(self.server)

@self.app.route('/fooh')
@oauth.create_authorization_response()
def test(): return None

with mock.patch("oauthlib.oauth2.Server.create_authorization_response",
side_effect=oauthlib.oauth2.InvalidClientIdError()) as mocked:
app_response = self.urlopen("/fooh")
self.assertEqual(app_response['code'], 500, "error is not handled by BottleOAuth2")
self.assertNotIn('Location', app_response['header'])
mocked.assert_called_once()


class test_create_revocation_decorators(ServerTestBase):
def setUp(self):
Expand Down

0 comments on commit bd71fd6

Please sign in to comment.