~ubuntu-branches/ubuntu/hardy/slack/hardy-proposed

« back to all changes in this revision

Viewing changes to test/02_getroles.t

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Pollock
  • Date: 2007-10-27 16:14:42 UTC
  • Revision ID: james.westby@ubuntu.com-20071027161442-z3wjuy3juutuxu7m
Tags: upstream-0.14.1
ImportĀ upstreamĀ versionĀ 0.14.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
 
 
3
use strict;
 
4
use Test::More tests => 6;
 
5
use test_util;
 
6
 
 
7
{
 
8
    my $output = `PERL5LIB=../src ../src/slack-getroles -C /dev/null --role-list $test_config{'role-list'}`;
 
9
    my @output = sort split(/\s+/, $output);
 
10
    is_deeply(\@output, \@test_roles, "test config");
 
11
}
 
12
 
 
13
{
 
14
    my $output = `PERL5LIB=../src ../src/slack-getroles -C /dev/null --role-list $test_config{'role-list'} --hostname=fixedhost.example.com`;
 
15
    my @output = sort split(/\s+/, $output);
 
16
    is_deeply(\@output, ['examplerole'], "hostname override");
 
17
}
 
18
 
 
19
{
 
20
    my $output = `PERL5LIB=../src ../src/slack-getroles -C /dev/null --role-list /dev/null 2> /dev/null`;
 
21
    my @output = sort split(/\s+/, $output);
 
22
    isnt($?, 0, "no roles exception");
 
23
    is_deeply(\@output, [], "no roles output");
 
24
}
 
25
 
 
26
{
 
27
    my $cached_list = "$test_config{'cache'}/_role_list";
 
28
 
 
29
    if (-f $cached_list) {
 
30
        unlink($cached_list) or die "unlink: $!";
 
31
    }
 
32
    my $output = `PERL5LIB=../src ../src/slack-getroles -C /dev/null --cache=$test_config{'cache'} --remote-role-list --role-list=$test_config{'role-list'}`;
 
33
    my @output = sort split(/\s+/, $output);
 
34
    is_deeply(\@output, \@test_roles, "test remote config");
 
35
    ok(-f $cached_list, "remote config synced");
 
36
    unlink($cached_list) or die "unlink: $!";
 
37
}
 
38