Lines 98-111
subtest 'get() tests' => sub {
Link Here
|
98 |
|
98 |
|
99 |
subtest 'delete() tests' => sub { |
99 |
subtest 'delete() tests' => sub { |
100 |
|
100 |
|
101 |
plan tests => 7; |
101 |
plan tests => 9; |
102 |
|
102 |
|
103 |
$schema->storage->txn_begin; |
103 |
$schema->storage->txn_begin; |
104 |
|
104 |
|
105 |
my $patron = $builder->build_object( |
105 |
my $patron = $builder->build_object( |
106 |
{ |
106 |
{ |
107 |
class => 'Koha::Patrons', |
107 |
class => 'Koha::Patrons', |
108 |
value => { flags => 9 } |
108 |
value => { flags => 0 } # no permissions |
109 |
} |
109 |
} |
110 |
); |
110 |
); |
111 |
my $password = 'thePassword123'; |
111 |
my $password = 'thePassword123'; |
Lines 115-120
subtest 'delete() tests' => sub {
Link Here
|
115 |
my $item = $builder->build_sample_item(); |
115 |
my $item = $builder->build_sample_item(); |
116 |
my $biblio_id = $item->biblionumber; |
116 |
my $biblio_id = $item->biblionumber; |
117 |
|
117 |
|
|
|
118 |
$t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id") |
119 |
->status_is(403, 'Not enough permissions makes it return the right code'); |
120 |
|
121 |
# Add permissions |
122 |
$builder->build( |
123 |
{ |
124 |
source => 'UserPermission', |
125 |
value => { |
126 |
borrowernumber => $patron->borrowernumber, |
127 |
module_bit => 9, |
128 |
code => 'edit_catalogue' |
129 |
} |
130 |
} |
131 |
); |
132 |
|
133 |
|
118 |
# Bibs with items cannot be deleted |
134 |
# Bibs with items cannot be deleted |
119 |
$t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id") |
135 |
$t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id") |
120 |
->status_is(409); |
136 |
->status_is(409); |
121 |
- |
|
|