aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2013-12-17 17:08:23 +0000
committerHakim Cassimally <hakim@mysociety.org>2013-12-17 17:08:23 +0000
commitc7b952e05624e4e2d1e7872ed80887a244e082ec (patch)
tree10eaa9632c24cdf3ab911b446f3b30c2fdb843da
parentbdf3f044543a9e2317e86459f4475e3c82b7359c (diff)
parent791814f98b6804b0e5394e5aebce106866efa951 (diff)
Merge branch 'issues/commercial/461-zurich-export-hidden-stats'
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm2
-rw-r--r--t/cobrand/zurich.t30
2 files changed, 20 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index b3e288bc4..30c396d62 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -693,7 +693,7 @@ sub admin_stats {
if ( $c->req->params->{export} ) {
my $problems = $c->model('DB::Problem')->search(
- {%params},
+ {%date_params},
{
columns => [
'id', 'created',
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index fb6f172fe..f6cbeffed 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -617,21 +617,29 @@ subtest "hidden report email are only sent when requested" => sub {
};
subtest "test stats" => sub {
- $user = $mech->log_in_ok( 'super@example.org' );
-
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'zurich' ],
}, sub {
- $mech->get( '/admin/stats' );
+ $user = $mech->log_in_ok( 'super@example.org' );
+
+ $mech->get_ok( '/admin/stats' );
+ is $mech->res->code, 200, "superuser should be able to see stats page";
+
+ $mech->content_contains('Innerhalb eines Arbeitstages moderiert: 2'); # now including hidden
+ $mech->content_contains('Innerhalb von f&uuml;nf Arbeitstagen abgeschlossen: 3');
+ # 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 {
+ $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;
};
- is $mech->res->code, 200, "superuser should be able to see stats page";
-
- $mech->content_contains('Innerhalb eines Arbeitstages moderiert: 2'); # now including hidden
- $mech->content_contains('Innerhalb von f&uuml;nf Arbeitstagen abgeschlossen: 3');
- # my @data = $mech->content =~ /(?:moderiert|abgeschlossen): \d+/g;
- # diag Dumper(\@data); use Data::Dumper;
-
- $mech->log_out_ok;
};
subtest "test admin_log" => sub {