chiark
/
gitweb
/
~ian
/
cgi-auth-flexible.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Testing: Tidy up html a bit
[cgi-auth-flexible.git]
/
tests
/
cgi
diff --git
a/tests/cgi
b/tests/cgi
index 6af24138ed4ab2f4d33f92c801d8056ffd284001..21fba258eb6360d776268a734d0d380816352d46 100755
(executable)
--- a/
tests/cgi
+++ b/
tests/cgi
@@
-12,6
+12,13
@@
$SIG{__DIE__} = sub { Carp::confess(@_) };
my $dump = "$ENV{'CAFTEST_CAF'}/tests/tmp";
my $dump = "$ENV{'CAFTEST_CAF'}/tests/tmp";
+my $q = CGI->new;
+
+my $url = $q->url();
+
+$url =~ s{^\Qhttp://localhost/\E}{$ENV{CAFTEST_URLBASE}}
+ if $ENV{'CAFTEST_URLBASE'};
+
my @verifier_params =(
username_password_error => sub {
my ($c,$r,$u,$p)=@_;
my @verifier_params =(
username_password_error => sub {
my ($c,$r,$u,$p)=@_;
@@
-22,24
+29,18
@@
my @verifier_params =(
dir => $dump,
srcdump_filter_cwd => 0,
debug => sub { print STDERR "DEBUG ", @_[2..@_-1]; },
dir => $dump,
srcdump_filter_cwd => 0,
debug => sub { print STDERR "DEBUG ", @_[2..@_-1]; },
- );
-
-push @verifier_params, (
- get_url => sub { return $ENV{'CAFTEST_URL'}; },
- ) if $ENV{'CAFTEST_URL'};
+ get_url => sub { return $url },
+);
my $verifier = CGI::Auth::Flexible->new_verifier(@verifier_params);
END { $verifier->disconnect() if $verifier; }
my $verifier = CGI::Auth::Flexible->new_verifier(@verifier_params);
END { $verifier->disconnect() if $verifier; }
-my $q = CGI->new;
-
my $authreq = $verifier->new_request($q);
$authreq->check_ok() or exit;
my $cookie = $authreq->secret_cookie();
my $authreq = $verifier->new_request($q);
$authreq->check_ok() or exit;
my $cookie = $authreq->secret_cookie();
-my $url = $q->url();
my $hiddenhtml = $authreq->secret_hidden_html();
print <<END;
my $hiddenhtml = $authreq->secret_hidden_html();
print <<END;
@@
-47,17
+48,19
@@
Content-Type: text/html
Set-Cookie: $cookie
<html><head><title>TITLE</title></head>
Set-Cookie: $cookie
<html><head><title>TITLE</title></head>
-<body><h1>H1</h1>
-<h1>again</h1>
-
-<h1>info<h1>
-<pre>
+<body><h1>ACCESSGRANTED</h1>
END
my $newurl = $authreq->url_with_query_params($authreq->chain_params());
my $newurl_esc = escapeHTML($newurl);
END
my $newurl = $authreq->url_with_query_params($authreq->chain_params());
my $newurl_esc = escapeHTML($newurl);
-my $txt = Data::Dumper->Dump([$authreq->get_username(), $authreq->mutate_ok(),
+print <<END;
+<h1>info<h1>
+<pre>
+END
+
+my $txt = Data::Dumper->Dump([$authreq->get_username(),
+ $q->request_method eq 'POST' ? $authreq->check_mutate() : "(not POST)",
$q->path_info(),
$authreq->chain_params(),
scalar $q->Vars()],
$q->path_info(),
$authreq->chain_params(),
scalar $q->Vars()],