use Test::More; use strict; use IO::String; BEGIN { eval { require 't/test-lib.pm'; require 't/smtp.pm'; }; } my $res; my $maintests = 12; SKIP: { eval 'require Email::Sender::Simple;'; if ($@) { skip 'Missing dependencies', $maintests; } my $client = LLNG::Manager::Test->new( { ini => { logLevel => 'error', useSafeJail => 1, authentication => 'Demo', userDB => 'Same', passwordDB => 'Demo', captcha_mail_enabled => 0, portalMainLogo => 'common/logos/logo_llng_old.png', newLocationWarning => 1, loginHistoryEnabled => 1 } } ); ## Simple access ok( $res = $client->_get( '/', accept => 'text/html' ), 'Get Portal', ); my ( $host, $url, $query ) = expectForm( $res, '#', undef, 'user', 'password' ); ## Authentication #1 with IP #1 (Test 1) ok( $res = $client->_post( '/', IO::String->new('user=dwho&password=dwho'), length => 23, accept => 'text/html', ), 'First auth query' ); my $id = expectCookie($res); $client->logout($id); ## Authentication #2 with IP #1 (Test 2) ok( $res = $client->_post( '/', IO::String->new('user=dwho&password=dwho'), length => 23, accept => 'text/html', ), 'Second auth query' ); $id = expectCookie($res); expectRedirection( $res, 'http://auth.example.com/' ); $client->logout($id); ## Authentication #3 with IP #2 (Test 3) ok( $res = $client->_post( '/', IO::String->new('user=dwho&password=dwho'), length => 23, accept => 'text/html', ip => '127.0.0.2', ), 'Third auth query' ); $id = expectCookie($res); expectRedirection( $res, 'http://auth.example.com/' ); $client->logout($id); like( mail(), qr#