diff options
author | M Somerville <matthew-github@dracos.co.uk> | 2020-08-04 15:05:55 +0100 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-08-04 15:05:55 +0100 |
commit | 994093c4675393bca6b84747e87a63e10cb063d9 (patch) | |
tree | 02db646fe452faada138c68fb07a734c1dc2875c /t/app/controller/dashboard.t | |
parent | 361bf0bc0d8b5e86ae2cde5f428129ae23af5999 (diff) |
Do not error in export if report has bad category.
If category groups are enabled, the CSV export includes a subcategory,
but it was only fetching a valid groups value if the row's contact was
found.
Diffstat (limited to 't/app/controller/dashboard.t')
-rw-r--r-- | t/app/controller/dashboard.t | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index 0f07bcae0..526b1a4c3 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -83,6 +83,7 @@ my $categories = scraper { FixMyStreet::override_config { ALLOWED_COBRANDS => 'no2fa', + COBRAND_FEATURES => { category_groups => { no2fa => 1 } }, MAPIT_URL => 'http://mapit.uk/', }, sub { @@ -174,13 +175,14 @@ FixMyStreet::override_config { subtest 'export as csv' => sub { $mech->create_problems_for_body(1, $body->id, 'Title', { detail => "this report\nis split across\nseveral lines", + category => 'Problem one', areas => ",$alt_area_id,2651,", }); $mech->get_ok('/dashboard?export=1'); my @rows = $mech->content_as_csv; is scalar @rows, 19, '1 (header) + 18 (reports) = 19 lines'; - is scalar @{$rows[0]}, 20, '20 columns present'; + is scalar @{$rows[0]}, 21, '21 columns present'; is_deeply $rows[0], [ @@ -189,6 +191,7 @@ FixMyStreet::override_config { 'Detail', 'User Name', 'Category', + 'Subcategory', 'Created', 'Confirmed', 'Acknowledged', @@ -207,9 +210,9 @@ FixMyStreet::override_config { ], 'Column headers look correct'; - is $rows[5]->[14], 'Trowbridge', 'Ward column is name not ID'; - is $rows[5]->[15], '529025', 'Correct Easting conversion'; - is $rows[5]->[16], '179716', 'Correct Northing conversion'; + is $rows[5]->[15], 'Trowbridge', 'Ward column is name not ID'; + is $rows[5]->[16], '529025', 'Correct Easting conversion'; + is $rows[5]->[17], '179716', 'Correct Northing conversion'; }; subtest 'export updates as csv' => sub { |