/[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

Annotation of /trunk/t/5_Node.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 39 - (hide annotations)
Thu Jan 5 22:36:10 2006 UTC (18 years, 2 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1170 byte(s)
added optional parametar to Node to turn on debugging (which isn't documented and probably
won't be because it spits output using warn)
1 dpavlin 28 #!/usr/bin/perl -w
2    
3     use strict;
4     use blib;
5    
6 dpavlin 37 use Test::More tests => 12;
7 dpavlin 28 use Test::Exception;
8     use Data::Dumper;
9    
10     BEGIN { use_ok('Search::Estraier') };
11    
12 dpavlin 35 # name of node for test
13     my $test_node = 'Search-Estraier';
14    
15 dpavlin 39 ok(my $node = new Search::Estraier::Node(1), 'new');
16 dpavlin 28 isa_ok($node, 'Search::Estraier::Node');
17    
18 dpavlin 29 ok($node->set_url('http://localhost:1978/'), 'set_url');
19    
20 dpavlin 38 ok($node->set_proxy('', 8080), 'set_proxy');
21 dpavlin 30 throws_ok {$node->set_proxy('proxy.example.com', 'foo') } qr/port/, 'set_proxy port NaN';
22    
23     ok($node->set_timeout(42), 'set_timeout');
24     throws_ok {$node->set_timeout('foo') } qr/timeout/, 'set_timeout NaN';
25 dpavlin 31
26 dpavlin 39 ok($node->set_auth('admin','admin'), 'set_auth');
27 dpavlin 32
28     cmp_ok($node->status, '==', -1, 'status');
29 dpavlin 35
30 dpavlin 38 my @res = ( -1, 200 );
31    
32 dpavlin 35 my $nodelist;
33 dpavlin 39 foreach my $url (qw{?action=nodelist http://localhost:1978/master?action=nodelist}) {
34 dpavlin 37 cmp_ok(
35     $node->shuttle_url( $url, 'text/plain', undef, \$nodelist)
36 dpavlin 38 ,'==', shift @res, 'nodelist');
37 dpavlin 37 }
38 dpavlin 35
39     my $draft = <<'_END_OF_DRAFT_';
40     @uri=data001
41     @title=Material Girl
42    
43     Living in a material world
44     And I am a material girl
45     You know that we are living in a material world
46     And I am a material girl
47     _END_OF_DRAFT_
48    
49     diag "draft:\n$draft";

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26