/[cwmp]/google/t/05-store.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/t/05-store.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 85 - (show annotations)
Fri Jun 22 18:36:09 2007 UTC (17 years ago) by dpavlin
File MIME type: application/x-troff
File size: 836 byte(s)
Implemented store->state( $ID ) and use it to test server
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 my $debug = shift @ARGV;
6
7 use Test::More tests => 10;
8 use Data::Dump qw/dump/;
9 use Cwd qw/abs_path/;
10 use lib 'lib';
11
12 BEGIN {
13 use_ok('CWMP::Store');
14 }
15
16 ok(my $abs_path = abs_path($0), "abs_path");
17 $abs_path =~ s!/[^/]*$!/!; #!fix-vim
18
19 my $path = "$abs_path/var/state.db";
20
21 unlink $path if -e $path;
22
23 ok( my $store = CWMP::Store->new({
24 debug => $debug,
25 path => $path,
26 }), 'new' );
27 isa_ok( $store, 'CWMP::Store' );
28
29 cmp_ok( $store->path, 'eq', $path, 'path' );
30
31 ok( $store->update_state( 42, { foo => 'bar' } ), 'update_state new' );
32
33 ok( my $state = $store->state('42'), 'db->get' );
34
35 is_deeply( $state, { foo => 'bar' }, 'state' );
36
37 ok( $store->update_state( 42, { baz => 12345 } ), 'update_state existing' );
38
39 is_deeply( $store->state(42), { foo => 'bar', baz => 12345 }, 'store->state' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26