From aefc9119baf5dd3c797ff3151efecacf70cf5e28 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 14 Feb 2025 16:24:04 +0000 Subject: [PATCH] Bug 39190: Remove test routine from API Signed-off-by: Kyle M Hall --- Koha/REST/V1/Config/SFTP/Servers.pm | 15 -------- t/db_dependent/api/v1/sftp_servers.t | 52 ++-------------------------- 2 files changed, 2 insertions(+), 65 deletions(-) diff --git a/Koha/REST/V1/Config/SFTP/Servers.pm b/Koha/REST/V1/Config/SFTP/Servers.pm index 8a53d2431db..7578d3cd934 100644 --- a/Koha/REST/V1/Config/SFTP/Servers.pm +++ b/Koha/REST/V1/Config/SFTP/Servers.pm @@ -166,19 +166,4 @@ sub delete { }; } -=head3 test - -Controller method that invokes Koha::SFTP::Server->test_conn - -=cut - -sub test { - my $c = shift->openapi->valid_input or return; - - my $sftp_server = Koha::File::Transports->find( $c->param('sftp_server_id') ); - - return $c->render_resource_not_found("FTP/SFTP server") - unless $sftp_server; -} - 1; diff --git a/t/db_dependent/api/v1/sftp_servers.t b/t/db_dependent/api/v1/sftp_servers.t index 80e6faea0f3..6e12e06b7ca 100755 --- a/t/db_dependent/api/v1/sftp_servers.t +++ b/t/db_dependent/api/v1/sftp_servers.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 6; +use Test::More tests => 5; use Test::Mojo; use t::lib::TestBuilder; @@ -400,52 +400,4 @@ subtest 'delete() tests' => sub { $schema->storage->txn_rollback; }; -subtest 'test() tests' => sub { - - plan tests => 5; - - $schema->storage->txn_begin; - - my $librarian = $builder->build_object( - { - class => 'Koha::Patrons', - value => { flags => 3**2 } # parameters flag = 3 - } - ); - my $password = 'thePassword123'; - $librarian->set_password( { password => $password, skip_validation => 1 } ); - my $userid = $librarian->userid; - - my $patron = $builder->build_object( - { - class => 'Koha::Patrons', - value => { flags => 0 } - } - ); - - $patron->set_password( { password => $password, skip_validation => 1 } ); - my $unauth_userid = $patron->userid; - - my $sftp_server = $builder->build_object( - { - class => 'Koha::File::Transports', - value => { - password => undef, - key_file => undef, - status => undef, - }, - } - ); - my $sftp_server_id = $sftp_server->id; - - # Unauthorized attempt to test - $t->get_ok("//$unauth_userid:$password@/api/v1/sftp_server/$sftp_server_id/test_connection")->status_is(403); - - $t->get_ok("//$userid:$password@/api/v1/sftp_server/$sftp_server_id/test_connection") - ->status_is( 200, 'SWAGGER3.2.4' ) - ->content_is( '{"1_ftp_conn":{"err":"cannot connect to ' - . $sftp_server->host - . ': Name or service not known","msg":null,"passed":false}}', 'SWAGGER3.3.4' ); - - $schema->storage->txn_rollback; -}; +1; -- 2.39.5 (Apple Git-154)