[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.3

1.1       andrew      1: #!perl -T
1.3     ! andrew      2: # $RedRiver: 54-network-add_su-su.t,v 1.2 2007/02/06 17:41: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:
                     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.2       andrew     30:     my $type = 'SU';
1.1       andrew     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;
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:
                     57:     my $t;
                     58:     ok($t = Net::Telnet::Trango->new(), "Instantiating object");
                     59:
                     60:     ok($t->open($host), "Opening connection to $host");
                     61:
                     62:     ok($t->is_connected, "connected");
                     63:
                     64:     ok($t->login($pass), "Logging in");
                     65:
                     66:     ok($t->logged_in, "logged in");
                     67:
                     68:     # XXX Additional tests go here.
1.3     ! andrew     69:     # XXX Although right now just logging it is all I can think of.
1.1       andrew     70:
                     71:     ok($t->bye, "Goodbye");
                     72: }

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