diff options
author | Struan Donald <struan@exo.org.uk> | 2011-09-08 10:05:06 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-09-08 10:05:06 +0100 |
commit | b1bd589b2fc8075cab39679d23db2b7d285f8345 (patch) | |
tree | 933ce962203f846d6d53b53851b36949f921a869 /t/app/controller | |
parent | ba9172907f5e41840cf5324cc335277bbd031ed2 (diff) | |
parent | 3423cfe5e16e9130a25238cd76de76ec2bf07c67 (diff) |
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into open311-consumer
Conflicts:
web/css/core.css
web/js/fixmystreet.js
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/admin.t | 40 | ||||
-rw-r--r-- | t/app/controller/questionnaire.t | 11 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 30 |
3 files changed, 59 insertions, 22 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index be3b74cf5..beeb6c9c1 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -997,6 +997,12 @@ subtest 'report search' => sub { $mech->get_ok('/admin/search_reports?search=' . $report->user->email); $mech->content_like( qr{<tr [^>]*hidden[^>]*> \s* <td> \s* $r_id \s* </td>}xs ); + + $report->state('fixed - user'); + $report->update; + + $mech->get_ok('/admin/search_reports?search=' . $report->user->email); + $mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id/">$r_id</a>} ); }; subtest 'search abuse' => sub { @@ -1047,6 +1053,9 @@ $log_entries = FixMyStreet::App->model('DB::AdminLog')->search( is $log_entries->count, 0, 'no admin log entries'; +$user->flagged( 0 ); +$user->update; + for my $test ( { desc => 'edit user name', @@ -1054,6 +1063,7 @@ for my $test ( name => 'Test User', email => 'test@example.com', council => 2509, + flagged => undef, }, changes => { name => 'Changed User', @@ -1067,6 +1077,7 @@ for my $test ( name => 'Changed User', email => 'test@example.com', council => 2509, + flagged => undef, }, changes => { email => 'changed@example.com', @@ -1080,6 +1091,7 @@ for my $test ( name => 'Changed User', email => 'changed@example.com', council => 2509, + flagged => undef, }, changes => { council => 2607, @@ -1087,6 +1099,34 @@ for my $test ( log_count => 3, log_entries => [qw/edit edit edit/], }, + { + desc => 'edit user flagged', + fields => { + name => 'Changed User', + email => 'changed@example.com', + council => 2607, + flagged => undef, + }, + changes => { + flagged => 'on', + }, + log_count => 4, + log_entries => [qw/edit edit edit edit/], + }, + { + desc => 'edit user remove flagged', + fields => { + name => 'Changed User', + email => 'changed@example.com', + council => 2607, + flagged => 'on', + }, + changes => { + flagged => undef, + }, + log_count => 4, + log_entries => [qw/edit edit edit edit/], + }, ) { subtest $test->{desc} => sub { $mech->get_ok( '/admin/user_edit/' . $user->id ); diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index af3b373ac..a013569ee 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -1,6 +1,7 @@ use strict; use warnings; use Test::More; +use DateTime; use FixMyStreet::TestMech; use FixMyStreet::App::Controller::Questionnaire; @@ -15,7 +16,10 @@ my $user = ->find_or_create( { email => 'test@example.com', name => 'Test User' } ); ok $user, "created test user"; -my $report_time = '2011-03-01 12:00:00'; +my $dt = DateTime->now()->subtract( weeks => 5 ); +my $report_time = $dt->ymd . ' ' . $dt->hms; +my $sent = $dt->add( minutes => 5 ); +my $sent_time = $sent->ymd . ' ' . $sent->hms; my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( { @@ -31,7 +35,7 @@ my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( state => 'confirmed', confirmed => $report_time, lastupdate => $report_time, - whensent => '2011-03-01 12:05:00', + whensent => $sent_time, lang => 'en-gb', service => '', cobrand => 'default', @@ -334,10 +338,11 @@ $mech->get_ok("/Q/" . $token); $mech->content_contains( 'should have reported what they have done' ); # Test already answered the ever reported question, so not shown again +$dt = $dt->add( weeks => 4 ); my $questionnaire2 = FixMyStreet::App->model('DB::Questionnaire')->find_or_create( { problem_id => $report->id, - whensent => '2011-03-28 12:00:00', + whensent => $dt->ymd . ' ' . $dt->hms, ever_reported => 1, } ); diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 993c6758e..4469d4003 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -413,19 +413,15 @@ subtest 'check non authority user cannot change set state' => sub { $user->update; $mech->get_ok("/report/$report_id"); - $mech->submit_form_ok( { - form_number => 2, - fields => { + $mech->post_ok( "/report/update", { submit_update => 1, id => $report_id, name => $user->name, - rznvy => $user->email, may_show_name => 1, - add_alert => 0, + add_alert => undef, photo => '', update => 'this is a forbidden update', state => 'fixed - council', - }, }, 'submitted with state', ); @@ -445,19 +441,15 @@ for my $state ( qw/unconfirmed hidden partial/ ) { $user->update; $mech->get_ok("/report/$report_id"); - $mech->submit_form_ok( { - form_number => 2, - fields => { + $mech->post_ok( "/report/update", { submit_update => 1, id => $report_id, name => $user->name, - rznvy => $user->email, may_show_name => 1, - add_alert => 0, + add_alert => undef, photo => '', update => 'this is a forbidden update', state => $state, - }, }, 'submitted with state', ); @@ -477,7 +469,7 @@ for my $test ( fields => { name => $user->name, may_show_name => 1, - add_alert => 0, + add_alert => undef, photo => '', update => 'Set state to investigating', state => 'investigating', @@ -489,7 +481,7 @@ for my $test ( fields => { name => $user->name, may_show_name => 1, - add_alert => 0, + add_alert => undef, photo => '', update => 'Set state to planned', state => 'planned', @@ -501,7 +493,7 @@ for my $test ( fields => { name => $user->name, may_show_name => 1, - add_alert => 0, + add_alert => undef, photo => '', update => 'Set state to in progress', state => 'in progress', @@ -513,7 +505,7 @@ for my $test ( fields => { name => $user->name, may_show_name => 1, - add_alert => 0, + add_alert => undef, photo => '', update => 'Set state to closed', state => 'closed', @@ -525,7 +517,7 @@ for my $test ( fields => { name => $user->name, may_show_name => 1, - add_alert => 0, + add_alert => undef, photo => '', update => 'Set state to fixed', state => 'fixed', @@ -537,7 +529,7 @@ for my $test ( fields => { name => $user->name, may_show_name => 1, - add_alert => 0, + add_alert => undef, photo => '', update => 'Set state to confirmed', state => 'confirmed', @@ -549,7 +541,7 @@ for my $test ( fields => { name => $user->name, may_show_name => 1, - add_alert => 0, + add_alert => undef, photo => '', update => 'Set state to fixed', state => 'fixed', |