From 558fae786b22a6f7b0e77ed62696a97dbefa461b Mon Sep 17 00:00:00 2001 From: djfiander Date: Thu, 22 Jun 2006 01:00:18 +0000 Subject: [PATCH] Add tests for invalid patron and invalid item --- t/09renew.t | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/t/09renew.t b/t/09renew.t index 8227e5d..ea2cb04 100644 --- a/t/09renew.t +++ b/t/09renew.t @@ -77,9 +77,35 @@ foreach my $field (@{$test->{fields}}) { push @tests, $checkin_template, $test; +$test = clone($renew_test_template); +$test->{id} = 'Renew: Invalid item'; +$test->{msg} =~ s/AB[^|]+/ABbad-item/; +$test->{pat} = qr/^300NUN$datepat/; +foreach my $field (@{$test->{fields}}) { + if ($field->{field} eq FID_TITLE_ID || $field->{field} eq FID_DUE_DATE) { + $field->{pat} = qr/^$/; + } elsif ($field->{field} eq FID_ITEM_ID) { + $field->{pat} = qr/^bad-item$/; + } +} + +push @tests, $test; + +$test = clone($renew_test_template); +$test->{id} = 'Renew: Invalid user'; +$test->{msg} =~ s/AAdjfiander/AAberick/; +$test->{pat} = qr/^300NUN$datepat/; +foreach my $field (@{$test->{fields}}) { + if ($field->{field} eq FID_TITLE_ID || $field->{field} eq FID_DUE_DATE) { + $field->{pat} = qr/^$/; + } elsif ($field->{field} eq FID_PATRON_ID) { + $field->{pat} = qr/^berick$/; + } +} + +push @tests, $test; + # Still need tests for -# - renewing invalid item -# - invalid patron id # - renewing a for-fee item # - patrons that are not permitted to renew # - renewing item with outstanding hold -- 2.11.0