From 43c98742ee85c73c4783451ceeea28108bb793c6 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 11 Dec 2014 16:42:53 +0000 Subject: 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. --- t/app/controller/dashboard.t | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 't/app/controller/dashboard.t') 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; -- cgit v1.2.3