--- google/trunk/t/20-response.t 2007/10/28 12:21:53 168 +++ google/trunk/t/20-methods.t 2007/10/28 19:47:30 178 @@ -4,32 +4,33 @@ my $debug = shift @ARGV; -use Test::More tests => 14; +use Test::More tests => 16; use Data::Dump qw/dump/; use Cwd qw/abs_path/; use File::Slurp; use blib; BEGIN { - use_ok('CWMP::Response'); + use_ok('CWMP::Methods'); } ok(my $abs_path = abs_path($0), "abs_path"); $abs_path =~ s!/[^/]*$!/!; #!fix-vim -ok( my $response = CWMP::Response->new({ debug => $debug }), 'new' ); -isa_ok( $response, 'CWMP::Response' ); +ok( my $method = CWMP::Methods->new({ debug => $debug }), 'new' ); +isa_ok( $method, 'CWMP::Methods' ); -sub check_response { +sub check_method { my $command = shift || die "no command?"; my $state = { ID => 42, }; - ok( my $xml = $response->$command( $state, @_ ), "generate response $command" . dump(@_) ); + diag "check_method $command",dump( 'state', @_ ) if $debug; + ok( my $xml = $method->$command( $state, @_ ), "generate method $command" . dump(@_) ); - my $file = "$abs_path/response/$command.xml"; + my $file = "$abs_path/methods/$command.xml"; if ( ! -e $file ) { diag "creating $file"; @@ -38,11 +39,18 @@ my $template_xml = read_file( $file ) || die "can't read template xml $file: $!"; - is( $xml, $template_xml, "compare $command" ); + is( $xml, $template_xml, "compare $file" ); } -check_response( 'InformResponse' ); -check_response( 'GetRPCMethods' ); -check_response( 'Reboot' ); -check_response( 'GetParameterNames', 'InternetGatewayDevice.DeviceInfo.SerialNumber', 0 ); -check_response( 'GetParameterValues' ); +check_method( 'InformResponse' ); +check_method( 'GetRPCMethods' ); +check_method( 'Reboot' ); +check_method( 'SetParameterValues', + 'InternetGatewayDevice.DeviceInfo.ProvisioningCode' => 'test provision', + 'InternetGatewayDevice.DeviceInfo.X_000E50_Country' => 42, +); +check_method( 'GetParameterNames', 'InternetGatewayDevice.DeviceInfo.SerialNumber' ); +check_method( 'GetParameterValues', + 'InternetGatewayDevice.DeviceInfo.SerialNumber', + 'InternetGatewayDevice.DeviceInfo.VendorConfigFile.', +);