| 1 | package Test::PlugAuth::Plugin::Authz; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Test::PlugAuth::Plugin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use 5.010001; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Test::Builder; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Role::Tiny (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use PlugAuth; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use File::Temp qw( tempdir ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use YAML::XS qw( DumpFile ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use base qw( Exporter ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | our @EXPORT = qw( run_tests ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # ABSTRACT: Test a PlugAuth Authz plugin for correctness | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | our $VERSION = '0.39'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | my $Test = Test::Builder->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | sub run_tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_tests: called CC=75 SCAR=82.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | my($class, $global_config, $plugin_config) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | ▶ | $class = "PlugAuth::Plugin::$class" unless $class =~ /::/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | eval qq{ use $class }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | ▶ | die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | $Test->plan( tests => 65 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | $global_config //= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$global_config //= {}
MC/DC0%0/1
$global_config //= {}
$global_config
Truth table50%1/2
A
A= $global_config
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | local $ENV{CLUSTERICIOUS_CONF_DIR} = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 2 | my $dir = tempdir(CLEANUP => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | my $list_fn = File::Spec->catfile($dir, 'user_list.txt'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 2 | ▶ | use autodie; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | open my $fh, '>', $list_fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | say $fh "optimus"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | say $fh "primus"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | say $fh "megatron"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 2 | say $fh "grimlock"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 2 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | DumpFile(File::Spec->catfile($dir, 'PlugAuth.conf'), { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | %$global_config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | plugins => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 'PlugAuth::Plugin::FlatUserList' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | user_list_file => $list_fn, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 2 | $dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | $global_config = Clustericious::Config->new($global_config) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 2 | ▶ | unless eval { $global_config->isa('Clustericious::Config') }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 2 | ▶ | $plugin_config //= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$plugin_config //= {}
MC/DC0%0/1
$plugin_config //= {}
$plugin_config
Truth table50%1/2
A
A= $plugin_config
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | my $object = eval { $class->new($global_config, $plugin_config, PlugAuth->new()) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 2 | my $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 2 | ▶ | if(ref $object) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | $Test->ok(1, "New returns a reference"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | $Test->ok(0, "New returns a reference"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | $Test->diag("ERROR: $error"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 2 | $Test->ok( Role::Tiny::does_role($object, 'PlugAuth::Role::Plugin'), 'does Plugin'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 2 | $Test->ok( Role::Tiny::does_role($object, 'PlugAuth::Role::Authz'), 'does Auth'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | my $refresh = Role::Tiny::does_role($object, 'PlugAuth::Role::Refresh') ? sub { $object->refresh } : sub {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
Subroutine
__ANON__: called CC=1 SCAR=1.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 2 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 2 | foreach my $username (qw( optimus primus megatron grimlock )) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 2 | my $groups = $object->groups_for_user($username); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | my $pass = ref($groups) eq 'ARRAY' && $#$groups == 0 && $groups->[0] eq $username; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
ref $groups eq 'ARRAY' && $groups->$#* == 0 && $groups->[0] eq $username
ref $groups eq "ARRAY" and $groups->$#* == 0
MC/DC0%0/3
ref $groups eq 'ARRAY' && $groups->$#* == 0 && $groups->[0] eq $username
ref $groups eq "ARRAY"
$groups->$#* == 0
$groups->[0] eq $username
Truth table0%0/4
A and B && C
A= ref $groups eq "ARRAY"B= $groups->$#* == 0C= $groups->[0] eq $username
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $Test->ok( $pass, "user $username belongs to exactly one group: $username" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my @groups = $object->all_groups; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $Test->ok( $#groups == -1, "no groups" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $Test->ok( eval { $object->create_group( 'group1', 'optimus,primus' ) } == 1, "create_group returned 1" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my @groups = $object->all_groups; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | $Test->ok( $#groups == 0 && $groups[0] eq 'group1', 'group1 exists' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$#groups == 0 && $groups[0] eq 'group1'
MC/DC0%0/2
$#groups == 0 && $groups[0] eq 'group1'
$#groups == 0
$groups[0] eq 'group1'
Truth table0%0/3
A && B
A= $#groups == 0B= $groups[0] eq 'group1'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my @optimus = sort @{ $object->groups_for_user('optimus') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my @primus = sort @{ $object->groups_for_user('primus') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my @megatron = sort @{ $object->groups_for_user('megatron') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | $Test->ok( $#optimus == 1 && $optimus[0] eq 'group1' && $optimus[1] eq 'optimus', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$#optimus == 1 && $optimus[0] eq 'group1' && $optimus[1] eq 'optimus'
$#optimus == 1 and $optimus[0] eq "group1"
MC/DC0%0/3
$#optimus == 1 && $optimus[0] eq 'group1' && $optimus[1] eq 'optimus'
$#optimus == 1
$optimus[0] eq "group1"
$optimus[1] eq 'optimus'
Truth table0%0/4
A and B && C
A= $#optimus == 1B= $optimus[0] eq "group1"C= $optimus[1] eq 'optimus'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | "optimus groups = optimus,group1"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | $Test->ok( $#primus == 1 && $primus[0] eq 'group1' && $primus[1] eq 'primus', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$#primus == 1 && $primus[0] eq 'group1' && $primus[1] eq 'primus'
$#primus == 1 and $primus[0] eq "group1"
MC/DC0%0/3
$#primus == 1 && $primus[0] eq 'group1' && $primus[1] eq 'primus'
$#primus == 1
$primus[0] eq "group1"
$primus[1] eq 'primus'
Truth table0%0/4
A and B && C
A= $#primus == 1B= $primus[0] eq "group1"C= $primus[1] eq 'primus'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | "primus groups = primus,group1"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | $Test->ok( $#megatron == 0 && $megatron[0] eq 'megatron', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$#megatron == 0 && $megatron[0] eq 'megatron'
MC/DC0%0/2
$#megatron == 0 && $megatron[0] eq 'megatron'
$#megatron == 0
$megatron[0] eq 'megatron'
Truth table0%0/3
A && B
A= $#megatron == 0B= $megatron[0] eq 'megatron'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | "megatron groups = megatron" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my @users = sort @{ $object->users_in_group('group1') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | my $pass = $#users == 1 && $users[0] eq 'optimus' && $users[1] eq 'primus'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$#users == 1 && $users[0] eq 'optimus' && $users[1] eq 'primus'
$#users == 1 and $users[0] eq "optimus"
MC/DC0%0/3
$#users == 1 && $users[0] eq 'optimus' && $users[1] eq 'primus'
$#users == 1
$users[0] eq "optimus"
$users[1] eq 'primus'
Truth table0%0/4
A and B && C
A= $#users == 1B= $users[0] eq "optimus"C= $users[1] eq 'primus'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $Test->ok( $pass, "group1 = optimus, primus" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | $Test->diag("group1 actually = [ ", join(', ', @users) , " ]") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | unless $pass; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $Test->ok( eval { $object->update_group('group1', "optimus,megatron") } == 1, "update_group returned 1" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my @groups = $object->all_groups; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | $Test->ok( $#groups == 0 && $groups[0] eq 'group1', 'group1 exists' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$#groups == 0 && $groups[0] eq 'group1'
MC/DC0%0/2
$#groups == 0 && $groups[0] eq 'group1'
$#groups == 0
$groups[0] eq 'group1'
Truth table0%0/3
A && B
A= $#groups == 0B= $groups[0] eq 'group1'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my @optimus = sort @{ $object->groups_for_user('optimus') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my @primus = sort @{ $object->groups_for_user('primus') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my @megatron = sort @{ $object->groups_for_user('megatron') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | $Test->ok( $#optimus == 1 && $optimus[0] eq 'group1' && $optimus[1] eq 'optimus', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$#optimus == 1 && $optimus[0] eq 'group1' && $optimus[1] eq 'optimus'
$#optimus == 1 and $optimus[0] eq "group1"
MC/DC0%0/3
$#optimus == 1 && $optimus[0] eq 'group1' && $optimus[1] eq 'optimus'
$#optimus == 1
$optimus[0] eq "group1"
$optimus[1] eq 'optimus'
Truth table0%0/4
A and B && C
A= $#optimus == 1B= $optimus[0] eq "group1"C= $optimus[1] eq 'optimus'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | "optimus groups = optimus,group1"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | $Test->ok( $#primus == 0 && $primus[0] eq 'primus', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$#primus == 0 && $primus[0] eq 'primus'
MC/DC0%0/2
$#primus == 0 && $primus[0] eq 'primus'
$#primus == 0
$primus[0] eq 'primus'
Truth table0%0/3
A && B
A= $#primus == 0B= $primus[0] eq 'primus'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | "primus groups = primus"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | $Test->ok( $#megatron == 1 && $megatron[0] eq 'group1' && $megatron[1] eq 'megatron', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$#megatron == 1 && $megatron[0] eq 'group1' && $megatron[1] eq 'megatron'
$#megatron == 1 and $megatron[0] eq "group1"
MC/DC0%0/3
$#megatron == 1 && $megatron[0] eq 'group1' && $megatron[1] eq 'megatron'
$#megatron == 1
$megatron[0] eq "group1"
$megatron[1] eq 'megatron'
Truth table0%0/4
A and B && C
A= $#megatron == 1B= $megatron[0] eq "group1"C= $megatron[1] eq 'megatron'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | "megatron groups = group1,megatron" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | my @users = sort @{ $object->users_in_group('group1') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | my $pass = $#users == 1 && $users[0] eq 'megatron' && $users[1] eq 'optimus'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$#users == 1 && $users[0] eq 'megatron' && $users[1] eq 'optimus'
$#users == 1 and $users[0] eq "megatron"
MC/DC0%0/3
$#users == 1 && $users[0] eq 'megatron' && $users[1] eq 'optimus'
$#users == 1
$users[0] eq "megatron"
$users[1] eq 'optimus'
Truth table0%0/4
A and B && C
A= $#users == 1B= $users[0] eq "megatron"C= $users[1] eq 'optimus'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $Test->ok( $pass, "group1 = megatron, optimus" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | $Test->diag("group1 actually = [ ", join(', ', @users) , " ]") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | unless $pass; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $Test->ok( eval { $object->delete_group('group1') } == 1, "delete_group returned 1" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my @groups = $object->all_groups; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $Test->ok( $#groups == -1, 'group1 DOES NOT exists' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my @optimus = sort @{ $object->groups_for_user('optimus') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my @primus = sort @{ $object->groups_for_user('primus') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my @megatron = sort @{ $object->groups_for_user('megatron') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | $Test->ok( $#optimus == 0 && $optimus[0] eq 'optimus', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$#optimus == 0 && $optimus[0] eq 'optimus'
MC/DC0%0/2
$#optimus == 0 && $optimus[0] eq 'optimus'
$#optimus == 0
$optimus[0] eq 'optimus'
Truth table0%0/3
A && B
A= $#optimus == 0B= $optimus[0] eq 'optimus'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | "optimus groups = group1"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | $Test->ok( $#primus == 0 && $primus[0] eq 'primus', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$#primus == 0 && $primus[0] eq 'primus'
MC/DC0%0/2
$#primus == 0 && $primus[0] eq 'primus'
$#primus == 0
$primus[0] eq 'primus'
Truth table0%0/3
A && B
A= $#primus == 0B= $primus[0] eq 'primus'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | "primus groups = primus"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | $Test->ok( $#megatron == 0 && $megatron[0] eq 'megatron', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$#megatron == 0 && $megatron[0] eq 'megatron'
MC/DC0%0/2
$#megatron == 0 && $megatron[0] eq 'megatron'
$#megatron == 0
$megatron[0] eq 'megatron'
Truth table0%0/3
A && B
A= $#megatron == 0B= $megatron[0] eq 'megatron'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | "megatron groups = megatron" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my $users = $object->users_in_group('group1'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my $pass = ! defined $users; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $Test->ok( $pass, "group1 is empty" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $Test->ok( !defined(eval { $object->can_user_action_resource('grimlock', 'be', '/bigbozo') }), "grimlock is not big bozo" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $Test->ok( eval { $object->grant('grimlock', 'be', '/bigbozo') } == 1, 'grant returns 1' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $Test->ok( defined(eval { $object->can_user_action_resource('grimlock', 'be', '/bigbozo') }), "grimlock is a big bozo" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $Test->ok( !defined(eval { $object->can_user_action_resource('primus', 'be', '/bigbozo') }), "primus is not a big bozo" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my @actions = $object->actions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | my $pass = $#actions == 0 && $actions[0] eq 'be'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$#actions == 0 && $actions[0] eq 'be'
MC/DC0%0/2
$#actions == 0 && $actions[0] eq 'be'
$#actions == 0
$actions[0] eq 'be'
Truth table0%0/3
A && B
A= $#actions == 0B= $actions[0] eq 'be'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $Test->ok( $pass, "actions = be" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | $Test->diag("actions is actually = ", join(', ', @actions)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | unless $pass; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $object->create_group( 'public', '*' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my @public = sort @{ $object->users_in_group('public') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # grimlock megatron optimus primus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | my $pass = $#public == 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/12
$#public == 3 && $public[0] eq 'grimlock' && $public[1] eq 'megatron' && $public[2] eq 'optimus' && $public[3] eq 'primus'
$#public == 3 and $public[0] eq "grimlock" and $public[1] eq "megatron" and $public[2] eq "optimus"
$#public == 3 and $public[0] eq "grimlock" and $public[1] eq "megatron"
$#public == 3 and $public[0] eq "grimlock"
MC/DC0%0/5
$#public == 3 && $public[0] eq 'grimlock' && $public[1] eq 'megatron' && $public[2] eq 'optimus' && $public[3] eq 'primus'
$#public == 3
$public[0] eq "grimlock"
$public[1] eq "megatron"
$public[2] eq "optimus"
$public[3] eq 'primus'
Truth table0%0/6
A and B and C and D && E
A= $#public == 3B= $public[0] eq "grimlock"C= $public[1] eq "megatron"D= $public[2] eq "optimus"E= $public[3] eq 'primus'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | && $public[0] eq 'grimlock' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | && $public[1] eq 'megatron' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | && $public[2] eq 'optimus' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | && $public[3] eq 'primus'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $Test->ok($pass, "public = [ grimlock, megatron, optimus, primus ]"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | $Test->diag("actual public = [ ", join(', ', @public), " ]") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | unless $pass; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | foreach my $username (qw( optimus primus megatron grimlock )) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | $Test->ok( !defined(eval { $object->can_user_action_resource($username, 'dislike', '/gobots') }), "$username likes gobots"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $Test->ok( eval { $object->grant('public', 'dislike', '/gobots') } == 1, 'grant returns 1' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | foreach my $username (qw( optimus primus megatron grimlock )) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $Test->ok( defined(eval { $object->can_user_action_resource($username, 'dislike', '/gobots') }), "$username dislikes gobots"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my @actions = $object->actions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | my $pass = $#actions == 1 && $actions[0] eq 'be' && $actions[1] eq 'dislike'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$#actions == 1 && $actions[0] eq 'be' && $actions[1] eq 'dislike'
$#actions == 1 and $actions[0] eq "be"
MC/DC0%0/3
$#actions == 1 && $actions[0] eq 'be' && $actions[1] eq 'dislike'
$#actions == 1
$actions[0] eq "be"
$actions[1] eq 'dislike'
Truth table0%0/4
A and B && C
A= $#actions == 1B= $actions[0] eq "be"C= $actions[1] eq 'dislike'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $Test->ok( $pass, "actions = be, dislike" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | $Test->diag("actions is actually = ", join(', ', @actions)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | unless $pass; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | $object->create_group( 'group2', 'grimlock,primus' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | my @group2 = sort @{ $object->users_in_group('group2') }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | my $pass = $#group2 == 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$#group2 == 1 && $group2[0] eq 'grimlock' && $group2[1] eq 'primus'
$#group2 == 1 and $group2[0] eq "grimlock"
MC/DC0%0/3
$#group2 == 1 && $group2[0] eq 'grimlock' && $group2[1] eq 'primus'
$#group2 == 1
$group2[0] eq "grimlock"
$group2[1] eq 'primus'
Truth table0%0/4
A and B && C
A= $#group2 == 1B= $group2[0] eq "grimlock"C= $group2[1] eq 'primus'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | && $group2[0] eq 'grimlock' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | && $group2[1] eq 'primus'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $Test->ok($pass, "group2 = [ grimlock, primus ]"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | foreach my $username (qw( optimus primus megatron grimlock )) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | $Test->ok( !defined(eval { $object->can_user_action_resource($username, 'have', '/bighead') }), "$username does not have a big head"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $Test->ok( eval { $object->grant('group2', 'have', '/bighead') } == 1, 'grant returns 1' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | foreach my $username (qw( primus grimlock )) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | $Test->ok( defined(eval { $object->can_user_action_resource($username, 'have', '/bighead') }), "$username does have a big head"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | foreach my $username (qw( megatron optimus )) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | $Test->ok( !defined(eval { $object->can_user_action_resource($username, 'have', '/bighead') }), "$username does not have a big head"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | my @actions = $object->actions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | my $pass = $#actions == 2 && $actions[0] eq 'be' && $actions[1] eq 'dislike' && $actions[2] eq 'have'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/9
$#actions == 2 && $actions[0] eq 'be' && $actions[1] eq 'dislike' && $actions[2] eq 'have'
$#actions == 2 and $actions[0] eq "be" and $actions[1] eq "dislike"
$#actions == 2 and $actions[0] eq "be"
MC/DC0%0/4
$#actions == 2 && $actions[0] eq 'be' && $actions[1] eq 'dislike' && $actions[2] eq 'have'
$#actions == 2
$actions[0] eq "be"
$actions[1] eq "dislike"
$actions[2] eq 'have'
Truth table0%0/5
A and B and C && D
A= $#actions == 2B= $actions[0] eq "be"C= $actions[1] eq "dislike"D= $actions[2] eq 'have'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $Test->ok( $pass, "actions = be, dislike, have" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | $Test->diag("actions is actually = ", join(', ', @actions)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | unless $pass; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $Test->ok( eval { $object->revoke('group2', 'have', '/bighead') } == 1, 'revoke returns 1' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | foreach my $username (qw( optimus primus megatron grimlock )) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | $Test->ok( !defined(eval { $object->can_user_action_resource($username, 'have', '/bighead') }), "$username does not have a big head"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $Test->ok( eval { $object->revoke('public', 'dislike', '/gobots') } == 1, 'revoke returns 1' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | foreach my $username (qw( optimus primus megatron grimlock )) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | $Test->ok( !defined(eval { $object->can_user_action_resource($username, 'dislike', '/gobots') }), "$username likes gobots"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | $Test->ok( eval { $object->revoke('grimlock', 'be', '/bigbozo') } == 1, 'revoke returns 1' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | $refresh->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | $Test->ok( !defined(eval { $object->can_user_action_resource('grimlock', 'be', '/bigbozo') }), "grimlock is not big bozo" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | $Test->diag($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | # These two do not have a write RESTful API yet and cannot be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | # tested. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | # TODO: match_resources | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | # TODO: host_has_tag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||