~ubuntu-branches/ubuntu/edgy/libapache2-mod-perl2/edgy

« back to all changes in this revision

Viewing changes to ModPerl-Registry/t/basic.t

  • Committer: Bazaar Package Importer
  • Author(s): Andres Salomon
  • Date: 2005-08-12 01:40:38 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050812014038-gjigefs55pqx4qc8
Tags: 2.0.1-3
Grr.  Really include perl.conf file; it got lost due to diff not
wanting to add an empty file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
use warnings FATAL => 'all';
3
3
 
4
4
use Apache::Test;
5
 
use Apache::TestUtil;
 
5
use Apache::TestUtil qw(t_cmp t_catfile_apache t_client_log_error_is_expected);
6
6
use Apache::TestRequest;
7
7
use Apache::TestConfig ();
8
8
 
9
 
use Apache::TestUtil qw(t_catfile_apache);
10
 
 
11
9
my %modules = (
12
10
    registry    => 'ModPerl::Registry',
13
11
    registry_bb => 'ModPerl::RegistryBB',
16
14
 
17
15
my @aliases = sort keys %modules;
18
16
 
19
 
plan tests => @aliases * 5 + 3;
 
17
plan tests => @aliases * 5 + 3, need 'mod_alias.c';
20
18
 
21
19
my $vars = Apache::Test::config()->{vars};
22
20
my $script_file = t_catfile_apache $vars->{serverroot}, 'cgi-bin', 'basic.pl';
26
24
    my $url = "/$alias/basic.pl";
27
25
 
28
26
    ok t_cmp(
 
27
        GET_BODY($url),
29
28
        "ok $script_file",
30
 
        GET_BODY($url),
31
29
        "$modules{$alias} basic cgi test",
32
30
    );
33
31
}
34
32
 
35
 
# test non-executable bit
 
33
# test non-executable bit (it should be executed w/o a problem)
36
34
for my $alias (@aliases) {
37
35
    if (Apache::TestConfig::WIN32) {
38
36
        skip "non-executable bit test for Win32", 0;
42
40
 
43
41
    t_client_log_error_is_expected();
44
42
    ok t_cmp(
45
 
        "403 Forbidden",
46
 
        HEAD($url)->status_line(),
 
43
        HEAD($url)->code,
 
44
        200,
47
45
        "$modules{$alias} non-executable file",
48
46
    );
49
47
}
53
51
    my $url = "/$alias/env.pl?foo=bar";
54
52
 
55
53
    ok t_cmp(
 
54
        GET_BODY($url),
56
55
        "foo=bar",
57
 
        GET_BODY($url),
58
56
        "$modules{$alias} mod_cgi-like environment pre-set",
59
57
    );
60
58
}
64
62
    my $url = "/$alias/require.pl";
65
63
 
66
64
    ok t_cmp(
 
65
        GET_BODY($url),
67
66
        "it works",
68
 
        GET_BODY($url),
69
67
        "$modules{$alias} mod_cgi-like environment pre-set",
70
68
    );
71
69
}
76
74
    my $url = "/$alias/exit.pl";
77
75
 
78
76
    ok t_cmp(
 
77
        GET_BODY_ASSERT($url),
79
78
        "before exit",
80
 
        GET_BODY_ASSERT($url),
81
79
        "$modules{$alias} mod_cgi-like environment pre-set",
82
80
    );
83
81
}
88
86
{
89
87
    my $url = "/registry_oo_conf/env.pl?foo=bar";
90
88
    ok t_cmp(
 
89
        GET_BODY($url),
91
90
        "foo=bar",
92
 
        GET_BODY($url),
93
91
        "ModPerl::Registry->handler mod_cgi-like environment pre-set",
94
92
    );
95
93
}
98
96
{
99
97
    my $url = "/registry/content_type.pl";
100
98
    ok t_cmp(
 
99
        GET_BODY($url),
101
100
        "ok",
102
 
        GET_BODY($url),
103
101
        "\$r->content_type('text/plain')",
104
102
    );
105
103
}
114
112
    my $url = "/registry/send_headers.html";
115
113
    my $res = GET $url;
116
114
    ok t_cmp(
 
115
        $res->content_type,
117
116
        "text/plain",
118
 
        $res->content_type,
119
117
        "script's content-type",
120
118
    );
121
119
}