summary refs log tree commit diff
path: root/t/01_basic.t
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-06-24 11:06:31 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-24 11:06:31 +0200
commitec48e1ecc95c17e792b4f576c585275d4e871e4d (patch)
tree7d1c71bccaf62b27a9d9e478b06b6470fd96f6ca /t/01_basic.t
parentparams can be strict or no strict (diff)
downloadmoosex-net-api-ec48e1ecc95c17e792b4f576c585275d4e871e4d.tar.gz
add strict and alter what params_in_url does
Diffstat (limited to '')
-rw-r--r--t/01_basic.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/01_basic.t b/t/01_basic.t
index d21e930..0958c36 100644
--- a/t/01_basic.t
+++ b/t/01_basic.t
@@ -93,4 +93,39 @@ $api->api_useragent->add_handler(
 
 ($content, $res) = $api->delete_user(name => 'eris');
 is $res->code, 204, 'code as expected';
+
+# unstrict parameters
+$api->api_useragent->remove_handler('request_send');
+$api->api_useragent->add_handler(
+    'request_send' => sub {
+        my $request = shift;
+        my $res = HTTP::Response->new(200);
+        $res;
+    }
+);
+
+($content, $res) = $api->unstrict_users(
+    name         => 'eris',
+    last_name    => 'foo',
+    random_stuff => 'bar'
+);
+is $res->code, 200, 'code as expected';
+is $res->request->uri,
+  'http://exemple.com/users/unstrict.json?random_stuff=bar&name=eris&last_name=foo',
+  'url is ok with no declared parameters';
+
+# params in url and body
+$api->api_useragent->remove_handler('request_send');
+$api->api_useragent->add_handler(
+    'request_send' => sub {
+        my $request = shift;
+        my $res = HTTP::Response->new(200);
+        $res;
+    }
+);
+
+($content, $res) = $api->params_users(name => 'eris', bod => '01/01/1970');
+is $res->code, 200, 'code as expected';
+is $res->request->uri, 'http://exemple.com/users.json?bod=01%2F01%2F1970', 'url is ok';
+
 done_testing;