Bugzilla – Attachment 171615 Details for
Bug 37898
All db dependent tests should run within a transaction
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37898: Wrap some ERM api tests inside a transaction
Bug-37898-Wrap-some-ERM-api-tests-inside-a-transac.patch (text/plain), 2.85 KB, created by
Martin Renvoize (ashimema)
on 2024-09-17 12:25:29 UTC
(
hide
)
Description:
Bug 37898: Wrap some ERM api tests inside a transaction
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-09-17 12:25:29 UTC
Size:
2.85 KB
patch
obsolete
>From 786917d8ec2b64a9a2c3d059cbcc30ded486ac82 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 11 Sep 2024 14:48:34 -0300 >Subject: [PATCH] Bug 37898: Wrap some ERM api tests inside a transaction > >Trivial ones. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/api/v1/erm_counter_registries.t | 6 ++++++ > t/db_dependent/api/v1/erm_sushi_services.t | 6 ++++++ > 2 files changed, 12 insertions(+) > >diff --git a/t/db_dependent/api/v1/erm_counter_registries.t b/t/db_dependent/api/v1/erm_counter_registries.t >index 894fa76dc0b..ed7c030ae69 100755 >--- a/t/db_dependent/api/v1/erm_counter_registries.t >+++ b/t/db_dependent/api/v1/erm_counter_registries.t >@@ -34,14 +34,18 @@ use Koha::Database; > # The Usage statistics module uses an external API to fetch data from the counter registry > # This test is designed to catch any changes in the response that the API provides so that we can react quickly to ensure the module still functions as expected > >+my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; > > my $t = Test::Mojo->new('Koha::REST::V1'); > t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); > > subtest 'get() tests' => sub { >+ > plan tests => 5; > >+ $schema->storage->txn_begin; >+ > my @expected_fields = ( > "abbrev", > "address", >@@ -90,4 +94,6 @@ subtest 'get() tests' => sub { > my @new_fields_in_response = array_minus( @response_fields, @expected_fields ); > > is( scalar(@new_fields_in_response), 0, 'The response fields match the expected fields' ); >+ >+ $schema->storage->txn_rollback; > }; >diff --git a/t/db_dependent/api/v1/erm_sushi_services.t b/t/db_dependent/api/v1/erm_sushi_services.t >index 097dfc7f73a..a6e712138f4 100755 >--- a/t/db_dependent/api/v1/erm_sushi_services.t >+++ b/t/db_dependent/api/v1/erm_sushi_services.t >@@ -31,6 +31,7 @@ use Array::Utils qw( array_minus ); > use Koha::ERM::EUsage::CounterFiles; > use Koha::Database; > >+my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; > > my $t = Test::Mojo->new('Koha::REST::V1'); >@@ -40,8 +41,11 @@ t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); > # This test is designed to catch any changes in the response that the API provides so that we can react quickly to ensure the module still functions as expected > > subtest 'get() tests' => sub { >+ > plan tests => 5; > >+ $schema->storage->txn_begin; >+ > my $service_url = "https://registry.countermetrics.org/api/v1/sushi-service/b94bc981-fa16-4bf6-ba5f-6c113f7ffa0b/"; > my @expected_fields = ( > "api_key_info", >@@ -100,4 +104,6 @@ subtest 'get() tests' => sub { > my @new_fields_in_response = array_minus( @response_fields, @expected_fields ); > > is( scalar(@new_fields_in_response), 0, 'The response fields match the expected fields' ); >+ >+ $schema->storage->txn_rollback; > }; >-- >2.46.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 37898
:
171346
|
171347
|
171348
|
171349
|
171353
|
171611
|
171612
|
171613
|
171614
| 171615