aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/admin/priorities.t
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2020-09-29 14:23:52 +0200
committerMarius Halden <marius.h@lden.org>2020-09-29 14:23:52 +0200
commita27ce1524d801d2742a2bdb6ec1da45126d64353 (patch)
tree64123c4e17dc1776aa0a7cd65ee01d49d3e7d978 /t/app/controller/admin/priorities.t
parent377bd96aab7cad3434185c30eb908c9da447fe40 (diff)
parent2773c60226b9370fe8ee00f7b205b571bb87c3b5 (diff)
Merge tag 'v3.0.1' into fiksgatami-dev
Diffstat (limited to 't/app/controller/admin/priorities.t')
-rw-r--r--t/app/controller/admin/priorities.t43
1 files changed, 15 insertions, 28 deletions
diff --git a/t/app/controller/admin/priorities.t b/t/app/controller/admin/priorities.t
index 4eff20be7..8341e212d 100644
--- a/t/app/controller/admin/priorities.t
+++ b/t/app/controller/admin/priorities.t
@@ -16,14 +16,14 @@ $mech->log_in_ok( $superuser->email );
subtest "response priorities can be added" => sub {
is $oxfordshire->response_priorities->count, 0, "No response priorities yet";
- $mech->get_ok( "/admin/responsepriorities/" . $oxfordshire->id . "/new" );
+ $mech->get_ok( "/admin/responsepriorities/" . $oxfordshire->id . "/create" );
my $fields = {
name => "Cat 1A",
description => "Fixed within 24 hours",
deleted => undef,
is_default => undef,
- "contacts[".$oxfordshirecontact->id."]" => 1,
+ contacts => $oxfordshirecontact->id,
};
$mech->submit_form_ok( { with_fields => $fields } );
@@ -41,7 +41,7 @@ subtest "response priorities can set to default" => sub {
description => "Fixed within 24 hours",
deleted => undef,
is_default => 1,
- "contacts[".$oxfordshirecontact->id."]" => 1,
+ contacts => $oxfordshirecontact->id,
};
$mech->submit_form_ok( { with_fields => $fields } );
@@ -51,49 +51,36 @@ subtest "response priorities can set to default" => sub {
};
subtest "response priorities can be listed" => sub {
- $mech->get_ok( "/admin/responsepriorities/" . $oxfordshire->id );
+ $mech->get_ok( "/admin/responsepriorities" );
$mech->content_contains( $oxfordshire->response_priorities->first->name );
$mech->content_contains( $oxfordshire->response_priorities->first->description );
};
-subtest "response priorities are limited by body" => sub {
- my $bromleypriority = $bromley->response_priorities->create( {
- deleted => 0,
- name => "Bromley Cat 0",
- } );
-
- is $bromley->response_priorities->count, 1, "Response priority was added to Bromley";
- is $oxfordshire->response_priorities->count, 1, "Response priority wasn't added to Oxfordshire";
-
- $mech->get_ok( "/admin/responsepriorities/" . $oxfordshire->id );
- $mech->content_lacks( $bromleypriority->name );
-
- $mech->get_ok( "/admin/responsepriorities/" . $bromley->id );
- $mech->content_contains( $bromleypriority->name );
-};
-
$mech->log_out_ok;
subtest "response priorities can't be viewed across councils" => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'oxfordshire' ],
}, sub {
+ my $bromley_priority = $bromley->response_priorities->create( {
+ deleted => 0,
+ name => "Bromley Cat 0",
+ } );
+
+ is $bromley->response_priorities->count, 1, "Response priority was added to Bromley";
+ is $oxfordshire->response_priorities->count, 1, "Response priority wasn't added to Oxfordshire";
+
$oxfordshireuser->user_body_permissions->create({
body => $oxfordshire,
permission_type => 'responsepriority_edit',
});
$mech->log_in_ok( $oxfordshireuser->email );
- $mech->get_ok( "/admin/responsepriorities/" . $oxfordshire->id );
+ $mech->get_ok( "/admin/responsepriorities" );
$mech->content_contains( $oxfordshire->response_priorities->first->name );
+ $mech->content_lacks( $bromley_priority->name );
-
- $mech->get( "/admin/responsepriorities/" . $bromley->id );
- ok !$mech->res->is_success(), "want a bad response";
- is $mech->res->code, 404, "got 404";
-
- my $bromley_priority_id = $bromley->response_priorities->first->id;
- $mech->get( "/admin/responsepriorities/" . $bromley->id . "/" . $bromley_priority_id );
+ $mech->get( "/admin/responsepriorities/" . $bromley->id . "/" . $bromley_priority->id );
ok !$mech->res->is_success(), "want a bad response";
is $mech->res->code, 404, "got 404";
};