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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 227 - (show annotations)
Sun Nov 25 18:51:26 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1533 byte(s)
 r266@brr:  dpavlin | 2007-11-25 19:50:35 +0100
 - first pass with Devel::LeakTrace::Fast
 - remove DBM::Deep store
 - CWMP::Queue now supports dir and clean args
 - create new parser for each request

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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26