Fixed ficture test for errors
Change-Id: I1957277d5ee2ef423ef5b15c553e1ffd97c58c01
diff --git a/lib/Kalamar/Apps/test_backend.pl b/lib/Kalamar/Apps/test_backend.pl
index d8af676..c529c4c 100644
--- a/lib/Kalamar/Apps/test_backend.pl
+++ b/lib/Kalamar/Apps/test_backend.pl
@@ -121,6 +121,12 @@
]
};
+ # Error responses:
+ if ($v->param('ql') && $v->param('ql') eq 'cosmas3') {
+ return $c->render(json => {
+ errors => [[101,"No entity found for id","test_h"]]
+ });
+ };
if (my $auth = $c->req->headers->header('Authorization')) {
if (my $jwt = $c->jwt_decode($auth)) {
diff --git a/t/remote.t b/t/remote.t
index 845c327..7148428 100644
--- a/t/remote.t
+++ b/t/remote.t
@@ -31,5 +31,21 @@
->element_exists_not('#ql-field option[value=poliqarp][selected]')
;
+# Check paging
+$t->get_ok('/?q=test&p=2&ql=cosmas2')
+ ->text_like('#total-results', qr/\d+$/)
+ ->text_is('#pagination a[rel=self] span', 2)
+ ->element_exists('#ql-field option[value=cosmas2][selected]')
+ ->element_exists_not('#ql-field option[value=poliqarp][selected]')
+;
+
+# Check for authorization
+# this should just trigger a fixture - it's not serious
+$t->get_ok('/?q=test&p=2&ql=cosmas3')
+ ->element_exists_not('#pagination a[rel=self] span')
+ ->element_exists('#search #no-results')
+ ->text_like('.notify-error', qr!No entity found!)
+ ;
+
done_testing;
__END__