From dc070f30cfd654b104edfe82ee1c6168c6f97482 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 18 Sep 2010 15:34:53 -0500 Subject: use valid base64 in the tests --- t/01-basic.t | 6 +++--- t/02-file-root.t | 20 ++++++++++---------- 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"); } }; -- cgit v1.2.3-54-g00ecf