diff options
Diffstat (limited to 't')
-rw-r--r-- | t/cobrand/oxfordshire.t | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t index b8422a28b..dd5eedc8d 100644 --- a/t/cobrand/oxfordshire.t +++ b/t/cobrand/oxfordshire.t @@ -1,6 +1,7 @@ use Test::MockModule; use FixMyStreet::TestMech; +use FixMyStreet::Script::Alerts; my $mech = FixMyStreet::TestMech->new; my $oxon = $mech->create_body_ok(2237, 'Oxfordshire County Council'); @@ -61,6 +62,49 @@ subtest 'can use customer reference to search for reports' => sub { }; }; +my $user = $mech->create_user_ok( 'user@example.com', name => 'Test User' ); +my $user2 = $mech->create_user_ok( 'user2@example.com', name => 'Test User2' ); + +subtest 'check unable to fix label' => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'oxfordshire' ], + MAPIT_URL => 'http://mapit.uk/', + }, sub { + my $problem = $problems[0]; + $problem->state( 'unable to fix' ); + $problem->update; + + my $alert = FixMyStreet::DB->resultset('Alert')->create( { + parameter => $problem->id, + alert_type => 'new_updates', + cobrand => 'oxfordshire', + user => $user, + } )->confirm; + + FixMyStreet::DB->resultset('Comment')->create( { + problem_state => 'unable to fix', + problem_id => $problem->id, + user_id => $user2->id, + name => 'User', + mark_fixed => 'f', + text => "this is an update", + state => 'confirmed', + confirmed => 'now()', + anonymous => 'f', + } ); + + + $mech->get_ok('/report/' . $problem->id); + $mech->content_contains('Investigation complete'); + + FixMyStreet::Script::Alerts::send(); + $mech->email_count_is(1); + my $email = $mech->get_email; + my $body = $mech->get_text_body_from_email($email); + like $body, qr/Investigation complete/, 'state correct in email'; + }; +}; + END { done_testing(); } |