--- trunk/t/5_Node.t 2006/01/28 19:41:59 100 +++ trunk/t/5_Node.t 2006/02/19 17:01:49 107 @@ -3,7 +3,7 @@ use strict; use blib; -use Test::More tests => 99; +use Test::More tests => 106; use Test::Exception; use Data::Dumper; @@ -32,7 +32,7 @@ SKIP: { -skip "no $test1_node node in Hyper Estraier", 88, unless($node->name); +skip "no $test1_node node in Hyper Estraier", 97, unless($node->name); my @res = ( -1, 200 ); @@ -102,7 +102,7 @@ for ( 6 .. 10 ) { my $uri = 'test' . $_; - ok( my $id = $node->uri_to_id( $uri ), "uri_to_id $uri"); + ok( my $id = $node->uri_to_id( $uri ), "uri_to_id($uri) = $id"); ok( $node->get_doc( $id ), "get_doc $id"); ok( $node->get_doc_by_uri( $uri ), "get_doc_by_uri $uri"); cmp_ok( $node->get_doc_attr( $id, '@uri' ), 'eq', $uri, "get_doc_attr $id"); @@ -138,13 +138,29 @@ ok($node = new Search::Estraier::Node( url => "http://localhost:1978/non-existant", croak_on_error => 1 ), "new non-existant"); throws_ok { $node->name } qr/404/, 'croak on error'; -# support for undef and 0 values -#ok($node = new Search::Estraier::Node( url => "http://localhost:1978/$test1_node", croak_on_error => 1 ), "new $test1_node"); +# croak_on_error +ok($node = new Search::Estraier::Node( url => "http://localhost:1978/node/$test1_node", croak_on_error => 1 ), "new $test1_node"); + +ok(! $node->uri_to_id('foobar'), 'uri_to_id without croak'); + +# test users + +ok(! $node->admins, 'no admins'); +ok(! $node->guests, 'no guests'); SKIP: { skip "no $test2_node in Hyper Estraier, skipping set_link", 2 unless (my $test2_label = $node2->label); - ok($node->set_link("http://localhost:1978/node/$test2_node", $test2_label, 42), "set_link $test2_node ($test2_label) 42"); + my $link_url = "http://localhost:1978/node/$test2_node"; + + ok($node->set_link( $link_url, $test2_label, 42), "set_link $test2_node ($test2_label) 42"); + + ok(my $links = $node->links, 'links'); + + cmp_ok($#{$links}, '==', 0, 'one link'); + + like($links->[0], qr/^$link_url/, 'link correct'); + ok($node->set_link("http://localhost:1978/node/$test2_node", $test2_label, 0), "set_link $test2_node ($test2_label) delete"); } # SKIP 2