#!perl
my
$t
= Pinto::Tester->new;
subtest
'create stack'
=>
sub
{
my
$stack
=
$t
->pinto->repo->create_stack(
name
=>
'test'
);
$stack
->set_property(
a
=> 1 );
is
$stack
->get_property(
'a'
), 1,
'set/get one property'
;
$stack
->set_properties( {
b
=> 2,
c
=> 3 } );
is_deeply
$stack
->get_properties, {
a
=> 1,
b
=> 2,
c
=> 3 },
'get/set many props at once'
;
my
$new_stack
=
$t
->pinto->repo->copy_stack(
stack
=>
$stack
,
name
=>
'qa'
);
my
$new_props
=
$new_stack
->get_properties;
is_deeply
$new_props
,
$stack
->get_properties,
'Copied stack has same properties'
;
$new_stack
->delete_property(
'a'
);
ok !
exists
$new_stack
->get_properties->{
'a'
},
'Deleted a prop'
;
$new_stack
->set_property(
a
=>
''
);
ok !
exists
$new_stack
->get_properties->{
'a'
},
'Deleted a prop by setting to empty'
;
throws_ok {
$new_stack
->set_property(
'foo#bar'
=> 4 ) }
qr{Invalid property name}
;
$new_stack
->set_property(
SHOUTING
=> 4 );
ok
exists
$new_stack
->get_properties->{
'shouting'
},
'Get/Set property irrespective of case'
;
$new_stack
->delete_property(
'ShOuTiNg'
);
ok !
exists
$new_stack
->get_properties->{
'shouting'
},
'Delete property irrespective of case'
;
};
done_testing;