File: 60_enable.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 (44 lines) | stat: -rw-r--r-- 1,026 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
41
42
43
44
# -*- perl -*-

use Test::More tests => 6;
use Net::Telnet::Cisco;
use FindBin;
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;
    skip("Won't enter enabled mode without an enable password", 5)
	unless $G{ENABLE};

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

    ok $S->disable,						"disable()";
    ok $S->enable($G{ENABLE}),					"enable()";
    ok $S->is_enabled,						"is_enabled()";

    eval { $S->enable(Level => undef) };
    like $@, 'Level was passed an undef',				"enable() -Level bugfix";

}

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