aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/model
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2019-11-01 12:58:26 +0000
committerDave Arter <davea@mysociety.org>2019-12-09 12:48:12 +0000
commit7e64cdff0a328550e529427665de6fddcf1d1e5d (patch)
tree0495c2e9f0c15d848014e2d5e6fcacb089d9246f /t/app/model
parent4c7f66b2884c629c9f42250cdd878035990f88cb (diff)
[UK Councils] Ensure response templates owned by other bodies aren’t visible
Diffstat (limited to 't/app/model')
-rw-r--r--t/app/model/defecttype.t4
-rw-r--r--t/app/model/responsepriority.t6
-rw-r--r--t/app/model/responsetemplate.t2
3 files changed, 6 insertions, 6 deletions
diff --git a/t/app/model/defecttype.t b/t/app/model/defecttype.t
index ec40f6dbc..3f1cc09b5 100644
--- a/t/app/model/defecttype.t
+++ b/t/app/model/defecttype.t
@@ -66,7 +66,7 @@ subtest 'Problem->defect_types behaves correctly' => sub {
subtest 'by_categories returns all defect types grouped by category' => sub {
my @contacts = FixMyStreet::DB->resultset('Contact')->not_deleted->search( { body_id => [ $oxfordshire->id ] } )->all;
- my $defect_types = FixMyStreet::DB->resultset('DefectType')->by_categories($area_id, @contacts);
+ my $defect_types = FixMyStreet::DB->resultset('DefectType')->by_categories(\@contacts, body_id => $oxfordshire->id);
my $potholes = decode_json($defect_types->{Potholes});
my $traffic_lights = decode_json($defect_types->{'Traffic lights'});
my $pavements = decode_json($defect_types->{Pavements});
@@ -88,7 +88,7 @@ subtest 'by_categories returns defect types for an area with multiple bodies' =>
);
my @contacts = FixMyStreet::DB->resultset('Contact')->not_deleted->search( { body_id => [ $oxfordshire->id ] } )->all;
- my $defect_types = FixMyStreet::DB->resultset('DefectType')->by_categories($area_id, @contacts);
+ my $defect_types = FixMyStreet::DB->resultset('DefectType')->by_categories(\@contacts, area_id => $area_id);
my $potholes = decode_json($defect_types->{Potholes});
my $traffic_lights = decode_json($defect_types->{'Traffic lights'});
my $pavements = decode_json($defect_types->{Pavements});
diff --git a/t/app/model/responsepriority.t b/t/app/model/responsepriority.t
index c7a4fe210..bd09c2da0 100644
--- a/t/app/model/responsepriority.t
+++ b/t/app/model/responsepriority.t
@@ -49,9 +49,9 @@ subtest 'for_bodies returns correct results' => sub {
is $priorities->first->name, $general_response_priority->name, 'Correct priority is returned for Traffic lights category';
};
-subtest 'by_categories returns allresponse priorities grouped by category' => sub {
+subtest 'by_categories returns all response priorities grouped by category' => sub {
my @contacts = FixMyStreet::DB->resultset('Contact')->not_deleted->search( { body_id => [ $oxfordshire->id ] } )->all;
- my $priorities = FixMyStreet::DB->resultset('ResponsePriority')->by_categories($area_id, @contacts);
+ my $priorities = FixMyStreet::DB->resultset('ResponsePriority')->by_categories(\@contacts, body_id => $oxfordshire->id);
my $potholes = decode_json($priorities->{Potholes});
my $traffic_lights = decode_json($priorities->{'Traffic lights'});
@@ -69,7 +69,7 @@ subtest 'by_categories returns all response priorities for an area with multiple
);
my @contacts = FixMyStreet::DB->resultset('Contact')->not_deleted->search( { body_id => [ $oxfordshire->id ] } )->all;
- my $priorities = FixMyStreet::DB->resultset('ResponsePriority')->by_categories($area_id, @contacts);
+ my $priorities = FixMyStreet::DB->resultset('ResponsePriority')->by_categories(\@contacts, area_id => $area_id);
my $potholes = decode_json($priorities->{Potholes});
my $traffic_lights = decode_json($priorities->{'Traffic lights'});
diff --git a/t/app/model/responsetemplate.t b/t/app/model/responsetemplate.t
index 631af9819..9efc7e3b4 100644
--- a/t/app/model/responsetemplate.t
+++ b/t/app/model/responsetemplate.t
@@ -16,7 +16,7 @@ $t2->add_to_contacts($c2);
my @contacts = FixMyStreet::DB->resultset('Contact')->not_deleted->search( { body_id => [ $body->id ] } )->all;
subtest 'by_categories returns allresponse templates grouped by category' => sub {
- my $templates = FixMyStreet::DB->resultset('ResponseTemplate')->by_categories($area_id, @contacts);
+ my $templates = FixMyStreet::DB->resultset('ResponseTemplate')->by_categories(\@contacts, body_id => $body->id);
my $potholes = decode_json($templates->{Potholes});
my $graffiti = decode_json($templates->{Graffiti});