IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 23, 2007, 10:42:29 AM (19 years ago)
Author:
jhoblitt
Message:

ws
add the use of Test::URI in tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/t/03_server_create_object.t

    r10546 r12960  
    33# Copryight (C) 2004-2005  Joshua Hoblitt
    44#
    5 # $Id: 03_server_create_object.t,v 1.11 2006-12-08 03:29:19 jhoblitt Exp $
     5# $Id: 03_server_create_object.t,v 1.12 2007-04-23 20:42:29 jhoblitt Exp $
    66
    77use strict;
     
    1515use Nebulous::Util qw( :standard );
    1616use Test::Nebulous;
     17use Test::URI;
     18use URI::Split qw( uri_split );
    1719
    1820my $neb = Nebulous::Server->new(
     
    2628{
    2729    # key
    28     my $uri = $neb->create_object( "foo" );
     30    my $uri = $neb->create_object("foo");
    2931
    30     ok( -e _get_file_path( $uri ), "file exists" );
    31     like( $uri, qr/^file:\//, "valid URI" );
     32    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
     33    ok(-e $path, "file exists");
     34    uri_scheme_ok($uri, 'file');
    3235}
    3336
     
    3639{
    3740    # key, class
    38     my $uri = $neb->create_object( "foo", 0 );
     41    my $uri = $neb->create_object("foo", 0);
    3942
    40     ok( -e _get_file_path( $uri ), "file exists" );
    41     like( $uri, qr/^file:\//, "valid URI" );
     43    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
     44    ok(-e $path, "file exists");
     45    uri_scheme_ok($uri, 'file');
    4246}
    4347
     
    4650{
    4751    # key, class, volume
    48     my $uri = $neb->create_object( "foo", 0, "node01" );
     52    my $uri = $neb->create_object("foo", 0, "node01");
    4953
    50     ok( -e _get_file_path( $uri ), "file exists" );
    51     like( $uri, qr/^file:\//, "valid URI" );
     54    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
     55    ok(-e $path, "file exists");
     56    uri_scheme_ok($uri, 'file');
    5257}
    5358
     
    5661{
    5762    # key, class, volume, comment
    58     my $uri = $neb->create_object( "foo", 0, "node01", "this is foo" );
     63    my $uri = $neb->create_object("foo", 0, "node01", "this is foo");
    5964
    60     ok( -e _get_file_path( $uri ), "file exists" );
    61     like( $uri, qr/^file:\//, "valid URI" );
     65    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
     66    ok(-e $path, "file exists");
     67    uri_scheme_ok($uri, 'file');
    6268}
    6369
     
    6571
    6672eval {
    67     $neb->create_object( "foo" );
    68     $neb->create_object( "foo" );
     73    $neb->create_object("foo");
     74    $neb->create_object("foo");
    6975};
    70 like( $@, qr/Duplicate entry/, "object already exists" );
     76like($@, qr/Duplicate entry/, "object already exists");
    7177
    7278Test::Nebulous->setup;
    7379
    7480{
    75     my $uri = $neb->create_object( "foo", 1 );
     81    my $uri = $neb->create_object("foo", 1);
    7682
    77     ok( -e _get_file_path( $uri ), "class exists" );
     83    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
     84    ok(-e $path, "class exists");
    7885}
    7986
     
    8188
    8289eval {
    83     $neb->create_object( "foo", 99 );
     90    $neb->create_object("foo", 99);
    8491};
    85 like( $@, qr/did not pass the \'is valid class id\'/, "class doesn't exist" );
     92like($@, qr/did not pass the \'is valid class id\'/, "class doesn't exist");
    8693
    8794Test::Nebulous->setup;
    8895
    8996eval {
    90     $neb->create_object( 1, 0, 'node01', 'x' x 256 );
     97    $neb->create_object(1, 0, 'node01', 'x' x 256);
    9198};
    92 like( $@, qr/comment length/, "comment is too long" );
     99like($@, qr/comment length/, "comment is too long");
    93100
    94101Test::Nebulous->setup;
     
    97104    $neb->create_object();
    98105};
    99 like( $@, qr/2 - 4 were expected/, "no params" );
     106like($@, qr/2 - 4 were expected/, "no params");
    100107
    101108Test::Nebulous->setup;
     
    104111    $neb->create_object( 1, 0, 'node01', 1, 1 );
    105112};
    106 like( $@, qr/2 - 4 were expected/, "too many params" );
     113like($@, qr/2 - 4 were expected/, "too many params");
    107114
    108115Test::Nebulous->cleanup;
Note: See TracChangeset for help on using the changeset viewer.