diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-27 11:03:57 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-06-27 11:03:57 +0100 |
commit | a20fc533b0f10646814742f1348c5f9141217efa (patch) | |
tree | 742b49b1347262bd971e397f1d3d52be7c7140d7 /t/app/controller | |
parent | df18e6c8b434dfd86177cf5041278fd46d6d2ea7 (diff) |
change to use from_council in users table and store the council id in
there so we can check that the problem is for the council the user is
from
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/report_display.t | 19 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 8 |
2 files changed, 17 insertions, 10 deletions
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t index fc844e31c..23b76fbc4 100644 --- a/t/app/controller/report_display.t +++ b/t/app/controller/report_display.t @@ -311,24 +311,31 @@ for my $test ( for my $test ( { desc => 'no state dropdown if user not from authority', - from_authority => 0, + from_council => 0, + no_state => 1, }, { desc => 'state dropdown if user from authority', - from_authority => 1, + from_council => 2504, + no_state => 0, + }, + { + desc => 'no state dropdown if user not from same council as problem', + from_council => 2505, + no_state => 1, }, ) { subtest $test->{desc} => sub { $mech->log_in_ok( $user->email ); - $user->from_authority( $test->{from_authority} ); + $user->from_council( $test->{from_council} ); $user->update; $mech->get_ok("/report/$report_id"); my $fields = $mech->visible_form_values( 'updateForm' ); - if ( $test->{from_authority} ) { - ok $fields->{state}; - } else { + if ( $test->{no_state} ) { ok !$fields->{state}; + } else { + ok $fields->{state}; } }; } diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index f0916610b..35e8b9e5f 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -387,7 +387,7 @@ $report->update; subtest 'check non authority user cannot change set state' => sub { $mech->log_in_ok( $user->email ); - $user->from_authority( 0 ); + $user->from_council( 0 ); $user->update; $mech->get_ok("/report/$report_id"); @@ -419,7 +419,7 @@ subtest 'check non authority user cannot change set state' => sub { for my $state ( qw/unconfirmed hidden partial/ ) { subtest "check that update cannot set state to $state" => sub { $mech->log_in_ok( $user->email ); - $user->from_authority( 1 ); + $user->from_council( 2504 ); $user->update; $mech->get_ok("/report/$report_id"); @@ -515,7 +515,7 @@ for my $test ( $report->comments->delete; $mech->log_in_ok( $user->email ); - $user->from_authority( 1 ); + $user->from_council( 2504 ); $user->update; $mech->get_ok("/report/$report_id"); @@ -540,7 +540,7 @@ for my $test ( }; } -$user->from_authority(0); +$user->from_council(0); $user->update; $report->state('confirmed'); |