=================================================================== RCS file: /cvs/trango/Net-Telnet-Trango/t/50-network.t-stub,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- trango/Net-Telnet-Trango/t/50-network.t-stub 2007/02/05 21:36:42 1.3 +++ trango/Net-Telnet-Trango/t/50-network.t-stub 2007/02/05 23:11:21 1.4 @@ -1,18 +1,20 @@ #!perl -T -# $RedRiver: 50-network.t,v 1.2 2007/02/05 19:39:33 andrew Exp $ +# $RedRiver: 50-network.t,v 1.3 2007/02/05 21:36:42 andrew Exp $ -use Test::More tests => 2; +use Test::More tests => 7; use File::Spec; BEGIN { use_ok( 'Net::Telnet::Trango' ); } -diag( "Testing Net::Telnet::Trango $Net::Telnet::Trango::VERSION, Perl $], $^X" ); +diag("Testing Net::Telnet::Trango $Net::Telnet::Trango::VERSION, Perl $], $^X"); +diag(" Generic tests"); my $cfg_file = File::Spec->catfile('t', 'tests.cfg'); SKIP: { + my $skipped = 6; my %cfg; if (-e $cfg_file) { if (open my $fh, $cfg_file) { @@ -25,8 +27,33 @@ } } - skip 'No AP or Password in config file', 1 - unless $cfg{AP} && $cfg{AP_PASSWD}; + my $type = 'AP'; + my ($host, $pass); - ok( sub { return 1 } ); + if ($cfg{$type} =~ /^(\d+\.\d+\.\d+.\d+)$/) { + $host = $1; + } + + skip 'No valid ' . $type . ' in config file', $skipped unless $host; + + if ($cfg{$type . '_PASSWD'} =~ /^(.*)$/) { + $pass = $1; + } + + skip 'No valid ' . $type . '_PASSWD in config file', $skipped unless $pass; + + my $t; + ok($t = Net::Telnet::Trango->new(), "Instantiating object"); + + ok($t->open($host), "Opening connection to $host"); + + ok($t->is_connected(), "connected"); + + ok($t->login($pass), "Logging in"); + + ok($t->logged_in(), "logged in"); + + # XXX Additional tests go here. + + ok($t->bye(), "Goodbye"); }