File: author-live_engine_response_large.t

package info (click to toggle)
libcatalyst-engine-apache-perl 1.16-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 1,040 kB
  • ctags: 667
  • sloc: perl: 6,344; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 787 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!perl

BEGIN {
  unless ($ENV{AUTHOR_TESTING}) {
    require Test::More;
    Test::More::plan(skip_all => 'these tests are for testing by the author');
  }
}


use strict;
use warnings;

use FindBin;
use lib "$FindBin::Bin/lib";

use Test::More tests => 6;
use Catalyst::Test 'TestApp';

# phaylon noticed that refactored was truncating output on large images.
# This test tests 100K and 1M output content.

my $expected = {
    one => 'x' x (100 * 1024),
    two => 'y' x (1024 * 1024),
};

for my $action ( keys %{$expected} ) {
    ok( my $response = request('http://localhost/engine/response/large/' . $action ),
        'Request' );
    ok( $response->is_success, 'Response Successful 2xx' );

    is( length( $response->content ), length( $expected->{$action} ), 'Length OK' );
}