aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/report_display.t140
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');