Koha integration tests - remove and create test user
[virtual-ldap] / t / koha / 01-remove-test-user.t
diff --git a/t/koha/01-remove-test-user.t b/t/koha/01-remove-test-user.t
new file mode 100755 (executable)
index 0000000..3f3a694
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More tests => 6;
+use Test::WWW::Mechanize;
+
+our ( $user, $passwd );
+require 'config.pl';
+
+my $url = 'https://localhost:8443'; # Koha intranet
+
+my $mech = Test::WWW::Mechanize->new;
+
+$mech->get_ok( $url, 'intranet' );
+
+$mech->submit_form_ok({
+       fields => {
+               userid => $user,
+               password => $passwd,
+       },
+}, 'login');
+
+$mech->submit_form_ok({
+       form_number => 2,
+       fields => {
+               member => 'kohatest@ffzg.hr',
+       },
+}, 'find patron' );
+
+#diag $mech->content;
+
+$mech->follow_link_ok({ url_regex => qr/moremember/ }, 'details' );
+
+my $html = $mech->content();
+
+if ( $html =~ m{(/cgi-bin/koha/members/deletemem\.pl\?member=\d+)}s ) {
+       ok( $1, 'found deletemem' );
+       $mech->get_ok( $url . $1 );
+}