Skip to content

Commit

Permalink
Tests: Perl streaming body and delayed response simple tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-zelenkov committed Mar 1, 2019
1 parent d92feef commit 754b85c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/perl/delayed_response/psgi.pl
@@ -0,0 +1,10 @@
my $app = sub {
my ($environ) = @_;

return sub {
(my $responder = shift)->([200, [
'Content-Type' => 'text/plain',
'Content-Length' => '12'
], ["Hello World!"]]);
}
};
13 changes: 13 additions & 0 deletions test/perl/streaming_body/psgi.pl
@@ -0,0 +1,13 @@
my $app = sub {
my ($environ) = @_;

return sub {
my $writer = (my $responder = shift)->([200, [
'Content-Type' => 'text/plain',
'Content-Length' => '12'
]]);

$writer->write("Hello World!");
$writer->close;
};
};
16 changes: 16 additions & 0 deletions test/test_perl_application.py
Expand Up @@ -200,5 +200,21 @@ def test_perl_body_io_fake(self):
self.search_in_log(r'\[error\].+IOFake close\(\) called'),
'body io fake close')

def test_perl_delayed_response(self):
self.load('delayed_response')

resp = self.get()

self.assertEqual(resp['status'], 200, 'status')
self.assertEqual(resp['body'], 'Hello World!', 'body')

def test_perl_streaming_body(self):
self.load('streaming_body')

resp = self.get()

self.assertEqual(resp['status'], 200, 'status')
self.assertEqual(resp['body'], 'Hello World!', 'body')

if __name__ == '__main__':
TestUnitPerlApplication.main()

0 comments on commit 754b85c

Please sign in to comment.