Improve error handling for non-redirect errors

Change-Id: I7b8b62e52b08ed92edf02c770fd908be47917505
diff --git a/t/server/mock.pl b/t/server/mock.pl
index ab0c34d..e615306 100644
--- a/t/server/mock.pl
+++ b/t/server/mock.pl
@@ -697,6 +697,14 @@
       return $c->rendered;
     };
 
+    if (index($redirect_uri,'http://wrong') >= 0) {
+      return $c->render(
+        code => 400,
+        content_type => 'text/plain',
+        text => '{"error_description":"Invalid redirect URI","state":"ZMwDGTZ2RY","error":"invalid_request"}'
+      );
+    };
+
     return $c->redirect_to(
       Mojo::URL->new($redirect_uri)->query({
         code => $tokens{auth_token_1},
@@ -713,7 +721,13 @@
         scope => 'match_info search openid'
       })
       );
-  }
+  };
+
+  return $c->render(
+    code => 400,
+    content_type => 'text/plain',
+    content => 'Unknown'
+  );
 };