File: 10_cmd.t

package info (click to toggle)
net-telnet-cisco 1.10-5.3
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 160 kB
  • ctags: 32
  • sloc: perl: 792; makefile: 52
file content (40 lines) | stat: -rw-r--r-- 983 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- perl -*-

use Test::More tests => 8;
use Net::Telnet::Cisco;
use Carp;
use t::Utils;

my %G = load();
my $S;

SKIP: {
    skip("Router unknown", 1) 		unless $G{ROUTER};
    skip("Login or password unknown", 1)	unless $G{LOGIN} || $G{PASSWD};

    ok $S = Net::Telnet::Cisco->new( Errmode	 => \&confess,
				     Host	 => $G{ROUTER},
				    log_args(),
				   ),				"new()";
}

SKIP: {
    skip("No Net::Telnet::Cisco session", 5) unless $S;

    ok $S->login(Name     => $G{LOGIN},
		 Password => $G{PASSWD},
		 Passcode => $G{PASSCODE},),		"login()";

    ok $S->cmd('show clock'),				 "cmd() short";
    ok $S->cmd('show ver'),				 "cmd() medium";
    ok show_help($S),					 "cmd() long";
    ok $S->cmd("\b" x 6),				 "show ? cleanup";
    ok @out = $S->cmd(''),				 "cmd() empty";
    is_deeply \@out, [''],				 "...returned array w/ empty string";
}

END {
   cleanup(savelogs => $G{SAVELOGS},
		   failed => scalar grep {$_ == 0} Test::More->builder->summary,
		  );
};