Arango-Tango

 view release on metacpan or  search on metacpan

lib/Arango/Tango/Cursor.pm  view on Meta::CPAN

C<Arango::Tango::Cursor> answers to the following methods:

=head1 METHODS

=over 4

=item C<next>

Returns the next results. On the first call, returns the results
obtained from the first query request.  Subsequent requests will try
to gather more hits if they exists, and the query id is still alive.

=item C<has_more>

Returns a boolean stating if there are more results to be fetched.

=item C<finish>

Deletes the cursor in the server and destroys all the object details.

=back

t/01-database.t  view on Meta::CPAN

# -*- cperl -*-
use Arango::Tango;
use Test2::V0;
use Test2::Tools::Exception qw/dies lives/;

do "./t/helper.pl";

skip_all "No ArangoDB environment variables for testing. See README" unless valid_env_vars();
skip_all "Can't reach ArangoDB Server" unless server_alive();

my $arango = Arango::Tango->new( );
skip_all "Credentials problems" unless auth_ok($arango);

clean_test_environment($arango);

## -- version
my $version = $arango->version;
is $version->{server} => 'arango';
is ($arango->http_status(), 200, "Version returns a 200 status");

t/02-collection.t  view on Meta::CPAN

# -*- cperl -*-
use Arango::Tango;
use Test2::V0;
use Test2::Tools::Exception qw/dies lives/;

do "./t/helper.pl";

skip_all "No ArangoDB environment variables for testing. See README" unless valid_env_vars();
skip_all "Can't reach ArangoDB Server" unless server_alive();

my $arango = Arango::Tango->new( );
skip_all "Credentials problems" unless auth_ok($arango);
clean_test_environment($arango);


my $db = $arango->create_database("tmp_");

my $test_collections = $db->list_collections;
is ref($test_collections), "ARRAY", "Collection list is still an array";

t/03-document.t  view on Meta::CPAN

# -*- cperl -*-
use Arango::Tango;
use Test2::V0;
use Test2::Tools::Exception qw/dies lives/;
do "./t/helper.pl";

skip_all "No ArangoDB environment variables for testing. See README" unless valid_env_vars();
skip_all "Can't reach ArangoDB Server" unless server_alive();

my $arango = Arango::Tango->new( );
skip_all "Credentials problems" unless auth_ok($arango);
clean_test_environment($arango);

my $db = $arango->create_database("tmp_");

my $collection = $db->create_collection("collection");

$collection->create_document( { Hello => 'World' });

t/04-query.t  view on Meta::CPAN

# -*- cperl -*-
use Arango::Tango;
use Test2::V0;
use Test2::Tools::Exception qw/dies lives/;
do "./t/helper.pl";

skip_all "No ArangoDB environment variables for testing. See README" unless valid_env_vars();
skip_all "Can't reach ArangoDB Server" unless server_alive();

my $arango = Arango::Tango->new( );
skip_all "Credentials problems" unless auth_ok($arango);
clean_test_environment($arango);

my $db = $arango->create_database("tmp_");

my $collection = $db->create_collection("collection");

my $documents = [

t/05-users.t  view on Meta::CPAN

# -*- cperl -*-

use Arango::Tango;
use Test2::V0;
use Test2::Tools::Exception qw/dies lives/;

do "./t/helper.pl";

skip_all "No ArangoDB environment variables for testing. See README" unless valid_env_vars();
skip_all "Can't reach ArangoDB Server" unless server_alive();

my $arango = Arango::Tango->new( );
skip_all "Credentials problems" unless auth_ok($arango);
clean_test_environment($arango);

## 1. Create User
my $ans = $arango->create_user('tmp_user_');
is $ans->{user}, "tmp_user_", "Looks like it was created";

## 2. List Users

t/helper.pl  view on Meta::CPAN


use HTTP::Tiny;

sub server_alive {
    my $port = $ENV{ARANGO_DB_PORT} || 8529;
    return HTTP::Tiny->new->get("http://$ENV{ARANGO_DB_HOST}:$port")->{success};
}

sub auth_ok {
    my $arango = shift;
    my $x = eval { $arango->version; };
    return !($@ && $arango->{last_error} == 401);
}



( run in 0.760 second using v1.01-cache-2.11-cpan-df04353d9ac )