#!perl
subtest
'stack lock'
=>
sub
{
my
$t
= Pinto::Tester->new->populate(
'AUTHOR/Foo-1=Foo~1'
);
my
$archive
= make_dist_archive(
'Foo-2=Foo~2'
);
$t
->stack_is_not_locked_ok(
'master'
);
$t
->run_ok(
Lock
=> {} );
$t
->stack_is_locked_ok(
'master'
);
$t
->run_throws_ok(
Add
=> {
archives
=>
$archive
},
qr/is locked/
,
'Cannot Add to locked stack'
);
$t
->run_throws_ok(
Pin
=> {
targets
=>
'Foo'
},
qr/is locked/
,
'Cannot Pin on locked stack'
);
$t
->run_throws_ok(
Unpin
=> {
targets
=>
'Foo'
},
qr/is locked/
,
'Cannot Unpin on locked stack'
);
$t
->run_throws_ok(
Unregister
=> {
targets
=>
'AUTHOR/Foo-1.tar.gz'
},
qr/is locked/
,
'Cannot Unregister from locked stack'
);
$t
->run_throws_ok(
Register
=> {
targets
=>
'AUTHOR/Foo-1.tar.gz'
},
qr/is locked/
,
'Cannot Register on locked stack'
);
$t
->run_ok(
Unlock
=> {} );
$t
->stack_is_not_locked_ok(
'master'
);
$t
->run_ok(
Add
=> {
archives
=>
$archive
} );
$t
->run_ok(
Pin
=> {
targets
=>
'Foo'
} );
$t
->run_ok(
Unpin
=> {
targets
=>
'Foo'
} );
$t
->run_ok(
Unregister
=> {
targets
=>
'AUTHOR/Foo-2.tar.gz'
} );
$t
->run_ok(
Register
=> {
targets
=>
'AUTHOR/Foo-2.tar.gz'
} );
};
done_testing;