summary refs log tree commit diff
path: root/t/spore-middleware
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-10-17 21:46:03 +0200
committerfranck cuny <franck@lumberjaph.net>2010-10-17 21:46:03 +0200
commit1c3ba5b29669ff002ff9650535ec019f4022e1e1 (patch)
tree6e9402fcf6c1db8440b1bf77469b0589f46a80dc /t/spore-middleware
parentremove couchdb api; add dummy spec for tests (diff)
downloadnet-http-spore-1c3ba5b29669ff002ff9650535ec019f4022e1e1.tar.gz
update tests to use the dummy api, and replace api_base_url with base_url
Diffstat (limited to 't/spore-middleware')
-rw-r--r--t/spore-middleware/auth-basic.t6
-rw-r--r--t/spore-middleware/format-auto.t2
-rw-r--r--t/spore-middleware/format-json.t8
-rw-r--r--t/spore-middleware/format-xml.t8
-rw-r--r--t/spore-middleware/format-yaml.t8
-rw-r--r--t/spore-middleware/runtime.t8
-rw-r--r--t/spore-middleware/useragent.t8
7 files changed, 24 insertions, 24 deletions
diff --git a/t/spore-middleware/auth-basic.t b/t/spore-middleware/auth-basic.t
index e0e1f05..a6c5ac7 100644
--- a/t/spore-middleware/auth-basic.t
+++ b/t/spore-middleware/auth-basic.t
@@ -10,7 +10,7 @@ my $username = 'franck';
 my $password = 's3kr3t';
 
 my $mock_server = {
-    '/test_spore/_all_docs' => sub {
+    '/show' => sub {
         my $req  = shift;
         my $auth = $req->header('Authorization');
         if ($auth) {
@@ -41,14 +41,14 @@ plan tests => 3 * @tests;
 
 foreach my $test (@tests) {
     ok my $client = Net::HTTP::Spore->new_from_spec(
-        't/specs/couchdb.json', api_base_url => 'http://localhost:5984'
+        't/specs/api.json', base_url => 'http://localhost/'
       ),
       'client created';
     foreach ( @{ $test->{middlewares} } ) {
         $client->enable(@$_);
     }
 
-    my $res = $client->get_all_documents( database => 'test_spore' );
+    my $res = $client->get_info();
     is $res->[0], $test->{expected}->{status}, 'valid HTTP status';
     is $res->[2], $test->{expected}->{body},   'valid HTTP body';
 }
diff --git a/t/spore-middleware/format-auto.t b/t/spore-middleware/format-auto.t
index e90e16b..857d65d 100644
--- a/t/spore-middleware/format-auto.t
+++ b/t/spore-middleware/format-auto.t
@@ -22,7 +22,7 @@ my $mock_server = {
 };
 
 my $api = {
-    api_base_url => 'http://services.org/api',
+    base_url => 'http://services.org/api',
     methods      => {
         'show' => {
             path   => '/show',
diff --git a/t/spore-middleware/format-json.t b/t/spore-middleware/format-json.t
index 61a557f..95d84c3 100644
--- a/t/spore-middleware/format-json.t
+++ b/t/spore-middleware/format-json.t
@@ -9,7 +9,7 @@ use Net::HTTP::Spore;
 my $content = { keys => [qw/1 2 3/] };
 
 my $mock_server = {
-    '/test_spore/_all_docs' => sub {
+    '/show' => sub {
         my $req = shift;
         $req->new_response(
             200,
@@ -20,13 +20,13 @@ my $mock_server = {
 };
 
 ok my $client =
-  Net::HTTP::Spore->new_from_spec( 't/specs/couchdb.json',
-    api_base_url => 'http://localhost:5984' );
+  Net::HTTP::Spore->new_from_spec( 't/specs/api.json',
+    base_url => 'http://localhost:5984' );
 
 $client->enable('Format::JSON');
 $client->enable('Mock', tests => $mock_server);
 
-my $res = $client->get_all_documents( database => 'test_spore' );
+my $res = $client->get_info();
 is $res->[0],        200;
 is_deeply $res->[2], $content;
 is $res->header('Content-Type'), 'application/json';
diff --git a/t/spore-middleware/format-xml.t b/t/spore-middleware/format-xml.t
index 623e281..492f564 100644
--- a/t/spore-middleware/format-xml.t
+++ b/t/spore-middleware/format-xml.t
@@ -9,7 +9,7 @@ use Net::HTTP::Spore;
 my $content = { keys => [qw/1 2 3/] };
 
 my $mock_server = {
-    '/test_spore/_all_docs' => sub {
+    '/show' => sub {
         my $req = shift;
         $req->new_response( 200, [ 'Content-Type' => 'text/xml' ],
             XMLout($content) );
@@ -17,13 +17,13 @@ my $mock_server = {
 };
 
 ok my $client =
-  Net::HTTP::Spore->new_from_spec( 't/specs/couchdb.json',
-    api_base_url => 'http://localhost:5984' );
+  Net::HTTP::Spore->new_from_spec( 't/specs/api.json',
+    base_url => 'http://localhost:5984' );
 
 $client->enable('Format::XML');
 $client->enable( 'Mock', tests => $mock_server );
 
-my $res = $client->get_all_documents( database => 'test_spore' );
+my $res = $client->get_info();
 is $res->[0],        200;
 is_deeply $res->[2], $content;
 is $res->header('Content-Type'), 'text/xml';
diff --git a/t/spore-middleware/format-yaml.t b/t/spore-middleware/format-yaml.t
index db9629d..58c743e 100644
--- a/t/spore-middleware/format-yaml.t
+++ b/t/spore-middleware/format-yaml.t
@@ -9,7 +9,7 @@ use Net::HTTP::Spore;
 my $content = { keys => [qw/1 2 3/] };
 
 my $mock_server = {
-    '/test_spore/_all_docs' => sub {
+    '/show' => sub {
         my $req = shift;
         $req->new_response( 200, [ 'Content-Type' => 'text/x-yaml' ],
             Dump($content) );
@@ -17,13 +17,13 @@ my $mock_server = {
 };
 
 ok my $client =
-  Net::HTTP::Spore->new_from_spec( 't/specs/couchdb.json',
-    api_base_url => 'http://localhost:5984' );
+  Net::HTTP::Spore->new_from_spec( 't/specs/api.json',
+    base_url => 'http://localhost:5984' );
 
 $client->enable('Format::YAML');
 $client->enable( 'Mock', tests => $mock_server );
 
-my $res = $client->get_all_documents( database => 'test_spore' );
+my $res = $client->get_info();
 is $res->[0],        200;
 is_deeply $res->[2], $content;
 is $res->header('Content-Type'), 'text/x-yaml';
diff --git a/t/spore-middleware/runtime.t b/t/spore-middleware/runtime.t
index e7509d6..07b2a63 100644
--- a/t/spore-middleware/runtime.t
+++ b/t/spore-middleware/runtime.t
@@ -5,20 +5,20 @@ use Test::More;
 use Net::HTTP::Spore;
 
 my $mock_server = {
-    '/test_spore/_all_docs' => sub {
+    '/show' => sub {
         my $req = shift;
         $req->new_response( 200, [ 'Content-Type' => 'text/plan' ], 'ok');
     },
 };
 
 ok my $client =
-  Net::HTTP::Spore->new_from_spec( 't/specs/couchdb.json',
-    api_base_url => 'http://localhost:5984' );
+  Net::HTTP::Spore->new_from_spec( 't/specs/api.json',
+    base_url => 'http://localhost:5984' );
 
 $client->enable('Runtime');
 $client->enable('Mock', tests => $mock_server);
 
-my $res = $client->get_all_documents(database => 'test_spore');
+my $res = $client->get_info();
 ok $res->header('X-Spore-Runtime');
 
 done_testing;
diff --git a/t/spore-middleware/useragent.t b/t/spore-middleware/useragent.t
index 92af94b..190a66e 100644
--- a/t/spore-middleware/useragent.t
+++ b/t/spore-middleware/useragent.t
@@ -5,22 +5,22 @@ use Test::More;
 use Net::HTTP::Spore;
 
 my $mock_server = {
-    '/test_spore/_all_docs' => sub {
+    '/show' => sub {
         my $req = shift;
         $req->new_response( 200, [ 'Content-Type' => 'text/plain' ], 'ok');
     },
 };
 
 ok my $client =
-  Net::HTTP::Spore->new_from_spec( 't/specs/couchdb.json',
-    api_base_url => 'http://localhost:5984' );
+  Net::HTTP::Spore->new_from_spec( 't/specs/api.json',
+    base_url => 'http://localhost:5984' );
 
 my $ua_str = 'Test::Spore middleware';
 
 $client->enable('UserAgent', useragent => $ua_str);
 $client->enable('Mock', tests => $mock_server);
 
-my $res = $client->get_all_documents(database => 'test_spore');
+my $res = $client->get_info();
 is $res->request->header('User-Agent'), $ua_str;
 
 done_testing;