File: live_app_remote1.t

package info (click to toggle)
libcatalyst-plugin-authentication-perl 0.10024-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 508 kB
  • sloc: perl: 1,531; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 1,120 bytes parent folder | download | duplicates (4)
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
use strict;
use warnings;
use Test::More;

use lib 't/lib';
use Catalyst::Test qw/RemoteTestApp1/;

$RemoteTestEngine::REMOTE_USER = undef;
ok( request('/public')->is_success, 'anonymous user (undef) - /public' );
ok( request('/')->is_error, 'anonymous user (undef) - /' );

$RemoteTestEngine::REMOTE_USER = '';
ok( request('/public')->is_success, 'anonymous user (empty) - /public' );
ok( request('/')->is_error, 'anonymous user (empty) - /' );

$RemoteTestEngine::REMOTE_USER = 'john';
ok( request('/')->is_success, 'valid user' );

$RemoteTestEngine::REMOTE_USER = 'nonexisting';
ok( request('/')->is_error, 'non-existing user' );

$RemoteTestEngine::REMOTE_USER = 'denieduser';
ok( request('/')->is_error, 'explicitly denied user' );

$RemoteTestEngine::REMOTE_USER = 'CN=namexyz/OU=Test/C=Company';
ok( request('/')->is_success, 'testing "cutname" option 1' );
is( request('/')->content, 'User:namexyz', 'testing "cutname" option 2' );

$RemoteTestEngine::REMOTE_USER = 'CN=/OU=Test/C=Company';
is( request('/')->content, 'User:CN=/OU=Test/C=Company', 'testing "cutname" option - empty $1 match' );

done_testing;