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

Annotation of trango/Net-Telnet-Trango/t/55-network-add_su-su.t, Revision 1.4

1.1       andrew      1: #!perl -T
1.4     ! andrew      2: # $RedRiver: 55-network-add_su-su.t,v 1.3 2007/02/06 17:46:55 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:
                     11: diag("Testing Net::Telnet::Trango $Net::Telnet::Trango::VERSION, Perl $], $^X");
1.2       andrew     12: diag("  SU tests when adding an SU to an AP");
1.1       andrew     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:
1.4     ! andrew     30:     my $type = 'AP';
        !            31:     my ($host, $pass, $su, $su_pass, $su_id, $su_mac);
1.1       andrew     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;
1.2       andrew     44:
                     45:     if ($cfg{SU_ID} && $cfg{SU_ID} =~ /^(\d+)$/) {
                     46:         $su_id= $1;
                     47:     }
                     48:
                     49:     skip 'No valid SU_ID in config file', $skipped unless $su_id;
                     50:
                     51:     if ($cfg{SU_MAC} && length $cfg{SU_MAC} >= 12 && $cfg{SU_MAC} =~ /^(.*)$/) {
                     52:         $su_mac = $1;
                     53:     }
                     54:
                     55:     skip 'No valid SU_MAC in config file', $skipped unless $su_mac;
1.1       andrew     56:
1.4     ! andrew     57:     $type = 'SU';
        !            58:     if ($cfg{$type} && $cfg{$type} =~ /^(\d+\.\d+\.\d+.\d+)$/) {
        !            59:         $su = $1;
        !            60:     }
        !            61:
        !            62:     skip 'No valid SU in config file',        $skipped unless $su;
        !            63:
        !            64:     if ($cfg{$type . '_PASSWD'} && $cfg{$type . '_PASSWD'} =~ /^(.*)$/) {
        !            65:         $su_pass = $1;
        !            66:     }
        !            67:
        !            68:     skip 'No valid SU_PASSWD in config file', $skipped unless $su_pass;
        !            69:
        !            70:
1.1       andrew     71:     my $t;
                     72:     ok($t = Net::Telnet::Trango->new(), "Instantiating object");
                     73:
1.4     ! andrew     74:     ok($t->open($host), "Opening connection to $su");
1.1       andrew     75:
                     76:     ok($t->is_connected, "connected");
                     77:
                     78:     ok($t->login($pass), "Logging in");
                     79:
                     80:     ok($t->logged_in, "logged in");
                     81:
                     82:     # XXX Additional tests go here.
1.3       andrew     83:     # XXX Although right now just logging it is all I can think of.
1.1       andrew     84:
                     85:     ok($t->bye, "Goodbye");
                     86: }

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