AFS

 view release on metacpan or  search on metacpan

src/BOS/t/BOS.t  view on Meta::CPAN

isa_ok($result->{fs} || $result->{dafs}, 'HASH', 'bos->status OK');

my %h = ( nog => 1 );
$bos->adduser(\%h);
like($AFS::CODE, qr/USER not an array reference/, 'bos->adduser(HASH)');

$bos->addhost('host', 'a');
like($AFS::CODE, qr/Flag "clone" should be numeric/, 'bos->addhost(host no_integer)');

$bos->addhost(\%h);
like($AFS::CODE, qr/HOST not an array reference/, 'bos->addhost(HASH)');

my $host = 'very_very_very_very_long_long_long_long_name_name_name_name_name_name';
$bos->addhost($host, 1);
like($AFS::CODE, qr/host name too long/, 'bos->addhost(long_name)');

can_ok('AFS::BOS', qw(addkey));
can_ok('AFS::BOS', qw(create));
can_ok('AFS::BOS', qw(delete));
can_ok('AFS::BOS', qw(exec));
can_ok('AFS::BOS', qw(getlog));
can_ok('AFS::BOS', qw(getrestricted));
can_ok('AFS::BOS', qw(listkeys));
can_ok('AFS::BOS', qw(prune));
$bos->removehost(\%h);
like($AFS::CODE, qr/HOST not an array reference/, 'bos->removehost(HASH)');

$host = 'z';
$bos->removehost($host);
SKIP: {
	skip "You lack rights for this test", 1 
		if $AFS::CODE =~ /you are not authorized for this operation/;
	like($AFS::CODE, qr/no such entity/, 'bos->removehost(unknown host)');
}
can_ok('AFS::BOS', qw(removekey));

$bos->removeuser(\%h);
like($AFS::CODE, qr/USER not an array reference/, 'bos->removeuser(HASH)');

my $user = 'z';
$bos->removeuser($user);
SKIP: {
	skip "You lack rights for this test", 1 
		if $AFS::CODE =~ /you are not authorized for this operation/;
	like($AFS::CODE, qr/no such user/, 'bos->removeuser(unknown user)');
}

can_ok('AFS::BOS', qw(restart_bos));
can_ok('AFS::BOS', qw(restart_all));
can_ok('AFS::BOS', qw(restart));
can_ok('AFS::BOS', qw(setauth));
can_ok('AFS::BOS', qw(setrestricted));
can_ok('AFS::BOS', qw(shutdown));
can_ok('AFS::BOS', qw(start));
can_ok('AFS::BOS', qw(startup));
can_ok('AFS::BOS', qw(stop));

$bos->DESTROY;
ok(! defined $bos, 'bos->DESTROY');

sub leak_test {
    my $count = 0;
    my $verb  = 1;
    while(1) {
        $count++;
        my $bos = AFS::BOS->new($verb);
        $bos->DESTROY();
        if ($count == 1210) { last; }
    }
    return $count;
}



( run in 0.677 second using v1.01-cache-2.11-cpan-39bf76dae61 )