5 my $debug = shift @ARGV;
7 use Test::More tests => 18;
8 use Data::Dump qw/dump/;
13 #use Devel::LeakTrace::Fast;
16 use_ok('CWMP::Methods');
19 ok(my $abs_path = abs_path($0), "abs_path");
20 $abs_path =~ s!/[^/]*$!/!; #!fix-vim
22 ok( my $method = CWMP::Methods->new({ debug => $debug }), 'new' );
23 isa_ok( $method, 'CWMP::Methods' );
26 my $command = shift || die "no command?";
32 diag "check_method $command",dump( 'state', @_ ) if $debug;
33 ok( my $xml = $method->$command( $state, shift ), "generate method $command" . dump(@_) );
35 my $file = "$abs_path/methods/$command.xml";
38 diag "creating $file";
39 write_file( $file, $xml );
42 my $template_xml = read_file( $file ) || die "can't read template xml $file: $!";
44 is( $xml, $template_xml, "compare $file" );
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,
54 check_method( 'GetParameterNames', [ 'InternetGatewayDevice.DeviceInfo.SerialNumber' ] );
55 check_method( 'GetParameterValues', [
56 'InternetGatewayDevice.DeviceInfo.SerialNumber',
57 'InternetGatewayDevice.DeviceInfo.VendorConfigFile.',
59 check_method( 'GetParameterAttributes', [
60 'InternetGatewayDevice.DeviceInfo.SerialNumber'