Lines 32-38
my $builder = t::lib::TestBuilder->new;
Link Here
|
32 |
my $t = Test::Mojo->new('Koha::REST::V1'); |
32 |
my $t = Test::Mojo->new('Koha::REST::V1'); |
33 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
33 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
34 |
|
34 |
|
35 |
subtest 'list_item_types() tests' => sub { |
35 |
subtest 'list() tests' => sub { |
36 |
|
36 |
|
37 |
plan tests => 12; |
37 |
plan tests => 12; |
38 |
|
38 |
|
Lines 109-119
subtest 'list_item_types() tests' => sub {
Link Here
|
109 |
my $unauth_userid = $patron->userid; |
109 |
my $unauth_userid = $patron->userid; |
110 |
|
110 |
|
111 |
## Authorized user tests |
111 |
## Authorized user tests |
112 |
# No category, 404 expected |
|
|
113 |
$t->get_ok("//$userid:$password@/api/v1/item_types")->status_is(200)->json_has('/0'); |
112 |
$t->get_ok("//$userid:$password@/api/v1/item_types")->status_is(200)->json_has('/0'); |
114 |
|
113 |
|
115 |
for my $json ( @{ $t->tx->res->json } ) { |
114 |
for my $json ( @{ $t->tx->res->json } ) { |
116 |
if ( $json->{item_type} eq 'TEST_IT' ) { |
115 |
if ( $json->{item_type_id} eq 'TEST_IT' ) { |
117 |
is( $json->{description}, 'Test item type' ); |
116 |
is( $json->{description}, 'Test item type' ); |
118 |
ok( !exists $json->{translated_descriptions} ); |
117 |
ok( !exists $json->{translated_descriptions} ); |
119 |
} |
118 |
} |
Lines 123-129
subtest 'list_item_types() tests' => sub {
Link Here
|
123 |
->status_is(200)->json_has('/0'); |
122 |
->status_is(200)->json_has('/0'); |
124 |
|
123 |
|
125 |
for my $json ( @{ $t->tx->res->json } ) { |
124 |
for my $json ( @{ $t->tx->res->json } ) { |
126 |
if ( $json->{item_type} eq 'TEST_IT' ) { |
125 |
if ( $json->{item_type_id} eq 'TEST_IT' ) { |
127 |
is( $json->{description}, 'Test item type' ); |
126 |
is( $json->{description}, 'Test item type' ); |
128 |
is_deeply( |
127 |
is_deeply( |
129 |
$json->{translated_descriptions}, |
128 |
$json->{translated_descriptions}, |
130 |
- |
|
|