[BACK]Return to 50-network.t-stub CVS log [TXT][DIR] Up to [local] / trango / Net-Telnet-Trango / t

Annotation of trango/Net-Telnet-Trango/t/50-network.t-stub, Revision 1.6

1.1       andrew      1: #!perl -T
1.6     ! andrew      2: # $RedRiver: 50-network.t-stub,v 1.5 2007/02/06 00:42:09 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.6     ! andrew     11: diag("50: test stub");
1.1       andrew     12:
1.3       andrew     13: my $cfg_file = File::Spec->catfile('t', 'tests.cfg');
1.2       andrew     14:
                     15: SKIP: {
1.4       andrew     16:     my $skipped = 6;
1.2       andrew     17:     my %cfg;
                     18:     if (-e $cfg_file) {
                     19:         if (open my $fh, $cfg_file) {
                     20:             while (<$fh>) {
                     21:                 chomp;
                     22:                 my ($key, $value) = split /\t/, $_, 2;
                     23:                 $cfg{$key} = $value;
                     24:             }
                     25:             close $fh;
1.1       andrew     26:         }
                     27:     }
                     28:
1.4       andrew     29:     my $type = 'AP';
                     30:     my ($host, $pass);
1.1       andrew     31:
1.5       andrew     32:     if ($cfg{$type} && $cfg{$type} =~ /^(\d+\.\d+\.\d+.\d+)$/) {
1.4       andrew     33:         $host = $1;
                     34:     }
                     35:
                     36:     skip 'No valid ' . $type . ' in config file',        $skipped unless $host;
                     37:
1.5       andrew     38:     if ($cfg{$type . '_PASSWD'} && $cfg{$type . '_PASSWD'} =~ /^(.*)$/) {
1.4       andrew     39:         $pass = $1;
                     40:     }
                     41:
                     42:     skip 'No valid ' . $type . '_PASSWD in config file', $skipped unless $pass;
                     43:
                     44:     my $t;
                     45:     ok($t = Net::Telnet::Trango->new(), "Instantiating object");
                     46:
                     47:     ok($t->open($host), "Opening connection to $host");
                     48:
1.5       andrew     49:     ok($t->is_connected, "connected");
1.4       andrew     50:
                     51:     ok($t->login($pass), "Logging in");
                     52:
1.5       andrew     53:     ok($t->logged_in, "logged in");
1.4       andrew     54:
                     55:     # XXX Additional tests go here.
                     56:
1.5       andrew     57:     ok($t->bye, "Goodbye");
1.1       andrew     58: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>