stas 2004/08/08 16:45:40
Modified: t/api access2.t
t/response/TestAPI access2.pm
Log:
test $r->satisfies when Satisfy is set
Revision Changes Path
1.2 +1 -1 modperl-2.0/t/api/access2.t
Index: access2.t
===================================================================
RCS file: /home/cvs/modperl-2.0/t/api/access2.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- access2.t 8 Aug 2004 21:30:06 -0000 1.1
+++ access2.t 8 Aug 2004 23:45:40 -0000 1.2
@@ -5,7 +5,7 @@
use Apache::TestUtil;
use Apache::TestRequest;
-plan tests => 6, need need_lwp, need_auth;
+plan tests => 6, need need_lwp, need_auth, need_access;
my $location = "/TestAPI__access2";
1.4 +24 -10 modperl-2.0/t/response/TestAPI/access2.pm
Index: access2.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/access2.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- access2.pm 8 Aug 2004 23:01:38 -0000 1.3
+++ access2.pm 8 Aug 2004 23:45:40 -0000 1.4
@@ -20,6 +20,9 @@
#
# otherwise it returns the same, sans the 'valid-user' entry
#
+# also test:
+# - $r->some_auth_required when it's required
+# - $r->satisfies when Satisfy is set
use strict;
use warnings FATAL => 'all';
@@ -30,7 +33,7 @@
use Apache::TestTrace;
use Apache::Const -compile => qw(OK HTTP_UNAUTHORIZED SERVER_ERROR
- M_POST);
+ M_POST :satisfy);
my $users = "goo bar";
my $groups = "bar tar";
@@ -42,8 +45,11 @@
sub handler {
my $r = shift;
- # test: $r->some_auth_required;
- return Apache::SERVER_ERROR unless $r->some_auth_required;
+ die '$r->some_auth_required failed' unless $r->some_auth_required;
+
+ my $satisfies = $r->satisfies;
+ die "wanted satisfies=" . Apache::SATISFY_ALL . ", got $satisfies"
+ unless $r->satisfies() == Apache::SATISFY_ALL;
my($rc, $sent_pw) = $r->get_basic_auth_pw;
return $rc if $rc != Apache::OK;
@@ -90,6 +96,12 @@
PerlResponseHandler Apache::TestHandler::ok1
SetHandler modperl
+ <IfModule @ACCESS_MODULE@>
+ # needed to test $r->satisfies
+ Order Deny,Allow
+ Deny from all
+ Allow from @servername@
+ </IfModule>
AuthType Basic
AuthName "Access"
Require user goo bar
@@ -97,12 +109,14 @@
<Limit POST>
Require valid-user
</Limit>
-
- # htpasswd -mbc auth-users goo foo
- # htpasswd -mb auth-users bar mar
- # using md5 password so it'll work on win32 too
- AuthUserFile @DocumentRoot@/api/auth-users
- # group: user1 user2 ...
- AuthGroupFile @DocumentRoot@/api/auth-groups
+ Satisfy All
+ <IfModule @AUTH_MODULE@>
+ # htpasswd -mbc auth-users goo foo
+ # htpasswd -mb auth-users bar mar
+ # using md5 password so it'll work on win32 too
+ AuthUserFile @DocumentRoot@/api/auth-users
+ # group: user1 user2 ...
+ AuthGroupFile @DocumentRoot@/api/auth-groups
+ </IfModule>
</Location>
</NoAutoConfig>