Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 1; |
20 |
use Test::More tests => 2; |
21 |
use Test::Mojo; |
21 |
use Test::Mojo; |
22 |
|
22 |
|
23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
Lines 105-107
subtest 'q handling tests' => sub {
Link Here
|
105 |
|
105 |
|
106 |
$schema->storage->txn_rollback; |
106 |
$schema->storage->txn_rollback; |
107 |
}; |
107 |
}; |
108 |
- |
108 |
|
|
|
109 |
subtest 'x-koha-embed tests' => sub { |
110 |
|
111 |
plan tests => 5; |
112 |
|
113 |
$schema->storage->txn_begin; |
114 |
|
115 |
my $librarian = $builder->build_object( |
116 |
{ |
117 |
class => 'Koha::Patrons', |
118 |
value => { flags => 1 } # superlibrarian |
119 |
} |
120 |
); |
121 |
my $password = 'thePassword123'; |
122 |
$librarian->set_password( { password => $password, skip_validation => 1 } ); |
123 |
my $userid = $librarian->userid; |
124 |
|
125 |
my $patron_id = $builder->build_object( { class => 'Koha::Patrons' } )->id; |
126 |
|
127 |
my $res = $t->get_ok( |
128 |
"//$userid:$password@/api/v1/patrons?q={\"me.patron_id\":$patron_id}" |
129 |
=> { 'x-koha-embed' => 'extended_attributes' } )->status_is(200) |
130 |
->tx->res->json; |
131 |
|
132 |
is( scalar @{$res}, 1, 'One patron returned' ); |
133 |
|
134 |
$res = $t->get_ok( |
135 |
"//$userid:$password@/api/v1/patrons?q={\"me.patron_id\":$patron_id}" => { |
136 |
'x-koha-embed' => |
137 |
'extended_attributes,custom_bad_embed,another_bad_embed' |
138 |
} |
139 |
)->status_is(400); |
140 |
|
141 |
$schema->storage->txn_rollback; |
142 |
}; |