about summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-07-05 11:42:57 +0200
committerfranck cuny <franck@lumberjaph.net>2010-07-05 11:42:57 +0200
commitf456a2f1c40432fbc6d764987840e3d5462cf7b9 (patch)
tree900088384fc9c3dd1158128ac1902f74d01100d7
parentreflect change about worker id; update POD (diff)
downloadpresque-f456a2f1c40432fbc6d764987840e3d5462cf7b9.tar.gz
update tests for worker_id; update REAMDE
-rw-r--r--README.md4
-rw-r--r--t/10_basic.t21
2 files changed, 14 insertions, 11 deletions
diff --git a/README.md b/README.md
index e964fe9..9f5a5d8 100644
--- a/README.md
+++ b/README.md
@@ -8,8 +8,7 @@ In order to use presque, you will need:
 
    * [Tatsumaki](http://search.cpan.org/perldoc?Tatsumaki)
    * [Redis](http://code.google.com/p/redis/) (at least version 2.0)
-   * [AnyEvent::Redis](http://search.cpan.org/perldoc?AnyEvent::Redis) original lib.
-   * [AnyEvent::Redis](http://github.com/franckcuny/AnyEvent-Redis) for Hash support in Redis (required)
+   * [AnyEvent::Redis](http://search.cpan.org/perldoc?AnyEvent::Redis)
 
 ## INTRODUCTION
 
@@ -63,6 +62,7 @@ The following HTTP routes are available:
 ## LIBRARIES
 
   * [Net::Presque](http://github.com/franckcuny/net-presque) - Perl
+  * [Presque::Client](http://github.com/ngrunwald/presque-client) - Clojure
 
 ## AUTHOR
 
diff --git a/t/10_basic.t b/t/10_basic.t
index b36cb8d..b3e3cbc 100644
--- a/t/10_basic.t
+++ b/t/10_basic.t
@@ -154,10 +154,10 @@ test_psgi $app, sub {
     is $res->code, 201, 'worker is reg.';
 
     # create/fetch/mcreate/mfetch/fail/stats
-    $res = create_job($cb, $job, $queue_url."?worker_id=$worker_id");
+    $res = create_job($cb, $job, $queue_url);
     is $res->code, 201, 'job created';
 
-    $res = get_jobs($cb, $queue_url."?worker_id=$worker_id");
+    $res = get_jobs($cb, $queue_url);
     is $res->code, 200, 'got job';
 
     $res = workers_stats($cb);
@@ -197,8 +197,9 @@ sub get_job {
 
 sub get_jobs {
     my $cb = shift;
-    my $req     = HTTP::Request->new(GET => $queue_batch_url);
-    ok my $res     = $cb->($req);
+    my $req = HTTP::Request->new(GET => $queue_batch_url);
+    $req->header('X-presque-workerid' => $worker_id);
+    ok my $res = $cb->($req);
     $res;
 }
 
@@ -207,6 +208,7 @@ sub create_job {
     $url ||= $queue_url;
     my $req = HTTP::Request->new(POST => $url);
     $req->header('Content-Type' => 'application/json');
+    $req->header('X-presque-workerid' => $worker_id);
     $req->content(JSON::encode_json($job));
     ok my $res = $cb->($req);
     $res;
@@ -261,17 +263,18 @@ sub workers_stats {
 }
 
 sub reg_worker {
-    my ($cb, ) = @_;
-    my $req = HTTP::Request->new(POST => $worker_url."$queue");
-    $req->content(JSON::encode_json({worker_id => $worker_id}));
-    $req->header('Content-Type' => 'application/json');
+    my ($cb,) = @_;
+    my $req = HTTP::Request->new(POST => $worker_url . "$queue");
+    $req->header('Content-Type'       => 'application/json');
+    $req->header('X-presque-workerid' => $worker_id);
     ok my $res = $cb->($req);
     $res;
 }
 
 sub unreg_worker {
     my ($cb, ) = @_;
-    my $req = HTTP::Request->new(DELETE => $worker_url."$queue?worker_id=$worker_id");
+    my $req = HTTP::Request->new(DELETE => $worker_url.$queue);
+    $req->header('X-presque-workerid' => $worker_id);
     ok my $res = $cb->($req);
     $res;
 }