--- trunk/t/5_Node.t 2006/01/05 15:38:34 32 +++ trunk/t/5_Node.t 2006/01/05 22:36:10 39 @@ -3,23 +3,47 @@ use strict; use blib; -use Test::More tests => 10; +use Test::More tests => 12; use Test::Exception; use Data::Dumper; BEGIN { use_ok('Search::Estraier') }; -ok(my $node = new Search::Estraier::Node, 'new'); +# name of node for test +my $test_node = 'Search-Estraier'; + +ok(my $node = new Search::Estraier::Node(1), 'new'); isa_ok($node, 'Search::Estraier::Node'); ok($node->set_url('http://localhost:1978/'), 'set_url'); -ok($node->set_proxy('proxy.example.com', 8080), 'set_proxy'); +ok($node->set_proxy('', 8080), 'set_proxy'); throws_ok {$node->set_proxy('proxy.example.com', 'foo') } qr/port/, 'set_proxy port NaN'; ok($node->set_timeout(42), 'set_timeout'); throws_ok {$node->set_timeout('foo') } qr/timeout/, 'set_timeout NaN'; -ok($node->set_auth('foo','bar'), 'set_auth'); +ok($node->set_auth('admin','admin'), 'set_auth'); cmp_ok($node->status, '==', -1, 'status'); + +my @res = ( -1, 200 ); + +my $nodelist; +foreach my $url (qw{?action=nodelist http://localhost:1978/master?action=nodelist}) { + cmp_ok( + $node->shuttle_url( $url, 'text/plain', undef, \$nodelist) + ,'==', shift @res, 'nodelist'); +} + +my $draft = <<'_END_OF_DRAFT_'; +@uri=data001 +@title=Material Girl + +Living in a material world +And I am a material girl +You know that we are living in a material world +And I am a material girl +_END_OF_DRAFT_ + +diag "draft:\n$draft";