diff options
author | franck cuny <franck@lumberjaph.net> | 2010-07-13 17:32:04 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-07-13 17:32:04 +0200 |
commit | 4df029ae7d7610dda343e8e665301b6e0f321f99 (patch) | |
tree | b9cf4a5ef7349a7ea912b9c69c53fae03ac3defc /t | |
download | net-neo4j-4df029ae7d7610dda343e8e665301b6e0f321f99.tar.gz |
initial import master
Diffstat (limited to 't')
-rw-r--r-- | t/01_basic.t | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/t/01_basic.t b/t/01_basic.t new file mode 100644 index 0000000..ab96c98 --- /dev/null +++ b/t/01_basic.t @@ -0,0 +1,42 @@ +use strict; +use warnings; +use Net::Neo4j; +use Test::More; +use Try::Tiny; +use YAML; + +my $url = "http://localhost:9999"; + +my $graph = Net::Neo4j->new(api_base_url => $url); + +ok my $root = $graph->root; +is $root->{index}, 'http://localhost:9999/index'; + +my @nodes = (qw/franckcuny cmaussan ngrunwald niko foo/); + +foreach my $n (@nodes) { + ok my $res = $graph->add_node(name => $n); +} + +ok my $res = $graph->node(id => 1); + +$graph->set_node_properties(id => 1, profession => 'hacker', name => $nodes[0]); + +ok $res = $graph->node_properties(id => 1); +is_deeply $res, {name => $nodes[0], profession => 'hacker'}; + +$graph->delete_node_properties(id => 1); +$res = $graph->node_properties(id => 1); +is $res, undef; + +#$graph->set_node_property(id => 1, property => {name => $nodes[0]}); + +#$graph->delete_node(id => 5); + +try { + ok $graph->add_edge(id => 1, to => $url.'/node/2', data => {date => time()}, type => 'COWORKER'); +}catch{ + warn Dump $_->http_error; +}; + +done_testing; |