automaticallay generate test cases for Perl

This commit is contained in:
wing328
2016-02-11 08:24:51 +08:00
parent 7b83664dd1
commit 3d9a331666
19 changed files with 445 additions and 8 deletions

View File

@@ -0,0 +1,89 @@
use Test::More tests => 38;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::PetApi');
use_ok('WWW::SwaggerClient::ApiClient');
use_ok('WWW::SwaggerClient::Object::Pet');
use_ok('WWW::SwaggerClient::Object::Tag');
use_ok('WWW::SwaggerClient::Object::Category');
my $api_client = WWW::SwaggerClient::ApiClient->instance('base_url' => 'http://testing');
my $pet_api = WWW::SwaggerClient::PetApi->new('api_client' => $api_client);
is $pet_api->{api_client}->{base_url}, 'http://testing', 'get the proper base URL from api client';
my $api = WWW::SwaggerClient::PetApi->new();
is $api->{api_client}->{base_url}, 'http://testing', 'we still get the original base URL from api client, because it\'s a singleton';
# reset the base_url - no direct access because an application shouldn't be changing
# its base URL halfway through
$api->{api_client}->{base_url} = 'http://petstore.swagger.io/v2';
is $api->{api_client}->{base_url}, 'http://petstore.swagger.io/v2', 'get the default base URL from api client';
# test select_header_content_type
is $api->{api_client}->select_header_content_type('application/xml', 'Application/JSON'), 'application/json', 'get the proper content type application/json but not application/xml';
is $api->{api_client}->select_header_content_type('application/xml'), 'application/xml', 'get the proper content type application/json';
is $api->{api_client}->select_header_content_type(''), 'application/json', 'get the proper content type application/json (default)';
# test select_header_accept
is $api->{api_client}->select_header_accept('application/xml', 'Application/JSON'), 'application/json', 'get the proper accept application/json but not application/xml';
is $api->{api_client}->select_header_content_type('application/xml'), 'application/xml', 'get the proper accept application/json';
is $api->{api_client}->select_header_accept(''), undef, 'get the proper accept "undef" (default)';
my $pet_id = 10008;
my $category = WWW::SwaggerClient::Object::Category->new('id' => '22', 'name' => 'perl');
my $tag = WWW::SwaggerClient::Object::Tag->new('id' => '11', 'name' => 'just kidding');
my $pet = WWW::SwaggerClient::Object::Pet->new('id' => $pet_id, 'name' => 'perl test',
"photoUrls" => ['123', 'oop'], 'tags' => [$tag], 'status' => 'pending', 'category' => $category);
isa_ok($api, 'WWW::SwaggerClient::PetApi');
isa_ok($category, 'WWW::SwaggerClient::Object::Category');
isa_ok($tag, 'WWW::SwaggerClient::Object::Tag');
isa_ok($pet, 'WWW::SwaggerClient::Object::Pet');
my $pet_hash = $pet->to_hash;
is $pet_hash->{category}->{id}, '22', 'get the proper category id';
is $pet_hash->{category}->{name}, 'perl', 'get the proper category name';
is $pet_hash->{tags}[0]->{name}, 'just kidding', 'get the proper tag name';
is $pet_hash->{tags}[0]->{id}, '11', 'get the proper tag id';
my $add_pet = $api->add_pet(body => $pet);
my $get_pet = $api->get_pet_by_id(pet_id => $pet_id);
my $get_pet_hash = $get_pet->to_hash;
is $get_pet_hash->{name}, 'perl test', 'get the proper pet name from get_pet_by_id';
is $get_pet_hash->{id}, '10008', 'get the proper pet id from get_pet_by_id';
is $get_pet_hash->{category}->{name}, 'perl', 'get the proper category name from get_pet_by_id';
is $get_pet_hash->{category}->{id}, '22', 'get the proper category id from get_pet_by_id';
is $get_pet_hash->{category}->{name}, 'perl', 'get the proper category from get_pet_by_id';
is $get_pet_hash->{tags}[0]->{name}, 'just kidding', 'get the proper tag from get_pet_by_id';
is $get_pet_hash->{tags}[0]->{id}, '11', 'get the proper tag id from get_pet_by_id';
is $get_pet_hash->{photoUrls}->[0], '123', 'get the proper photoUrl from get_pet_by_id';
is $get_pet_hash->{photoUrls}->[1], 'oop', 'get the proper photoUrl from get_pet_by_id';
my $update_pet_with_form = $api->update_pet_with_form(pet_id => $pet_id, name => 'test_name', status => 'sold');
is $update_pet_with_form, undef, 'get the null response from update_pet_wth_form';
my $get_pet_after_update = $api->get_pet_by_id(pet_id => $pet_id);
is $get_pet_after_update->{status}, 'sold', 'get the updated status after update_pet_with_form';
my $upload_pet = $api->upload_file(pet_id => $pet_id, additional_metadata => 'testabc', file => 'test.pl');
is $upload_pet, undef, 'get the null response from upload_pet';
my $delete_pet = $api->delete_pet(pet_id => $pet_id);
is $delete_pet, undef, 'get the null response from delete_pet';
throws_ok{$api->get_pet_by_id(pet_id => $pet_id)} qr/API Exception\(404\): Not Found/, "throw 404 error about pet not found after delete";
#is $get_pet_after_delete->{status}, undef, 'get the updated status after update_pet_with_form';
my $pets;
lives_ok {$pets = $api->find_pets_by_status(status => [qw(sold available)])} 'array query param processed correctly';
isa_ok($pets->[0], 'WWW::SwaggerClient::Object::Pet');

