From 9dc01637b32d7ce8ae97260b3964287b8640f96b Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 16 May 2017 11:33:23 +0100 Subject: Fix timing edge case test failure. If the creation of this test report and the loading of the dashboard took place within the same second, the test report would appear in a different column than the test expected. --- t/app/controller/dashboard.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/app/controller/dashboard.t') diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index 903affdcf..c83902c48 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -132,7 +132,7 @@ FixMyStreet::override_config { }, { desc => 'confirmed last 2 weeks with no state', - dt => $now->clone->subtract( weeks => 2 ), + dt => $now->clone->subtract( weeks => 2, hours => 1 ), counts => [1,2,4,4], report_counts => [2, 1, 1], }, -- cgit v1.2.3 From 1bb94cd0bf0821927b3f449d832a9982b0397fa9 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 31 May 2017 12:48:17 +0100 Subject: Auto-add strict/warnings/Test::More with TestMech. --- t/app/controller/dashboard.t | 3 --- 1 file changed, 3 deletions(-) (limited to 't/app/controller/dashboard.t') diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index c83902c48..9713d2d2c 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -1,6 +1,3 @@ -use strict; -use warnings; -use Test::More; use Test::MockTime ':all'; use FixMyStreet::TestMech; -- cgit v1.2.3 From 466c5cac0f000bfa80ab49c88ec6e03c388ac328 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Sat, 8 Jul 2017 22:11:57 +0100 Subject: Add inactive state to categories. A new 'state' column replaces confirmed and deleted, allowing categories to be unconfirmed, confirmed, deleted or inactive. --- t/app/controller/dashboard.t | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 't/app/controller/dashboard.t') diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index 9713d2d2c..9d424c1ae 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -59,9 +59,8 @@ FixMyStreet::override_config { body_id => $body->id, category => $contact, email => "$contact\@example.org", - confirmed => 1, + state => 'confirmed', whenedited => DateTime->now, - deleted => 0, editor => 'test', note => 'test', } -- cgit v1.2.3 From 986c97311c4cb1f3ec092c0605dcb15ab2527da1 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 23 Aug 2017 13:58:34 +0100 Subject: Remove hardcoded states from templates. State display names are now got from the database wherever they are displayed, including admin dropdowns, list filters, and update meta statements. This also covers the open/closed/fixed 'groups'. This also fixes a bug whereby if e.g. an update has problem_state investigating, the next update has no problem_state, and the last update has investigating again, it was previously showing a state change to investigating on that third update. --- t/app/controller/dashboard.t | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 't/app/controller/dashboard.t') diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index 9d424c1ae..b87b58b38 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -545,21 +545,10 @@ FixMyStreet::override_config { }, { desc => 'limit by state works', - state => 'fixed', + state => 'fixed - council', report_counts => [2,0,0], report_counts_after => [1,0,0], }, - { - desc => 'planned counted as action scheduled', - p1 => { - state => 'planned', - conf_dt => DateTime->now(), - category => 'Potholes', - }, - state => 'action scheduled', - report_counts => [3,0,0], - report_counts_after => [1,0,0], - }, { desc => 'All fixed states count as fixed', p1 => { @@ -573,7 +562,7 @@ FixMyStreet::override_config { category => 'Potholes', }, state => 'fixed', - report_counts => [5,0,0], + report_counts => [4,0,0], report_counts_after => [3,0,0], }, ) { @@ -612,7 +601,7 @@ FixMyStreet::override_config { while ( my $row = $csv->getline( $data_handle ) ) { push @rows, $row; } - is scalar @rows, 7, '1 (header) + 6 (reports) = 7 lines'; + is scalar @rows, 6, '1 (header) + 5 (reports) = 6 lines'; }; }; restore_time; -- cgit v1.2.3 From 4c0328bbe43b5cdf0ca9660505220d093a0cebe0 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Mon, 4 Sep 2017 17:04:49 +0100 Subject: include ward in dashboard csv export Adds a Ward column to the council dashboard CSV export with the name of the ward. Fixes mysociety/fixmystreetforcouncils#220 --- t/app/controller/dashboard.t | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 't/app/controller/dashboard.t') diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index b87b58b38..4ecad9f31 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -593,6 +593,7 @@ FixMyStreet::override_config { detail => "this report\nis split across\nseveral lines", state => "confirmed", conf_dt => DateTime->now(), + areas => 62883, } ); $mech->get_ok('/dashboard?export=1'); open my $data_handle, '<', \$mech->content; @@ -602,6 +603,31 @@ FixMyStreet::override_config { push @rows, $row; } is scalar @rows, 6, '1 (header) + 5 (reports) = 6 lines'; + + is scalar @{$rows[0]}, 16, '16 columns present'; + + is_deeply $rows[0], + [ + 'Report ID', + 'Title', + 'Detail', + 'User Name', + 'Category', + 'Created', + 'Confirmed', + 'Acknowledged', + 'Fixed', + 'Closed', + 'Status', + 'Latitude', + 'Longitude', + 'Nearest Postcode', + 'Ward', + 'Report URL', + ], + 'Column headers look correct'; + + is $rows[5]->[14], 'Bradford-on-Avon', 'Ward column is name not ID'; }; }; restore_time; -- cgit v1.2.3 From 1391186c2fb56e46df5b124362e3facf6af173b5 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Mon, 4 Sep 2017 17:47:46 +0100 Subject: include easting/northing in dashboard CSV export Fixes mysociety/fixmystreetforcouncils#221 --- t/app/controller/dashboard.t | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 't/app/controller/dashboard.t') diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index 4ecad9f31..5c0e19070 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -604,7 +604,7 @@ FixMyStreet::override_config { } is scalar @rows, 6, '1 (header) + 5 (reports) = 6 lines'; - is scalar @{$rows[0]}, 16, '16 columns present'; + is scalar @{$rows[0]}, 18, '18 columns present'; is_deeply $rows[0], [ @@ -623,11 +623,16 @@ FixMyStreet::override_config { 'Longitude', 'Nearest Postcode', 'Ward', + 'Easting', + 'Northing', 'Report URL', ], 'Column headers look correct'; is $rows[5]->[14], 'Bradford-on-Avon', 'Ward column is name not ID'; + + is $rows[5]->[15], '610591', 'Correct Easting conversion'; + is $rows[5]->[16], '126573', 'Correct Northing conversion'; }; }; restore_time; -- cgit v1.2.3 From 12013d397d981efbc90d5fed1a7bb25eae23eb91 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 6 Sep 2017 18:04:00 +0100 Subject: sort body dashboard CSV export by report confirmed time And update the tests to avoid a random failure caused by inconsistent ordering. --- t/app/controller/dashboard.t | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 't/app/controller/dashboard.t') diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index 5c0e19070..457eceade 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -531,12 +531,12 @@ FixMyStreet::override_config { desc => 'Selecting no state does nothing', p1 => { state => 'fixed - user', - conf_dt => DateTime->now(), + conf_dt => DateTime->now()->subtract( minutes => 1 ), category => 'Potholes', }, p2 => { state => 'confirmed', - conf_dt => DateTime->now(), + conf_dt => DateTime->now()->subtract( minutes => 1 ), category => 'Litter', }, state => '', @@ -553,12 +553,12 @@ FixMyStreet::override_config { desc => 'All fixed states count as fixed', p1 => { state => 'fixed - council', - conf_dt => DateTime->now(), + conf_dt => DateTime->now()->subtract( minutes => 1 ), category => 'Potholes', }, p2 => { state => 'fixed', - conf_dt => DateTime->now(), + conf_dt => DateTime->now()->subtract( minutes => 1 ), category => 'Potholes', }, state => 'fixed', -- cgit v1.2.3