/[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

Diff of /google/t/05-store.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 94 by dpavlin, Fri Jun 22 18:36:09 2007 UTC revision 95 by dpavlin, Sat Jun 23 09:23:08 2007 UTC
# Line 4  use warnings; Line 4  use warnings;
4    
5  my $debug = shift @ARGV;  my $debug = shift @ARGV;
6    
7  use Test::More tests => 10;  use Test::More tests => 14;
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
10  use lib 'lib';  use lib 'lib';
# Line 28  isa_ok( $store, 'CWMP::Store' ); Line 28  isa_ok( $store, 'CWMP::Store' );
28    
29  cmp_ok( $store->path, 'eq', $path, 'path' );  cmp_ok( $store->path, 'eq', $path, 'path' );
30    
31  ok( $store->update_state( 42, { foo => 'bar' } ), 'update_state new' );  my $state = {
32            foo => 'bar',
33            DeviceID => {
34                    SerialNumber => 123456,
35            },
36    };
37    
38  ok( my $state = $store->state('42'), 'db->get' );  cmp_ok( $store->ID_to_uid( 42, $state ), 'eq', 123456, 'ID_to_uid' );
39    
40  is_deeply( $state, { foo => 'bar' }, 'state' );  ok( $store->update_state( 42, $state ), 'update_state new' );
41    
42    ok( my $store_state = $store->state('42'), 'db->get' );
43    
44    is_deeply( $store_state, $state, 'state' );
45    
46  ok( $store->update_state( 42, { baz => 12345 } ), 'update_state existing' );  ok( $store->update_state( 42, { baz => 12345 } ), 'update_state existing' );
47    
48  is_deeply( $store->state(42), { foo => 'bar', baz => 12345 }, 'store->state' );  $state->{baz} = 12345;
49    
50    is_deeply( $store->state(42), $state, 'store->state' );
51    
52    is_deeply( [ $store->known_CPE ], [ 123456 ], 'known_CPE' );
53    
54    ok( $store->update_state( 11, { DeviceID => { SerialNumber => 99999 } } ), 'new device' );
55    
56    is_deeply( [ $store->known_CPE ], [ 123456, 99999 ], 'known_CPE' );
57    

Legend:
Removed from v.94  
changed lines
  Added in v.95

  ViewVC Help
Powered by ViewVC 1.1.26