[BACK]Return to network_tests.t CVS log [TXT][DIR] Up to [local] / HOPE / Net-OpenAMD / t

Diff for /HOPE/Net-OpenAMD/t/network_tests.t between version 1.12 and 1.14

version 1.12, 2010/07/13 07:10:31 version 1.14, 2010/07/17 12:46:47
Line 1 
Line 1 
 #!perl  #!perl
 package NetworkTests;  package NetworkTests;
   
 # $AFresh1: network_tests.t,v 1.11 2010/07/13 03:37:47 andrew Exp $  # $AFresh1: network_tests.t,v 1.13 2010/07/14 01:54:03 andrew Exp $
   
 use strict;  use strict;
 use warnings;  use warnings;
Line 14 
Line 14 
   
 if ( !caller() ) {  if ( !caller() ) {
     if ( $ENV{'NETWORK_TESTS'} ) {      if ( $ENV{'NETWORK_TESTS'} ) {
         plan tests => 31;          plan tests => 14;
     }      }
     else {      else {
         plan skip_all =>          plan skip_all =>
             'Network test.  Set $ENV{NETWORK_TESTS} to a true value to run.';              'Network test.  Set $ENV{NETWORK_TESTS} to a true value to run.';
     }      }
   
     my $amd      my $amd = Net::OpenAMD->new();
         = Net::OpenAMD->new( { base_uri => 'http://api.hope.net/api/', } );  
     run_tests($amd);      run_tests($amd);
   
     #done_testing();      #done_testing();
Line 54 
Line 53 
         area          => any('Engressia'),          area          => any('Engressia'),
         interests     => any(@interests),          interests     => any(@interests),
         all_interests => bag(@interests),          all_interests => bag(@interests),
         coordinate    => re('^\d\d\.\d+$'),          coordinate    => re('^\d{1,2}\.\d+$'),
         boolean => any( 'True', 'False' ),          boolean => any( 'True', 'False' ),
     );      );
   
     $cmp{user} = [      $cmp{user} = [
         $cmp{single_line},          $cmp{single_line},
         {   name => $cmp{single_line},          superhashof(
               {   name => $cmp{single_line},
   
             #interests => array_each( $cmp{interests} ),                  #interests => array_each( $cmp{interests} ),
             #x         => $cmp{coordinate},                  #x         => $cmp{coordinate},
             #y         => $cmp{coordinate},                  #y         => $cmp{coordinate},
         }              }
           ),
     ];      ];
   
     $cmp{speaker} = [      $cmp{speaker} = [
Line 75 
Line 76 
         }          }
     ];      ];
   
       $cmp{location} = superhashof(
           {   #area => $cmp{area},
               user => $cmp{single_line},
   
               #button => $cmp{boolean},
               x => $cmp{coordinate},
               y => $cmp{coordinate},
   
               #time   => $cmp{single_line},
           }
       );
   
     my %tests = (      my %tests = (
         location => [          location => [
             {   args   => undef,              {   args   => undef,
                 expect => array_each(                  expect => array_each( $cmp{location} ),
                     {   area   => $cmp{area},  
                         user   => $cmp{digits},  
                         button => $cmp{boolean},  
                         x      => $cmp{coordinate},  
                         y      => $cmp{coordinate},  
                         time   => $cmp{single_line},  
                     }  
                 ),  
             },              },
             {   args   => { user => 'user0' },              {   args   => { user => 'user0' },
                 expect => array_each(),                  expect => qr/^Invalid \s JSON/xms,
             },              },
             {   args   => { user => 'user0', limit => 20 },              {   args   => { user => 'user0', limit => 5 },
                 expect => array_each(),                  expect => qr/^Invalid \s JSON/xms,
             },              },
             {   args   => { area => 'Engressa' },              {   args   => { area => 'Lovelace' },
                 expect => array_each(),                  expect => array_each( $cmp{location} ),
             },              },
         ],          ],
         speakers => [          speakers => [
Line 165 
Line 170 
                 like( $@, $test->{expect}, "AMD->$method($test->{args})" );                  like( $@, $test->{expect}, "AMD->$method($test->{args})" );
             }              }
             elsif ( ref $test->{expect} ) {              elsif ( ref $test->{expect} ) {
                 is( $@, '', "AMD->$method($test->{args})" );                  if ($@) {
                 cmp_deeply( $result, $test->{expect},                      is( $@, '', "AMD->$method($test->{args})" );
                           "AMD->$method($test->{args}) - "                  }
                         . 'got expected result' );                  else {
                       cmp_deeply( $result, $test->{expect},
                                 "AMD->$method($test->{args}) - "
                               . 'got expected result' );
                   }
             }              }
             else {              else {
                 is( $@, $test->{expect}, "AMD->$method($test->{args})" );                  is( $@, $test->{expect}, "AMD->$method($test->{args})" );

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.14

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>