diff options
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/dashboard.t | 8 | ||||
-rw-r--r-- | t/app/controller/json.t | 6 | ||||
-rw-r--r-- | t/app/controller/report_display.t | 16 | ||||
-rw-r--r-- | t/app/controller/report_interest_count.t | 8 | ||||
-rw-r--r-- | t/app/controller/report_new.t | 12 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 2 | ||||
-rw-r--r-- | t/app/controller/rss.t | 2 |
7 files changed, 35 insertions, 19 deletions
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index 307943abd..5a8465edc 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -12,6 +12,8 @@ my $test_pass = 'password'; my $test_council = 2651; my $test_ward = 20723; +$mech->create_body_ok($test_council, 'City of Edinburgh Council'); + $mech->delete_user( $test_user ); my $user = FixMyStreet::App->model('DB::User')->create( { email => $test_user, @@ -578,7 +580,7 @@ sub make_problem { confirmed => $args->{conf_dt}, whensent => $args->{conf_dt}, lastupdate => $args->{mark_dt} || $args->{conf_dt}, - council => $test_council, + bodies_str => $test_council, postcode => 'EH99 1SP', latitude => '51', longitude => '1', @@ -632,10 +634,10 @@ sub check_report_counts { sub delete_problems { FixMyStreet::App->model('DB::Comment') - ->search( { 'problem.council' => $test_council }, { join => 'problem' } ) + ->search( { 'problem.bodies_str' => $test_council }, { join => 'problem' } ) ->delete; FixMyStreet::App->model('DB::Problem') - ->search( { council => $test_council } )->delete(); + ->search( { bodies_str => $test_council } )->delete(); } done_testing; diff --git a/t/app/controller/json.t b/t/app/controller/json.t index e8f9c0e09..405a84821 100644 --- a/t/app/controller/json.t +++ b/t/app/controller/json.t @@ -45,6 +45,8 @@ is_deeply # # put an entry in the database for this test my $user = $mech->create_user_ok('test@example.com'); +my $body = $mech->create_body_ok(2501, 'Wandsworth Borough Council'); + my $problem_args = { postcode => 'sw1a 1aa', bodies_str => '2501', @@ -86,7 +88,7 @@ is_deeply # 'category' => 'test category', 'confirmed' => '2000-01-01 12:01:00', 'lastupdate' => '2000-01-01 12:00:00', - 'council' => 'Wandsworth Borough Council', + 'bodies_str' => 'Wandsworth Borough Council', 'detail' => 'Test detail', 'id' => $problem->id, 'name' => 'Test Name', @@ -103,7 +105,7 @@ is_deeply # 'category' => 'test category', 'confirmed' => '2000-01-01 12:02:00', 'lastupdate' => '2000-01-01 12:00:00', - 'council' => 'Wandsworth Borough Council', + 'bodies_str' => 'Wandsworth Borough Council', 'detail' => 'Test detail', 'id' => $anon_problem->id, 'name' => '', diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t index b20fe4077..4c7b33f73 100644 --- a/t/app/controller/report_display.t +++ b/t/app/controller/report_display.t @@ -33,7 +33,7 @@ my $dt = DateTime->new( my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( { postcode => 'SW1A 1AA', - council => '2504', + bodies_str => '2504', areas => ',105255,11806,11828,2247,2504,', category => 'Other', title => 'Test 2', @@ -350,25 +350,25 @@ for my $test ( desc => 'no state dropdown if user not from authority', from_body => 0, no_state => 1, - report_council => '2504', + report_body => '2504', }, { desc => 'state dropdown if user from authority', from_body => 2504, no_state => 0, - report_council => '2504', + report_body => '2504', }, { - desc => 'no state dropdown if user not from same council as problem', + desc => 'no state dropdown if user not from same body as problem', from_body => 2505, no_state => 1, - report_council => '2504', + report_body => '2504', }, { - desc => 'state dropdown if user from authority and problem sent to multiple councils', + desc => 'state dropdown if user from authority and problem sent to multiple bodies', from_body => 2504, no_state => 0, - report_council => '2504,2506', + report_body => '2504,2506', }, ) { subtest $test->{desc} => sub { @@ -377,7 +377,7 @@ for my $test ( $user->update; $report->discard_changes; - $report->bodies_str( $test->{report_council} ); + $report->bodies_str( $test->{report_body} ); $report->update; $mech->get_ok("/report/$report_id"); diff --git a/t/app/controller/report_interest_count.t b/t/app/controller/report_interest_count.t index 788d2c473..d0e0054c4 100644 --- a/t/app/controller/report_interest_count.t +++ b/t/app/controller/report_interest_count.t @@ -33,7 +33,7 @@ my $dt = DateTime->new( my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( { postcode => 'SW1A 1AA', - council => '2504', + bodies_str => '2504', areas => ',105255,11806,11828,2247,2504,', category => 'Other', title => 'Test 2', @@ -61,12 +61,12 @@ SKIP: { unless FixMyStreet::Cobrand->exists('fixmybarangay'); for my $test ( { - desc => 'if not from council then no supporter button', + desc => 'if not from body then no supporter button', from_body => 0, support_string => 'No supporters', }, { - desc => 'from council user can increment supported count', + desc => 'from body user can increment supported count', from_body => 2504, support_string => 'No supporters', updated_support => '1 supporter' @@ -104,7 +104,7 @@ SKIP: { }; } - subtest 'check non council user cannot increment support count' => sub { + subtest 'check non body user cannot increment support count' => sub { ok $mech->host('fixmybarangay.com'), 'changed to fixmybarangay'; $report->discard_changes; $report->interest_count(1); diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index 323abfa18..f6a7b0824 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -33,6 +33,18 @@ my %contact_params = ( whenedited => \'current_timestamp', note => 'Created for test', ); + +for my $body ( + { id => 2651, name => 'City of Edinburgh Council' }, + { id => 2226, name => 'Gloucestershire County Council' }, + { id => 2326, name => 'Cheltenham Borough Council' }, + { id => 2482, name => 'Bromley Council' }, + { id => 2240, name => 'Staffordshire County Council' }, + { id => 2434, name => 'Lichfield District Council' }, +) { + $mech->create_body_ok($body->{id}, $body->{name}); +} + # Let's make some contacts to send things to! FixMyStreet::App->model('DB::Contact')->search( { email => { 'like', '%example.com' }, diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 2d49d3eef..fe1c27199 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -35,7 +35,7 @@ my $dt = DateTime->new( my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( { postcode => 'SW1A 1AA', - council => '2504', + bodies_str => '2504', areas => ',105255,11806,11828,2247,2504,', category => 'Other', title => 'Test 2', diff --git a/t/app/controller/rss.t b/t/app/controller/rss.t index 77e2c7ee1..e683806cd 100644 --- a/t/app/controller/rss.t +++ b/t/app/controller/rss.t @@ -17,7 +17,7 @@ my $user1 = FixMyStreet::App->model('DB::User') my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( { postcode => 'eh1 1BB', - council => '2651', + bodies_str => '2651', areas => ',11808,135007,14419,134935,2651,20728,', category => 'Street lighting', title => 'Testing', |