View File

@@ -0,0 +1,146 @@
use Test::More tests => 41;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use JSON;
use_ok('WWW::SwaggerClient::StoreApi');
use_ok('WWW::SwaggerClient::ApiClient');
use_ok('WWW::SwaggerClient::Object::Pet');
use_ok('WWW::SwaggerClient::Object::Tag');
use_ok('WWW::SwaggerClient::Object::Category');
use_ok('WWW::SwaggerClient::Object::User');
my $api_client = WWW::SwaggerClient::ApiClient->instance();
my $store_api = WWW::SwaggerClient::StoreApi->new('api_client' => $api_client);
is $store_api->{api_client}->{base_url}, 'http://petstore.swagger.io/v2', 'get the default base URL from api client';
my $get_inventory_response = $store_api->get_inventory();
# comment out pending check as sometimes there's no object with pending status
#like ($get_inventory_response->{pending}, qr/^\d+$/, "pending is numeric");
like ($get_inventory_response->{sold}, qr/^\d+$/, "sold is numeric");
my $pet_json = <<JSON;
{
"pet": {
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "tag string"
}
],
"status": "available"
}
}
JSON
is ref(decode_json $pet_json), "HASH", "the decoded json string is a hash";
is ref $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}, "WWW::SwaggerClient::Object::Pet", "get Pet object from hash";
is $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}->{name}, "doggie", "get the name of the Pet object";
is $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}->{category}->{name}, "string", "get the category name of the Pet object";
is ref $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}->{category}, "WWW::SwaggerClient::Object::Category", "get the Category the Pet object";
is ref $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}->{tags}[0], "WWW::SwaggerClient::Object::Tag", "get the Tag of the Pet object";
is $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}->{tags}[0]->{name}, "tag string", "get the Tag name of the Pet object";
is $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}->{photo_urls}->[0], "string", "get the photoUrl from the Pet object";
my $array_json = <<JSON;
[
{
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "tag string"
}
],
"status": "available"
}
]
JSON
is ref(decode_json $array_json), "ARRAY", "the decoded json string is an array";
is ref $api_client->deserialize("ARRAY[Pet]", $array_json)->[0], "WWW::SwaggerClient::Object::Pet", "get Pet object from hash";
is $api_client->deserialize("ARRAY[Pet]", $array_json)->[0]->{name}, "doggie", "get the name of the Pet object";
is $api_client->deserialize("ARRAY[Pet]", $array_json)->[0]->{category}->{name}, "string", "get the category name of the Pet object";
is ref $api_client->deserialize("ARRAY[Pet]", $array_json)->[0]->{category}, "WWW::SwaggerClient::Object::Category", "get the Category the Pet object";
is ref $api_client->deserialize("ARRAY[Pet]", $array_json)->[0]->{tags}->[0], "WWW::SwaggerClient::Object::Tag", "get the Tag[0] the Pet object";
is $api_client->deserialize("ARRAY[Pet]", $array_json)->[0]->{tags}->[0]->{name}, "tag string", "get the tag name the Pet object";
is $api_client->deserialize("ARRAY[Pet]", $array_json)->[0]->{photo_urls}->[0], "string", "get the photoUrl from the Pet object";
my $pet_json_nopet = <<JSON;
{
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "tag string"
}
],
"status": "available"
}
JSON
is ref(decode_json $pet_json_nopet), "HASH", "the decoded json string is a hash";
is ref $api_client->deserialize("Pet", $pet_json_nopet), "WWW::SwaggerClient::Object::Pet", "get Pet object via from_hash()";
is $api_client->deserialize("Pet", $pet_json_nopet)->{name}, "doggie", "get the name of the Pet object";
is $api_client->deserialize("Pet", $pet_json_nopet)->{category}->{name}, "string", "get the category name of the Pet object";
is ref $api_client->deserialize("Pet", $pet_json_nopet)->{category}, "WWW::SwaggerClient::Object::Category", "get the Category the Pet object";
is ref $api_client->deserialize("Pet", $pet_json_nopet)->{tags}->[0], "WWW::SwaggerClient::Object::Tag", "get the Tag[0] the Pet object";
is $api_client->deserialize("Pet", $pet_json_nopet)->{tags}->[0]->{name}, "tag string", "get the tag name the Pet object";
is $api_client->deserialize("Pet", $pet_json_nopet)->{photo_urls}->[0], "string", "get the photoUrl from the Pet object";
my %userdata = (
id => 4000,
username => "tony",
firstName => "Tony",
lastName => "Tiger",
email => 'tony@fail.com',
password => "XXXXXXXXXXX",
phone => "408-867-5309",
userStatus => 1,
);
my $user = WWW::SwaggerClient::Object::User->new->from_hash(\%userdata);
is ref $user, 'WWW::SwaggerClient::Object::User', "built a User object via from_hash()";
is $user->{id}, $userdata{id}, "got the id of the User object";
is $user->{username}, $userdata{username}, "got the username of the User object";
is $user->{first_name}, $userdata{firstName}, "got the firstName of the User object";
is $user->{last_name}, $userdata{lastName}, "got the lastName of the User object";
is $user->{email}, $userdata{email}, "got the email of the User object";
is $user->{password}, $userdata{password}, "got the password of the User object";
is $user->{phone}, $userdata{phone}, "got the phone of the User object";
is $user->{user_status}, $userdata{userStatus}, "got the userStatus of the User object";

