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

Annotation of trango/Net-Telnet-Trango/t/56-network-su.t, Revision 1.2

1.1       andrew      1: #!perl -T
1.2     ! andrew      2: # $RedRiver: 56-network-su.t,v 1.1 2007/02/06 18:57:14 andrew Exp $
1.1       andrew      3:
                      4: use Test::More tests => 7;
                      5: use File::Spec;
                      6:
                      7: BEGIN {
                      8:        use_ok( 'Net::Telnet::Trango' );
                      9: }
                     10:
1.2     ! andrew     11: diag("56:  SU tests");
1.1       andrew     12:
                     13: my $cfg_file = File::Spec->catfile('t', 'tests.cfg');
                     14:
                     15: SKIP: {
                     16:     my $skipped = 6;
                     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;
                     26:         }
                     27:     }
                     28:
                     29:     my $type = 'SU';
                     30:     my ($host, $pass);
                     31:
                     32:     if ($cfg{$type} && $cfg{$type} =~ /^(\d+\.\d+\.\d+.\d+)$/) {
                     33:         $host = $1;
                     34:     }
                     35:
                     36:     skip 'No valid ' . $type . ' in config file',        $skipped unless $host;
                     37:
                     38:     if ($cfg{$type . '_PASSWD'} && $cfg{$type . '_PASSWD'} =~ /^(.*)$/) {
                     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:
                     49:     ok($t->is_connected, "connected");
                     50:
                     51:     ok($t->login($pass), "Logging in");
                     52:
                     53:     ok($t->logged_in, "logged in");
                     54:
                     55:     # XXX Additional tests go here.
                     56:     # XXX Although right now just logging it is all I can think of.
                     57:
                     58:     ok($t->bye, "Goodbye");
                     59: }

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