diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-02-02 23:31:53 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-02-02 23:31:53 -0600 |
commit | 1229e6ee02def382dcd96accb44b23b26209da6a (patch) | |
tree | 27f21e61890d4b2fe5d29154784933d1f2dc74a0 /t/02-typemap.t | |
parent | f07cd4e7a5c7135095380e6626fdd9b6c9689916 (diff) | |
download | kiokudb-serializer-crypt-1229e6ee02def382dcd96accb44b23b26209da6a.tar.gz kiokudb-serializer-crypt-1229e6ee02def382dcd96accb44b23b26209da6a.zip |
pass default_typemap through
Diffstat (limited to 't/02-typemap.t')
-rw-r--r-- | t/02-typemap.t | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/t/02-typemap.t b/t/02-typemap.t new file mode 100644 index 0000000..4bc0cb8 --- /dev/null +++ b/t/02-typemap.t @@ -0,0 +1,40 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +use Test::Requires 'Crypt::Rijndael'; +use Test::Requires 'Crypt::CFB'; +use Test::Requires 'DateTime'; + +use KiokuDB; +use KiokuDB::Util; +use KiokuDB::Serializer::Crypt; + +my $backend = KiokuDB::Util::dsn_to_backend( + 'hash', + serializer => KiokuDB::Serializer::Crypt->new( + serializer => 'json', + crypt_cipher => 'Rijndael', + crypt_mode => 'CFB', + crypt_key => 'foo', + ), +); + +my $d = KiokuDB->new(backend => $backend); +my $obj = [DateTime->now]; + +{ + my $s = $d->new_scope; + $d->insert(obj => $obj); +} + +{ + my $s = $d->new_scope; + my $db_obj = $d->lookup('obj'); + is(ref($db_obj), 'ARRAY', "got array back"); + isa_ok($db_obj->[0], 'DateTime'); + is_deeply($db_obj, $obj, "got the right obj"); +} + +done_testing; |