Agent-TCLI-Package-Net
view release on metacpan or search on metacpan
t/TCLI.Package.Net.HTTPD.t view on Meta::CPAN
is($test_c1_0->command,'tcli_'.$testee, '$test_c1_0->command get from init args');
is($test_c1_0->handler,'establish_context', '$test_c1_0->handler get from init args');
is($test_c1_0->call_style,'session', '$test_c1_0->call_style get from init args');
$t->is_body('httpd','Context now: httpd','Context now: httpd');
$t->ok('spawn' );
$t->ok('stop' );
$t->like_body('show port',qr(8080),'show default port');
$t->ok('set port 8000');
$t->like_body('show port',qr(8000),'show set port');
$t->not_ok('set port eight');
$t->like_body('show port',qr(8000),'show set port');
$t->ok('set port 8080');
$t->like_body('show address',qr(#!undefined),'show default address');
$t->ok('set address 127.0.0.1');
$t->like_body('show address',qr(127.0.0.1),'show set address');
$t->not_ok('set address foobario');
$t->like_body('show address',qr(127.0.0.1),'show set address');
$t->ok('set hostname example.com');
$t->like_body('show hostname',qr(example.com),'show set hostname');
$t->ok('set regex ^/foo/.*');
$t->like_body('show regex',qr(\^/foo/\.\*),'show set regex');
$t->like_body('show response',qr(OK200),'show set response');
$t->ok('set response NA404');
$t->like_body('show response',qr(NA404),'show set response');
$t->not_ok('set response OK404');
$t->like_body('show response',qr(NA404),'show set response');
$t->ok('set response OK200');
$t->ok('uri add regex=foo');
$t->like_body('show handlers',qr(foo));
$t->ok('spawn' );
$t->ok('/http cget url=http://127.0.0.1:8080/foo.htm');
$t->ok('stop' );
$t->ok('uri delete regex=foo');
$t->unlike_body('show handlers',qr(foo),'foo gone');
$t->ok('set logging');
$t->like_body('show logging',qr(logging: 1) );
$t->ok('uri add regex=bar.*');
$t->like_body('show handlers',qr(bar.*));
$t->ok('spawn' );
$t->ok('/tail test add like 200.*?bar');
$t->ok('/http cget url=http://127.0.0.1:8080/bar.htm');
$t->ok('/tail test add like 404.*?foo');
$t->ok('/http cget url=http://127.0.0.1:8080/foo.htm');
$t->ok('/tail test add like 200.*?foobar');
$t->ok('/http cget url=http://127.0.0.1:8080/foobar.htm');
$t->ok('stop' );
$t->ok('uri delete regex=bar.*');
$t->unlike_body('show handlers',qr(bar),'bar gone');
# test for error on restarting on same port
$t->ok('spawn port 8000' );
$t->ok('/http cget url=http://127.0.0.1:8000/foo.htm','HTTPD up');
$t->not_ok('spawn port 8000' );
$t->not_ok('stop' );
$t->ok('stop port 8000' );
# Can't add handler after server up yet. Need to fix SimpleHTTP
# 13 tests
#$t->ok('spawn' );
#$t->ok('uri add regex=bar.*');
#$t->like_body('show handlers',qr(bar.*));
#
#$t->ok('/tail test add like 200.*?bar');
#$t->ok('/http cget url=http://127.0.0.1:8080/bar.htm');
#$t->ok('/tail test add like 404.*?foo');
#$t->ok('/http cget url=http://127.0.0.1:8080/foo.htm');
#$t->ok('/tail test add like 200.*?foobar');
#$t->ok('/http cget url=http://127.0.0.1:8080/foobar.htm');
#
#$t->ok('stop' );
#$t->ok('uri delete regex=bar.*');
#$t->unlike_body('show handlers',qr(bar),'bar gone');
$test_master->run;
( run in 0.795 second using v1.01-cache-2.11-cpan-39bf76dae61 )