Changeset 805

Show
Ignore:
Timestamp:
04/12/07 18:45:14 (2 years ago)
Author:
hachi
Message:

Since the protocol changed, update tests to follow the new protocol.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/filepaths-20070306/server/t/20-filepaths.t

    r763 r805  
    2828my $sto = eval { temp_store(); }; 
    2929if ($sto) { 
    30     plan tests => 18
     30    plan tests => 19
    3131} else { 
    3232    plan skip_all => "Can't create temporary test database: $@"; 
     
    9595 
    9696{ 
    97     my $dir = $mogc->list_directory('/'); 
    98     ok($dir, "Got a directory listing for/"); 
    99     ok(!$dir->{'foo.txt'}, "foo.txt didn't end up in the listing"); 
    100     my $bar = $dir->{'bar'}; 
     97    my $dir = $mogc->filepaths_list_directory('/'); 
     98    ok($dir, "Got a directory listing for /"); 
     99 
     100    my %files; 
     101    my $filecount = $dir->{files}; 
     102 
     103    for (my $i = 0; $i < $filecount; $i++) { 
     104        my $prefix = "file$i"; 
     105        my %nodeinfo; 
     106        $nodeinfo{type} = $dir->{"$prefix.type"}; 
     107        my $filename = $dir->{$prefix}; 
     108        $files{$filename} = \%nodeinfo; 
     109    } 
     110    ok(!$files{'foo.txt'}, "foo.txt didn't end up in the listing"); 
     111    my $bar = $files{'bar'}; 
    101112    ok($bar, "/bar is in the listing"); 
    102     is($bar, "D", "/bar is a directory"); 
     113    is($bar->{type}, "D", "/bar is a directory"); 
    103114} 
    104115 
    105116{ 
    106     my $dir = $mogc->list_directory('/bar'); 
     117    my $dir = $mogc->filepaths_list_directory('/bar'); 
    107118    ok($dir, "Got directory listing for /bar"); 
    108     my $file1 = $dir->{'file1.txt'}; 
     119 
     120    my %files; 
     121    my $filecount = $dir->{files}; 
     122 
     123    for (my $i = 0; $i < $filecount; $i++) { 
     124        my $prefix = "file$i"; 
     125        my %nodeinfo; 
     126        $nodeinfo{type} = $dir->{"$prefix.type"}; 
     127        $nodeinfo{size} = $dir->{"$prefix.size"}; 
     128        my $filename = $dir->{$prefix}; 
     129        $files{$filename} = \%nodeinfo; 
     130    } 
     131 
     132    my $file1 = $files{'file1.txt'}; 
    109133    ok($file1, "/file1.txt is in the listing"); 
    110     is($dir->{'file1.txt'}, "F:" . length($data), "/file1.txt is a file and has the correct length"); 
     134    is($file1->{type}, "F", "Type of file1.txt is correct"); 
     135    is($file1->{size}, length($data), "Size of file1.txt is correct"); 
    111136} 
    112137 
    113138ok($mogc->filepaths_disable, "Filepaths disabled successfully"); 
     139 
     140# vim: filetype=perl