X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=t%2FPlack-Middleware-Auth-Complex.t;h=72de5723e6c1db4605066a2992abef11093e3d8d;hb=cd19b1b40c2315cc84f34a77f415f525c366fb4e;hp=5b42232c64cc5c224d85f93d92fb6e6e2192d5c2;hpb=4c1b8033b07680fc1ee1cdd4f515ca89545b22c4;p=plack-middleware-auth-complex.git diff --git a/t/Plack-Middleware-Auth-Complex.t b/t/Plack-Middleware-Auth-Complex.t index 5b42232..72de572 100644 --- a/t/Plack-Middleware-Auth-Complex.t +++ b/t/Plack-Middleware-Auth-Complex.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 59; +use Test::More tests => 61; BEGIN { $ENV{EMAIL_SENDER_TRANSPORT} = 'Test' } BEGIN { use_ok('Plack::Middleware::Auth::Complex') }; @@ -50,9 +50,10 @@ test_psgi $app, sub { is_http $cb->(POST '/'), 200, 'Anon', 'POST /'; is_http $cb->(GET '/register'), 200, 'Anon', 'GET /register'; set_auth 'user', 'password'; + is_http $cb->(GET '/', Authorization => 'Hello'), 200, 'Anon', 'GET / with invalid Authorization'; is_http $cb->(GET '/', Authorization => $auth), 200, 'Anon', 'GET / with bad user/pass'; is_http $cb->(POST '/register'), 400, 'Missing parameter username', 'POST /register with no parameters'; - is_http $cb->(POST '/register', [@register_args, username => '???'] ), 400, 'Username must match (?^a:^\w{2,20}$)', 'POST /register with bad username'; + is_http $cb->(POST '/register', [@register_args, username => '???'] ), 400, 'Invalid username', 'POST /register with bad username'; is_http $cb->(POST '/register', [@register_args, password => '???'] ), 400, 'The two passwords do not match', 'POST /register with different passwords'; is_http $cb->(POST '/register', \@register_args), 200, 'Registered successfully', 'POST /register with correct parameters', is_http $cb->(POST '/register', \@register_args), 400, 'Username already in use', 'POST /register with existing user',