5 my $debug = shift @ARGV;
7 use Test::More tests => 18;
8 use Data::Dump qw/dump/;
14 use_ok('CWMP::Methods');
17 ok(my $abs_path = abs_path($0), "abs_path");
18 $abs_path =~ s!/[^/]*$!/!; #!fix-vim
20 ok( my $method = CWMP::Methods->new({ debug => $debug }), 'new' );
21 isa_ok( $method, 'CWMP::Methods' );
24 my $command = shift || die "no command?";
30 diag "check_method $command",dump( 'state', @_ ) if $debug;
31 ok( my $xml = $method->$command( $state, shift ), "generate method $command" . dump(@_) );
33 my $file = "$abs_path/methods/$command.xml";
36 diag "creating $file";
37 write_file( $file, $xml );
40 my $template_xml = read_file( $file ) || die "can't read template xml $file: $!";
42 is( $xml, $template_xml, "compare $file" );
45 check_method( 'InformResponse' );
46 check_method( 'GetRPCMethods' );
47 check_method( 'Reboot' );
48 check_method( 'SetParameterValues', {
49 'InternetGatewayDevice.DeviceInfo.ProvisioningCode' => 'test provision',
50 'InternetGatewayDevice.DeviceInfo.X_000E50_Country' => 42,
52 check_method( 'GetParameterNames', [ 'InternetGatewayDevice.DeviceInfo.SerialNumber' ] );
53 check_method( 'GetParameterValues', [
54 'InternetGatewayDevice.DeviceInfo.SerialNumber',
55 'InternetGatewayDevice.DeviceInfo.VendorConfigFile.',
57 check_method( 'GetParameterAttributes', [
58 'InternetGatewayDevice.DeviceInfo.SerialNumber'