aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/dashboard.t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2014-12-11 16:42:53 +0000
committerMatthew Somerville <matthew@mysociety.org>2014-12-12 12:41:31 +0000
commit43c98742ee85c73c4783451ceeea28108bb793c6 (patch)
tree40ced5bfa4a7b6c0328da62f8332cdc06a6637ea /t/app/controller/dashboard.t
parent4edc79829ebf2f6dcce11185e929a2a592a3f5ed (diff)
By default, use area-based alerts.
The body-based alert only works if the body ID matches the MapIt ID. This fixes #959. Further work needs to be done to enable proper body-based alerts that work properly in all circumstances. Consequently, factor out fixed body IDs from many tests. Also fix a couple of tests not overriding geocoder correctly.
Diffstat (limited to 't/app/controller/dashboard.t')
-rw-r--r--t/app/controller/dashboard.t14
1 files changed, 7 insertions, 7 deletions
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t
index 4e62028b5..3829873e5 100644
--- a/t/app/controller/dashboard.t
+++ b/t/app/controller/dashboard.t
@@ -13,7 +13,7 @@ my $test_pass = 'password';
my $test_council = 2651;
my $test_ward = 20723;
-$mech->create_body_ok($test_council, 'City of Edinburgh Council');
+my $body = $mech->create_body_ok($test_council, 'City of Edinburgh Council');
$mech->delete_user( $test_user );
my $user = FixMyStreet::App->model('DB::User')->create( {
@@ -44,7 +44,7 @@ FixMyStreet::override_config {
is $mech->status, '404', 'If not council user get 404';
- $user->from_body( $test_council );
+ $user->from_body( $body->id );
$user->update;
$mech->log_out_ok;
@@ -55,7 +55,7 @@ FixMyStreet::override_config {
$mech->content_contains( 'City of Edinburgh' );
- FixMyStreet::App->model('DB::Contact')->search( { body_id => $test_council } )
+ FixMyStreet::App->model('DB::Contact')->search( { body_id => $body->id } )
->delete;
delete_problems();
@@ -64,7 +64,7 @@ FixMyStreet::override_config {
for my $contact ( @cats ) {
FixMyStreet::App->model('DB::Contact')->create(
{
- body_id => $test_council,
+ body_id => $body->id,
category => $contact,
email => "$contact\@example.org",
confirmed => 1,
@@ -638,7 +638,7 @@ sub make_problem {
confirmed => $args->{conf_dt},
whensent => $args->{conf_dt},
lastupdate => $args->{mark_dt} || $args->{conf_dt},
- bodies_str => $test_council,
+ bodies_str => $body->id,
postcode => 'EH99 1SP',
latitude => '51',
longitude => '1',
@@ -692,10 +692,10 @@ sub check_report_counts {
sub delete_problems {
FixMyStreet::App->model('DB::Comment')
- ->search( { 'problem.bodies_str' => $test_council }, { join => 'problem' } )
+ ->search( { 'problem.bodies_str' => $body->id }, { join => 'problem' } )
->delete;
FixMyStreet::App->model('DB::Problem')
- ->search( { bodies_str => $test_council } )->delete();
+ ->search( { bodies_str => $body->id } )->delete();
}
done_testing;