Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tests for Dancer::Session::Cookie

  • Loading branch information...
commit 2f81e4d76b315c980a3f78fab4027d51841a23ec 1 parent 57d39e5
Alexis Sukrieh authored
Showing with 8 additions and 18 deletions.
  1. +6 −0 t/08_session/03_http_requests.t
  2. +2 −18 t/08_session/06_cookie.t
View
6 t/08_session/03_http_requests.t
@@ -15,6 +15,11 @@ if ($ENV{DANCER_TEST_MEMCACHED}) {
push @engines, "memcached";
setting(memcached_servers => '127.0.0.1:11211');
}
+if ($ENV{DANCER_TEST_COOKIE}) {
+ push @engines, "cookie";
+ setting(session_cookie_key => "secret/foo*@!");
+}
+
plan tests => 3 * scalar(@clients) * scalar(@engines) + (scalar(@engines));
@@ -38,6 +43,7 @@ test_tcp(
$res = $ua->get("http://127.0.0.1:$port/read_session");
like $res->content, qr/name='$client'/,
"session looks good for client $client";
+
}
},
server => sub {
View
20 t/08_session/06_cookie.t
@@ -13,7 +13,7 @@ BEGIN {
unless Dancer::ModuleLoader->load('String::CRC32');
plan skip_all => "need Crypt::Rijndael"
unless Dancer::ModuleLoader->load('Crypt::Rijndael');
- plan tests => 12;
+ plan tests => 7;
use_ok 'Dancer::Session::Cookie'
}
@@ -46,20 +46,4 @@ is $@, '', "Cookie session created";
isa_ok $session, 'Dancer::Session::Cookie';
can_ok $session, qw(init create retrieve destroy flush);
-
-ok defined($session->id), 'session id is defined';
-
-my $s = Dancer::Session::Cookie->retrieve('XXX');
-is $s, undef, "unknown session is not found";
-
-my $s = Dancer::Session::Cookie->retrieve($session->id);
-is_deeply $s, $session, "session is retrieved";
-
-$s->{foo} = 42;
-$s->flush;
-$session = Dancer::Session::Cookie->retrieve($session->id);
-is_deeply $s, $session, "session is changed on flush";
-
-$s->destroy;
-$session = Dancer::Session::Cookie->retrieve($session->id);
-is $session, undef, 'destroy removes the session';
+# see ./03_http_requests.t for a full functional test
Please sign in to comment.
Something went wrong with that request. Please try again.