25-AutoSignin.t 619 Bytes
Newer Older
Yadd's avatar
Yadd committed
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
use Test::More;
use strict;

require 't/test-lib.pm';

my $res;

my $client = LLNG::Manager::Test->new(
    {
        ini => {
            logLevel        => 'error',
            authentication  => 'Demo',
            userDB          => 'Same',
            autoSigninRules => {
                dwho => '$env->{REMOTE_ADDR} =~ /^127/',
            },
        }
    }
);

ok( $res = $client->_get( '/', ), 'Auth query' );
count(1);
expectOK($res);
my $id = expectCookie($res);

ok( $res = $client->_get( '/', ip => '192.168.1.1' ), 'Bad query' );
count(1);
expectReject($res);
clean_sessions();

done_testing( count() );