Newer
Older
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/perl
use strict;
use warnings;
use English qw(-no_match_vars);
use File::Temp;
use IPC::Run qw(run);
use Test::More;
plan tests => 2;
$ENV{ACCOUNTMANAGER_CONFIG} = 't/manager.conf';
subtest start_page => sub {
plan tests => 4;
local $ENV{REQUEST_METHOD} = 'GET';
local $ENV{QUERY_STRING} = '';
my ($out, $err, $rc) = run_executable('account-manager.cgi');
diag($out) if $ENV{TEST_DEBUG};
like(
$out,
qr{^Content-Type: text/html\n\n},
'HTTP headers'
);
like(
$out,
qr{<title>eduGAIN Access Check</title>},
'page title'
);
like(
$out,
qr{<button id="start_testing">Go on testing the service</button>},
'start button'
);
is($err, '', 'empty stderr');
};
subtest sp_selection_page => sub {
plan tests => 4;
local $ENV{REQUEST_METHOD} = 'GET';
local $ENV{QUERY_STRING} = 'action=account_wizard';
my ($out, $err, $rc) = run_executable('account-manager.cgi');
diag($out) if $ENV{TEST_DEBUG};
like(
$out,
qr{^Content-Type: text/html\n\n},
'HTTP headers'
);
like(
$out,
qr{<title>eduGAIN Access Check - Select your Service Provider</title>},
'page title'
);
like(
$out,
qr{<select id="sp_entityid" name="sp_entityid" class="required">},
'selection list'
);
is($err, '', 'empty stderr');
};
sub run_executable {
my ($executable, $args) = @_;
my @args = $args ? split(/\s+/, $args) : ();
run(
[ $EXECUTABLE_NAME, '-I', 'lib', 'bin/' . $executable, @args ],
\my ($in, $out, $err)
);
return ($out, $err, $CHILD_ERROR >> 8);
}