Lines 60-73
subtest 'list_av_from_category() tests' => sub {
Link Here
|
60 |
|
60 |
|
61 |
## Authorized user tests |
61 |
## Authorized user tests |
62 |
# No category, 404 expected |
62 |
# No category, 404 expected |
63 |
$t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/NON_EXISTS/values") |
63 |
$t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/NON_EXISTS/authorised_values") |
64 |
->status_is(404) |
64 |
->status_is(404) |
65 |
->json_is( '/error' => 'Category not found' ); |
65 |
->json_is( '/error' => 'Category not found' ); |
66 |
|
66 |
|
67 |
my $av_cat = $builder->build_object({ class => 'Koha::AuthorisedValueCategories' })->category_name; |
67 |
my $av_cat = $builder->build_object({ class => 'Koha::AuthorisedValueCategories' })->category_name; |
68 |
|
68 |
|
69 |
# No AVs, so empty array should be returned |
69 |
# No AVs, so empty array should be returned |
70 |
$t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/values") |
70 |
$t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/authorised_values") |
71 |
->status_is(200) |
71 |
->status_is(200) |
72 |
->json_is( [] ); |
72 |
->json_is( [] ); |
73 |
|
73 |
|
Lines 75-86
subtest 'list_av_from_category() tests' => sub {
Link Here
|
75 |
{ class => 'Koha::AuthorisedValues', value => { category => $av_cat } } ); |
75 |
{ class => 'Koha::AuthorisedValues', value => { category => $av_cat } } ); |
76 |
|
76 |
|
77 |
# One av created, should get returned |
77 |
# One av created, should get returned |
78 |
$t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/values") |
78 |
$t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/authorised_values") |
79 |
->status_is(200) |
79 |
->status_is(200) |
80 |
->json_is( [$av->to_api] ); |
80 |
->json_is( [$av->to_api] ); |
81 |
|
81 |
|
82 |
# Unauthorized access |
82 |
# Unauthorized access |
83 |
$t->get_ok("//$unauth_userid:$password@/api/v1/authorised_value_categories/$av_cat/values") |
83 |
$t->get_ok("//$unauth_userid:$password@/api/v1/authorised_value_categories/$av_cat/authorised_values") |
84 |
->status_is(403); |
84 |
->status_is(403); |
85 |
|
85 |
|
86 |
$schema->storage->txn_rollback; |
86 |
$schema->storage->txn_rollback; |
87 |
- |
|
|