Redirect to index on auth-failure if user not logged in (fixes #192)
Change-Id: Ifc38d975542b6b30fa2b4bae6d5753d80be4e642
diff --git a/t/plugin/auth-oauth.t b/t/plugin/auth-oauth.t
index 67ddedd..3e5b78c 100644
--- a/t/plugin/auth-oauth.t
+++ b/t/plugin/auth-oauth.t
@@ -811,12 +811,26 @@
->session_hasnt('/user')
->header_is('Location' => '/');
-$csrf = $t->get_ok('/')
+$t->get_ok('/')
->status_is(200)
->element_exists_not('div.notify-error')
->element_exists('div.notify-success')
->text_is('div.notify-success', 'Logout successful')
->element_exists("input[name=handle_or_email]")
+ ;
+
+# OAuth client authorization flow - but user not logged in
+$t->get_ok(Mojo::URL->new('/settings/oauth/authorize'))
+ ->status_is(302)
+ ->header_is('location','/')
+ ;
+
+$csrf = $t->get_ok('/')
+ ->status_is(200)
+ ->element_exists('div.notify-error')
+ ->element_exists_not('div.notify-success')
+ ->text_is('div.notify-error', 'Client ID required')
+ ->element_exists("input[name=handle_or_email]")
->tx->res->dom->at('input[name=csrf_token]')->attr('value')
;