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