diff options
Diffstat (limited to 't/spore')
-rw-r--r-- | t/spore/01_new_from_string.t | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/t/spore/01_new_from_string.t b/t/spore/01_new_from_string.t index 6a21994..834baa3 100644 --- a/t/spore/01_new_from_string.t +++ b/t/spore/01_new_from_string.t @@ -3,7 +3,7 @@ use warnings; use Test::More; use Test::Exception; -plan tests => 27; +plan tests => 28; use JSON; use IO::All; @@ -37,6 +37,12 @@ my $api_without_method = { methods => { get_info => { method => 'PET', path => '/show' } }, }; +my $api_with_authentication = { + base_url => "http://services.org/restapi", + authentication => JSON::true(), + methods => { get_info => { method => 'GET', path => '/show' } }, +}; + dies_ok { Net::HTTP::Spore->new_from_spec }; like $@, qr/specification file is missing/; @@ -70,6 +76,8 @@ like $@, qr/Attribute \(method\) does not pass the type constraint/; ok $client = Net::HTTP::Spore->new_from_string(JSON::encode_json($api_ok)); ok $client->meta->_find_spore_method_by_name(sub{/^get_info$/}); +ok $client = Net::HTTP::Spore->new_from_string(JSON::encode_json($api_with_authentication)); + dies_ok { Net::HTTP::Spore->new_from_strings('/a/b/c', '/a/b/c'); }; |