/[Search-Estraier]/trunk/t/5_Node.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/t/5_Node.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 73 by dpavlin, Mon Jan 9 15:26:50 2006 UTC revision 79 by dpavlin, Mon Jan 16 21:47:21 2006 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use blib;  use blib;
5    
6  use Test::More tests => 95;  use Test::More tests => 97;
7  use Test::Exception;  use Test::Exception;
8  use Data::Dumper;  use Data::Dumper;
9    
# Line 12  BEGIN { use_ok('Search::Estraier') }; Line 12  BEGIN { use_ok('Search::Estraier') };
12  my $debug = 0;  my $debug = 0;
13    
14  # name of node for test  # name of node for test
15  my $test_node = 'test1';  my $test1_node = 'test1';
16  my $test1_node = 'test2';  my $test2_node = 'test2';
17    
18  ok(my $node = new Search::Estraier::Node( debug => $debug ), 'new');  ok(my $node = new Search::Estraier::Node( debug => $debug ), 'new');
19  isa_ok($node, 'Search::Estraier::Node');  isa_ok($node, 'Search::Estraier::Node');
20    
21  ok($node->set_url("http://localhost:1978/node/$test_node"), "set_url $test_node");  ok($node->set_url("http://localhost:1978/node/$test1_node"), "set_url $test1_node");
22    
23  ok($node->set_proxy('', 8080), 'set_proxy');  ok($node->set_proxy('', 8080), 'set_proxy');
24  throws_ok {$node->set_proxy('proxy.example.com', 'foo') } qr/port/, 'set_proxy port NaN';  throws_ok {$node->set_proxy('proxy.example.com', 'foo') } qr/port/, 'set_proxy port NaN';
# Line 32  cmp_ok($node->status, '==', -1, 'status' Line 32  cmp_ok($node->status, '==', -1, 'status'
32    
33  SKIP: {  SKIP: {
34    
35  skip "no $test_node node in Hyper Estraier", 85, unless($node->name);  skip "no $test1_node node in Hyper Estraier", 87, unless($node->name);
36    
37  my @res = ( -1, 200 );  my @res = ( -1, 200 );
38    
# Line 123  ok($node->set_snippet_width( 100, 10, 10 Line 123  ok($node->set_snippet_width( 100, 10, 10
123  # user doesn't exist  # user doesn't exist
124  ok(! $node->set_user('foobar', 1), 'set_user');  ok(! $node->set_user('foobar', 1), 'set_user');
125    
126  ok(my $node1 = new Search::Estraier::Node( "http://localhost:1978/node/$test1_node" ), "new $test1_node");  ok(my $node1 = new Search::Estraier::Node( "http://localhost:1978/node/$test2_node" ), "new $test2_node");
127  ok($node1->set_auth('admin','admin'), "set_auth $test1_node");  ok($node1->set_auth('admin','admin'), "set_auth $test2_node");
128    
129    # croak_on_error
130    
131    ok(my $node2 = new Search::Estraier::Node( url => "http://localhost:1978/non-existant", croak_on_error => 1 ), "new non-existant");
132    throws_ok { $node2->name } qr/404/, 'croak on error';
133    
134  SKIP: {  SKIP: {
135          skip "no $test1_node in Hyper Estraier, skipping set_link", 2 unless (my $test1_label = $node1->label);          skip "no $test2_node in Hyper Estraier, skipping set_link", 2 unless (my $test1_label = $node1->label);
136    
137          ok($node->set_link("http://localhost:1978/node/$test1_node", $test1_label, 42), "set_link $test1_node ($test1_label) 42");          ok($node->set_link("http://localhost:1978/node/$test2_node", $test1_label, 42), "set_link $test2_node ($test1_label) 42");
138          ok($node->set_link("http://localhost:1978/node/$test1_node", $test1_label, 0), "set_link $test1_node ($test1_label) delete");          ok($node->set_link("http://localhost:1978/node/$test2_node", $test1_label, 0), "set_link $test2_node ($test1_label) delete");
139  }       # SKIP 2  }       # SKIP 2
140    
141  }       # SKIP 1  }       # SKIP 1

Legend:
Removed from v.73  
changed lines
  Added in v.79

  ViewVC Help
Powered by ViewVC 1.1.26