File: release-30_phrasebook.t

package info (click to toggle)
libnet-cli-interact-perl 1.121640-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 368 kB
  • sloc: perl: 1,805; makefile: 2
file content (53 lines) | stat: -rw-r--r-- 1,418 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl

BEGIN {
  unless ($ENV{RELEASE_TESTING}) {
    require Test::More;
    Test::More::plan(skip_all => 'these tests are for release candidate testing');
  }
}


use strict; use warnings FATAL => 'all';
use Test::More 0.88;

use lib 't/lib';
use Net::CLI::Interact;

my $s = new_ok('Net::CLI::Interact' => [{
    transport => 'Test',
    personality => 'testing',
    add_library => 't/phrasebook',
}]);

my $pb = $s->phrasebook;


ok(eval { $pb->prompt('TEST_PROMPT_ONE') }, 'prompt exists');
ok(! eval { $pb->prompt('TEST_PROMPT_XXX') }, 'prompt does not exist');

my $p = $pb->prompt('TEST_PROMPT_ONE');
isa_ok($p, 'Net::CLI::Interact::ActionSet');

ok(eval { $pb->macro('TEST_MACRO_ONE') }, 'macro exists');
ok(! eval { $pb->macro('TEST_MACRO_XXX') }, 'macro does not exist');

my $m = $pb->macro('TEST_MACRO_ONE');
isa_ok($m, 'Net::CLI::Interact::ActionSet');

ok($s->set_phrasebook({ personality => 'cisco' }), 'new phrasebook loaded');
$pb = $s->phrasebook;

ok(eval { $pb->prompt('basic') }, 'prompt exists');
ok(! eval { $pb->prompt('basic_XXX') }, 'prompt does not exist');

my $p2 = $pb->prompt('privileged');
isa_ok($p2, 'Net::CLI::Interact::ActionSet');

ok(eval { $pb->macro('begin_privileged') }, 'macro exists');
ok(! eval { $pb->macro('begin_privileged_XXX') }, 'macro does not exist');

my $m2 = $pb->macro('end_privileged');
isa_ok($m2, 'Net::CLI::Interact::ActionSet');

done_testing;