aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorpezholio <pezholio@gmail.com>2017-02-02 15:25:27 +0000
committerpezholio <pezholio@gmail.com>2017-02-07 09:53:21 +0000
commit81b642a59ec389399131880f4850148157787c38 (patch)
tree5357b048d5e9fdc6551e638e073441aa7d4efd66 /t/app/controller
parent263ba94fe4ba91ef08cfada386900669ff289a2b (diff)
Add shortlist filters
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/reports.t51
1 files changed, 50 insertions, 1 deletions
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('<option value="shortlisted">Shortlisted</option>');
+ $mech->content_contains('<option value="unshortlisted">Unshortlisted</option>');
+
+ $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('<option value="shortlisted">Shortlisted</option>');
+ $mech->content_lacks('<option value="unshortlisted">Unshortlisted</option>');
+ };
+};
+
+done_testing();