aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/report_new.t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-07-26 16:57:08 +0100
committerStruan Donald <struan@exo.org.uk>2011-07-26 16:57:08 +0100
commit54066cd1387643dd6c6cb3040c520bee66881fd7 (patch)
treeeda84b3f347220ed12de3aa690116148287891bd /t/app/controller/report_new.t
parent8146bad18eeaab658871dd28eb38199a5d068395 (diff)
parent198fcef62892fe0b2fbb3ea8a080fca87843445e (diff)
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into new_statuses
Conflicts: perllib/FixMyStreet/App/Controller/Admin.pm perllib/FixMyStreet/App/Controller/JSON.pm perllib/FixMyStreet/Map/Tilma/Original.pm web/css/core.css
Diffstat (limited to 't/app/controller/report_new.t')
-rw-r--r--t/app/controller/report_new.t18
1 files changed, 15 insertions, 3 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 537786ebc..f06c23501 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -331,6 +331,9 @@ foreach my $test (
my $user = FixMyStreet::App->model('DB::User')->find( { email => $test_email } );
ok $user, "test user does exist";
$user->problems->delete;
+ $user->name( 'Old Name' );
+ $user->password( 'old_password' );
+ $user->update;
} else {
ok !FixMyStreet::App->model('DB::User')->find( { email => $test_email } ),
"test user does not exist";
@@ -366,11 +369,15 @@ foreach my $test (
# check that we got the errors expected
is_deeply $mech->form_errors, [], "check there were no errors";
- # check that the user has been created
+ # check that the user has been created/ not changed
my $user =
FixMyStreet::App->model('DB::User')->find( { email => $test_email } );
- ok $user, "created new user";
- ok $user->check_password('secret'), 'password set correctly';
+ ok $user, "user found";
+ if ($test->{user}) {
+ ok $user->check_password('old_password'), 'password unchanged';
+ } else {
+ ok $user->check_password('secret'), 'password set correctly';
+ }
# find the report
my $report = $user->problems->first;
@@ -398,6 +405,11 @@ foreach my $test (
$mech->get_ok( '/report/' . $report->id );
+ if ($test->{user}) {
+ is $report->name, 'Joe Bloggs', 'name updated correctly';
+ ok $report->user->check_password('secret'), 'password updated correctly';
+ }
+
# check that the reporter has an alert
my $alert = FixMyStreet::App->model('DB::Alert')->find( {
user => $report->user,