diff options
author | Hakim Cassimally <hakim@mysociety.org> | 2013-12-17 16:56:19 +0000 |
---|---|---|
committer | Hakim Cassimally <hakim@mysociety.org> | 2013-12-17 17:02:00 +0000 |
commit | 791814f98b6804b0e5394e5aebce106866efa951 (patch) | |
tree | 67d376e5c3d4e0f58b79bd6ec213ffefbf373aba /t/cobrand | |
parent | 7628dc67ad06a96c2ee18accc8c8b4f4109b1cae (diff) |
[Zurich] stats export include 'hidden'
See https://github.com/mysociety/FixMyStreet-Commercial/issues/461
Again, we just need to substitute the %params line (which elides
hidden reports) for the less restrictive %date_params.
This commit includes very basic tests for the previously untested
?export=1 functionality.
Diffstat (limited to 't/cobrand')
-rw-r--r-- | t/cobrand/zurich.t | 30 |
1 files changed, 19 insertions, 11 deletions
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ü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ü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 { |