X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fapi%2Fuser.t;h=94494f1621d1906bbfe99b2660d9b5c05890f392;hb=863c1ca1d9363c8fda3136514cef90584a1f4427;hp=e6b891f73230a15651c6f4a34c3b3c366eafad18;hpb=f3c4966ed1f6ec3db7accd6dcdd3a5a3821d72a7;p=freeside.git diff --git a/rt/t/api/user.t b/rt/t/api/user.t index e6b891f73..94494f162 100644 --- a/rt/t/api/user.t +++ b/rt/t/api/user.t @@ -2,7 +2,7 @@ use strict; use warnings; use RT; -use RT::Test tests => 111; +use RT::Test tests => 122; { @@ -106,7 +106,7 @@ ok($user->Privileged, "User 'root' is privileged again"); ok(my $u = RT::User->new(RT->SystemUser)); ok($u->Load(1), "Loaded the first user"); -is($u->PrincipalObj->ObjectId , 1, "user 1 is the first principal"); +is($u->PrincipalObj->id , 1, "user 1 is the first principal"); is($u->PrincipalObj->PrincipalType, 'User' , "Principal 1 is a user, not a group"); @@ -335,3 +335,30 @@ ok($rqv, "Revoked the right successfully - $rqm"); } +{ + my $root = RT::Test->load_or_create_user( Name => 'root' ); + ok $root && $root->id; + + my $queue = RT::Test->load_or_create_queue( Name => 'General' ); + ok $queue && $queue->id; + + my $ticket = RT::Ticket->new( RT->SystemUser ); + my ($id) = $ticket->Create( Subject => 'test', Queue => $queue ); + ok $id; + + my $b_ticket = RT::Ticket->new( RT->SystemUser ); + ($id) = $b_ticket->Create( Subject => 'test', Queue => $queue ); + ok $id; + + ok $root->ToggleBookmark($b_ticket); + ok !$root->ToggleBookmark($b_ticket); + ok $root->ToggleBookmark($b_ticket); + + ok $root->HasBookmark( $b_ticket ); + ok !$root->HasBookmark( $ticket ); + + my @marks = $root->Bookmarks; + is scalar @marks, 1; + is $marks[0], $b_ticket->id; +} +