View File

@@ -0,0 +1,49 @@
use Test::More tests => 19;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::ApiFactory');
my $api_factory = WWW::SwaggerClient::ApiFactory->new('base_url' => 'http://testing');
my $pet_api = $api_factory->get_api('Pet');
isa_ok($pet_api, 'WWW::SwaggerClient::PetApi');
is $pet_api->{api_client}->{base_url}, 'http://testing', 'get the proper base URL from api client';
$api_factory = WWW::SwaggerClient::ApiFactory->new;
$pet_api = $api_factory->get_api('Pet');
# reset the base_url - no direct access because an application shouldn't be changing
# its base URL halfway through
$pet_api->{api_client}->{base_url} = 'http://petstore.swagger.io/v2';
is $pet_api->{api_client}->{base_url}, 'http://petstore.swagger.io/v2', 'get the default base URL from api client';
# test accessor methods
my $pet_id = 10008;
# note - we don't need to 'use' these modules because they've already been loaded by ApiFactory
my ($category, $tag, $pet);
lives_ok { $category = WWW::SwaggerClient::Object::Category->new('id' => '22', 'name' => 'perl') } 'Category.pm loaded OK';
lives_ok { $tag = WWW::SwaggerClient::Object::Tag->new('id' => '11', 'name' => 'just kidding') } 'Tag.pm loaded OK';
lives_ok { $pet = WWW::SwaggerClient::Object::Pet->new('id' => $pet_id, 'name' => 'perl test',
"photoUrls" => ['123', 'oop'], 'tags' => [$tag], 'status' => 'pending', 'category' => $category) } 'Pet.pm loaded OK';
is $pet->id, '10008', 'got the proper pet id';
is $pet->name, 'perl test', 'got the proper pet name';
is $pet->category->id, '22', 'got the proper category id';
is $pet->category->name, 'perl', 'got the proper category name';
is $pet->tags->[0]->name, 'just kidding', 'got the proper tag name';
is $pet->tags->[0]->id, '11', 'got the proper tag id';
my $add_pet = $pet_api->add_pet(body => $pet);
my $get_pet = $pet_api->get_pet_by_id(pet_id => $pet_id);
is $get_pet->id, '10008', 'stored and retrieved: got the proper pet id';
is $get_pet->name, 'perl test', 'stored and retrieved: got the proper pet name';
is $get_pet->category->id, '22', 'stored and retrieved: got the proper category id';
is $get_pet->category->name, 'perl', 'stored and retrieved: got the proper category name';
is $get_pet->tags->[0]->name, 'just kidding', 'stored and retrieved: got the proper tag name';
is $get_pet->tags->[0]->id, '11', 'stored and retrieved: got the proper tag id';

