Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test session expiry updating

  • Loading branch information...
commit 8f162df07bccc18e50c83ecbd869f9221849e91d 1 parent 97ed623
@jrockway authored
Showing with 24 additions and 1 deletion.
  1. +1 −0  Makefile.PL
  2. +23 −1 t/live-test.t
View
1  Makefile.PL
@@ -6,6 +6,7 @@ all_from 'lib/Catalyst/Plugin/Session/HMAC.pm';
requires 'Crypt::Util' => '0.05';
requires 'Class::C3';
+build_requires 'URI::Escape';
build_requires 'Catalyst::Runtime';
build_requires 'Test::WWW::Mechanize::Catalyst';
build_requires 'Test::More';
View
24 t/live-test.t
@@ -2,7 +2,8 @@
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More tests => 19;
+use URI::Escape;
# setup library path
use FindBin qw($Bin);
@@ -17,6 +18,16 @@ my $mech = Test::WWW::Mechanize::Catalyst->new;
$mech->get_ok('http://localhost/', 'get main page');
$mech->content_like(qr/it works/i, 'see if it has our text');
+my $orig_expires;
+$mech->cookie_jar->scan(
+ sub {
+ $orig_expires = TestApp->
+ _thaw_session_string(uri_unescape($_[2]))->{__expires};
+ }
+);
+
+ok $orig_expires, 'got expiry from cryptocookie OF DEATH';
+
for(1..3){
$mech->get_ok('http://localhost/increment');
$mech->content_like(qr/count is now $_/);
@@ -31,3 +42,14 @@ $mech->get_ok('http://localhost/increment');
$mech->content_like(qr/count is now 1/);
$mech->get_ok('http://localhost/get_non_expired_key');
$mech->content_like(qr/bar/);
+
+my $new_expires;
+$mech->cookie_jar->scan(
+ sub {
+ $new_expires = TestApp->
+ _thaw_session_string(uri_unescape($_[2]))->{__expires};
+ }
+);
+
+ok $new_expires, 'got new expiry';
+ok $new_expires > $orig_expires, 'expiry moved forward with time';
Please sign in to comment.
Something went wrong with that request. Please try again.