Improve error handling for non-redirect errors
Change-Id: I7b8b62e52b08ed92edf02c770fd908be47917505
diff --git a/t/plugin/auth-oauth.t b/t/plugin/auth-oauth.t
index a2cc73c..67ddedd 100644
--- a/t/plugin/auth-oauth.t
+++ b/t/plugin/auth-oauth.t
@@ -955,6 +955,23 @@
$t->post_ok(Mojo::URL->new('/settings/oauth/authorize')->query({
client_id => 'xyz',
+ state => 'abcde',
+ scope => 'search match',
+ redirect_uri_server => 'http://example.com/',
+ redirect_uri => $t->app->close_redirect_to('http://wrong'),
+ csrf_token => $csrf,
+}))
+ ->status_is(302)
+ ->header_is('location', '/settings/oauth')
+ ->tx->res->headers->header('location')
+ ;
+
+$t->get_ok('/settings/oauth')
+ ->text_is('div.notify-error', 'Invalid redirect URI')
+ ;
+
+$t->post_ok(Mojo::URL->new('/settings/oauth/authorize')->query({
+ client_id => 'xyz',
state => 'fail',
scope => 'search match',
# redirect_uri_server => 'http://example.com/',