Skip to content

Commit

Permalink
fixup! [Northumberland] Add comment when assigned user or extra detai…
Browse files Browse the repository at this point in the history
…ls updated
  • Loading branch information
nephila-nacrea committed Sep 13, 2024
1 parent f5f7831 commit 818dabf
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion t/cobrand/northumberland.t
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use CGI::Simple;
use FixMyStreet::TestMech;
use FixMyStreet::Script::CSVExport;
use Test::MockModule;
Expand Down Expand Up @@ -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(
'[email protected]',
name => 'Super User',
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -158,7 +179,7 @@ FixMyStreet::override_config {
button => 'save',
form_id => 'report_inspect_form',
fields => {
detailed_information => 'A',
detailed_information => 'ABC',
include_update => 0,
},
);
Expand All @@ -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',
Expand All @@ -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';
};
}
};
Expand Down

0 comments on commit 818dabf

Please sign in to comment.