From b455571f1feee8af1f65baad8603b085ef8fbcb9 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Fri, 11 Dec 2009 17:17:09 +0100 Subject: add some tests and update deps --- Makefile.PL | 9 +++++---- t/basic.t | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 t/basic.t diff --git a/Makefile.PL b/Makefile.PL index 3d0a232..5cd9b68 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -2,15 +2,16 @@ use inc::Module::Install; name 'AnyEvent-Riak'; all_from 'lib/AnyEvent/Riak.pm'; -# requires ''; -requires 'Moose'; -requires 'Test::Class'; -requires 'Test::Exception'; +requires 'URI'; +requires 'JSON::XS'; +requires 'AnyEvent'; +requires 'AnyEvent::HTTP'; tests 't/*.t'; author_tests 'xt'; build_requires 'Test::More'; +build_requires 'Test::Exception'; use_test_base; auto_include; WriteAll; diff --git a/t/basic.t b/t/basic.t new file mode 100644 index 0000000..29fed23 --- /dev/null +++ b/t/basic.t @@ -0,0 +1,31 @@ +use strict; +use warnings; +use Test::More; +use Test::Exception; +use AnyEvent::Riak; + +my $jiak = AnyEvent::Riak->new( + host => 'http://127.0.0.1:8098', + path => 'jiak' +); + +ok my $buckets = $jiak->list_bucket('bar')->recv, "... fetch bucket list"; +is scalar @{ $buckets->{keys} }, '0', '... no keys'; + +ok my $new_bucket + = $jiak->set_bucket( 'foo', { allowed_fields => '*' } )->recv, + '... set a new bucket'; + +my $value = { + bucket => 'foo', + key => 'baz', + object => { foo => "bar" }, + links => [] +}; + +ok my $res = $jiak->store($value)->recv, '... set a new key'; + +ok $res = $jiak->fetch( 'foo', 'baz' )->recv, '... fetch our new key'; +ok $res = $jiak->delete( 'foo', 'baz' )->recv, '... delete our key'; + +done_testing(); -- cgit 1.4.1