[prev] [thread] [next] [lurker] [Date index for 2003/12/17]
Author: gabor
Date: 2003-12-17 15:22:53 +0200 (Wed, 17 Dec 2003)
New Revision: 118
Modified:
yapcom/trunk/lib/YAPC/Organizer.pm
yapcom/trunk/t/07-web-change-data.t
yapcom/trunk/t/09-web-change-password.t
yapcom/trunk/t/lib/YAPC/Test/Data.pm
Log:
slightly improve test cases after a false alarm of a potential bug
Modified: yapcom/trunk/lib/YAPC/Organizer.pm
===================================================================
--- yapcom/trunk/lib/YAPC/Organizer.pm 2003-12-15 07:48:27 UTC (rev 117)
+++ yapcom/trunk/lib/YAPC/Organizer.pm 2003-12-17 13:22:53 UTC (rev 118)
@@ -72,10 +72,8 @@
return $self->prerun_mode($page);
}
-# my $id = 1;
- my $id;
if (grep {$_ eq $page} (@user_pages, @admin_pages)) {
- if ($id = $self->is_logged_in) {
+ if (my $id = $self->is_logged_in) {
if (grep {$_ eq $page} @user_pages) {
$self->prerun_mode($page);
}
Modified: yapcom/trunk/t/07-web-change-data.t
===================================================================
--- yapcom/trunk/t/07-web-change-data.t 2003-12-15 07:48:27 UTC (rev 117)
+++ yapcom/trunk/t/07-web-change-data.t 2003-12-17 13:22:53 UTC (rev 118)
@@ -63,22 +63,22 @@
}
# access to personl_info page is successful when authenticated
-{
+foreach my $i (0..1) {
local $ENV{PATH_INFO} = '/personal_info.html';
- local $ENV{HTTP_COOKIE} = "Yapcom=$cookies[0]";
+ local $ENV{HTTP_COOKIE} = "Yapcom=$cookies[$i]";
+ $ENV{HTTP_COOKIE} = "Yapcom=$cookies[2]" if $i == 1; # the second user as the 3rd cookie in our jar.
my $q = CGI->new();
my $webapp = YAPC::Organizer->new;
$webapp->query($q);
my $result = $webapp->run();
like($result, qr@<h2>Change Personal Information</h2>@, 'personal_info page accessed');
- like($result, qr@\Q<tr><td>First Name:</td><td><input size="40" name="fname" value="$people[0]{fname}" /> *</td></tr>@, 'old fname filled in correclty');
- like($result, qr@\Q<tr><td>Last Name:</td><td><input size="40" name="lname" value="$people[0]{lname}" /> *</td></tr>@, 'old lname filled in correclty');
- like($result, qr@\Q<tr><td>Phone:</td><td><input size="40" name="phone" value="$people[0]{phone}" /> *</td></tr>@, 'old phone filled in correclty');
+ like($result, qr@\Q<tr><td>First Name:</td><td><input size="40" name="fname" value="$people[$i]{fname}" /> *</td></tr>@, 'old fname filled in correclty');
+ like($result, qr@\Q<tr><td>Last Name:</td><td><input size="40" name="lname" value="$people[$i]{lname}" /> *</td></tr>@, 'old lname filled in correclty');
+ like($result, qr@\Q<tr><td>Phone:</td><td><input size="40" name="phone" value="$people[$i]{phone}" /> *</td></tr>@, 'old phone filled in correclty');
like($result, qr@\Q<tr><td>Company:</td><td><input size="40" name="company" value="" /></td></tr>@, 'old company filled in correctly');
# $people[0]{company}
}
-
# submit change to personl_info page when not authenticated
# no value submitted:
{
Modified: yapcom/trunk/t/09-web-change-password.t
===================================================================
--- yapcom/trunk/t/09-web-change-password.t 2003-12-15 07:48:27 UTC (rev 117)
+++ yapcom/trunk/t/09-web-change-password.t 2003-12-17 13:22:53 UTC (rev 118)
@@ -69,9 +69,10 @@
like($result, qr@<h2>Login</h2>@, 'Redirected to login page');
my @ppl = YAPC::Person->search(password => 'somenewpw');
is(@ppl, 0, 'No entry was set in the database to the new password');
- @ppl = YAPC::Person->search(password => 'nopassword');
- my @all = YAPC::Person->retrieve_all();
- is(@ppl, @all, 'Non of the passwords were changed.');
+ @ppl = YAPC::Person->search(password => 'somenewpw' );
+# my @all = YAPC::Person->retrieve_all();
+# is(@ppl, @all, 'Non of the passwords were changed.');
+ is(@ppl, 0, 'Non of the passwords were changed.');
}
# fetch form by authenticated user
@@ -105,9 +106,10 @@
like($result, qr@Error@, 'Get error message');
my @ppl = YAPC::Person->search(password => 'somenewpw');
is(@ppl, 0, 'No entry was set in the database to the new password');
- @ppl = YAPC::Person->search(password => 'nopassword');
- my @all = YAPC::Person->retrieve_all();
- is(@ppl, @all, 'Non of the passwords were changed.');
+ @ppl = YAPC::Person->search(password => 'somenewpw');
+ #my @all = YAPC::Person->retrieve_all();
+ #is(@ppl, @all, 'Non of the passwords were changed.');
+ is(@ppl, 0, 'Non of the passwords were changed.');
}
# submit form with good password should yield a success message
@@ -128,8 +130,8 @@
like($result, qr@Your password has been successfully updated@, 'Success message');
my @ppl = YAPC::Person->search(password => 'somenewpw');
is(@ppl, 1, 'One password was set to the new password in the database');
- @ppl = YAPC::Person->search(password => 'nopassword');
- my @all = YAPC::Person->retrieve_all();
- is(@ppl, @all - 1, 'Non of the other passwords were changed.');
+ @ppl = YAPC::Person->search(password => 'somenewpw');
+ #my @all = YAPC::Person->retrieve_all();
+ is(@ppl, 1, 'Non of the other passwords were changed.');
}
Modified: yapcom/trunk/t/lib/YAPC/Test/Data.pm
===================================================================
--- yapcom/trunk/t/lib/YAPC/Test/Data.pm 2003-12-15 07:48:27 UTC (rev 117)
+++ yapcom/trunk/t/lib/YAPC/Test/Data.pm 2003-12-17 13:22:53 UTC (rev 118)
@@ -16,19 +16,19 @@
password2 => 'nopassword',
},
{
- fname => 'Gabor',
- lname => 'Szabo',
+ fname => 'Gabor x',
+ lname => 'Szabo z',
email => 'gabor@xxx.xx.xx',
phone => '08-9716380',
- password => 'nopassword',
- password2 => 'nopassword',
+ password => 'nopassword2',
+ password2 => 'nopassword2',
},
{
- fname => 'Gabor',
- lname => 'Szabo',
+ fname => 'Gabor 3',
+ lname => 'Szabo 3',
email => 'gaborwork@xxx.xx.xx',
- password => 'nopassword',
- password2 => 'nopassword',
+ password => 'nopassword3',
+ password2 => 'nopassword3',
},
{
fname => 'asldhsaldj',
Generated at 17:00 on 17 Dec 2003 by mariachi 0.52