IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24304


Ignore:
Timestamp:
Jun 2, 2009, 4:29:49 PM (17 years ago)
Author:
jhoblitt
Message:

add params checking to Nebulous::Key::parse_neb_key()

Location:
trunk/Nebulous-Server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/Changes

    r24291 r24304  
    22
    330.17
     4    - add params checking to Nebulous::Key::parse_neb_key()
    45    - restrict creation/modification/remove of xattrs to the user.* namespace
    56    - add chmod_object() method
  • trunk/Nebulous-Server/lib/Nebulous/Key.pm

    r23932 r24304  
    2727{
    2828    my ($key, $volume) = @_;
    29     return unless defined $key;
     29
     30    die "key param is not optional" unless defined $key;
     31    die "too many params" if scalar @_ > 2;
    3032
    3133    # white space is not allowed
  • trunk/Nebulous-Server/t/75_parse_neb_key.t

    r23932 r24304  
    1010use Test::More;
    1111
    12 plan tests => 99;
     12plan tests => 103;
    1313
    1414use lib qw( ./t ./lib );
     
    322322};
    323323like( $@, qr/requires a path/, "no path" );
     324
     325# params
     326eval {
     327    my $key = parse_neb_key();
     328};
     329like( $@, qr/key param is not optional/, "no params" );
     330
     331eval {
     332    my $key = parse_neb_key(undef);
     333};
     334like( $@, qr/key param is not optional/, "key is undef" );
     335
     336eval {
     337    my $key = parse_neb_key(undef, 'bar');
     338};
     339like( $@, qr/key param is not optional/, "key is undef" );
     340
     341eval {
     342    my $key = parse_neb_key('foo', 'bar', 'foo');
     343};
     344like( $@, qr/too many params/, "too many params" );
Note: See TracChangeset for help on using the changeset viewer.