File: author-12_ssh_no_route.t

package info (click to toggle)
libnet-cli-interact-perl 2.400002-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 576 kB
  • sloc: perl: 2,075; makefile: 7
file content (36 lines) | stat: -rw-r--r-- 861 bytes parent folder | download
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
#!/usr/bin/perl

BEGIN {
  unless ($ENV{AUTHOR_TESTING}) {
    require Test::More;
    Test::More::plan(skip_all => 'these tests are for testing by the author');
  }
}


BEGIN {
  if ($ENV{AT_HOME}) {
    require Test::More;
    Test::More::plan(skip_all => 'these tests do not work at home');
  }
}

use strict; use warnings FATAL => 'all';
use Test::More 0.88;
use Test::File::ShareDir::Dist { "Net-CLI-Interact" => "share" };

BEGIN { use_ok( 'Net::CLI::Interact') }

my $s = Net::CLI::Interact->new(
    transport => "SSH",
    ($^O eq 'MSWin32' ?
        (app => "$ENV{HOMEPATH}\\Desktop\\plink.exe") : () ),
    connect_options => { host => "81.21.232.221" },
    personality => "cisco",
);

# should fail
eval { $s->cmd('show clock') };
like( $@, qr/Connection refused|No route to host|Connection timed out|read timed-out/i, 'No Route' );

done_testing;