|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 6; |
20 |
use Test::More tests => 5; |
| 21 |
use Test::Mojo; |
21 |
use Test::Mojo; |
| 22 |
|
22 |
|
| 23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
|
Lines 400-451
subtest 'delete() tests' => sub {
Link Here
|
| 400 |
$schema->storage->txn_rollback; |
400 |
$schema->storage->txn_rollback; |
| 401 |
}; |
401 |
}; |
| 402 |
|
402 |
|
| 403 |
subtest 'test() tests' => sub { |
403 |
1; |
| 404 |
|
|
|
| 405 |
plan tests => 5; |
| 406 |
|
| 407 |
$schema->storage->txn_begin; |
| 408 |
|
| 409 |
my $librarian = $builder->build_object( |
| 410 |
{ |
| 411 |
class => 'Koha::Patrons', |
| 412 |
value => { flags => 3**2 } # parameters flag = 3 |
| 413 |
} |
| 414 |
); |
| 415 |
my $password = 'thePassword123'; |
| 416 |
$librarian->set_password( { password => $password, skip_validation => 1 } ); |
| 417 |
my $userid = $librarian->userid; |
| 418 |
|
| 419 |
my $patron = $builder->build_object( |
| 420 |
{ |
| 421 |
class => 'Koha::Patrons', |
| 422 |
value => { flags => 0 } |
| 423 |
} |
| 424 |
); |
| 425 |
|
| 426 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
| 427 |
my $unauth_userid = $patron->userid; |
| 428 |
|
| 429 |
my $sftp_server = $builder->build_object( |
| 430 |
{ |
| 431 |
class => 'Koha::File::Transports', |
| 432 |
value => { |
| 433 |
password => undef, |
| 434 |
key_file => undef, |
| 435 |
status => undef, |
| 436 |
}, |
| 437 |
} |
| 438 |
); |
| 439 |
my $sftp_server_id = $sftp_server->id; |
| 440 |
|
| 441 |
# Unauthorized attempt to test |
| 442 |
$t->get_ok("//$unauth_userid:$password@/api/v1/sftp_server/$sftp_server_id/test_connection")->status_is(403); |
| 443 |
|
| 444 |
$t->get_ok("//$userid:$password@/api/v1/sftp_server/$sftp_server_id/test_connection") |
| 445 |
->status_is( 200, 'SWAGGER3.2.4' ) |
| 446 |
->content_is( '{"1_ftp_conn":{"err":"cannot connect to ' |
| 447 |
. $sftp_server->host |
| 448 |
. ': Name or service not known","msg":null,"passed":false}}', 'SWAGGER3.3.4' ); |
| 449 |
|
| 450 |
$schema->storage->txn_rollback; |
| 451 |
}; |
| 452 |
- |
|
|