aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-10-20 17:02:09 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-10-20 17:02:09 +0100
commit8e5853830f0fb65985881272b3b0178b37ac947b (patch)
tree3be466a2381a89c819002f91f350f341bdd14554 /t/app/controller
parent235502e48f2a94ac90c425a04cda09cb22ad78d2 (diff)
parent6e1d005093e6a97f2f8bd90def4aa794b2ca7cc3 (diff)
Merge branch 'reports-dashboard-councils'
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/reports.t19
1 files changed, 13 insertions, 6 deletions
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t
index 7773223dd..76c920562 100644
--- a/t/app/controller/reports.t
+++ b/t/app/controller/reports.t
@@ -12,9 +12,6 @@ END {
ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' );
-# Run the cron script with empty database
-FixMyStreet::Script::UpdateAllReports::generate_dashboard();
-
$mech->create_body_ok(2514, 'Birmingham City Council');
my $body_edin_id = $mech->create_body_ok(2651, 'City of Edinburgh Council')->id;
my $body_west_id = $mech->create_body_ok(2504, 'Westminster City Council')->id;
@@ -99,10 +96,14 @@ $fife_problems[10]->update( {
});
# Run the cron script that makes the data for /reports so we don't get an error.
-FixMyStreet::Script::UpdateAllReports::generate_dashboard();
+my $data = FixMyStreet::Script::UpdateAllReports::generate_dashboard();
# check that we can get the page
-$mech->get_ok('/reports');
+FixMyStreet::override_config {
+ TEST_DASHBOARD_DATA => $data,
+}, sub {
+ $mech->get_ok('/reports');
+};
$mech->title_like(qr{Dashboard});
$mech->content_contains('Birmingham');
@@ -138,6 +139,7 @@ is scalar @$problems, 5, 'correct number of problems displayed';
FixMyStreet::override_config {
MAPIT_URL => 'http://mapit.uk/',
+ TEST_DASHBOARD_DATA => $data,
}, sub {
$mech->get_ok('/reports');
$mech->submit_form_ok({ with_fields => { body => $body_slash_id } }, 'Submitted dropdown okay');
@@ -199,13 +201,18 @@ is scalar @$problems, 4, 'only public problems are displayed';
$mech->content_lacks('All reports Test 3 for ' . $body_west_id, 'non public problem is not visible');
# No change to numbers if report is non-public
-$mech->get_ok('/reports');
+FixMyStreet::override_config {
+ TEST_DASHBOARD_DATA => $data,
+}, sub {
+ $mech->get_ok('/reports');
+};
$mech->content_contains('&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;,&quot;Jul&quot;');
$mech->content_contains('5,9,10,22');
subtest "test fiksgatami all reports page" => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'fiksgatami' ],
+ TEST_DASHBOARD_DATA => $data, # Not relevant to what we're testing, just so page loads
}, sub {
$mech->create_body_ok(3, 'Oslo');
ok $mech->host("fiksgatami.no"), 'change host to fiksgatami';