Commit | Line | Data |
4585dfb1 |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin; |
7 | use lib "$FindBin::Bin/lib"; |
8 | |
9 | use Test::More tests => 6; |
10 | use Catalyst::Test 'TestApp'; |
11 | |
12 | TestApp->config->{require_ssl} = { |
13 | remain_in_ssl => 1, |
14 | }; |
15 | |
16 | # test an SSL redirect |
17 | ok( my $res = request('http://localhost/ssl/secured'), 'request ok' ); |
18 | is( $res->code, 302, 'redirect code ok' ); |
19 | is( $res->header('location'), 'https://localhost/ssl/secured', 'redirect uri ok' ); |
20 | isnt( $res->content, 'Secured', 'no content displayed on secure page, ok' ); |
21 | |
22 | # test redirect back to HTTP, should not redirect |
23 | SKIP: |
24 | { |
cc4f2717 |
25 | if ( Catalyst->VERSION < 5.5 ) { |
26 | skip "These tests require Catalyst >= 5.5", 2; |
27 | } |
4585dfb1 |
28 | ok( $res = request('https://localhost/ssl/unsecured'), 'request ok' ); |
29 | is( $res->code, 200, 'remain in SSL ok' ); |
30 | } |
31 | |