Lines 20-26
use Modern::Perl;
Link Here
|
20 |
use utf8; |
20 |
use utf8; |
21 |
use Encode; |
21 |
use Encode; |
22 |
|
22 |
|
23 |
use Test::More tests => 4; |
23 |
use Test::More tests => 5; |
24 |
use Test::MockModule; |
24 |
use Test::MockModule; |
25 |
use Test::Mojo; |
25 |
use Test::Mojo; |
26 |
use Test::Warn; |
26 |
use Test::Warn; |
Lines 345-348
subtest 'put() tests' => sub {
Link Here
|
345 |
is($subfield_a, 'USMARCFormated'); |
345 |
is($subfield_a, 'USMARCFormated'); |
346 |
|
346 |
|
347 |
$schema->storage->txn_rollback; |
347 |
$schema->storage->txn_rollback; |
348 |
}; |
348 |
}; |
|
|
349 |
|
350 |
|
351 |
subtest 'list() tests' => sub { |
352 |
plan tests => 14; |
353 |
|
354 |
$schema->storage->txn_begin; |
355 |
|
356 |
my $patron = $builder->build_object( |
357 |
{ |
358 |
class => 'Koha::Patrons', |
359 |
value => { flags => 0 } |
360 |
} |
361 |
); |
362 |
my $password = 'thePassword123'; |
363 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
364 |
$patron->discard_changes; |
365 |
my $userid = $patron->userid; |
366 |
|
367 |
my $authid1 = $builder->build_object({ 'class' => 'Koha::Authorities', value => { |
368 |
marcxml => q|<?xml version="1.0" encoding="UTF-8"?> |
369 |
<record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/MARC21/slim" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"> |
370 |
<controlfield tag="001">1001</controlfield> |
371 |
<datafield tag="110" ind1=" " ind2=" "> |
372 |
<subfield code="9">102</subfield> |
373 |
<subfield code="a">My Corporation</subfield> |
374 |
</datafield> |
375 |
</record>| |
376 |
} })->authid; |
377 |
|
378 |
my $authid2 = $builder->build_object({ 'class' => 'Koha::Authorities', value => { |
379 |
marcxml => q|<?xml version="1.0" encoding="UTF-8"?> |
380 |
<record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/MARC21/slim" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"> |
381 |
<controlfield tag="001">1001</controlfield> |
382 |
<datafield tag="110" ind1=" " ind2=" "> |
383 |
<subfield code="9">102</subfield> |
384 |
<subfield code="a">My Corporation</subfield> |
385 |
</datafield> |
386 |
</record>| |
387 |
} })->authid; |
388 |
|
389 |
my $search = |
390 |
"[{\"authid\": \"$authid1\"}, {\"authid\": \"$authid2\"}]"; |
391 |
$t->get_ok( |
392 |
"//$userid:$password@/api/v1/authorities/" => { 'x-koha-query' => $search } |
393 |
)->status_is(403); |
394 |
|
395 |
$patron->flags(4)->store; |
396 |
|
397 |
$t->get_ok( "//$userid:$password@/api/v1/authorities/" => |
398 |
{ Accept => 'application/weird+format', 'x-koha-query' => $search } ) |
399 |
->status_is(400); |
400 |
|
401 |
$t->get_ok( "//$userid:$password@/api/v1/authorities/" => |
402 |
{ Accept => 'application/json', 'x-koha-query' => $search } ) |
403 |
->status_is(200); |
404 |
|
405 |
$t->get_ok( "//$userid:$password@/api/v1/authorities/" => |
406 |
{ Accept => 'application/marcxml+xml', 'x-koha-query' => $search } ) |
407 |
->status_is(200); |
408 |
|
409 |
$t->get_ok( "//$userid:$password@/api/v1/authorities/" => |
410 |
{ Accept => 'application/marc-in-json', 'x-koha-query' => $search } ) |
411 |
->status_is(200); |
412 |
|
413 |
$t->get_ok( "//$userid:$password@/api/v1/authorities/" => |
414 |
{ Accept => 'application/marc', 'x-koha-query' => $search } ) |
415 |
->status_is(200); |
416 |
|
417 |
$t->get_ok( "//$userid:$password@/api/v1/authorities/" => |
418 |
{ Accept => 'text/plain', 'x-koha-query' => $search } ) |
419 |
->status_is(200); |
420 |
|
421 |
$schema->storage->txn_rollback; |
422 |
}; |
349 |
- |
|
|