View File

@@ -0,0 +1,143 @@
use Test::More tests => 37;
use Test::Exception;
use Test::Warnings 'warnings';
use Test::Deep;
use lib 'lib';
use strict;
use warnings;
SKIP: {
eval "
package MyApp;
use Moose;
with 'WWW::SwaggerClient::Role';
sub auth_setup_handler {}
";
# die $@ if $@;
skip 'Moose not installed', 37 if $@;
my $api = MyApp->new;
my $pet_id = 10008;
# note - we don't need to 'use' these modules because they've already been loaded by ApiFactory
my ($category, $tag, $pet);
lives_ok { $category = WWW::SwaggerClient::Object::Category->new('id' => '22', 'name' => 'perl') } 'Category.pm loaded OK';
lives_ok { $tag = WWW::SwaggerClient::Object::Tag->new('id' => '11', 'name' => 'just kidding') } 'Tag.pm loaded OK';
lives_ok { $pet = WWW::SwaggerClient::Object::Pet->new('id' => $pet_id, 'name' => 'perl test',
"photoUrls" => ['123', 'oop'], 'tags' => [$tag], 'status' => 'pending', 'category' => $category) } 'Pet.pm loaded OK';
is $pet->id, '10008', 'got the proper pet id';
is $pet->name, 'perl test', 'got the proper pet name';
is $pet->category->id, '22', 'got the proper category id';
is $pet->category->name, 'perl', 'got the proper category name';
is $pet->tags->[0]->name, 'just kidding', 'got the proper tag name';
is $pet->tags->[0]->id, '11', 'got the proper tag id';
my $add_pet = $api->add_pet(body => $pet);
my $get_pet = $api->get_pet_by_id(pet_id => $pet_id);
is $get_pet->id, '10008', 'stored and retrieved: got the proper pet id';
is $get_pet->name, 'perl test', 'stored and retrieved: got the proper pet name';
is $get_pet->category->id, '22', 'stored and retrieved: got the proper category id';
is $get_pet->category->name, 'perl', 'stored and retrieved: got the proper category name';
is $get_pet->tags->[0]->name, 'just kidding', 'stored and retrieved: got the proper tag name';
is $get_pet->tags->[0]->id, '11', 'stored and retrieved: got the proper tag id';
# documentation tests
# API method docs
is_deeply( [sort keys %{$api->pet_api->method_documentation}],
[ 'add_pet', 'add_pet_using_byte_array', 'delete_pet', 'find_pets_by_status', 'find_pets_by_tags', 'get_pet_by_id', 'get_pet_by_id_with_byte_array', 'update_pet', 'update_pet_with_form', 'upload_file'],
"Pet API method_documentation has the correct keys");
is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{description},
'ID of pet that needs to be fetched', 'get_pet_by_id parameter pet_id description is correct';
is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{required},
1, 'get_pet_by_id parameter pet_id is required';
is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{data_type},
'int', 'get_pet_by_id parameter pet_id is an int';
is $api->pet_api->method_documentation->{get_pet_by_id}->{returns},
'Pet', 'get_pet_by_id returns a Pet';
is $api->pet_api->method_documentation->{get_pet_by_id}->{summary},
'Find pet by ID', 'get_pet_by_id summary is correct';
# object class docs
my $pet_class_doco = { 'description' => '', required => [], class => 'Pet' };
is_deeply($get_pet->class_documentation, $pet_class_doco, 'Pet object class_documentation is available');
is $get_pet->class_documentation->{description}, '', 'Pet object class_documentation is correct'; # right now it's blank
is $get_pet->class_documentation->{class}, 'Pet', 'Pet object class_documentation returns correct class name';
# object method docs
is $get_pet->method_documentation->{status}->{description}, 'pet status in the store', 'Pet object method_documentation for status() - description is correct';
is $get_pet->method_documentation->{status}->{format}, '', 'Pet object method_documentation for status() - format is correct';
is $get_pet->method_documentation->{status}->{base_name}, 'status', 'Pet object method_documentation for status() - base_name is correct';
is $get_pet->method_documentation->{status}->{datatype}, 'string', 'Pet object method_documentation for status() - datatype is correct';
# / documentation tests
my $tokens = {
username => 'UserName',
password => 'PassWord',
access_token => 'OAuth_token',
someKey => { token => 'some_key_token',
prefix => 'some_key_prefix',
in => 'query',
},
anotherKey => { token => 'another_key_token',
},
};
$api->_cfg->accept_tokens({%$tokens}); # pass a copy
no warnings 'once';
is $WWW::SwaggerClient::Configuration::username, 'UserName', 'accept_tokens() correctly set the username';
is $WWW::SwaggerClient::Configuration::password, 'PassWord', 'accept_tokens() correctly set the password';
is $WWW::SwaggerClient::Configuration::access_token, 'OAuth_token', 'accept_tokens() correctly set the oauth';
my $api_key_href = {
'anotherKey' => 'another_key_token',
'someKey' => 'some_key_token'
};
cmp_deeply( $WWW::SwaggerClient::Configuration::api_key, $api_key_href, 'accept_tokens() correctly set api_key' );
my $api_key_prefix_href = {
'someKey' => 'some_key_prefix'
};
cmp_deeply( $WWW::SwaggerClient::Configuration::api_key_prefix, $api_key_prefix_href, 'accept_tokens() correctly set api_key_prefix' );
my $api_key_in = {
'someKey' => 'query',
'anotherKey' => 'head'
};
cmp_deeply( $WWW::SwaggerClient::Configuration::api_key_in, $api_key_in, 'accept_tokens() correctly set api_key_in' );
use warnings 'once';
my $cleared_tokens_cmp = {
'anotherKey' => {
'in' => 'head',
'token' => 'another_key_token',
'prefix' => undef
},
'access_token' => 'OAuth_token',
'someKey' => {
'token' => 'some_key_token',
'in' => 'query',
'prefix' => 'some_key_prefix'
},
'username' => 'UserName',
'password' => 'PassWord'
};
cmp_deeply( $api->_cfg->clear_tokens, $cleared_tokens_cmp, 'clear_tokens() returns the correct data structure' );
my $bad_token = { bad_token_name => 'bad token value' }; # value should should be hashref
dies_ok { $api->_cfg->accept_tokens($bad_token) } "bad token causes exception";
} # / SKIP

