fix extend_session_expires to extend the current session (RT#59595)
[catagits/Catalyst-Plugin-Session.git] / t / live_verify_address.t
CommitLineData
2a1463db 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More;
7
8BEGIN {
9 eval { require Catalyst::Plugin::Session::State::Cookie; Catalyst::Plugin::Session::State::Cookie->VERSION(0.03) }
10 or plan skip_all =>
11 "Catalyst::Plugin::Session::State::Cookie 0.03 or higher is required for this test";
12
13 eval {
14 require Test::WWW::Mechanize::Catalyst;
15 Test::WWW::Mechanize::Catalyst->VERSION(0.51);
16 }
17 or plan skip_all =>
18 'Test::WWW::Mechanize::Catalyst >= 0.51 is required for this test';
19
20 plan tests => 12;
21}
22
23use lib "t/lib";
24use Test::WWW::Mechanize::Catalyst "SessionTestApp";
25
26# Test without delete __address
27local $ENV{REMOTE_ADDR} = "192.168.1.1";
28
29my $ua = Test::WWW::Mechanize::Catalyst->new( {} );
30$ua->get_ok( "http://localhost/login" );
31$ua->content_contains('logged in');
32
33$ua->get_ok( "http://localhost/set_session_variable/logged/in" );
34$ua->content_contains('session variable set');
35
36
37# Change Client
38local $ENV{REMOTE_ADDR} = "192.168.1.2";
39
40$ua->get_ok( "http://localhost/get_session_variable/logged");
41$ua->content_contains('VAR_logged=n.a.');
42
43# Inital Client
44local $ENV{REMOTE_ADDR} = "192.168.1.1";
45
46$ua->get_ok( "http://localhost/login_without_address" );
47$ua->content_contains('logged in (without address)');
48
49$ua->get_ok( "http://localhost/set_session_variable/logged/in" );
50$ua->content_contains('session variable set');
51
52# Change Client
53local $ENV{REMOTE_ADDR} = "192.168.1.2";
54
55$ua->get_ok( "http://localhost/get_session_variable/logged" );
56$ua->content_contains('VAR_logged=in');
57
58
59