Skip to content

Commit

Permalink
more progress and finish event tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 3, 2012
1 parent 2956250 commit c2815ad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -2,6 +2,7 @@ This file documents the revision history for Perl extension Mojolicious.

2.74 2012-04-04
- Improved documentation.
- Improved tests.

2.73 2012-04-03
- Improved documentation.
Expand Down
16 changes: 15 additions & 1 deletion t/mojo/request_cgi.t
@@ -1,6 +1,6 @@
use Mojo::Base -strict;

use Test::More tests => 180;
use Test::More tests => 188;

# "Aren't we forgetting the true meaning of Christmas?
# You know, the birth of Santa."
Expand Down Expand Up @@ -143,6 +143,12 @@ is $req->proxy->userinfo, 'Aladdin:open sesame', 'right proxy userinfo';

# Parse Apache 2.2 (win32) like CGI environment variables and a body
$req = Mojo::Message::Request->new;
my $finished;
my $progress = 0;
$req->on(finish => sub { $finished = shift->is_finished });
$req->on(progress => sub { $progress++ });
ok !$finished, 'not finished';
ok !$progress, 'no progress';
is $req->content->progress, 0, 'right progress';
$req->parse(
CONTENT_LENGTH => 87,
Expand All @@ -154,10 +160,18 @@ $req->parse(
HTTP_HOST => 'test1',
SERVER_PROTOCOL => 'HTTP/1.1'
);
ok !$finished, 'not finished';
ok $progress, 'made progress';
$progress = 0;
is $req->content->progress, 0, 'right progress';
$req->parse('request=&ajax=true&login=test&password=111&');
ok !$finished, 'not finished';
ok $progress, 'made progress';
$progress = 0;
is $req->content->progress, 43, 'right progress';
$req->parse('edition=db6d8b30-16df-4ecd-be2f-c8194f94e1f4');
ok $finished, 'finished';
ok $progress, 'made progress';
is $req->content->progress, 87, 'right progress';
ok $req->is_finished, 'request is finished';
is $req->method, 'POST', 'right method';
Expand Down

0 comments on commit c2815ad

Please sign in to comment.