[Rt-commit] rt branch, 4.0/fix-users-whohaveroleright, updated. rt-4.0.0rc6-14-g198b641

Thomas Sibley trs at bestpractical.com
Wed Mar 9 16:29:00 EST 2011


The branch, 4.0/fix-users-whohaveroleright has been updated
       via  198b6414ee64873aac34223657eb9a6495d36f24 (commit)
      from  325cca62894f918bb0bc63ac7fdd65348ad45e02 (commit)

Summary of changes:
 t/web/ticket_owner_issues_16656.t |   63 +++++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 t/web/ticket_owner_issues_16656.t

- Log -----------------------------------------------------------------
commit 198b6414ee64873aac34223657eb9a6495d36f24
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Mar 9 16:28:38 2011 -0500

    Test the failure case that this branch fixed

diff --git a/t/web/ticket_owner_issues_16656.t b/t/web/ticket_owner_issues_16656.t
new file mode 100644
index 0000000..a6306f7
--- /dev/null
+++ b/t/web/ticket_owner_issues_16656.t
@@ -0,0 +1,63 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use RT::Test tests => 19;
+
+my $queue = RT::Test->load_or_create_queue( Name => 'Test' );
+ok $queue && $queue->id, 'loaded or created queue';
+
+my $user_a = RT::Test->load_or_create_user(
+    Name            => 'user_a',
+    EmailAddress    => 'user_a at example.com',
+    Password        => 'password',
+);
+ok $user_a && $user_a->id, 'loaded or created user';
+
+RT->Config->Set( AutocompleteOwners => 0 );
+my ($baseurl, $agent_root) = RT::Test->started_ok;
+
+ok( RT::Test->set_rights({
+    Principal   => 'Requestor',
+    Object      => $queue,
+    Right       => [qw(OwnTicket)]
+}), 'set rights');
+
+ok $agent_root->login('root', 'password'), 'logged in as user root';
+
+diag "user_a doesn't show up in create form";
+{
+    $agent_root->get_ok('/', 'open home page');
+    $agent_root->form_name('CreateTicketInQueue');
+    $agent_root->select( 'Queue', '1' );
+    $agent_root->submit;
+
+    $agent_root->content_contains('Create a new ticket', 'opened create ticket page');
+    my $form = $agent_root->form_name('TicketCreate');
+    my $input = $form->find_input('Owner');
+    is $input->value, RT->Nobody->Id, 'correct owner selected';
+    ok((not scalar grep { $_ == $user_a->Id } $input->possible_values), 'no user_a value in dropdown');
+    $form->value('Requestors', 'user_a at example.com');
+    $agent_root->submit;
+
+    $agent_root->content_like(qr/Ticket \d+ created in queue/i, 'created ticket');
+    my ($id) = ($agent_root->content =~ /Ticket (\d+) created in queue/);
+    ok $id, 'found id of the ticket';
+
+    my $ticket = RT::Ticket->new( RT->SystemUser );
+    $ticket->Load( $id );
+    ok $ticket->id, 'loaded the ticket';
+    is $ticket->Queue, '1', 'correct queue';
+    is $ticket->Owner, RT->Nobody->Id, 'correct owner';
+    is $ticket->RequestorAddresses, 'user_a at example.com', 'correct requestor';
+}
+
+diag "user_a doesn't appear in owner list after being made requestor";
+{
+    $agent_root->get("/Ticket/Modify.html?id=1");
+    my $form = $agent_root->form_name('TicketModify');
+    my $input = $form->find_input('Owner');
+    is $input->value, RT->Nobody->Id, 'correct owner selected';
+    ok((not scalar grep { $_ == $user_a->Id } $input->possible_values), 'no user_a value in dropdown');
+}
+

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


More information about the Rt-commit mailing list