diff --git a/t/cobrand/northumberland.t b/t/cobrand/northumberland.t index bd6072d359a..73dec222878 100644 --- a/t/cobrand/northumberland.t +++ b/t/cobrand/northumberland.t @@ -1,3 +1,4 @@ +use CGI::Simple; use FixMyStreet::TestMech; use FixMyStreet::Script::CSVExport; use Test::MockModule; @@ -115,6 +116,8 @@ FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'northumberland', 'fixmystreet' ], MAPIT_URL => 'http://mapit.uk/', }, sub { + my $o = Open311->new( fixmystreet_body => $body ); + my $superuser = $mech->create_user_ok( 'superuser@example.com', name => 'Super User', @@ -142,6 +145,15 @@ FixMyStreet::override_config { is_superuser => 1, }, 'Comment created for user assignment'; + my $id = $o->post_service_request_update($comment); + my $cgi = CGI::Simple->new($o->test_req_used->content); + is $cgi->param('attribute[assigned_to_user_email]'), + $superuser->email, + 'correct assigned_to_user_email attribute'; + is $cgi->param('attribute[extra_details]'), + '', + 'correct extra_details attribute'; + $mech->get_ok( '/report/' . $problem_to_update->id ); $mech->click_ok('.btn--shortlisted'); $comment @@ -150,6 +162,15 @@ FixMyStreet::override_config { shortlisted_user => undef, is_superuser => 1, }, 'Comment created for user un-assignment'; + + $id = $o->post_service_request_update($comment); + $cgi = CGI::Simple->new($o->test_req_used->content); + is $cgi->param('attribute[assigned_to_user_email]'), + '', + 'correct assigned_to_user_email attribute'; + is $cgi->param('attribute[extra_details]'), + '', + 'correct extra_details attribute'; }; subtest "Extra details on $host site" => sub { @@ -158,7 +179,7 @@ FixMyStreet::override_config { button => 'save', form_id => 'report_inspect_form', fields => { - detailed_information => 'A', + detailed_information => 'ABC', include_update => 0, }, ); @@ -169,6 +190,15 @@ FixMyStreet::override_config { is_superuser => 1, }, 'Comment created for extra details'; + my $id = $o->post_service_request_update($comment); + my $cgi = CGI::Simple->new($o->test_req_used->content); + is $cgi->param('attribute[assigned_to_user_email]'), + '', + 'correct assigned_to_user_email attribute'; + is $cgi->param('attribute[extra_details]'), + 'ABC', + 'correct extra_details attribute'; + $mech->get_ok( '/report/' . $problem_to_update->id ); $mech->submit_form( button => 'save', @@ -187,6 +217,15 @@ FixMyStreet::override_config { is_deeply $problem_to_update->get_extra_metadata, {}, 'Extra details unset on problem'; + + $id = $o->post_service_request_update($comment); + $cgi = CGI::Simple->new($o->test_req_used->content); + is $cgi->param('attribute[assigned_to_user_email]'), + '', + 'correct assigned_to_user_email attribute'; + is $cgi->param('attribute[extra_details]'), + '', + 'correct extra_details attribute'; }; } };