summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-10-12 17:18:40 +0200
committerfranck cuny <franck@lumberjaph.net>2010-10-12 17:18:40 +0200
commitbbe059b352b1ebc4c07e3e603a956c4329e8f8da (patch)
tree43c0c29efa826505b7e6de3d4a99fabcbb06be4a /t
parentupdate POD (diff)
downloadnet-http-spore-bbe059b352b1ebc4c07e3e603a956c4329e8f8da.tar.gz
dist.ini file and basic test for format::autho
Diffstat (limited to 't')
-rw-r--r--t/spore-middleware/format-auto.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/spore-middleware/format-auto.t b/t/spore-middleware/format-auto.t
new file mode 100644
index 0000000..e90e16b
--- /dev/null
+++ b/t/spore-middleware/format-auto.t
@@ -0,0 +1,38 @@
+use strict;
+use warnings;
+use Test::More;
+
+plan tests => 1;
+
+use JSON;
+
+use Net::HTTP::Spore;
+
+my $content = { keys => [qw/1 2 3/] };
+
+my $mock_server = {
+ '/api/show' => sub {
+ my $req = shift;
+ $req->new_response(
+ 200,
+ [ 'Content-Type' => 'application/json' ],
+ JSON::encode_json($content),
+ );
+ },
+};
+
+my $api = {
+ api_base_url => 'http://services.org/api',
+ methods => {
+ 'show' => {
+ path => '/show',
+ method => 'GET',
+ }
+ }
+};
+
+ok my $client = Net::HTTP::Spore->new_from_string( JSON::encode_json($api) );
+
+$client->enable('Format::Auto');
+$client->enable( 'Mock', tests => $mock_server );
+