Lines 48-60
subtest 'cancel() tests' => sub {
Link Here
|
48 |
{ password => $password, skip_validation => 1 } ); |
48 |
{ password => $password, skip_validation => 1 } ); |
49 |
my $userid = $authorized_patron->userid; |
49 |
my $userid = $authorized_patron->userid; |
50 |
|
50 |
|
51 |
my $deleted_article_requet = |
51 |
my $deleted_article_request = |
52 |
$builder->build_object( { class => 'Koha::ArticleRequests' } ); |
52 |
$builder->build_object( { class => 'Koha::ArticleRequests' } ); |
53 |
my $deleted_article_requet_id = $deleted_article_requet->id; |
53 |
my $deleted_article_request_id = $deleted_article_request->id; |
54 |
$deleted_article_requet->delete; |
54 |
$deleted_article_request->delete; |
55 |
|
55 |
|
56 |
$t->delete_ok( |
56 |
$t->delete_ok( |
57 |
"//$userid:$password@/api/v1/article_requests/$deleted_article_requet_id" |
57 |
"//$userid:$password@/api/v1/article_requests/$deleted_article_request_id" |
58 |
)->status_is(404)->json_is( { error => "Article request not found" } ); |
58 |
)->status_is(404)->json_is( { error => "Article request not found" } ); |
59 |
|
59 |
|
60 |
my $article_request = |
60 |
my $article_request = |
Lines 80-86
subtest 'cancel() tests' => sub {
Link Here
|
80 |
|
80 |
|
81 |
subtest 'patron_cancel() tests' => sub { |
81 |
subtest 'patron_cancel() tests' => sub { |
82 |
|
82 |
|
83 |
plan tests => 10; |
83 |
plan tests => 12; |
84 |
|
84 |
|
85 |
t::lib::Mocks::mock_preference( 'RESTPublicAPI', 1 ); |
85 |
t::lib::Mocks::mock_preference( 'RESTPublicAPI', 1 ); |
86 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
86 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
Lines 98-117
subtest 'patron_cancel() tests' => sub {
Link Here
|
98 |
my $userid = $patron->userid; |
98 |
my $userid = $patron->userid; |
99 |
my $patron_id = $patron->borrowernumber; |
99 |
my $patron_id = $patron->borrowernumber; |
100 |
|
100 |
|
101 |
my $deleted_article_requet = $builder->build_object( { class => 'Koha::ArticleRequests' } ); |
101 |
my $deleted_article_request = $builder->build_object( { class => 'Koha::ArticleRequests', value => { borrowernumber => $patron_id } } ); |
102 |
my $deleted_article_requet_id = $deleted_article_requet->id; |
102 |
my $deleted_article_request_id = $deleted_article_request->id; |
103 |
$deleted_article_requet->delete; |
103 |
$deleted_article_request->delete; |
104 |
|
104 |
|
105 |
my $another_patron = $builder->build_object({ class => 'Koha::Patrons' }); |
105 |
my $another_patron = $builder->build_object({ class => 'Koha::Patrons' }); |
106 |
my $another_patron_id = $another_patron->id; |
106 |
my $another_patron_id = $another_patron->id; |
107 |
|
107 |
|
108 |
$t->delete_ok("//$userid:$password@/api/v1/public/patrons/$another_patron_id/article_requests/$deleted_article_requet_id") |
108 |
$t->delete_ok("//$userid:$password@/api/v1/public/patrons/$another_patron_id/article_requests/$deleted_article_request_id") |
109 |
->status_is(403); |
109 |
->status_is(403); |
110 |
|
110 |
|
111 |
$t->delete_ok("//$userid:$password@/api/v1/public/patrons/$patron_id/article_requests/$deleted_article_requet_id") |
111 |
$t->delete_ok("//$userid:$password@/api/v1/public/patrons/$patron_id/article_requests/$deleted_article_request_id") |
112 |
->status_is(404) |
112 |
->status_is(404) |
113 |
->json_is( { error => "Article request not found" } ); |
113 |
->json_is( { error => "Article request not found" } ); |
114 |
|
114 |
|
|
|
115 |
my $another_article_request = $builder->build_object( |
116 |
{ |
117 |
class => 'Koha::ArticleRequests', |
118 |
value => { borrowernumber => $another_patron->id } |
119 |
} |
120 |
); |
121 |
|
122 |
$t->delete_ok("//$userid:$password@/api/v1/public/patrons/$patron_id/article_requests/$another_article_request") |
123 |
->status_is(403); |
124 |
|
125 |
|
115 |
my $article_request = $builder->build_object( |
126 |
my $article_request = $builder->build_object( |
116 |
{ |
127 |
{ |
117 |
class => 'Koha::ArticleRequests', |
128 |
class => 'Koha::ArticleRequests', |
118 |
- |
|
|