/[cwmp]/google/trunk/t/20-response.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-response.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 168 - (show annotations)
Sun Oct 28 12:21:53 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1086 byte(s)
check response with parametars
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 my $debug = shift @ARGV;
6
7 use Test::More tests => 14;
8 use Data::Dump qw/dump/;
9 use Cwd qw/abs_path/;
10 use File::Slurp;
11 use blib;
12
13 BEGIN {
14 use_ok('CWMP::Response');
15 }
16
17 ok(my $abs_path = abs_path($0), "abs_path");
18 $abs_path =~ s!/[^/]*$!/!; #!fix-vim
19
20 ok( my $response = CWMP::Response->new({ debug => $debug }), 'new' );
21 isa_ok( $response, 'CWMP::Response' );
22
23 sub check_response {
24 my $command = shift || die "no command?";
25
26 my $state = {
27 ID => 42,
28 };
29
30 ok( my $xml = $response->$command( $state, @_ ), "generate response $command" . dump(@_) );
31
32 my $file = "$abs_path/response/$command.xml";
33
34 if ( ! -e $file ) {
35 diag "creating $file";
36 write_file( $file, $xml );
37 }
38
39 my $template_xml = read_file( $file ) || die "can't read template xml $file: $!";
40
41 is( $xml, $template_xml, "compare $command" );
42 }
43
44 check_response( 'InformResponse' );
45 check_response( 'GetRPCMethods' );
46 check_response( 'Reboot' );
47 check_response( 'GetParameterNames', 'InternetGatewayDevice.DeviceInfo.SerialNumber', 0 );
48 check_response( 'GetParameterValues' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26