From b6cf3eb912fa501a23f4a3f5664f1a12228e731b Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 4 Feb 2016 13:09:48 -0500 Subject: [PATCH] LP#1350457: add test case for perl2JSONObject change Signed-off-by: Galen Charlton --- src/perl/t/09-Utils-JSON.t | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/perl/t/09-Utils-JSON.t b/src/perl/t/09-Utils-JSON.t index ff5d580..431b896 100644 --- a/src/perl/t/09-Utils-JSON.t +++ b/src/perl/t/09-Utils-JSON.t @@ -29,14 +29,17 @@ is (OpenSRF::Utils::JSON->false, 0); # register_class_hint my $testmap = { hints => { osrfException => { hint => 'osrfException', + strip => ['session'], name => 'OpenSRF::DomainObject::oilsException' } }, classes => { 'OpenSRF::DomainObject::oilsException' => { hint => 'osrfException', + strip => ['session'], name => 'OpenSRF::DomainObject::oilsException' } } }; OpenSRF::Utils::JSON->register_class_hint( hint => 'osrfException', + strip => ['session'], name => 'OpenSRF::DomainObject::oilsException'); is_deeply (\%OpenSRF::Utils::JSON::_class_map, $testmap); @@ -99,7 +102,7 @@ is (UNIVERSAL::isa($coderef,'CODE'), 1); # code doesn't stop me from doing it is_deeply (OpenSRF::Utils::JSON->perl2JSONObject($coderef), { __c => 'CODE', __p => undef }, "Passing in coderef"); -my $fakeobj = bless { foo => 'bar' }, 'OpenSRF::DomainObject::oilsException'; +my $fakeobj = bless { foo => 'bar', session => 'hidden session stuff' }, 'OpenSRF::DomainObject::oilsException'; is (UNIVERSAL::isa($fakeobj,'HASH'), 1); my $jsonobj = OpenSRF::Utils::JSON->perl2JSONObject($fakeobj); is_deeply ($jsonobj, { __c => 'osrfException', __p => { foo => 'bar' } }, -- 2.43.2