File: TestAppDriver.pm

package info (click to toggle)
libcgi-application-plugin-authorization-perl 0.07%2B~cs0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 356 kB
  • sloc: perl: 1,237; makefile: 17
file content (39 lines) | stat: -rw-r--r-- 751 bytes parent folder | download | duplicates (3)
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
34
35
36
37
38
39
package TestAppDriver;

use base qw(CGI::Application);
use CGI::Application::Plugin::Authorization;
use Test::More;

#
# These tests should pass with the parameters that were passed
#
sub run_authz_success_tests {
    my $class    = shift;
    my @testdata = @_;

    my $cgiapp = $class->new();

    foreach my $data (@testdata) {
        # Successful authz
        ok($cgiapp->authz->authorize(@$data), 'successful authz');
    }
}


#
# These tests should fail with the parameters that were passed
#
sub run_authz_failure_tests {
    my $class    = shift;
    my @testdata = @_;

    my $cgiapp = $class->new();

    foreach my $data (@testdata) {
        # Failed authz
        ok(!$cgiapp->authz->authorize(@$data), 'failed authz');
    }
}


1;