diff options
author | Edmund von der Burg <evdb@mysociety.org> | 2011-04-07 15:41:59 +0100 |
---|---|---|
committer | Edmund von der Burg <evdb@mysociety.org> | 2011-04-07 15:44:01 +0100 |
commit | d0059b5b46bf16d5adbeddffc412699a8c815725 (patch) | |
tree | ea82bb7a7652e2bc8ab37058b7dee95fba19f064 /perllib/FixMyStreet/TestMech.pm | |
parent | a932cf24e53109204e304ba68263d55326bee78f (diff) |
Add the 'remember_me' checkbox on login
Diffstat (limited to 'perllib/FixMyStreet/TestMech.pm')
-rw-r--r-- | perllib/FixMyStreet/TestMech.pm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 3d011d708..c16f288c8 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -280,4 +280,28 @@ sub visible_form_values { return \%params; } +=head2 session_cookie_expiry + + $expiry = $mech->session_cookie_expiry( ); + +Returns the current expiry time for the session cookie. Might be '0' which +indicates it expires at end of browser session. + +=cut + +sub session_cookie_expiry { + my $mech = shift; + + my $cookie_name = 'fixmystreet_app_session'; + my $expires = 'not found'; + + $mech # + ->cookie_jar # + ->scan( sub { $expires = $_[8] if $_[1] eq $cookie_name } ); + + croak "Could not find cookie '$cookie_name'" if $expires eq 'not found'; + + return $expires || 0; +} + 1; |