diff options
author | franck cuny <franck@lumberjaph.net> | 2010-06-02 11:37:19 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-06-02 11:37:19 +0200 |
commit | f92976bd47ad9ef1c54de83876db7dcc9843aafd (patch) | |
tree | c398c0f59acbe74178b94b113270a07fa6bf5e2f /t/lib | |
parent | role to handle useragent (diff) | |
download | moosex-net-api-f92976bd47ad9ef1c54de83876db7dcc9843aafd.tar.gz |
tests
Diffstat (limited to '')
-rw-r--r-- | t/lib/TestAPI.pm | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/t/lib/TestAPI.pm b/t/lib/TestAPI.pm new file mode 100644 index 0000000..1e8bf97 --- /dev/null +++ b/t/lib/TestAPI.pm @@ -0,0 +1,49 @@ +package TestAPI; +use MooseX::Net::API; + +use HTTP::Response; + +net_api_declare fake_api => ( + api_base_url => 'http://exemple.com', + format => 'json', +); + +net_api_method users => ( + method => 'GET', + path => '/users/', + expected => [qw/200/], +); + +net_api_method user => ( + method => 'GET', + path => '/user/:user_name', + params => [qw/user_name/], + required => [qw/user_name/], + expected => [qw/200/], +); + +net_api_method add_user => ( + method => 'POST', + path => '/user/', + params => [qw/name dob/], + required => [qw/name/], + expected => [qw/201/], +); + +net_api_method update_user => ( + method => 'PUT', + path => '/user/:name', + params => [qw/name dob/], + required => [qw/name/], + expected => [qw/201/], +); + +net_api_method delete_user => ( + method => 'DELETE', + path => '/user/:name', + params => [qw/name/], + required => [qw/name/], + expected => [qw/204/], +); + +1; |