Bugzilla – Attachment 183073 Details for
Bug 29668
Add API route to create a basket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29668: Move tests
Bug-29668-Move-tests.patch (text/plain), 4.31 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-06-06 15:16:09 UTC
(
hide
)
Description:
Bug 29668: Move tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-06-06 15:16:09 UTC
Size:
4.31 KB
patch
obsolete
>From b59a98122ec9162db5a8a735aa035027d3a1993f Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 6 Jun 2025 12:05:14 -0300 >Subject: [PATCH] Bug 29668: Move tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/api/v1/acquisitions_baskets.t | 52 +++++++++++++- > .../api/v1/acquisitions_baskets/post.t | 68 ------------------- > 2 files changed, 51 insertions(+), 69 deletions(-) > delete mode 100755 t/db_dependent/api/v1/acquisitions_baskets/post.t > >diff --git a/t/db_dependent/api/v1/acquisitions_baskets.t b/t/db_dependent/api/v1/acquisitions_baskets.t >index fa4c3e468f0..727930463bb 100755 >--- a/t/db_dependent/api/v1/acquisitions_baskets.t >+++ b/t/db_dependent/api/v1/acquisitions_baskets.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > > use Test::NoWarnings; >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::Mojo; > > use t::lib::TestBuilder; >@@ -97,3 +97,53 @@ subtest 'list() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'add() tests' => sub { >+ >+ plan tests => 14; >+ >+ $schema->storage->txn_begin; >+ >+ my $vendor = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Booksellers', >+ } >+ ); >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { flags => 0 } >+ } >+ ); >+ my $password = 'thePassword123'; >+ $patron->set_password( { password => $password, skip_validation => 1 } ); >+ my $userid = $patron->userid; >+ >+ my $url = "//$userid:$password@/api/v1/acquisitions/baskets"; >+ >+ $t->post_ok( $url, json => {} )->status_is(403); >+ >+ $schema->resultset('UserPermission')->create( >+ { >+ borrowernumber => $patron->borrowernumber, >+ module_bit => 11, >+ code => 'order_manage', >+ } >+ ); >+ >+ $t->post_ok( $url, json => {} )->status_is(400); >+ >+ $t->post_ok( $url, json => { vendor_id => $vendor->id } )->status_is(201)->json_has('/basket_id') >+ ->json_is( '/vendor_id', $vendor->id ); >+ >+ my $basket = { >+ vendor_id => $vendor->id, >+ name => 'Basket #1', >+ vendor_note => 'Vendor note', >+ }; >+ $t->post_ok( $url, json => $basket )->status_is(201)->json_has('/basket_id') >+ ->json_is( '/vendor_id', $basket->{vendor_id} )->json_is( '/name', $basket->{name} ) >+ ->json_is( '/vendor_note', $basket->{vendor_note} ); >+ >+ $schema->storage->txn_rollback; >+}; >diff --git a/t/db_dependent/api/v1/acquisitions_baskets/post.t b/t/db_dependent/api/v1/acquisitions_baskets/post.t >deleted file mode 100755 >index 8a7536d8822..00000000000 >--- a/t/db_dependent/api/v1/acquisitions_baskets/post.t >+++ /dev/null >@@ -1,68 +0,0 @@ >-#!/usr/bin/env perl >- >-use Modern::Perl; >- >-use Test::More tests => 14; >-use Test::Mojo; >- >-use t::lib::Mocks; >-use t::lib::TestBuilder; >- >-my $schema = Koha::Database->new->schema; >-my $builder = t::lib::TestBuilder->new; >- >-t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); >- >-my $t = Test::Mojo->new('Koha::REST::V1'); >- >-$schema->storage->txn_begin; >- >-my $bookseller = $builder->build_object( >- { >- class => 'Koha::Acquisition::Booksellers', >- } >-); >-my $patron = $builder->build_object( >- { >- class => 'Koha::Patrons', >- value => { flags => 0 } >- } >-); >-my $password = 'thePassword123'; >-$patron->set_password( { password => $password, skip_validation => 1 } ); >-my $userid = $patron->userid; >- >-my $url = "//$userid:$password@/api/v1/acquisitions/baskets"; >- >-$t->post_ok($url, json => {}) >- ->status_is(403); >- >-$schema->resultset('UserPermission')->create( >- { >- borrowernumber => $patron->borrowernumber, >- module_bit => 11, >- code => 'order_manage', >- } >-); >- >-$t->post_ok($url, json => {}) >- ->status_is(400); >- >-$t->post_ok($url, json => { vendor_id => $bookseller->id }) >- ->status_is(201) >- ->json_has('/basket_id') >- ->json_is('/vendor_id', $bookseller->id); >- >-my $basket = { >- vendor_id => $bookseller->id, >- name => 'Basket #1', >- vendor_note => 'Vendor note', >-}; >-$t->post_ok($url, json => $basket) >- ->status_is(201) >- ->json_has('/basket_id') >- ->json_is('/vendor_id', $basket->{vendor_id}) >- ->json_is('/name', $basket->{name}) >- ->json_is('/vendor_note', $basket->{vendor_note}); >- >-$schema->storage->txn_rollback; >-- >2.49.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29668
:
128371
|
183072
| 183073 |
183074