From 81b642a59ec389399131880f4850148157787c38 Mon Sep 17 00:00:00 2001 From: pezholio Date: Thu, 2 Feb 2017 15:25:27 +0000 Subject: Add shortlist filters --- t/app/controller/reports.t | 51 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 't/app/controller/reports.t') diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index 141269cd8..8fa03897b 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -233,5 +233,54 @@ subtest "test greenwich all reports page" => sub { } }; -done_testing(); +subtest "it lists shortlisted reports" => sub { + FixMyStreet::override_config { + MAPIT_URL => 'http://mapit.mysociety.org/' + }, sub { + my $body = FixMyStreet::App->model('DB::Body')->find( $body_edin_id ); + my $user = $mech->log_in_ok( 'test@example.com' ); + $user->update({ from_body => $body }); + $user->user_body_permissions->find_or_create({ + body => $body, + permission_type => 'planned_reports', + }); + + my ($shortlisted_problem) = $mech->create_problems_for_body(1, $body_edin_id, 'Shortlisted report'); + my ($unshortlisted_problem) = $mech->create_problems_for_body(1, $body_edin_id, 'Unshortlisted report'); + my ($removed_from_shortlist_problem) = $mech->create_problems_for_body(1, $body_edin_id, 'Removed from shortlist report'); + + $user->add_to_planned_reports($shortlisted_problem); + $user->add_to_planned_reports($removed_from_shortlist_problem); + $user->remove_from_planned_reports($removed_from_shortlist_problem); + + $mech->get_ok('/reports/City+of+Edinburgh+Council'); + $mech->content_contains(''); + $mech->content_contains(''); + + $mech->get_ok('/reports/City+of+Edinburgh+Council?status=shortlisted'); + + $mech->content_contains('Shortlisted report'); + $mech->content_lacks('Unshortlisted report'); + $mech->content_lacks('Removed from shortlist report'); + $mech->get_ok('/reports/City+of+Edinburgh+Council?status=shortlisted,open'); + + $mech->content_contains('Shortlisted report'); + $mech->content_lacks('Unshortlisted report'); + $mech->content_lacks('Removed from shortlist report'); + + $mech->get_ok('/reports/City+of+Edinburgh+Council?status=unshortlisted,open'); + + $mech->content_contains('Unshortlisted report'); + $mech->content_contains('Removed from shortlist report'); + $mech->content_lacks('Shortlisted report'); + + $user->admin_user_body_permissions->delete; + + $mech->get_ok('/reports/City+of+Edinburgh+Council'); + $mech->content_lacks(''); + $mech->content_lacks(''); + }; +}; + +done_testing(); -- cgit v1.2.3 From 6713d6a4cd04a6e91743f687347367f070538e63 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 21 Mar 2017 18:26:39 +0000 Subject: Make sure all MapIt tests can run offline. --- t/app/controller/reports.t | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 't/app/controller/reports.t') diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index 8fa03897b..a21d3ad65 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -107,7 +107,7 @@ is $stats->{'Fife Council'}->[4], 3, 'correct number of fixed reports for Fife'; is $stats->{'Fife Council'}->[5], 1, 'correct number of older fixed reports for Fife'; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->follow_link_ok( { text_regex => qr/Birmingham/ } ); $mech->get_ok('/reports/Westminster'); @@ -121,7 +121,7 @@ my $problems = $mech->extract_problem_list; is scalar @$problems, 5, 'correct number of problems displayed'; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/reports'); $mech->follow_link_ok({ url_regex => qr{/reports/Electricity_Gas\+Council} }); @@ -133,7 +133,7 @@ $problems = $mech->extract_problem_list; is scalar @$problems, 2, 'correct number of new problems displayed'; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/reports/City+of+Edinburgh?t=older'); }; @@ -169,7 +169,7 @@ for my $test ( ) { subtest $test->{desc} => sub { FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/reports/Fife+Council?t=' . $test->{type}); }; @@ -183,7 +183,7 @@ my $private = $westminster_problems[2]; ok $private->update( { non_public => 1 } ), 'problem marked non public'; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/reports/Westminster'); }; @@ -213,7 +213,7 @@ subtest "test fiksgatami all reports page" => sub { subtest "test greenwich all reports page" => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'greenwich' ], - MAPIT_URL => 'http://mapit.mysociety.org/' + MAPIT_URL => 'http://mapit.uk/' }, sub { my $body = $mech->create_body_ok(2493, 'Royal Borough of Greenwich'); my $deleted_contact = $mech->create_contact_ok( @@ -235,7 +235,7 @@ subtest "test greenwich all reports page" => sub { subtest "it lists shortlisted reports" => sub { FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/' + MAPIT_URL => 'http://mapit.uk/' }, sub { my $body = FixMyStreet::App->model('DB::Body')->find( $body_edin_id ); my $user = $mech->log_in_ok( 'test@example.com' ); -- cgit v1.2.3