Commit | Line | Data |
73d1f3a2 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More; |
7 | |
8 | BEGIN { |
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 | |
f8f81744 |
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'; |
73d1f3a2 |
19 | |
20 | plan tests => 2; |
21 | } |
22 | |
23 | use lib "t/lib"; |
24 | use Test::WWW::Mechanize::Catalyst "SessionTestApp"; |
25 | |
26 | my $injected_cookie = "sessiontestapp_session=89c3a019866af6f5a305e10189fbb23df3f4772c"; |
27 | |
28 | my $ua1 = Test::WWW::Mechanize::Catalyst->new; |
29 | $ua1->add_header('Cookie' => $injected_cookie); |
30 | |
31 | my $res = $ua1->get( "http://localhost/login" ); |
32 | my $cookie = $res->header('Set-Cookie'); |
33 | |
34 | ok $cookie; |
35 | isnt $cookie, qr/$injected_cookie/, 'Logging in generates us a new cookie'; |
36 | |