/[cwmp]/google/trunk/t/20-methods.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

Diff of /google/trunk/t/20-methods.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 177 by dpavlin, Sun Oct 28 16:39:58 2007 UTC revision 178 by dpavlin, Sun Oct 28 19:47:30 2007 UTC
# Line 4  use warnings; Line 4  use warnings;
4    
5  my $debug = shift @ARGV;  my $debug = shift @ARGV;
6    
7  use Test::More tests => 14;  use Test::More tests => 16;
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
10  use File::Slurp;  use File::Slurp;
# Line 17  BEGIN { Line 17  BEGIN {
17  ok(my $abs_path = abs_path($0), "abs_path");  ok(my $abs_path = abs_path($0), "abs_path");
18  $abs_path =~ s!/[^/]*$!/!;      #!fix-vim  $abs_path =~ s!/[^/]*$!/!;      #!fix-vim
19    
20  ok( my $response = CWMP::Methods->new({ debug => $debug }), 'new' );  ok( my $method = CWMP::Methods->new({ debug => $debug }), 'new' );
21  isa_ok( $response, 'CWMP::Methods' );  isa_ok( $method, 'CWMP::Methods' );
22    
23  sub check_response {  sub check_method {
24          my $command = shift || die "no command?";          my $command = shift || die "no command?";
25    
26          my $state = {          my $state = {
27                  ID => 42,                  ID => 42,
28          };          };
29    
30          diag "check_response $command",dump( 'state', @_ ) if $debug;          diag "check_method $command",dump( 'state', @_ ) if $debug;
31          ok( my $xml = $response->$command( $state, @_ ), "generate response $command" . dump(@_) );          ok( my $xml = $method->$command( $state, @_ ), "generate method $command" . dump(@_) );
32    
33          my $file = "$abs_path/response/$command.xml";          my $file = "$abs_path/methods/$command.xml";
34    
35          if ( ! -e $file ) {          if ( ! -e $file ) {
36                  diag "creating $file";                  diag "creating $file";
# Line 39  sub check_response { Line 39  sub check_response {
39    
40          my $template_xml = read_file( $file ) || die "can't read template xml $file: $!";          my $template_xml = read_file( $file ) || die "can't read template xml $file: $!";
41    
42          is( $xml, $template_xml, "compare $command" );          is( $xml, $template_xml, "compare $file" );
43  }  }
44    
45  check_response( 'InformResponse' );  check_method( 'InformResponse' );
46  check_response( 'GetRPCMethods' );  check_method( 'GetRPCMethods' );
47  check_response( 'Reboot' );  check_method( 'Reboot' );
48  check_response( 'GetParameterNames', 'InternetGatewayDevice.DeviceInfo.SerialNumber' );  check_method( 'SetParameterValues',
49  check_response( 'GetParameterValues', 'InternetGatewayDevice.DeviceInfo.SerialNumber', 'InternetGatewayDevice.DeviceInfo.VendorConfigFile.' );          'InternetGatewayDevice.DeviceInfo.ProvisioningCode' => 'test provision',
50            'InternetGatewayDevice.DeviceInfo.X_000E50_Country' => 42,
51    );
52    check_method( 'GetParameterNames', 'InternetGatewayDevice.DeviceInfo.SerialNumber' );
53    check_method( 'GetParameterValues',
54            'InternetGatewayDevice.DeviceInfo.SerialNumber',
55            'InternetGatewayDevice.DeviceInfo.VendorConfigFile.',
56    );

Legend:
Removed from v.177  
changed lines
  Added in v.178

  ViewVC Help
Powered by ViewVC 1.1.26