Annotation of trango/Net-Telnet-Trango/t/59-network-cleanup.t, Revision 1.1
1.1 ! andrew 1: #!perl -T
! 2: # $RedRiver$
! 3:
! 4: use Test::More tests => 7;
! 5: use File::Spec;
! 6:
! 7: BEGIN {
! 8: use_ok( 'Net::Telnet::Trango' );
! 9: }
! 10:
! 11: diag("Testing Net::Telnet::Trango $Net::Telnet::Trango::VERSION, Perl $], $^X");
! 12: diag(" Cleanup settings from other tests");
! 13:
! 14: my $cfg_file = File::Spec->catfile('t', 'tests.cfg');
! 15:
! 16: SKIP: {
! 17: my $skipped = 6;
! 18: my %cfg;
! 19: if (-e $cfg_file) {
! 20: if (open my $fh, $cfg_file) {
! 21: while (<$fh>) {
! 22: chomp;
! 23: my ($key, $value) = split /\t/, $_, 2;
! 24: $cfg{$key} = $value;
! 25: }
! 26: close $fh;
! 27: }
! 28: }
! 29:
! 30: my $type = 'AP';
! 31: my ($host, $pass);
! 32:
! 33: if ($cfg{$type} && $cfg{$type} =~ /^(\d+\.\d+\.\d+.\d+)$/) {
! 34: $host = $1;
! 35: }
! 36:
! 37: skip 'No valid ' . $type . ' in config file', $skipped unless $host;
! 38:
! 39: if ($cfg{$type . '_PASSWD'} && $cfg{$type . '_PASSWD'} =~ /^(.*)$/) {
! 40: $pass = $1;
! 41: }
! 42:
! 43: skip 'No valid ' . $type . '_PASSWD in config file', $skipped unless $pass;
! 44:
! 45: my $t;
! 46: ok($t = Net::Telnet::Trango->new(), "Instantiating object");
! 47:
! 48: ok($t->open($host), "Opening connection to $host");
! 49:
! 50: ok($t->is_connected, "connected");
! 51:
! 52: ok($t->login($pass), "Logging in");
! 53:
! 54: ok($t->logged_in, "logged in");
! 55:
! 56: # XXX Additional tests go here.
! 57:
! 58: ok($t->bye, "Goodbye");
! 59: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>