-
-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Northumberland] Add comment when assigned user or extra details updated
We don't want to do this when pulling update from Alloy, hence the 'no_comment' flag.
- Loading branch information
1 parent
addc9f0
commit bb6d52d
Showing
5 changed files
with
153 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,4 +111,84 @@ FixMyStreet::override_config { | |
}; | ||
}; | ||
|
||
FixMyStreet::override_config { | ||
ALLOWED_COBRANDS => [ 'northumberland', 'fixmystreet' ], | ||
MAPIT_URL => 'http://mapit.uk/', | ||
}, sub { | ||
my $superuser = $mech->create_user_ok( | ||
'[email protected]', | ||
name => 'Super User', | ||
is_superuser => 1, | ||
); | ||
$mech->log_in_ok( $superuser->email ); | ||
|
||
for my $host ( 'northumberland', 'fixmystreet' ) { | ||
ok $mech->host($host), "change host to $host"; | ||
|
||
my ($problem_to_update) = $mech->create_problems_for_body( | ||
1, | ||
$body->id, | ||
'Test', | ||
{ cobrand => $host }, | ||
); | ||
|
||
subtest "User assignment on $host site" => sub { | ||
$mech->get_ok( '/report/' . $problem_to_update->id ); | ||
$mech->click_ok('.btn--shortlist'); | ||
my $comment | ||
= $problem_to_update->comments->order_by('-id')->first; | ||
is_deeply $comment->get_extra_metadata, { | ||
shortlisted_user => $superuser->email, | ||
is_superuser => 1, | ||
}, 'Comment created for user assignment'; | ||
|
||
$mech->get_ok( '/report/' . $problem_to_update->id ); | ||
$mech->click_ok('.btn--shortlisted'); | ||
$comment | ||
= $problem_to_update->comments->order_by('-id')->first; | ||
is_deeply $comment->get_extra_metadata, { | ||
shortlisted_user => undef, | ||
is_superuser => 1, | ||
}, 'Comment created for user un-assignment'; | ||
}; | ||
|
||
subtest "Extra details on $host site" => sub { | ||
$mech->get_ok( '/report/' . $problem_to_update->id ); | ||
$mech->submit_form( | ||
button => 'save', | ||
form_id => 'report_inspect_form', | ||
fields => { | ||
detailed_information => 'A', | ||
include_update => 0, | ||
}, | ||
); | ||
my $comment | ||
= $problem_to_update->comments->order_by('-id')->first; | ||
is_deeply $comment->get_extra_metadata, { | ||
detailed_information => 1, | ||
is_superuser => 1, | ||
}, 'Comment created for extra details'; | ||
|
||
$mech->get_ok( '/report/' . $problem_to_update->id ); | ||
$mech->submit_form( | ||
button => 'save', | ||
form_id => 'report_inspect_form', | ||
fields => { | ||
detailed_information => '', | ||
include_update => 0, | ||
}, | ||
); | ||
$comment | ||
= $problem_to_update->comments->order_by('-id')->first; | ||
is_deeply $comment->get_extra_metadata, { | ||
detailed_information => 1, | ||
is_superuser => 1, | ||
}, 'Comment created for extra details unsetting'; | ||
is_deeply $problem_to_update->get_extra_metadata, | ||
{}, | ||
'Extra details unset on problem'; | ||
}; | ||
} | ||
}; | ||
|
||
done_testing(); |