[Rt-commit] rt branch, 4.0/transaction-batch-twice, updated. rt-4.0.2-139-gdee4d21
Kevin Falcone
falcone at bestpractical.com
Tue Oct 11 15:43:19 EDT 2011
The branch, 4.0/transaction-batch-twice has been updated
via dee4d21c7bbd8aead13f52000c675907fb261071 (commit)
from 1d6bfed3ad9e2e33a5af38e70cc067b169d01500 (commit)
Summary of changes:
t/web/transaction_batch.t | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit dee4d21c7bbd8aead13f52000c675907fb261071
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Tue Oct 11 15:42:01 2011 -0400
Add a test that confirms that the CurrentUser isn't changed
This avoids the bug which 2338cd19ed7a7f4c1e94f639ab2789d6586d01f3
was fixing when it introduced the new "run twice" bug.
diff --git a/t/web/transaction_batch.t b/t/web/transaction_batch.t
index 8c032d2..3d1db73 100644
--- a/t/web/transaction_batch.t
+++ b/t/web/transaction_batch.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 7;
+use RT::Test tests => 11;
my $q = RT::Test->load_or_create_queue ( Name => 'General' );
@@ -24,8 +24,23 @@ my ($tv,$ttv,$tm) = $ticket->Create(Queue => $q->Id,
);
ok($tv, $tm);
+my $testuser = RT::Test->load_or_create_user( Name => 'bob', EmailAddress => 'bob at example.com', Password => 'password' );
+ok($testuser->Id, "Created test user bob");
+
+ok( RT::Test->add_rights({ Principal => 'Privileged', Right => [qw(ShowTicket ModifyTicket SeeQueue)]}), 'Granted ticket management rights');
+
+my $test_current_user = RT::CurrentUser->new();
+$test_current_user->LoadByName($testuser->Name);
+my $api_test = RT::Ticket->new($test_current_user);
+$api_test->Load($ticket->Id);
+$api_test->SetTimeEstimated(12);
+$api_test->ApplyTransactionBatch;
+is($api_test->CurrentUser->UserObj->Name, $testuser->Name,"User didn't change running Transaction Batch scrips");
+$api_test->Load($api_test->Id);
+is($api_test->Priority,2,"Ticket priority updated");
+
my ($baseurl, $m) = RT::Test->started_ok;
-$m->login;
+$m->login('bob','password');
$m->get_ok("$baseurl/Ticket/Modify.html?id=".$ticket->Id);
$m->submit_form( form_name => 'TicketModify',
fields => { TimeEstimated => 5 }
@@ -33,4 +48,4 @@ $m->get_ok("$baseurl/Ticket/Modify.html?id=".$ticket->Id);
$ticket->Load($ticket->Id);
-is ($ticket->Priority , '2', "Ticket priority is set right");
+is ($ticket->Priority , 4, "Ticket priority is set right");
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list