5 my $debug = shift @ARGV;
7 use Test::More tests => 14;
8 use Data::Dump qw/dump/;
14 use_ok('CWMP::Response');
17 ok(my $abs_path = abs_path($0), "abs_path");
18 $abs_path =~ s!/[^/]*$!/!; #!fix-vim
20 ok( my $response = CWMP::Response->new({ debug => $debug }), 'new' );
21 isa_ok( $response, 'CWMP::Response' );
24 my $command = shift || die "no command?";
30 diag "check_response $command",dump( 'state', @_ ) if $debug;
31 ok( my $xml = $response->$command( $state, @_ ), "generate response $command" . dump(@_) );
33 my $file = "$abs_path/response/$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 $command" );
45 check_response( 'InformResponse' );
46 check_response( 'GetRPCMethods' );
47 check_response( 'Reboot' );
48 check_response( 'GetParameterNames', 'InternetGatewayDevice.DeviceInfo.SerialNumber' );
49 check_response( 'GetParameterValues', 'InternetGatewayDevice.DeviceInfo.SerialNumber', 'InternetGatewayDevice.DeviceInfo.VendorConfigFile.' );