View File

@@ -0,0 +1,96 @@
use Test::More;
use Test::Exception;
use lib 'deep_module_test/lib';
use strict;
use warnings;
if (! -d 'deep_module_test/lib' ) {
plan skip_all => 'bin/perl-petstore.sh needs to be run first';
}
else {
plan tests => 38;
}
use_ok('Something::Deep::PetApi');
use_ok('Something::Deep::ApiClient');
use_ok('Something::Deep::Object::Pet');
use_ok('Something::Deep::Object::Tag');
use_ok('Something::Deep::Object::Category');
my $api_client = Something::Deep::ApiClient->instance('base_url' => 'http://testing');
my $pet_api = Something::Deep::PetApi->new('api_client' => $api_client);
is $pet_api->{api_client}->{base_url}, 'http://testing', 'get the proper base URL from api client';
my $api = Something::Deep::PetApi->new();
is $api->{api_client}->{base_url}, 'http://testing', 'we still get the original base URL from api client, because it\'s a singleton';
# reset the base_url - no direct access because an application shouldn't be changing
# its base URL halfway through
$api->{api_client}->{base_url} = 'http://petstore.swagger.io/v2';
is $api->{api_client}->{base_url}, 'http://petstore.swagger.io/v2', 'get the default base URL from api client';
# test select_header_content_type
is $api->{api_client}->select_header_content_type('application/xml', 'Application/JSON'), 'application/json', 'get the proper content type application/json but not application/xml';
is $api->{api_client}->select_header_content_type('application/xml'), 'application/xml', 'get the proper content type application/json';
is $api->{api_client}->select_header_content_type(''), 'application/json', 'get the proper content type application/json (default)';
# test select_header_accept
is $api->{api_client}->select_header_accept('application/xml', 'Application/JSON'), 'application/json', 'get the proper accept application/json but not application/xml';
is $api->{api_client}->select_header_content_type('application/xml'), 'application/xml', 'get the proper accept application/json';
is $api->{api_client}->select_header_accept(''), undef, 'get the proper accept "undef" (default)';
my $pet_id = 10008;
my $category = Something::Deep::Object::Category->new('id' => '22', 'name' => 'perl');
my $tag = Something::Deep::Object::Tag->new('id' => '11', 'name' => 'just kidding');
my $pet = Something::Deep::Object::Pet->new('id' => $pet_id, 'name' => 'perl test',
"photoUrls" => ['123', 'oop'], 'tags' => [$tag], 'status' => 'pending', 'category' => $category);
isa_ok($api, 'Something::Deep::PetApi');
isa_ok($category, 'Something::Deep::Object::Category');
isa_ok($tag, 'Something::Deep::Object::Tag');
isa_ok($pet, 'Something::Deep::Object::Pet');
my $pet_hash = $pet->to_hash;
is $pet_hash->{category}->{id}, '22', 'get the proper category id';
is $pet_hash->{category}->{name}, 'perl', 'get the proper category name';
is $pet_hash->{tags}[0]->{name}, 'just kidding', 'get the proper tag name';
is $pet_hash->{tags}[0]->{id}, '11', 'get the proper tag id';
my $add_pet = $api->add_pet(body => $pet);
my $get_pet = $api->get_pet_by_id(pet_id => $pet_id);
my $get_pet_hash = $get_pet->to_hash;
is $get_pet_hash->{name}, 'perl test', 'get the proper pet name from get_pet_by_id';
is $get_pet_hash->{id}, '10008', 'get the proper pet id from get_pet_by_id';
is $get_pet_hash->{category}->{name}, 'perl', 'get the proper category name from get_pet_by_id';
is $get_pet_hash->{category}->{id}, '22', 'get the proper category id from get_pet_by_id';
is $get_pet_hash->{category}->{name}, 'perl', 'get the proper category from get_pet_by_id';
is $get_pet_hash->{tags}[0]->{name}, 'just kidding', 'get the proper tag from get_pet_by_id';
is $get_pet_hash->{tags}[0]->{id}, '11', 'get the proper tag id from get_pet_by_id';
is $get_pet_hash->{photoUrls}->[0], '123', 'get the proper photoUrl from get_pet_by_id';
is $get_pet_hash->{photoUrls}->[1], 'oop', 'get the proper photoUrl from get_pet_by_id';
my $update_pet_with_form = $api->update_pet_with_form(pet_id => $pet_id, name => 'test_name', status => 'sold');
is $update_pet_with_form, undef, 'get the null response from update_pet_wth_form';
my $get_pet_after_update = $api->get_pet_by_id(pet_id => $pet_id);
is $get_pet_after_update->{status}, 'sold', 'get the updated status after update_pet_with_form';
my $upload_pet = $api->upload_file(pet_id => $pet_id, additional_metadata => 'testabc', file => 'test.pl');
is $upload_pet, undef, 'get the null response from upload_pet';
my $delete_pet = $api->delete_pet(pet_id => $pet_id);
is $delete_pet, undef, 'get the null response from delete_pet';
throws_ok{$api->get_pet_by_id(pet_id => $pet_id)} qr/API Exception\(404\): Not Found/, "throw 404 error about pet not found after delete";
#is $get_pet_after_delete->{status}, undef, 'get the updated status after update_pet_with_form';
my $pets;
lives_ok {$pets = $api->find_pets_by_status(status => [qw(sold available)])} 'array query param processed correctly';
isa_ok($pets->[0], 'Something::Deep::Object::Pet');