Branch Coverage: lib/OpenAPI/Handler/Role.pm

# Branch Coverage

File: | lib/OpenAPI/Handler/Role.pm
Coverage: | 68.7%

line | % | coverage | branch
--- | --- | --- | ---
11 | 50 | T | F | unless _IDENT($role)
23 | 100 | T | F | if ($role eq '~')
26 | 100 | T | F | if ($role eq 'Admin' or $role eq 'Public')
29 | 50 | T | F | if (not $self->has_role($role))
34 | 50 | T | F | $self->do($sql) >= 0 ? :
42 | 50 | T | F | if (not $self->has_role($role))
45 | 50 | T | F | if ($col ne '~' and $col ne 'method' and $col ne 'url' and $col ne 'id')
48 | 50 | T | F | if ($role eq 'Admin')
52 | 100 | T | F | if ($value eq '~') { }
| 50 | T | F | elsif ($col eq '~') { }
63 | 50 | T | F | $res >= 0 ? :
72 | 50 | T | F | if (not $self->has_role($role))
75 | 50 | T | F | if ($col ne '~' and $col ne 'method' and $col ne 'url' and $col ne 'id')
80 | 100 | T | F | if ($value eq '~') { }
85 | 100 | T | F | if ($op eq 'like')
90 | 100 | T | F | if ($col eq '~') { }
108 | 50 | T | F | if (not $self->has_role($role))
111 | 50 | T | F | if ($role eq 'Admin')
114 | 50 | T | F | if ($col ne '~' and $col ne 'method' and $col ne 'url' and $col ne 'id')
120 | 50 | T | F | unless _HASH $data
123 | 100 | T | F | if (lc $col eq 'id')
129 | 50 | T | F | if ($value eq '~') { }
134 | 50 | T | F | if ($op eq 'like')
139 | 50 | T | F | if ($col eq '~') { }
152 | 50 | T | F | $res >= 0 ? :
161 | 50 | T | F | if (not $self->has_role($role))
167 | 100 | T | F | if (_HASH $data) { }
| 50 | T | F | elsif (_ARRAY $data) { }
169 | 50 | T | F | $rows_affected >= 1 ? :
179 | 50 | T | F | $rows_affected == @$data ? :
185 | 50 | T | F | $rows_affected >= 0 ? :
| 50 | T | F | $last_id ? :
194 | 50 | T | F | if (defined $id)
198 | 50 | T | F | unless _STRING $method
200 | 50 | T | F | if (not $method =~ /^(?:GET|POST|PUT|DELETE|HEAD)$/)
204 | 100 | T | F | if (not defined $url)
207 | 50 | T | F | if (not $url =~ m[^/=/])
210 | 50 | T | F | if (%$data)
236 | 100 | T | F | if ($role eq '~')
240 | 100 | T | F | if (not $role_id)
260 | 50 | T | F | $self->do($sql) >= 0 ? :
270 | 100 | T | F | if ($last_bits[$max_i] ne '~')
286 | 50 | T | F | unless my $data = _HASH($$self{'_req_data'})
291 | 50 | T | F | if ($role eq '~')
295 | 50 | T | F | if ($name = delete $$data{'name'} and $name ne $role)
312 | 50 | T | F | if ($nroles >= $ROLE_LIMIT)
316 | 50 | T | F | unless my $name = delete $$data{'name'}
318 | 50 | T | F | unless _IDENT($name)
319 | 100 | T | F | if ($self->has_role($name))
324 | 100 | T | F | if (not defined $desc)
327 | 50 | T | F | unless _STRING $desc
330 | 100 | T | F | if (not defined $login)
333 | 50 | T | F | unless _STRING $login
335 | 100 | T | F | if (not $login =~ /^(?:password|captcha|anonymous)$/)
340 | 50 | T | F | if (defined $password and $login ne 'password')
344 | 100 | T | F | if ($login eq 'password')
345 | 100 | T | F | if (not defined $password) { }
| 100 | T | F | elsif (length $password < $PASSWORD_MIN_LEN) { }
352 | 50 | T | F | if (%$data)
361 | 50 | T | F | $self->do($insert) ? :
367 | 50 | T | F | unless my $data = _HASH($$self{'_req_data'})
370 | 50 | T | F | unless $self->has_role($role)
377 | 100 | T | F | if (defined $new_name)
378 | 50 | T | F | unless _IDENT($new_name)
384 | 100 | T | F | if (defined $new_login)
385 | 100 | T | F | unless _STRING $new_login
387 | 100 | T | F | if (not $new_login =~ /^(?:password|anonymous|captcha)$/)
394 | 100 | T | F | if (defined $new_password)
395 | 100 | T | F | if (defined $new_login and $new_login ne 'password')
398 | 50 | T | F | unless _STRING $new_password
404 | 100 | T | F | if (defined $new_login and $new_login eq 'password' and not defined $new_password)
409 | 100 | T | F | if (defined $new_desc)
410 | 100 | T | F | unless _STRING $new_desc
414 | 50 | T | F | if (%$data)
418 | 50 | T | F | $retval >= 0 ? :