From: Dobrica Pavlinusic Date: Tue, 23 Feb 2010 18:16:03 +0000 (+0000) Subject: Koha integration tests - remove and create test user X-Git-Url: http://git.rot13.org/?p=virtual-ldap;a=commitdiff_plain;h=66576637717e069cd9c4a34e3a0f5148e52a6bbc;ds=sidebyside Koha integration tests - remove and create test user --- diff --git a/t/koha/01-remove-test-user.t b/t/koha/01-remove-test-user.t new file mode 100755 index 0000000..3f3a694 --- /dev/null +++ b/t/koha/01-remove-test-user.t @@ -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 ); +} diff --git a/t/koha/02-create-test-user.t b/t/koha/02-create-test-user.t new file mode 100755 index 0000000..62df482 --- /dev/null +++ b/t/koha/02-create-test-user.t @@ -0,0 +1,35 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use Test::More tests => 3; +use Test::WWW::Mechanize; +use File::Slurp; + +our $config; +require 't/config.pl'; + +use WWW::Mechanize; + +my $mech = Test::WWW::Mechanize->new; + +my $save_count = 1; +sub save { write_file "/tmp/login-$save_count.html", @_; $save_count++; } + + +$mech->get_ok( 'https://localhost', 'opac' ); +save $mech->content; + +$mech->follow_link_ok({ text_regex => qr/Log in to Your Account/i }, 'login form' ); +save $mech->content; + +$mech->submit_form_ok({ + form_number => 2, + fields => { + userid => $config->{bind_as}, + password => $config->{password}, + }, +}, 'login'); +save $mech->content; +