1use Test::More tests => 8; 2 3use HTTP::Proxy; 4 5my ( $proxy, $agent, $daemon ); 6 7# individual methods 8$proxy = HTTP::Proxy->new( port => 0 ); 9is( $proxy->agent, undef, 'agent undefined at startup' ); 10is( $proxy->daemon, undef, 'daemon undefined at startup' ); 11 12# private methods (should we test them?) 13$agent = $proxy->_init_agent; 14$daemon = $proxy->_init_daemon; 15isa_ok( $agent, 'LWP::UserAgent', 'init_agent' ); 16isa_ok( $daemon, 'HTTP::Daemon', 'init_daemon' ); 17 18# this is ugly 19$daemon = undef; 20 21# combined init method 22$proxy = HTTP::Proxy->new( port => 0 ); 23$proxy->init; 24isa_ok( $proxy->agent, 'LWP::UserAgent', 'init agent' ); 25isa_ok( $proxy->daemon, 'HTTP::Daemon', 'init daemon' ); 26 27# basic checks on the agent 28$agent = $proxy->agent; 29ok( ! $agent->is_protocol_supported('mailto'), "Can't mailto" ); 30ok( ! $agent->is_protocol_supported('file'), "Can't access local files" ); 31