[Bps-public-commit] jifty-plugin-recordhistory branch, master, updated. 0.05-8-g3b82609

Shawn Moore sartak at bestpractical.com
Thu Feb 24 19:10:50 EST 2011


The branch, master has been updated
       via  3b826091aca86a8c5051a64b2aea4803df8c3c31 (commit)
      from  b78cf3b880a0117b171fe80d82d36fb70500e7a7 (commit)

Summary of changes:
 .../t/008-access-control.t                         |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 3b826091aca86a8c5051a64b2aea4803df8c3c31
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Feb 24 19:09:54 2011 -0500

    Test to make sure that we can't read changes if we can't read the ticket

diff --git a/t/TestApp-Plugin-RecordHistory/t/008-access-control.t b/t/TestApp-Plugin-RecordHistory/t/008-access-control.t
index dc4a880..2ddfd4c 100644
--- a/t/TestApp-Plugin-RecordHistory/t/008-access-control.t
+++ b/t/TestApp-Plugin-RecordHistory/t/008-access-control.t
@@ -2,7 +2,7 @@
 use warnings;
 use strict;
 
-use Jifty::Test::Dist tests => 41;
+use Jifty::Test::Dist tests => 49;
 
 my $user = TestApp::Plugin::RecordHistory::Model::User->new;
 $user->create(
@@ -86,3 +86,21 @@ $change->create(
 );
 ok(!$change->id, "couldn't create a change as an ordinary user");
 
+my $super_ticket = TestApp::Plugin::RecordHistory::Model::Ticket->new(current_user => Jifty::CurrentUser->superuser);
+$super_ticket->load($ticket->id);
+$super_ticket->set_forced_updatable(1);
+
+# flush cache
+$ticket->load($ticket->id);
+
+is($ticket->forced_updatable, 1, "ticket was updated");
+is($ticket->changes->count, 4, "now four changes since the superuser *could* update the record");
+
+$ticket->set_forced_readable(0);
+ok(!$ticket->current_user_can('read'), "can no longer read the ticket");
+is($ticket->subject, undef, "can no longer read ticket fields");
+isa_ok($ticket->changes, 'Jifty::Plugin::RecordHistory::Model::ChangeCollection');
+is($ticket->changes->current_user->id, $user->id, 'current user is the user not superuser');
+ok(!$ticket->changes->current_user->is_superuser, 'not superuser');
+is($ticket->changes->first, undef, "no readable changes");
+

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list