Skip to content

Commit

Permalink
_decode () is now a method, not a function
Browse files Browse the repository at this point in the history
  • Loading branch information
stevieb9 committed Apr 20, 2022
1 parent 13bd09b commit aff03e3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion t/015-auth_code_extract.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ my $known_code = '2B51b8031f2b4ad4db52873da125b729497593e6c15c4a2dd591e698777f';

my $t = Tesla::API->new(unauthenticated => 1);

my $code = $t->_authentication_code_extract($data->{auth_url_extract});
my $url = $data->{auth_url_extract};

my $code = $t->_authentication_code_extract($url);
is $code, $known_code, "Extracted code is correct ok";

$url =~ s/code/asdf/;

my $ok = eval { $t->_authentication_code_extract($url); 1; };

is $ok, undef, "If the auth code can't be extracted, we croak ok";
like $@, qr/Could not extract the auth/, "...and error is sane";

done_testing();

0 comments on commit aff03e3

Please sign in to comment.