summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-09-18 15:34:53 -0500
committerJesse Luehrs <doy@tozt.net>2010-09-18 15:34:53 -0500
commitdc070f30cfd654b104edfe82ee1c6168c6f97482 (patch)
tree01dd797dfd1c5fc2b4d04e182b6d6f5b4fd09a23
parent00fdb4e3956a26be005dc8f1fe7638f6cbf16f6b (diff)
downloadplack-middleware-auth-htpasswd-dc070f30cfd654b104edfe82ee1c6168c6f97482.tar.gz
plack-middleware-auth-htpasswd-dc070f30cfd654b104edfe82ee1c6168c6f97482.zip
use valid base64 in the tests0.02
-rw-r--r--t/01-basic.t6
-rw-r--r--t/02-file-root.t20
2 files changed, 13 insertions, 13 deletions
diff --git a/t/01-basic.t b/t/01-basic.t
index 9646510..fb79ad4 100644
--- a/t/01-basic.t
+++ b/t/01-basic.t
@@ -31,21 +31,21 @@ use Plack::Builder;
{
my $res = $cb->(
- GET "/", "Authorization" => "Basic dGVzdDplZGNiYQ",
+ GET "/", "Authorization" => "Basic dGVzdDplZGNiYQ==",
);
is($res->code, 401, "request with wrong password gets 401");
}
{
my $res = $cb->(
- GET "/", "Authorization" => "Basic dHNldDphYmNkZQ",
+ GET "/", "Authorization" => "Basic dHNldDphYmNkZQ==",
);
is($res->code, 401, "request with unknown username gets 401");
}
{
my $res = $cb->(
- GET "/", "Authorization" => "Basic dGVzdDphYmNkZQ",
+ GET "/", "Authorization" => "Basic dGVzdDphYmNkZQ==",
);
is($res->code, 200, "valid authentication succeeds");
is($res->content, "Hello test", "and gets the right content");
diff --git a/t/02-file-root.t b/t/02-file-root.t
index f053efb..c6a9eb6 100644
--- a/t/02-file-root.t
+++ b/t/02-file-root.t
@@ -32,7 +32,7 @@ my $data_root = file(__FILE__)->dir->subdir('data', '02');
}
{
- my $res = $cb->(GET "/", 'Authorization' => 'Basic Zm9vOjEyMzQ');
+ my $res = $cb->(GET "/", 'Authorization' => 'Basic Zm9vOjEyMzQ=');
is($res->code, 200, "authorized request gets 200");
is($res->content, 'Hello foo: /', "and gets the right content");
}
@@ -44,21 +44,21 @@ my $data_root = file(__FILE__)->dir->subdir('data', '02');
{
my $res = $cb->(GET "/bar.txt",
- 'Authorization' => 'Basic Zm9vOjEyMzQ');
+ 'Authorization' => 'Basic Zm9vOjEyMzQ=');
is($res->code, 200, "authorized request gets 200");
is($res->content, 'Hello foo: /bar.txt',
"and gets the right content");
}
{
- my $res = $cb->(GET "/bar", 'Authorization' => 'Basic Zm9vOjEyMzQ');
+ my $res = $cb->(GET "/bar", 'Authorization' => 'Basic Zm9vOjEyMzQ=');
is($res->code, 200, "authorized request gets 200");
is($res->content, 'Hello foo: /bar', "and gets the right content");
}
{
my $res = $cb->(GET "/bar/baz.txt",
- 'Authorization' => 'Basic Zm9vOjEyMzQ');
+ 'Authorization' => 'Basic Zm9vOjEyMzQ=');
is($res->code, 200, "authorized request gets 200");
is($res->content, 'Hello foo: /bar/baz.txt',
"and gets the right content");
@@ -66,13 +66,13 @@ my $data_root = file(__FILE__)->dir->subdir('data', '02');
{
my $res = $cb->(GET "/bar/baz",
- 'Authorization' => 'Basic Zm9vOjEyMzQ');
+ 'Authorization' => 'Basic Zm9vOjEyMzQ=');
is($res->code, 401, "user foo isn't authorized for this path");
}
{
my $res = $cb->(GET "/bar/baz",
- 'Authorization' => 'Basic YmF6OjQzMjE');
+ 'Authorization' => 'Basic YmF6OjQzMjE=');
is($res->code, 200, "but user baz is");
is($res->content, 'Hello baz: /bar/baz',
"and gets the right content");
@@ -80,13 +80,13 @@ my $data_root = file(__FILE__)->dir->subdir('data', '02');
{
my $res = $cb->(GET "/bar/baz/quux.txt",
- 'Authorization' => 'Basic Zm9vOjEyMzQ');
+ 'Authorization' => 'Basic Zm9vOjEyMzQ=');
is($res->code, 401, "user foo isn't authorized for this path");
}
{
my $res = $cb->(GET "/bar/baz/quux.txt",
- 'Authorization' => 'Basic YmF6OjQzMjE');
+ 'Authorization' => 'Basic YmF6OjQzMjE=');
is($res->code, 200, "but user baz is");
is($res->content, 'Hello baz: /bar/baz/quux.txt',
"and gets the right content");
@@ -99,7 +99,7 @@ my $data_root = file(__FILE__)->dir->subdir('data', '02');
{
my $res = $cb->(GET "/rab/zab",
- 'Authorization' => 'Basic Zm9vOjEyMzQ');
+ 'Authorization' => 'Basic Zm9vOjEyMzQ=');
is($res->code, 200, "authorized request gets 200");
is($res->content, 'Hello foo: /rab/zab',
"and gets the right content");
@@ -147,7 +147,7 @@ my $data_root = file(__FILE__)->dir->subdir('data', '02');
my $cb = shift;
{
- my $res = $cb->(GET "/", 'Authorization' => 'Basic Zm9vOjEyMzQ');
+ my $res = $cb->(GET "/", 'Authorization' => 'Basic Zm9vOjEyMzQ=');
is($res->code, 401, "don't look up above file_root for .htpasswd");
}
};