Annotation of trango/Net-Telnet-Trango/t/50-network.t-stub, Revision 1.5
1.1 andrew 1: #!perl -T
1.5 ! andrew 2: # $RedRiver: 50-network.t,v 1.4 2007/02/05 23:11:21 andrew Exp $
1.1 andrew 3:
1.4 andrew 4: use Test::More tests => 7;
1.2 andrew 5: use File::Spec;
1.1 andrew 6:
7: BEGIN {
8: use_ok( 'Net::Telnet::Trango' );
9: }
10:
1.4 andrew 11: diag("Testing Net::Telnet::Trango $Net::Telnet::Trango::VERSION, Perl $], $^X");
12: diag(" Generic tests");
1.1 andrew 13:
1.3 andrew 14: my $cfg_file = File::Spec->catfile('t', 'tests.cfg');
1.2 andrew 15:
16: SKIP: {
1.4 andrew 17: my $skipped = 6;
1.2 andrew 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;
1.1 andrew 27: }
28: }
29:
1.4 andrew 30: my $type = 'AP';
31: my ($host, $pass);
1.1 andrew 32:
1.5 ! andrew 33: if ($cfg{$type} && $cfg{$type} =~ /^(\d+\.\d+\.\d+.\d+)$/) {
1.4 andrew 34: $host = $1;
35: }
36:
37: skip 'No valid ' . $type . ' in config file', $skipped unless $host;
38:
1.5 ! andrew 39: if ($cfg{$type . '_PASSWD'} && $cfg{$type . '_PASSWD'} =~ /^(.*)$/) {
1.4 andrew 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:
1.5 ! andrew 50: ok($t->is_connected, "connected");
1.4 andrew 51:
52: ok($t->login($pass), "Logging in");
53:
1.5 ! andrew 54: ok($t->logged_in, "logged in");
1.4 andrew 55:
56: # XXX Additional tests go here.
57:
1.5 ! andrew 58: ok($t->bye, "Goodbye");
1.1 andrew 59: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>