diff options
author | Struan Donald <struan@exo.org.uk> | 2018-10-15 14:52:19 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2018-10-17 09:46:51 +0100 |
commit | a1122f6d8b3cd4fe35724ab5b4d234ee33670e87 (patch) | |
tree | 39a069962ecc910eedcd20f99491d4b8fabe5790 /t | |
parent | adb976ce4b72d6c8747ccd578a9f1ff256531e15 (diff) |
display alert count on admin report page
Add a count of currently active alerts on new updates for a report to
the admin page.
Fixes #669
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/admin/report_edit.t | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/app/controller/admin/report_edit.t b/t/app/controller/admin/report_edit.t index 5e3e6c315..c6e03ff7e 100644 --- a/t/app/controller/admin/report_edit.t +++ b/t/app/controller/admin/report_edit.t @@ -608,6 +608,32 @@ subtest "Test display of report extra data" => sub { $mech->content_contains('extra_field</strong>: this is extra data'); }; +subtest "Test alert count display" => sub { + $mech->get_ok("/admin/report_edit/$report_id"); + $mech->content_contains('Alerts: 0'); + + my $alert = FixMyStreet::App->model('DB::Alert')->find_or_create( + { + alert_type => 'new_updates', + parameter => $report_id, + user => $user, + } + ); + + $mech->get_ok("/admin/report_edit/$report_id"); + $mech->content_contains('Alerts: 0', 'does not include unconfirmed reports'); + + $alert->update( { confirmed => 1 } ); + $mech->get_ok("/admin/report_edit/$report_id"); + $mech->content_contains('Alerts: 1'); + + $alert->update( { whendisabled => \"now()" } ); + $mech->get_ok("/admin/report_edit/$report_id"); + $mech->content_contains('Alerts: 0'); + + $alert->delete; +}; + my $report2 = FixMyStreet::App->model('DB::Problem')->find_or_create( { postcode => 'SW1A 1AA', |