Bug 39980: Add tests for .../acquisition/vendors* in Mojo context

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 54f84f232a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Julian Maurice 2025-05-23 12:39:25 +00:00 committed by Paul Derscheid
parent 8192a36a7d
commit 32b31e2a27
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,49 @@
#!/usr/bin/perl
use Modern::Perl;
use Test::More tests => 1;
use Test::Mojo;
use Koha::App::Intranet;
use Koha::Database;
use Koha::Patrons;
use t::lib::TestBuilder;
my $schema = Koha::Database->schema;
my $builder = t::lib::TestBuilder->new();
subtest '/cgi-bin/koha/acquisitions/vendors' => sub {
plan tests => 10;
my $t = Test::Mojo->new('Koha::App::Intranet');
my $patron = $builder->build_object(
{
class => 'Koha::Patrons',
value => {
flags => 1,
},
}
);
$patron->set_password( { password => 'P4ssword!', skip_validation => 1 } );
# Log in
$t->get_ok('/cgi-bin/koha/mainpage.pl');
my $csrf_token = $t->tx->res->dom('input[name="csrf_token"]')->map( attr => 'value' )->first;
$t->post_ok(
'/cgi-bin/koha/mainpage.pl',
form => {
csrf_token => $csrf_token,
op => 'cud-login',
login_userid => $patron->userid,
login_password => 'P4ssword!',
koha_login_context => 'intranet',
branch => '',
}
)->status_is(200)->content_like( qr/Koha home/, 'Login OK' );
$t->get_ok('/cgi-bin/koha/acquisition/vendors')->status_is(200)->element_exists('#vendors');
$t->get_ok('/cgi-bin/koha/acquisition/vendors/add')->status_is(200)->element_exists('#vendors');
};