Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
use Modern::Perl; |
4 |
|
5 |
use Test::More tests => 1; |
6 |
use Test::Mojo; |
7 |
use Koha::App::Intranet; |
8 |
|
9 |
use Koha::Database; |
10 |
use Koha::Patrons; |
11 |
|
12 |
use t::lib::TestBuilder; |
13 |
|
14 |
my $schema = Koha::Database->schema; |
15 |
my $builder = t::lib::TestBuilder->new(); |
16 |
|
17 |
subtest '/cgi-bin/koha/acquisitions/vendors' => sub { |
18 |
plan tests => 10; |
19 |
|
20 |
my $t = Test::Mojo->new('Koha::App::Intranet'); |
21 |
|
22 |
my $patron = $builder->build_object( |
23 |
{ |
24 |
class => 'Koha::Patrons', |
25 |
value => { |
26 |
flags => 1, |
27 |
}, |
28 |
} |
29 |
); |
30 |
$patron->set_password({ password => 'P4ssword!', skip_validation => 1 }); |
31 |
|
32 |
# Log in |
33 |
$t->get_ok('/cgi-bin/koha/mainpage.pl'); |
34 |
my $csrf_token = $t->tx->res->dom('input[name="csrf_token"]')->map( attr => 'value' )->first; |
35 |
$t->post_ok( |
36 |
'/cgi-bin/koha/mainpage.pl', |
37 |
form => { |
38 |
csrf_token => $csrf_token, |
39 |
op => 'cud-login', |
40 |
login_userid => $patron->userid, |
41 |
login_password => 'P4ssword!', |
42 |
koha_login_context => 'intranet', |
43 |
branch => '', |
44 |
} |
45 |
)->status_is(200)->content_like( qr/Koha home/, 'Login OK' ); |
46 |
|
47 |
$t->get_ok('/cgi-bin/koha/acquisition/vendors')->status_is(200)->element_exists('#vendors'); |
48 |
$t->get_ok('/cgi-bin/koha/acquisition/vendors/add')->status_is(200)->element_exists('#vendors'); |
49 |
}; |