-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlive_verify_address.t
55 lines (38 loc) · 1.28 KB
/
live_verify_address.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use strict;
use warnings;
use Test::Needs {
'Catalyst::Plugin::Authentication' => '0',
'Catalyst::Plugin::Session::State::Cookie' => '0.03',
};
use Test::More;
use lib "t/lib";
use MiniUA;
my $ua = MiniUA->new('SessionTestApp');
# Test without delete __address
local $ENV{REMOTE_ADDR} = "192.168.1.1";
my $res;
$res = $ua->get( "http://localhost/login" );
ok +$res->is_success;
like +$res->content, qr{logged in};
$res = $ua->get( "http://localhost/set_session_variable/logged/in" );
ok +$res->is_success;
like +$res->content, qr{session variable set};
# Change Client
my $ua2 = MiniUA->new('SessionTestApp');
$res = $ua2->get( "http://localhost/get_session_variable/logged" );
ok +$res->is_success;
like +$res->content, qr{VAR_logged=n\.a\.};
# Inital Client
local $ENV{REMOTE_ADDR} = "192.168.1.1";
$res = $ua->get( "http://localhost/login_without_address" );
ok +$res->is_success;
like +$res->content, qr{logged in \(without address\)};
$res = $ua->get( "http://localhost/set_session_variable/logged/in" );
ok +$res->is_success;
like +$res->content, qr{session variable set};
# Change Client
local $ENV{REMOTE_ADDR} = "192.168.1.2";
$res = $ua->get( "http://localhost/get_session_variable/logged" );
ok +$res->is_success;
like +$res->content, qr{VAR_logged=in};
done_testing;