Skip to content

Commit

Permalink
modernized a few more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 22, 2012
1 parent efee8c9 commit 64cd88d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
13 changes: 3 additions & 10 deletions t/mojolicious/app.t
Expand Up @@ -14,7 +14,6 @@ use lib "$FindBin::Bin/lib";

use File::Spec::Functions 'catdir';
use Mojo::Date;
use Mojo::Transaction::HTTP;
use Mojolicious;
use Test::Mojo;

Expand Down Expand Up @@ -304,22 +303,16 @@ is $app->mode, 'test', 'right mode';

# Persistent error
$app = MojoliciousTest->new;
my $tx = Mojo::Transaction::HTTP->new;
$tx->req->method('GET');
$tx->req->url->parse('/foo');
my $tx = $t->ua->build_tx(GET => '/foo');
$app->handler($tx);
is $tx->res->code, 200, 'right status';
like $tx->res->body, qr|Hello Mojo from the template /foo! Hello World!|,
'right content';
$tx = Mojo::Transaction::HTTP->new;
$tx->req->method('GET');
$tx->req->url->parse('/foo/willdie');
$tx = $t->ua->build_tx(GET => '/foo/willdie');
$app->handler($tx);
is $tx->res->code, 500, 'right status';
like $tx->res->body, qr/Foo\.pm/, 'right content';
$tx = Mojo::Transaction::HTTP->new;
$tx->req->method('GET');
$tx->req->url->parse('/foo');
$tx = $t->ua->build_tx(GET => '/foo');
$app->handler($tx);
is $tx->res->code, 200, 'right status';
like $tx->res->body, qr|Hello Mojo from the template /foo! Hello World!|,
Expand Down
9 changes: 2 additions & 7 deletions t/mojolicious/lite_app.t
Expand Up @@ -14,7 +14,6 @@ use Mojo::ByteStream 'b';
use Mojo::Cookie::Response;
use Mojo::IOLoop;
use Mojo::JSON;
use Mojo::Transaction::HTTP;
use Mojolicious::Lite;
use Test::Mojo;

Expand Down Expand Up @@ -1041,12 +1040,8 @@ $t->post_form_ok(
->content_is("табак ангел\n");

# POST /malformed_utf8
my $tx = Mojo::Transaction::HTTP->new;
$tx->req->method('POST');
$tx->req->url->parse('/malformed_utf8');
$tx->req->headers->content_type('application/x-www-form-urlencoded');
$tx->req->body('foo=%E1');
$t->ua->start($tx);
my $tx = $t->ua->post('/malformed_utf8' =>
{'Content-Type' => 'application/x-www-form-urlencoded'} => 'foo=%E1');
is $tx->res->code, 200, 'right status';
is scalar $tx->res->headers->server, 'Mojolicious (Perl)',
'right "Server" value';
Expand Down

0 comments on commit 64cd88d

Please sign in to comment.