diff options
author | Struan Donald <struan@exo.org.uk> | 2011-08-22 11:22:33 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-08-22 11:22:33 +0100 |
commit | 44c31ab8efbd97086e17d26c819b1d5b4946ce43 (patch) | |
tree | 5a509a5006afd50f4c48f52fdf45ac9ac86ac054 /t/app/controller/report_display.t | |
parent | f93ff062c986847f97aef76673c2ca7742f1f125 (diff) | |
parent | a9a4fed583d7467c9c1f1fa56d42bcb75b4b488c (diff) |
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into open311-consumer
Conflicts:
t/app/model/problem.t
templates/web/default/report/new/fill_in_details.html
web/css/core.css
Diffstat (limited to 't/app/controller/report_display.t')
-rw-r--r-- | t/app/controller/report_display.t | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t index 1f857a387..a70d5b9e9 100644 --- a/t/app/controller/report_display.t +++ b/t/app/controller/report_display.t @@ -235,6 +235,54 @@ for my $test ( banner_text => 'This problem has been fixed.', fixed => 1 }, + { + description => 'user fixed report', + date => DateTime->now, + state => 'fixed - user', + banner_id => 'fixed', + banner_text => 'This problem has been fixed.', + fixed => 1 + }, + { + description => 'council fixed report', + date => DateTime->now, + state => 'fixed - council', + banner_id => 'fixed', + banner_text => 'This problem has been fixed.', + fixed => 1 + }, + { + description => 'closed report', + date => DateTime->now, + state => 'closed', + banner_id => 'closed', + banner_text => 'This problem has been closed.', + fixed => 0 + }, + { + description => 'investigating report', + date => DateTime->now, + state => 'investigating', + banner_id => 'progress', + banner_text => 'This problem is in progress.', + fixed => 0 + }, + { + description => 'planned report', + date => DateTime->now, + state => 'planned', + banner_id => 'progress', + banner_text => 'This problem is in progress.', + fixed => 0 + }, + { + description => 'in progressreport', + date => DateTime->now, + state => 'in progress', + banner_id => 'progress', + banner_text => 'This problem is in progress.', + fixed => 0 + }, ) { subtest "banner for $test->{description}" => sub { $report->confirmed( $test->{date}->ymd . ' ' . $test->{date}->hms ); @@ -260,6 +308,55 @@ for my $test ( }; } +for my $test ( + { + desc => 'no state dropdown if user not from authority', + from_council => 0, + no_state => 1, + report_council => '2504', + }, + { + desc => 'state dropdown if user from authority', + from_council => 2504, + no_state => 0, + report_council => '2504', + }, + { + desc => 'no state dropdown if user not from same council as problem', + from_council => 2505, + no_state => 1, + report_council => '2504', + }, + { + desc => 'state dropdown if user from authority and problem sent to multiple councils', + from_council => 2504, + no_state => 0, + report_council => '2504,2506', + }, +) { + subtest $test->{desc} => sub { + $mech->log_in_ok( $user->email ); + $user->from_council( $test->{from_council} ); + $user->update; + + $report->discard_changes; + $report->council( $test->{report_council} ); + $report->update; + + $mech->get_ok("/report/$report_id"); + my $fields = $mech->visible_form_values( 'updateForm' ); + if ( $test->{no_state} ) { + ok !$fields->{state}; + } else { + ok $fields->{state}; + } + }; +} + +$report->discard_changes; +$report->council( 2504 ); +$report->update; + # tidy up $mech->delete_user('test@example.com'); done_testing(); |