diff options
author | Hakim Cassimally <hakim@mysociety.org> | 2015-02-27 15:34:24 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2015-10-06 09:09:24 +0100 |
commit | e7c35a0de101331436b1d5d6f2346a8c85233737 (patch) | |
tree | 895462731355a23da52c5d504c59871c9342a426 /t/app/controller/report_display.t | |
parent | 34f3f5a36b6773ad51060256d4e95efd7c45b3c8 (diff) |
[Zurich] admin workflow changes available states
See mysociety/FixMyStreet-Commercial#690
- external_message for Extern/Wunsch states
- as per PDF mockups, the "public response" field is now editable
from more states, namely:
- Ruckmeldung ausstehend
- Extern
- Zustandigkeit unbekannt
- Wunsch
- Nicht kontaktierbar
- Unsichtbar
- test fixes
NB: slight hack to reorder Zurich report_display tests
As these remove 'investigating' from hidden_states, these break
tests for default cobrand (the FMS::App code expects to be called
once on request start, not multiple times within one test)
- Not contactable button
and tests for this and the similar `send_back` functionality
(previously untested).
NB: Unsure why we need to specify form_number=2 just for these submits,
but test won't find the buttons otherwise.
- Make sure SDMs' "time_spent" figure is recorded.
(See mysociety/FixMyStreet-Commercial#718)
Diffstat (limited to 't/app/controller/report_display.t')
-rw-r--r-- | t/app/controller/report_display.t | 140 |
1 files changed, 78 insertions, 62 deletions
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t index 002cdc1e5..c863f829f 100644 --- a/t/app/controller/report_display.t +++ b/t/app/controller/report_display.t @@ -96,19 +96,6 @@ subtest "change report to unconfirmed and check for 404 status" => sub { }; -subtest "Zurich unconfirmeds are 200" => sub { - FixMyStreet::override_config { - ALLOWED_COBRANDS => [ 'zurich' ], - }, sub { - $mech->host( 'zurich.example.com' ); - ok $report->update( { state => 'unconfirmed' } ), 'unconfirm report'; - $mech->get_ok("/report/$report_id"); - $mech->content_contains( 'Überprüfung ausstehend' ); - ok $report->update( { state => 'confirmed' } ), 'confirm report again'; - $mech->host( 'www.fixmystreet.com' ); - }; -}; - subtest "change report to hidden and check for 410 status" => sub { ok $report->update( { state => 'hidden' } ), 'hide report'; ok $mech->get("/report/$report_id"), "get '/report/$report_id'"; @@ -400,6 +387,67 @@ for my $test ( }; } +my $body_westminster = $mech->create_body_ok(2504, 'Westminster City Council'); +my $body_camden = $mech->create_body_ok(2505, 'Camden Borough Council'); + +for my $test ( + { + desc => 'no state dropdown if user not from authority', + from_body => undef, + no_state => 1, + report_body => $body_westminster->id, + }, + { + desc => 'state dropdown if user from authority', + from_body => $body_westminster->id, + no_state => 0, + report_body => $body_westminster->id, + }, + { + desc => 'no state dropdown if user not from same body as problem', + from_body => $body_camden->id, + no_state => 1, + report_body => $body_westminster->id, + }, + { + desc => 'state dropdown if user from authority and problem sent to multiple bodies', + from_body => $body_westminster->id, + no_state => 0, + report_body => $body_westminster->id . ',2506', + }, +) { + subtest $test->{desc} => sub { + $mech->log_in_ok( $user->email ); + $user->from_body( $test->{from_body} ); + $user->update; + + $report->discard_changes; + $report->bodies_str( $test->{report_body} ); + $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}; + } + }; +} + +subtest "Zurich unconfirmeds are 200" => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'zurich' ], + }, sub { + $mech->host( 'zurich.example.com' ); + ok $report->update( { state => 'unconfirmed' } ), 'unconfirm report'; + $mech->get_ok("/report/$report_id"); + $mech->content_contains( 'Überprüfung ausstehend' ); + ok $report->update( { state => 'confirmed' } ), 'confirm report again'; + $mech->host( 'www.fixmystreet.com' ); + }; +}; + subtest "Zurich banners are displayed correctly" => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'zurich' ], @@ -428,8 +476,8 @@ subtest "Zurich banners are displayed correctly" => sub { { description => 'closed report', state => 'closed', - banner_id => 'fixed', - banner_text => 'Beantwortet', + banner_id => 'closed', + banner_text => _('Extern'), }, { description => 'in progress report', @@ -443,6 +491,21 @@ subtest "Zurich banners are displayed correctly" => sub { banner_id => 'progress', banner_text => 'In Bearbeitung', }, + { + description => 'planned report', + state => 'planned', + banner_id => 'progress', + banner_text => 'In Bearbeitung', + }, + { + description => 'jurisdiction unknown', + state => 'unable to fix', + banner_id => 'fixed', + # We can't use _('Jurisdiction Unknown') here because + # TestMech::extract_problem_banner decodes the HTML entities before + # the string is passed back. + banner_text => 'Zust\x{e4}ndigkeit unbekannt', + }, ) { subtest "banner for $test->{description}" => sub { $report->state( $test->{state} ); @@ -470,53 +533,6 @@ subtest "Zurich banners are displayed correctly" => sub { }; }; -my $body_westminster = $mech->create_body_ok(2504, 'Westminster City Council'); -my $body_camden = $mech->create_body_ok(2505, 'Camden Borough Council'); - -for my $test ( - { - desc => 'no state dropdown if user not from authority', - from_body => undef, - no_state => 1, - report_body => $body_westminster->id, - }, - { - desc => 'state dropdown if user from authority', - from_body => $body_westminster->id, - no_state => 0, - report_body => $body_westminster->id, - }, - { - desc => 'no state dropdown if user not from same body as problem', - from_body => $body_camden->id, - no_state => 1, - report_body => $body_westminster->id, - }, - { - desc => 'state dropdown if user from authority and problem sent to multiple bodies', - from_body => $body_westminster->id, - no_state => 0, - report_body => $body_westminster->id . ',2506', - }, -) { - subtest $test->{desc} => sub { - $mech->log_in_ok( $user->email ); - $user->from_body( $test->{from_body} ); - $user->update; - - $report->discard_changes; - $report->bodies_str( $test->{report_body} ); - $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}; - } - }; -} END { $mech->delete_user('test@example.com'); |