Added authorized search and fixed logout

Change-Id: Ia18d1bf14286c658a9aef9ca29508145f07309ca
diff --git a/t/remote_user.t b/t/remote_user.t
index d904fb7..a484d1d 100644
--- a/t/remote_user.t
+++ b/t/remote_user.t
@@ -8,6 +8,13 @@
 
 my $t = Test::Mojo->new('Kalamar');
 
+$t->get_ok('/?q=Baum')
+  ->status_is(200)
+  ->text_like('h1 span', qr/KorAP: Find .Baum./i)
+  ->text_like('#total-results', qr/\d+$/)
+  ->content_like(qr/\"authorized\"\:null/)
+  ;
+
 $t->get_ok('/')
   ->element_exists('form[action=/user/login] input[name=handle_or_email]');
 
@@ -29,17 +36,45 @@
   ->status_is(200)
   ->element_exists_not('div.notify-error')
   ->element_exists('div.notify-success')
-  ->text_is('div.notify-success', 'Login successful!')
+  ->text_is('div.notify-success', 'Login successful')
+  ;
+
+# Now the user is logged in and should be able to
+# search with authorization
+$t->get_ok('/?q=Baum')
+  ->status_is(200)
+  ->text_like('h1 span', qr/KorAP: Find .Baum./i)
+  ->text_like('#total-results', qr/\d+$/)
+  ->element_exists_not('div.notify-error')
+  ->content_like(qr/\"authorized\"\:\"test\"/)
   ;
 
 
+# Logout
+$t->get_ok('/user/logout')
+  ->status_is(302)
+  ->header_is('Location' => '/');
+
+$t->get_ok('/')
+  ->status_is(200)
+  ->element_exists_not('div.notify-error')
+  ->element_exists('div.notify-success')
+  ->text_is('div.notify-success', 'Logout successful')
+  ;
+
+$t->get_ok('/?q=Baum')
+  ->status_is(200)
+  ->text_like('h1 span', qr/KorAP: Find .Baum./i)
+  ->text_like('#total-results', qr/\d+$/)
+  ->content_like(qr/\"authorized\"\:null/)
+  ;
+
 done_testing;
 __END__
 
 
 
 
-
 ok(!$c->user->get('details'), 'User not logged in');
 
 # Login with user credentials