/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 199 - (hide annotations)
Wed Nov 14 18:16:14 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1409 byte(s)
 r210@brr:  dpavlin | 2007-11-14 19:15:41 +0100
 New version [0.09] with buch of changes:
 - command queue for device now really works
 - cpe-queue.pl now supports --list to display queue
 - convert all methods to receive just one param (simplifies code all over)

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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26