Fix error message in case of server error
Change-Id: I72528fea917f91d16b3fee8cb4c47282b9b08556
diff --git a/t/plugin/auth-oauth.t b/t/plugin/auth-oauth.t
index 7db935f..33ffafa 100644
--- a/t/plugin/auth-oauth.t
+++ b/t/plugin/auth-oauth.t
@@ -236,6 +236,11 @@
->element_exists_not('p.hint')
;
+# Query with error
+$t->get_ok('/?q=error')
+ ->status_is(400)
+ ->text_is('#notifications .notify-error','500: Internal Server Error')
+;
# Logout
$t->get_ok('/user/logout')
diff --git a/t/query.t b/t/query.t
index d3f0cd3..50d81b1 100644
--- a/t/query.t
+++ b/t/query.t
@@ -225,6 +225,12 @@
->text_is('#total-results', '> 4,274,841');
;
+# Query with error
+$t->get_ok('/?q=error')
+ ->status_is(400)
+ ->text_is('#notifications .notify-error','500: Internal Server Error')
+;
+
# Do not cache
$t->get_ok('/?q=timeout')
->status_is(200)
diff --git a/t/server/mock.pl b/t/server/mock.pl
index bd6debe..5389156 100644
--- a/t/server/mock.pl
+++ b/t/server/mock.pl
@@ -150,6 +150,13 @@
return $c->render(%{$c->load_response('query_no_query')});
};
+ if ($v->param('q') eq 'error') {
+ return $c->render(
+ status => 500,
+ inline => '<html><head>ERROR</head></html>'
+ );
+ };
+
my @slug_base = ($v->param('q'));
push @slug_base, 'o' . $v->param('offset') if defined $v->param('offset');
push @slug_base, 'c' . $v->param('count') if defined $v->param('count');