[Rt-commit] rt branch 5.0/validate-get-default-queue updated. rt-5.0.2-26-g2d9184c854

BPS Git Server git at git.bestpractical.com
Tue Nov 2 17:48:23 UTC 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/validate-get-default-queue has been updated
       via  2d9184c85462a66d53990c4d86316b791c038ffc (commit)
      from  ef9baaa4f813c58d34fe3a21c0012463975c891d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2d9184c85462a66d53990c4d86316b791c038ffc
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Nov 3 01:45:45 2021 +0800

    Add tests for default queue rights check

diff --git a/t/web/ticket_create.t b/t/web/ticket_create.t
index 58ac5134c4..3714c555f9 100644
--- a/t/web/ticket_create.t
+++ b/t/web/ticket_create.t
@@ -94,4 +94,21 @@ $m->content_lacks( 'Permission Denied', 'Has permission to create ticket' );
 $form = $m->form_name('TicketCreate');
 is_deeply( [ $form->find_input('Queue','option')->possible_values ], [ $queue2->id ], 'Only Another queue is listed' );
 
+RT->Config->Set(DefaultQueue => 'General');
+RT::Test->stop_server;
+( $baseurl, $m ) = RT::Test->started_ok;
+
+ok( $user->PrincipalObj->RevokeRight( Right => 'SeeQueue', Object => RT->System ), 'Revoke SeeQueue right' );
+ok( $m->login( 'user', 'password' ), 'logged in as user' );
+$m->submit_form_ok( { form_name => 'CreateTicketInQueue' }, 'Try to create ticket' );
+$m->text_contains('Permission Denied', 'No permission to create ticket without SeeQueue');
+$m->warning_like(qr/Permission Denied/, 'Permission denied warning' );
+
+ok( $user->PrincipalObj->GrantRight( Right => 'SeeQueue', Object => $queue2 ), 'Grant SeeQueue right to Another queue' );
+$m->submit_form_ok( { form_name => 'CreateTicketInQueue' }, 'Try to create ticket' );
+$m->content_lacks( 'Permission Denied', 'Has permission to create ticket' );
+$form = $m->form_name('TicketCreate');
+is( $form->value('Queue'), $queue2->id, 'Queue selection dropdown populated and pre-selected' );
+is_deeply( [ $form->find_input('Queue','option')->possible_values ], [ $queue2->id ], 'Only Another queue is listed' );
+
 done_testing();

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

Summary of changes:
 t/web/ticket_create.t | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list