Branch Coverage

blib/lib/Tesla/API.pm
Criterion Covered Total %
branch 11 94 11.7


line true false branch
61 2 0 if ($params{'unauthenticated'})
80 1 1 unless (defined $endpoint_name)
90 1 0 if ($uri =~ /\{/)
91 1 0 unless (defined $id and $id =~ /^\d+$/)
99 0 0 if ($self->api_cache_persist or $self->api_cache_time)
107 0 0 if ($self->api_cache_persist or time - $api_cache_alive_time <= $self->api_cache_time)
108 0 0 if ($self->_cache("endpoint", $endpoint_name, "id", $id))
120 0 0 if ($auth)
139 0 0 if ($response->is_success) { }
0 0 elsif ($response->code == 500) { }
163 0 0 if (defined $persist)
170 0 0 if (defined $cache_seconds)
178 2 2 if (not $self->{'endpoints'} or $self->{'reset_data'})
184 0 2 unless open my $fh, "<", "/root/.cpan/build/Tesla-API-0.10-0/blib/lib/auto/share/dist/Tesla-API/endpoints.json"
193 1 3 if ($endpoint)
194 0 1 unless (exists $self->{'endpoints'}{$endpoint})
205 0 0 if $self->{'mech'}
222 0 0 unless ($self->{'option_codes'})
226 0 0 unless open my $fh, "<", "/root/.cpan/build/Tesla-API-0.10-0/blib/lib/auto/share/dist/Tesla-API/option_codes.json"
236 0 0 if ($code)
237 0 0 unless (exists $self->{'option_codes'}{$code})
251 0 0 if ($data_url =~ m[.*/(\w+\.json)$])
255 0 0 unless (defined $filename)
264 0 0 if ($response->is_success) { }
270 0 0 if (scalar keys %$new_data != scalar keys %$existing_data)
274 0 0 unless ($data_differs)
276 0 0 unless (exists $existing_data->{$key})
282 0 0 unless (exists $new_data->{$key})
289 0 0 if ($data_differs)
296 0 0 unless copy($file, $backup)
300 0 0 unless open my $fh, ">", "$file"
320 0 0 unless (-e "/root/tesla_api_cache.json")
327 0 0 unless ($valid_token)
340 0 0 if defined $data
342 0 0 if $self->{'cache_data'}
345 0 0 unless open my $fh, "<", "/root/tesla_api_cache.json"
357 0 0 unless (defined $auth_code)
381 0 0 if ($response->is_success) { }
403 0 0 if (time + $token_expires_in < $token_expires_at)
415 0 0 if (not defined $token_data or ref $token_data ne "HASH")
450 0 0 if ($response->is_success) { }
471 0 0 if (not defined $token_data or ref $token_data ne "HASH")
477 0 0 unless open my $fh, ">", "/root/tesla_api_cache.json"
517 0 0 if ($code_url =~ /code=(.*?)\&/) { }
532 0 0 if (defined $self->{'authentication_code_verifier'})
550 0 0 unless ($endpoint)
554 0 0 if ($data)