Koha integration tests - remove and create test user
[virtual-ldap] / t / koha / 01-remove-test-user.t
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use Test::More tests => 6;
7 use Test::WWW::Mechanize;
8
9 our ( $user, $passwd );
10 require 'config.pl';
11
12 my $url = 'https://localhost:8443'; # Koha intranet
13
14 my $mech = Test::WWW::Mechanize->new;
15
16 $mech->get_ok( $url, 'intranet' );
17
18 $mech->submit_form_ok({
19         fields => {
20                 userid => $user,
21                 password => $passwd,
22         },
23 }, 'login');
24
25 $mech->submit_form_ok({
26         form_number => 2,
27         fields => {
28                 member => 'kohatest@ffzg.hr',
29         },
30 }, 'find patron' );
31
32 #diag $mech->content;
33
34 $mech->follow_link_ok({ url_regex => qr/moremember/ }, 'details' );
35
36 my $html = $mech->content();
37
38 if ( $html =~ m{(/cgi-bin/koha/members/deletemem\.pl\?member=\d+)}s ) {
39         ok( $1, 'found deletemem' );
40         $mech->get_ok( $url . $1 );
41 }