Skip to content

Commit

Permalink
ensure that caching does not bypass controller security
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 30, 2012
1 parent 82af8d5 commit 65cdc64
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion t/mojolicious/app.t
Expand Up @@ -7,7 +7,7 @@ BEGIN {
$ENV{MOJO_MODE} = 'development';
}

use Test::More tests => 268;
use Test::More tests => 275;

use FindBin;
use lib "$FindBin::Bin/lib";
Expand All @@ -34,6 +34,12 @@ $t->get_ok('/plugin-test-some_plugin2/register')->status_isnt(500)
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->content_unlike(qr/Something/)->content_like(qr/Page not found/);

# Plugin::Test::SomePlugin2::register (security violation again)
$t->get_ok('/plugin-test-some_plugin2/register')->status_isnt(500)
->status_is(404)->header_is(Server => 'Mojolicious (Perl)')
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->content_unlike(qr/Something/)->content_like(qr/Page not found/);

# Foo::fun
my $url = $t->ua->app_url;
$url->path('/fun/time');
Expand Down
8 changes: 7 additions & 1 deletion t/mojolicious/production_app.t
Expand Up @@ -7,7 +7,7 @@ BEGIN {
$ENV{MOJO_MODE} = 'production';
}

use Test::More tests => 57;
use Test::More tests => 63;

use FindBin;
use lib "$FindBin::Bin/lib";
Expand All @@ -25,6 +25,12 @@ $t->get_ok('/plugin-test-some_plugin2/register')->status_isnt(500)
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->content_like(qr/Page not found/);

# Plugin::Test::SomePlugin2::register (security violation again)
$t->get_ok('/plugin-test-some_plugin2/register')->status_isnt(500)
->status_is(404)->header_is(Server => 'Mojolicious (Perl)')
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->content_like(qr/Page not found/);

# SyntaxError::foo in production mode (syntax error in controller)
$t->get_ok('/syntax_error/foo')->status_is(500)
->header_is(Server => 'Mojolicious (Perl)')
Expand Down

0 comments on commit 65cdc64

Please sign in to comment.