aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand
diff options
context:
space:
mode:
Diffstat (limited to 't/cobrand')
-rw-r--r--t/cobrand/zurich.t29
1 files changed, 23 insertions, 6 deletions
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index a4f3963c6..73007ff59 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -78,12 +78,30 @@ sub cleanup {
$mech->delete_user( 'sdm1@example.org' );
}
+sub get_export_rows_count {
+ my $mech = shift;
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+ }, sub {
+ $mech->get_ok( '/admin/stats?export=1' );
+ };
+ is $mech->res->code, 200, 'csv retrieved ok';
+ is $mech->content_type, 'text/csv', 'content_type correct' and do {
+ my @lines = split /\n/, $mech->content;
+ return @lines - 1;
+ };
+ return;
+}
+
cleanup();
+my $EXISTING_REPORT_COUNT = 0;
+
subtest "set up superuser" => sub {
my $superuser = $mech->log_in_ok( 'super@example.org' );
# a user from body $zurich is a superuser, as $zurich has no parent id!
$superuser->update({ from_body => $zurich->id });
+ $EXISTING_REPORT_COUNT = get_export_rows_count($mech);
$mech->log_out_ok;
};
@@ -635,14 +653,13 @@ subtest "test stats" => sub {
# my @data = $mech->content =~ /(?:moderiert|abgeschlossen): \d+/g;
# diag Dumper(\@data); use Data::Dumper;
- $mech->get_ok( '/admin/stats?export=1' );
- is $mech->res->code, 200, 'csv retrieved ok';
- is $mech->content_type, 'text/csv', 'content_type correct' and do {
+ my $export_count = get_export_rows_count($mech);
+ if (defined $export_count) {
+ is $export_count - $EXISTING_REPORT_COUNT, 3, 'Correct number of reports';
$mech->content_contains(',fixed - council,');
$mech->content_contains(',hidden,');
- my @lines = split /\n/, $mech->content;
- is scalar @lines, 4, 'Correct number of lines';
- };
+ }
+
$mech->log_out_ok;
};
};