summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2009-12-11 17:17:09 +0100
committerfranck cuny <franck@lumberjaph.net>2009-12-11 17:17:09 +0100
commitb455571f1feee8af1f65baad8603b085ef8fbcb9 (patch)
treeb94277167cbddcbe3984dae9a0935b587a96d70f
parentrequires methods to do simple tasks (diff)
downloadanyevent-riak-b455571f1feee8af1f65baad8603b085ef8fbcb9.tar.gz
add some tests and update deps
-rw-r--r--Makefile.PL9
-rw-r--r--t/basic.t31
2 files changed, 36 insertions, 4 deletions
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();