summary refs log tree commit diff
path: root/t/01_store_fetch_object.t
blob: 4c8a1dc151ef200fa682f378da8256bf2d512c60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use lib 't/lib';
use Test::More;
use Test::Riak;

test_riak {
    my ($client, $bucket_name) = @_;
    ok my $bucket = $client->bucket($bucket_name), 'got bucket test';
    my $content = [int(rand(100))];
    ok my $obj = $bucket->new_object('foo', $content),
      'created a new riak object';

    ok $obj->store, 'store object foo';

    if ($obj->client->can('status')) {
        is $obj->client->status, 200, 'valid status';
    }

    is $obj->key, 'foo', 'valid key';
    is_deeply $obj->data, $content, 'valid content';
};

test_riak_rest {
    my ($client, $bucket_name) = @_;
    ok my $bucket = $client->bucket($bucket_name), 'got bucket test';
    my $content = [int(rand(100))];

    ok my $obj = $bucket->new_object(undef, $content),
      'created a new riak object without a key';
    ok $obj->store, 'store object without key';
    ok $obj->key, 'key created';
}