Handler: Update tests for previous commit (#630)

environments/ppa-mbqj77/deployments/1
François-Xavier Deltombe 11 years ago
parent 628d7e393f
commit 0f0ac0dc69
  1. 13
      lemonldap-ng-handler/t/01-Lemonldap-NG-Handler-Main.t
  2. 5
      lemonldap-ng-handler/t/10-Lemonldap-NG-Handler-SharedConf.t

@ -23,7 +23,6 @@ use lib dirname( abs_path $0 );
# its man page ( perldoc Test::More ) for help writing this test script.
my $h;
$h = bless {}, 'Lemonldap::NG::Handler::Main';
my $apacheRequest;
$ENV{SERVER_NAME} = "test1.example.com";
open STDERR, '>/dev/null';
@ -63,9 +62,9 @@ ok( Lemonldap::NG::Handler::Reload->configReload( $conf, $Lemonldap::NG::Handler
ok( &{ $tsv->{portal} }() eq 'http://auth.example.com/', 'portal' );
ok( $h->grant( $apacheRequest, '/s' ), 'basic rule "accept"' );
ok( !$h->grant( $apacheRequest, '/no' ), 'basic rule "deny"' );
ok( $h->grant( $apacheRequest, '/a/a' ), 'bad ordered rule 1/2' );
ok( $h->grant( $apacheRequest, '/a' ), 'bad ordered rule 2/2' );
ok( !$h->grant( $apacheRequest, '/b/a' ), 'good ordered rule 1/2' );
ok( $h->grant( $apacheRequest, '/b' ), 'good ordered rule 2/2' );
ok( $h->grant( '/s' ), 'basic rule "accept"' );
ok( !$h->grant( '/no' ), 'basic rule "deny"' );
ok( $h->grant( '/a/a' ), 'bad ordered rule 1/2' );
ok( $h->grant( '/a' ), 'bad ordered rule 2/2' );
ok( !$h->grant( '/b/a' ), 'good ordered rule 1/2' );
ok( $h->grant( '/b' ), 'good ordered rule 2/2' );

@ -61,6 +61,7 @@ if ( $numTests == 3 ) {
my $mock = Test::MockObject->new();
my $ret;
$mock->fake_module( 'Lemonldap::NG::Handler::API',
newRequest => sub { print STDERR "newRequest\n" },
header_in => sub { "" },
hostname => sub { 'test.example.com' },
is_initial_req => sub { '1' },
@ -70,14 +71,14 @@ if ( $numTests == 3 ) {
uri => sub { '/' },
uri_with_args => sub { '/' },
get_server_port => sub { '80' },
set_header_out => sub { $ret = join( ':', $_[2], $_[3], ); }, );
set_header_out => sub { $ret = join( ':', $_[1], $_[2], ); }, );
our $apacheRequest;
my $h = bless {}, 'Lemonldap::NG::Handler';
ok(
$h->Lemonldap::NG::Handler::run($apacheRequest),
$h->handler($apacheRequest),
'run Handler with basic configuration and no cookie'
);

Loading…
Cancel
Save