[otrs-cvs] otrs/scripts/test/ProcessManagement/TransitionAction SLASet.t, 1.1, NONE TicketServiceSet.t, NONE, 1.1 TicketOwnerSet.t, NONE, 1.1 TicketArticleCreate.t, NONE, 1.1 StateSet.t, 1.6, NONE ServiceSet.t, 1.1, NONE ArticleCreate.t, 1.5, NONE QueueMove.t, 1.5, NONE OwnerSet.t, 1.5, NONE TicketQueueSet.t, NONE, 1.1 ResponsibleSet.t, 1.1, NONE TicketCustomerSet.t, NONE, 1.1 TicketResponsibleSet.t, NONE, 1.1 TicketStateSet.t, NONE, 1.1 CustomerSet.t, 1.5, NONE TicketLockSet.t, NONE, 1.1 TicketUnlock.t, 1.4, NONE TicketSLASet.t, NONE, 1.1
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/scripts/test/ProcessManagement/TransitionAction
In directory lancelot:/tmp/cvs-serv13698/scripts/test/ProcessManagement/TransitionAction
Added Files:
TicketServiceSet.t TicketOwnerSet.t TicketArticleCreate.t
TicketQueueSet.t TicketCustomerSet.t TicketResponsibleSet.t
TicketStateSet.t TicketLockSet.t TicketSLASet.t
Removed Files:
SLASet.t StateSet.t ServiceSet.t ArticleCreate.t QueueMove.t
OwnerSet.t ResponsibleSet.t CustomerSet.t TicketUnlock.t
Log Message:
Fixed bug#9032 - TransitionAction module name notation.
--- SLASet.t DELETED ---
Author: cr
--- NEW FILE: TicketServiceSet.t ---
# --
# TicketServiceSet.t - TicketServiceSet testscript
# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id: TicketServiceSet.t,v 1.1 2013/01/11 06:09:05 cr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
use strict;
use warnings;
use utf8;
use vars qw($Self);
use Kernel::Config;
use Kernel::System::UnitTest::Helper;
use Kernel::System::Ticket;
use Kernel::System::Service;
use Kernel::System::ProcessManagement::TransitionAction::TicketServiceSet;
use Kernel::System::VariableCheck qw(:all);
# create local objects
my $HelperObject = Kernel::System::UnitTest::Helper->new(
%{$Self},
UnitTestObject => $Self,
RestoreSystemConfiguration => 0,
);
my $ConfigObject = Kernel::Config->new();
my $TicketObject = Kernel::System::Ticket->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $ServiceObject = Kernel::System::Service->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $ModuleObject = Kernel::System::ProcessManagement::TransitionAction::TicketServiceSet->new(
%{$Self},
ConfigObject => $ConfigObject,
TicketObject => $TicketObject,
);
# define variables
my $UserID = 1;
my $ModuleName = 'TicketServiceSet';
my $RandomID = $HelperObject->GetRandomID();
# add a customer user
my $TestUserLogin = $HelperObject->TestCustomerUserCreate();
# ----------------------------------------
# Create new services
# ----------------------------------------
my @Services = (
{
Name => 'Service0' . $RandomID,
ValidID => 1,
UserID => 1,
},
{
Name => 'Service1' . $RandomID,
ValidID => 1,
UserID => 1,
},
{
Name => 'Service2' . $RandomID,
ValidID => 1,
UserID => 1,
},
);
for my $ServiceData (@Services) {
my $ServiceID = $ServiceObject->ServiceAdd( %{$ServiceData} );
# sanity test
$Self->IsNot(
$ServiceID,
undef,
"ServiceADD() for $ServiceData->{Name}, ServiceID should not be undef",
);
# store the ServiceID
$ServiceData->{ServiceID} = $ServiceID;
}
# ----------------------------------------
# ----------------------------------------
# Assign services to customer (0 and 1)
# ----------------------------------------
my $Success = $ServiceObject->CustomerUserServiceMemberAdd(
CustomerUserLogin => $TestUserLogin,
ServiceID => $Services[0]->{ServiceID},
Active => 1,
UserID => 1,
);
# sanity test
$Self->True(
$Success,
"CustomerUserServiceMemberAdd() for user $TestUserLogin, and Service $Services[0]->{Name}"
. " with true",
);
$Success = $ServiceObject->CustomerUserServiceMemberAdd(
CustomerUserLogin => $TestUserLogin,
ServiceID => $Services[1]->{ServiceID},
Active => 1,
UserID => 1,
);
# sanity test
$Self->True(
$Success,
"CustomerUserServiceMemberAdd() for user $TestUserLogin, and Service $Services[1]->{Name}"
. " with true",
);
# ----------------------------------------
# ----------------------------------------
# Create a test tickets
# ----------------------------------------
my $TicketID1 = $TicketObject->TicketCreate(
TN => undef,
Title => 'test',
QueueID => 1,
Lock => 'unlock',
Priority => '3 normal',
StateID => 1,
TypeID => 1,
Service => undef,
SLA => undef,
CustomerID => undef,
CustomerUser => $TestUserLogin,
OwnerID => 1,
ResponsibleID => 1,
ArchiveFlag => undef,
UserID => $UserID,
);
# sanity checks
$Self->True(
$TicketID1,
"TicketCreate() - $TicketID1",
);
my %Ticket1 = $TicketObject->TicketGet(
TicketID => $TicketID1,
UserID => $UserID,
);
$Self->True(
IsHashRefWithData( \%Ticket1 ),
"TicketGet() - Get Ticket with ID $TicketID1.",
);
my $TicketID2 = $TicketObject->TicketCreate(
TN => undef,
Title => 'test',
QueueID => 1,
Lock => 'unlock',
Priority => '3 normal',
StateID => 1,
TypeID => 1,
Service => undef,
SLA => undef,
CustomerID => undef,
CustomerUser => undef,
OwnerID => 1,
ResponsibleID => 1,
ArchiveFlag => undef,
UserID => $UserID,
);
# sanity checks
$Self->True(
$TicketID2,
"TicketCreate() - $TicketID2",
);
my %Ticket2 = $TicketObject->TicketGet(
TicketID => $TicketID2,
UserID => $UserID,
);
$Self->True(
IsHashRefWithData( \%Ticket2 ),
"TicketGet() - Get Ticket with ID $TicketID2.",
);
# ----------------------------------------
# Run() tests
my @Tests = (
{
Name => 'No Params',
Config => undef,
Success => 0,
},
{
Name => 'No UserID',
Config => {
UserID => undef,
Ticket => \%Ticket1,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Ticket',
Config => {
UserID => $UserID,
Ticket => undef,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {},
},
Success => 0,
},
{
Name => 'Wrong Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
NoAgentNotify => 0,
},
},
Success => 0,
},
{
Name => 'Wrong Ticket Format',
Config => {
UserID => $UserID,
Ticket => 1,
Config => {
Service => 'open',
},
},
Success => 0,
},
{
Name => 'Wrong Config Format',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => 1,
},
Success => 0,
},
{
Name => 'Wrong Service',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
Service => 'NotExisting' . $RandomID,
},
},
Success => 0,
},
{
Name => 'Wrong ServiceID',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
ServiceID => 'NotExisting' . $RandomID,
},
},
Success => 0,
},
{
Name => 'Not assigned Service',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
Service => $Services[2]->{Name},
},
},
Success => 0,
},
{
Name => 'Not Assigned ServiceID',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
ServiceID => $Services[2]->{ServiceID},
},
},
Success => 0,
},
{
Name => "Ticket without customer with Service $Services[0]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket2,
Config => {
ServiceID => $Services[0]->{Name},
},
},
Success => 0,
},
{
Name => "Ticket without customer with ServiceID $Services[1]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket2,
Config => {
ServiceID => $Services[0]->{ServiceID},
},
},
Success => 0,
},
{
Name => "Correct Service $Services[0]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
Service => $Services[0]->{Name},
},
},
Success => 1,
},
{
Name => "Correct Service $Services[1]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
Service => $Services[1]->{Name},
},
},
Success => 1,
},
{
Name => "Correct ServiceID $Services[0]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
ServiceID => $Services[0]->{ServiceID},
},
},
Success => 1,
},
{
Name => "Correct ServiceID $Services[1]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
ServiceID => $Services[0]->{ServiceID},
},
},
Success => 1,
},
);
for my $Test (@Tests) {
my $Success = $ModuleObject->Run( %{ $Test->{Config} } );
if ( $Test->{Success} ) {
$Self->True(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with True"
);
# get ticket
my $TicketID = $TicketID1;
if ( $Test->{Config}->{Ticket}->{TicketID} eq $TicketID2 ) {
$TicketID = $TicketID2;
}
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => 1,
);
ATTRIBUTE:
for my $Attribute ( sort keys %{ $Test->{Config}->{Config} } ) {
$Self->True(
$Ticket{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID exists with True",
);
$Self->Is(
$Ticket{$Attribute},
$Test->{Config}->{Config}->{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID match expected value",
);
}
}
else {
$Self->False(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with False"
);
}
}
#-----------------------------------------
# Destructors to remove our Testitems
# ----------------------------------------
# Tickets
my $Delete = $TicketObject->TicketDelete(
TicketID => $TicketID1,
UserID => 1,
);
$Self->True(
$Delete,
"TicketDelete() - $TicketID2",
);
$Delete = $TicketObject->TicketDelete(
TicketID => $TicketID1,
UserID => 1,
);
$Self->True(
$Delete,
"TicketDelete() - $TicketID2",
);
# Services
for my $ServiceData (@Services) {
my $Success = $ServiceObject->ServiceUpdate(
%{$ServiceData},
ValidID => 2,
);
# sanity test
$Self->True(
$Success,
"ServiceUpdate() for $ServiceData->{Name}, Set service to invalid with true",
);
}
# ----------------------------------------
1;
Author: cr
--- NEW FILE: TicketOwnerSet.t ---
# --
# TicketOwnerSet.t - TicketOwnerSet testscript
# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
# --
# $Id: TicketOwnerSet.t,v 1.1 2013/01/11 06:09:05 cr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
use strict;
use warnings;
use utf8;
use vars qw($Self);
use Kernel::Config;
use Kernel::System::UnitTest::Helper;
use Kernel::System::Ticket;
use Kernel::System::User;
use Kernel::System::ProcessManagement::TransitionAction::TicketOwnerSet;
use Kernel::System::VariableCheck qw(:all);
# create local objects
my $HelperObject = Kernel::System::UnitTest::Helper->new(
%{$Self},
UnitTestObject => $Self,
RestoreSystemConfiguration => 0,
);
my $ConfigObject = Kernel::Config->new();
my $UserObject = Kernel::System::User->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $TicketObject = Kernel::System::Ticket->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $ModuleObject = Kernel::System::ProcessManagement::TransitionAction::TicketOwnerSet->new(
%{$Self},
ConfigObject => $ConfigObject,
TicketObject => $TicketObject,
);
# define variables
my $UserID = 1;
my $ModuleName = 'TicketOwnerSet';
my $RandomID = $HelperObject->GetRandomID();
# set user details
my $TestUserLogin = $HelperObject->TestUserCreate();
my $TestUserID = $UserObject->UserLookup(
UserLogin => $TestUserLogin,
);
# ----------------------------------------
# Create a test ticket
# ----------------------------------------
my $TicketID = $TicketObject->TicketCreate(
TN => undef,
Title => 'test',
QueueID => 1,
Lock => 'unlock',
Priority => '3 normal',
StateID => 1,
TypeID => 1,
Service => undef,
SLA => undef,
CustomerID => undef,
CustomerUser => undef,
OwnerID => 1,
ResponsibleID => 1,
ArchiveFlag => undef,
UserID => $UserID,
);
# sanity checks
$Self->True(
$TicketID,
"TicketCreate() - $TicketID",
);
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => $UserID,
);
$Self->True(
IsHashRefWithData( \%Ticket ),
"TicketGet() - Get Ticket with ID $TicketID.",
);
# Run() tests
my @Tests = (
{
Name => 'No Params',
Config => undef,
Success => 0,
},
{
Name => 'No UserID',
Config => {
UserID => undef,
Ticket => \%Ticket,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Ticket',
Config => {
UserID => $UserID,
Ticket => undef,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {},
},
Success => 0,
},
{
Name => 'Wrong Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
NoAgentNotify => 0,
},
},
Success => 0,
},
{
Name => 'Wrong Ticket Format',
Config => {
UserID => $UserID,
Ticket => 1,
Config => {
Owner => $TestUserLogin,
},
},
Success => 0,
},
{
Name => 'Wrong Config Format',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => 1,
},
Success => 0,
},
# This tests are disabled since MySQL is more tolerant to NULL
# TicketOwnerSet should verify if the NewUserID has a value to set
# {
# Name => 'Wrong Owner',
# Config => {
# UserID => $UserID,
# Ticket => \%Ticket,
# Config => {
# Owner => 'NotExisting' . $RandomID,
# },
# },
# Success => 0,
# },
# {
# Name => 'Wrong OwnerID',
# Config => {
# UserID => $UserID,
# Ticket => \%Ticket,
# Config => {
# OwnerID => 'NotExisting' . $RandomID,
# },
# },
# Success => 0,
# },
{
Name => 'Correct Owner TestUser',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
Owner => $TestUserLogin,
},
},
Success => 1,
},
{
Name => 'Correct Owner root@localhost',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
Owner => 'root@localhost',
},
},
Success => 1,
},
{
Name => 'Correct OwnerID TestUser',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
OwnerID => $TestUserID,
},
},
Success => 1,
},
{
Name => 'Correct OwnerID root@localhost',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
OwnerID => 1,
},
},
Success => 1,
},
);
for my $Test (@Tests) {
my $Success = $ModuleObject->Run( %{ $Test->{Config} } );
if ( $Test->{Success} ) {
$Self->True(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with True"
);
# get ticket
%Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => 1,
);
ATTRIBUTE:
for my $Attribute ( sort keys %{ $Test->{Config}->{Config} } ) {
$Self->True(
$Ticket{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID exists with True",
);
$Self->Is(
$Ticket{$Attribute},
$Test->{Config}->{Config}->{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID match expected value",
);
}
}
else {
$Self->False(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with False"
);
}
}
# ----------------------------------------
#-----------------------------------------
# Destructors to remove our Testitems
# ----------------------------------------
# Ticket
my $Delete = $TicketObject->TicketDelete(
TicketID => $TicketID,
UserID => 1,
);
$Self->True(
$Delete,
"TicketDelete() - $TicketID",
);
# ----------------------------------------
1;
Author: cr
--- NEW FILE: TicketArticleCreate.t ---
# --
# TicketArticleCreate.t - TicketArticleCreate testscript
# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
# --
# $Id: TicketArticleCreate.t,v 1.1 2013/01/11 06:09:05 cr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
use strict;
use warnings;
use utf8;
use vars qw($Self);
use Kernel::Config;
use Kernel::System::UnitTest::Helper;
use Kernel::System::Ticket;
use Kernel::System::ProcessManagement::TransitionAction::TicketArticleCreate;
use Kernel::System::VariableCheck qw(:all);
# create local objects
my $HelperObject = Kernel::System::UnitTest::Helper->new(
%{$Self},
UnitTestObject => $Self,
RestoreSystemConfiguration => 0,
);
my $ConfigObject = Kernel::Config->new();
my $TicketObject = Kernel::System::Ticket->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $ModuleObject = Kernel::System::ProcessManagement::TransitionAction::TicketArticleCreate->new(
%{$Self},
ConfigObject => $ConfigObject,
TicketObject => $TicketObject,
);
# define variables
my $UserID = 1;
my $ModuleName = 'TicketArticleCreate';
# ----------------------------------------
# Create a test ticket
# ----------------------------------------
my $TicketID = $TicketObject->TicketCreate(
TN => undef,
Title => 'test',
QueueID => 1,
Lock => 'unlock',
Priority => '3 normal',
StateID => 1,
TypeID => 1,
Service => undef,
SLA => undef,
CustomerID => undef,
CustomerUser => undef,
OwnerID => 1,
ResponsibleID => 1,
ArchiveFlag => undef,
UserID => $UserID,
);
# sanity checks
$Self->True(
$TicketID,
"TicketCreate() - $TicketID",
);
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => $UserID,
);
$Self->True(
IsHashRefWithData( \%Ticket ),
"TicketGet() - Get Ticket with ID $TicketID.",
);
# ----------------------------------------
# Run() tests
my @Tests = (
{
Name => 'No Params',
Config => undef,
Success => 0,
},
{
Name => 'No UserID',
Config => {
UserID => undef,
Ticket => \%Ticket,
Config => {
ArticleType => 'note-internal',
SenderType => 'agent',
ContentType => 'text/plain; charset=ISO-8859-15',
Subject => 'some short description',
Body => 'the message text',
HistoryType => 'OwnerUpdate',
HistoryComment => 'Some free text!',
From => 'Some Agent <[email protected]>',
To => 'Some Customer A <[email protected]>',
Cc => 'Some Customer B <[email protected]>',
ReplyTo => 'Some Customer B <[email protected]>',
MessageID => '<[email protected]>',
InReplyTo => '<[email protected]>',
References =>
'<[email protected]> <[email protected]>',
NoAgentNotify => 0,
AutoResponseType => 'auto reply',
ForceNotificationToUserID => [ 1, 43, 56, ],
ExcludeNotificationToUserID => [ 43, 56, ],
ExcludeMuteNotificationToUserID => [ 43, 56, ],
},
},
Success => 0,
},
{
Name => 'No Ticket',
Config => {
UserID => $UserID,
Ticket => undef,
Config => {
ArticleType => 'note-internal',
SenderType => 'agent',
ContentType => 'text/plain; charset=ISO-8859-15',
Subject => 'some short description',
Body => 'the message text',
HistoryType => 'OwnerUpdate',
HistoryComment => 'Some free text!',
From => 'Some Agent <[email protected]>',
To => 'Some Customer A <[email protected]>',
Cc => 'Some Customer B <[email protected]>',
ReplyTo => 'Some Customer B <[email protected]>',
MessageID => '<[email protected]>',
InReplyTo => '<[email protected]>',
References =>
'<[email protected]> <[email protected]>',
NoAgentNotify => 0,
AutoResponseType => 'auto reply',
ForceNotificationToUserID => [ 1, 43, 56, ],
ExcludeNotificationToUserID => [ 43, 56, ],
ExcludeMuteNotificationToUserID => [ 43, 56, ],
},
},
Success => 0,
},
{
Name => 'No Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {},
},
Success => 0,
},
{
Name => 'Wrong Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
NoAgentNotify => 0,
},
},
Success => 0,
},
{
Name => 'Wrong Ticket Format',
Config => {
UserID => $UserID,
Ticket => 1,
Config => {
NoAgentNotify => 0,
},
},
Success => 0,
},
{
Name => 'Wrong Config Format',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => 1,
},
Success => 0,
},
{
Name => 'Correct ASCII',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
ArticleType => 'note-internal',
SenderType => 'agent',
ContentType => 'text/plain; charset=ISO-8859-15',
Subject => 'some short description',
Body => 'the message text',
HistoryType => 'OwnerUpdate',
HistoryComment => 'Some free text!',
From => 'Some Agent <[email protected]>',
To => 'Some Customer A <[email protected]>',
Cc => 'Some Customer B <[email protected]>',
ReplyTo => 'Some Customer B <[email protected]>',
MessageID => '<[email protected]>',
InReplyTo => '<[email protected]>',
References =>
'<[email protected]> <[email protected]>',
NoAgentNotify => 0,
ForceNotificationToUserID => [ 1, 43, 56, ],
ExcludeNotificationToUserID => [ 43, 56, ],
ExcludeMuteNotificationToUserID => [ 43, 56, ],
},
},
Success => 1,
},
{
Name => 'Correct UTF8',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
ArticleType => 'note-internal',
SenderType => 'agent',
ContentType => 'text/plain; charset=ISO-8859-15',
Subject =>
'äöüßÄÖÜ€исáéíúóúÁÉÍÓÚñÑ-カスタ-用迎使用-Язык',
Body =>
'äöüßÄÖÜ€исáéíúóúÁÉÍÓÚñÑ-カスタ-用迎使用-Язык',
HistoryType => 'OwnerUpdate',
HistoryComment => 'Some free text!',
From => 'Some Agent <[email protected]>',
To => 'Some Customer A <[email protected]>',
Cc => 'Some Customer B <[email protected]>',
ReplyTo => 'Some Customer B <[email protected]>',
MessageID => '<[email protected]>',
InReplyTo => '<[email protected]>',
References =>
'<[email protected]> <[email protected]>',
NoAgentNotify => 0,
ForceNotificationToUserID => [ 1, 43, 56, ],
ExcludeNotificationToUserID => [ 43, 56, ],
ExcludeMuteNotificationToUserID => [ 43, 56, ],
},
},
Success => 1,
},
);
my %ExcludedArtributes = (
HistoryType => 1,
HistoryComment => 1,
ExcludeNotificationToUserID => 1,
ForceNotificationToUserID => 1,
NoAgentNotify => 1,
ExcludeMuteNotificationToUserID => 1,
AutoResponseType => 1,
);
for my $Test (@Tests) {
my $Success = $ModuleObject->Run( %{ $Test->{Config} } );
if ( $Test->{Success} ) {
$Self->True(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with True"
);
# get last article
my @ArticleIDs = $TicketObject->ArticleIndex(
TicketID => $TicketID,
);
my %Article = $TicketObject->ArticleGet(
ArticleID => $ArticleIDs[-1],
UserID => 1,
);
ATTRIBUTE:
for my $Attribute ( sort keys %{ $Test->{Config}->{Config} } ) {
next ATTRIBUTE if $ExcludedArtributes{$Attribute};
$Self->True(
$Article{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for ArticleID:"
. " $Article{ArticleID} exists with True",
);
$Self->Is(
$Article{$Attribute},
$Test->{Config}->{Config}->{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for ArticleID:"
. " $Article{ArticleID} match expected value",
);
}
}
else {
$Self->False(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with False"
);
}
}
#-----------------------------------------
# Destructors to remove our Testitems
# ----------------------------------------
# Ticket
my $Delete = $TicketObject->TicketDelete(
TicketID => $TicketID,
UserID => 1,
);
$Self->True(
$Delete,
"TicketDelete() - $TicketID",
);
# ----------------------------------------
1;
--- StateSet.t DELETED ---
--- ServiceSet.t DELETED ---
--- ArticleCreate.t DELETED ---
--- QueueMove.t DELETED ---
--- OwnerSet.t DELETED ---
Author: cr
--- NEW FILE: TicketQueueSet.t ---
# --
# TicketQueueSet.t - TicketQueueSet testscript
# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
# --
# $Id: TicketQueueSet.t,v 1.1 2013/01/11 06:09:05 cr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
use strict;
use warnings;
use utf8;
use vars qw($Self);
use Kernel::Config;
use Kernel::System::UnitTest::Helper;
use Kernel::System::Ticket;
use Kernel::System::User;
use Kernel::System::ProcessManagement::TransitionAction::TicketQueueSet;
use Kernel::System::VariableCheck qw(:all);
# create local objects
my $HelperObject = Kernel::System::UnitTest::Helper->new(
%{$Self},
UnitTestObject => $Self,
RestoreSystemConfiguration => 0,
);
my $ConfigObject = Kernel::Config->new();
my $TicketObject = Kernel::System::Ticket->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $ModuleObject = Kernel::System::ProcessManagement::TransitionAction::TicketQueueSet->new(
%{$Self},
ConfigObject => $ConfigObject,
TicketObject => $TicketObject,
);
# define variables
my $UserID = 1;
my $ModuleName = 'TicketQueueSet';
my $RandomID = $HelperObject->GetRandomID();
# ----------------------------------------
# Create a test ticket
# ----------------------------------------
my $TicketID = $TicketObject->TicketCreate(
TN => undef,
Title => 'test',
QueueID => 1,
Lock => 'unlock',
Priority => '3 normal',
StateID => 1,
TypeID => 1,
Service => undef,
SLA => undef,
CustomerID => undef,
CustomerUser => undef,
OwnerID => 1,
ResponsibleID => 1,
ArchiveFlag => undef,
UserID => $UserID,
);
# sanity checks
$Self->True(
$TicketID,
"TicketCreate() - $TicketID",
);
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => $UserID,
);
$Self->True(
IsHashRefWithData( \%Ticket ),
"TicketGet() - Get Ticket with ID $TicketID.",
);
# ----------------------------------------
# Run() tests
my @Tests = (
{
Name => 'No Params',
Config => undef,
Success => 0,
},
{
Name => 'No UserID',
Config => {
UserID => undef,
Ticket => \%Ticket,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Ticket',
Config => {
UserID => $UserID,
Ticket => undef,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {},
},
Success => 0,
},
{
Name => 'Wrong Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
NoAgentNotify => 0,
},
},
Success => 0,
},
{
Name => 'Wrong Ticket Format',
Config => {
UserID => $UserID,
Ticket => 1,
Config => {
TargetQueue => 'Raw',
},
},
Success => 0,
},
{
Name => 'Wrong Config Format',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => 1,
},
Success => 0,
},
{
Name => 'Wrong Queue',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
TargetQueue => 'NotExisting' . $RandomID,
},
},
Success => 0,
},
{
Name => 'Wrong QueueID',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
TargetQueueID => 'NotExisting' . $RandomID,
},
},
Success => 0,
},
{
Name => 'Correct Queue Raw',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
TargetQueue => 'Raw',
},
},
Success => 1,
},
{
Name => 'Correct Queue Junk',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
TargetQueue => 'Junk',
},
},
Success => 1,
},
{
Name => 'Correct QueueID Raw',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
TargetQueueID => 2,
},
},
Success => 1,
},
{
Name => 'Correct QueueID Junk',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
TargetQueueID => 3,
},
},
Success => 1,
},
);
for my $Test (@Tests) {
my $Success = $ModuleObject->Run( %{ $Test->{Config} } );
if ( $Test->{Success} ) {
$Self->True(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with True"
);
# get ticket
%Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => 1,
);
ATTRIBUTE:
for my $Attribute ( sort keys %{ $Test->{Config}->{Config} } ) {
# set attributes to easy compare
$Ticket{TargetQueue} = $Ticket{Queue} || undef;
$Ticket{TargetQueueID} = $Ticket{QueueID} || undef;
$Self->True(
$Ticket{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID exists with True",
);
$Self->Is(
$Ticket{$Attribute},
$Test->{Config}->{Config}->{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID match expected value",
);
}
}
else {
$Self->False(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with False"
);
}
}
#-----------------------------------------
# Destructors to remove our Testitems
# ----------------------------------------
# Ticket
my $Delete = $TicketObject->TicketDelete(
TicketID => $TicketID,
UserID => 1,
);
$Self->True(
$Delete,
"TicketDelete() - $TicketID",
);
# ----------------------------------------
1;
--- ResponsibleSet.t DELETED ---
Author: cr
--- NEW FILE: TicketCustomerSet.t ---
# --
# TicketCustomerSet.t - TicketCustomerSet testscript
# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
# --
# $Id: TicketCustomerSet.t,v 1.1 2013/01/11 06:09:05 cr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
use strict;
use warnings;
use utf8;
use vars qw($Self);
use Kernel::Config;
use Kernel::System::UnitTest::Helper;
use Kernel::System::Ticket;
use Kernel::System::ProcessManagement::TransitionAction::TicketCustomerSet;
use Kernel::System::VariableCheck qw(:all);
# create local objects
my $HelperObject = Kernel::System::UnitTest::Helper->new(
%{$Self},
UnitTestObject => $Self,
RestoreSystemConfiguration => 0,
);
my $ConfigObject = Kernel::Config->new();
my $TicketObject = Kernel::System::Ticket->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $ModuleObject = Kernel::System::ProcessManagement::TransitionAction::TicketCustomerSet->new(
%{$Self},
ConfigObject => $ConfigObject,
TicketObject => $TicketObject,
);
# define variables
my $UserID = 1;
my $ModuleName = 'TicketCustomerSet';
# ----------------------------------------
# Create a test ticket
# ----------------------------------------
my $TicketID = $TicketObject->TicketCreate(
TN => undef,
Title => 'test',
QueueID => 1,
Lock => 'unlock',
Priority => '3 normal',
StateID => 1,
TypeID => 1,
Service => undef,
SLA => undef,
CustomerID => undef,
CustomerUser => undef,
OwnerID => 1,
ResponsibleID => 1,
ArchiveFlag => undef,
UserID => $UserID,
);
# sanity checks
$Self->True(
$TicketID,
"TicketCreate() - $TicketID",
);
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => $UserID,
);
$Self->True(
IsHashRefWithData( \%Ticket ),
"TicketGet() - Get Ticket with ID $TicketID.",
);
# ----------------------------------------
# Run() tests
my @Tests = (
{
Name => 'No Params',
Config => undef,
Success => 0,
},
{
Name => 'No UserID',
Config => {
UserID => undef,
Ticket => \%Ticket,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Ticket',
Config => {
UserID => $UserID,
Ticket => undef,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {},
},
Success => 0,
},
{
Name => 'Wrong Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
NoAgentNotify => 0,
},
},
Success => 0,
},
{
Name => 'Wrong Ticket Format',
Config => {
UserID => $UserID,
Ticket => 1,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'Wrong Config Format',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => 1,
},
Success => 0,
},
{
Name => 'Correct ASCII CustomerID',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
CustomerID => 'test',
},
},
Success => 1,
},
{
Name => 'Correct ASCII CustomerUserID',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
CustomerID => 'test',
},
},
Success => 1,
},
{
Name => 'Correct ASCII No',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
No => 'test',
},
},
Success => 1,
},
{
Name => 'Correct ASCII User',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
User => '#',
},
},
Success => 1,
},
{
Name => 'Correct UTF8 CustomerID',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
CustomerID =>
'äöüßÄÖÜ€исáéíúóúÁÉÍÓÚñÑ-カスタ-用迎使用-Язык',
},
},
Success => 1,
},
{
Name => 'Correct UTF8 CustomerUserID',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
CustomerUserID =>
'äöüßÄÖÜ€исáéíúóúÁÉÍÓÚñÑ-カスタ-用迎使用-Язык',
},
},
Success => 1,
},
);
for my $Test (@Tests) {
my $Success = $ModuleObject->Run( %{ $Test->{Config} } );
if ( $Test->{Success} ) {
$Self->True(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with True"
);
# get ticket
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => 1,
);
# set Attributes No as CustomerID and User as CustomerUserID
$Ticket{No} = $Ticket{CustomerID} || '';
$Ticket{User} = $Ticket{CustomerUserID} || '';
ATTRIBUTE:
for my $Attribute ( sort keys %{ $Test->{Config}->{Config} } ) {
$Self->True(
$Ticket{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID exists with True",
);
$Self->Is(
$Ticket{$Attribute},
$Test->{Config}->{Config}->{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID match expected value",
);
}
}
else {
$Self->False(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with False"
);
}
}
#-----------------------------------------
# Destructors to remove our Testitems
# ----------------------------------------
# Ticket
my $Delete = $TicketObject->TicketDelete(
TicketID => $TicketID,
UserID => 1,
);
$Self->True(
$Delete,
"TicketDelete() - $TicketID",
);
# ----------------------------------------
1;
Author: cr
--- NEW FILE: TicketResponsibleSet.t ---
# --
# TicketResponsibleSet.t - TicketResponsibleSet testscript
# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id: TicketResponsibleSet.t,v 1.1 2013/01/11 06:09:05 cr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
use strict;
use warnings;
use utf8;
use vars qw($Self);
use Kernel::Config;
use Kernel::System::UnitTest::Helper;
use Kernel::System::Ticket;
use Kernel::System::User;
use Kernel::System::ProcessManagement::TransitionAction::TicketResponsibleSet;
use Kernel::System::VariableCheck qw(:all);
# create local objects
my $HelperObject = Kernel::System::UnitTest::Helper->new(
%{$Self},
UnitTestObject => $Self,
RestoreSystemConfiguration => 0,
);
my $ConfigObject = Kernel::Config->new();
my $UserObject = Kernel::System::User->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $TicketObject = Kernel::System::Ticket->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $ModuleObject = Kernel::System::ProcessManagement::TransitionAction::TicketResponsibleSet->new(
%{$Self},
ConfigObject => $ConfigObject,
TicketObject => $TicketObject,
);
# define variables
my $UserID = 1;
my $ModuleName = 'TicketResponsibleSet';
my $RandomID = $HelperObject->GetRandomID();
# set user details
my $TestUserLogin = $HelperObject->TestUserCreate();
my $TestUserID = $UserObject->UserLookup(
UserLogin => $TestUserLogin,
);
# ----------------------------------------
# Create a test ticket
# ----------------------------------------
my $TicketID = $TicketObject->TicketCreate(
TN => undef,
Title => 'test',
QueueID => 1,
Lock => 'unlock',
Priority => '3 normal',
StateID => 1,
TypeID => 1,
Service => undef,
SLA => undef,
CustomerID => undef,
CustomerUser => undef,
OwnerID => 1,
ResponsibleID => 1,
ArchiveFlag => undef,
UserID => $UserID,
);
# sanity checks
$Self->True(
$TicketID,
"TicketCreate() - $TicketID",
);
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => $UserID,
);
$Self->True(
IsHashRefWithData( \%Ticket ),
"TicketGet() - Get Ticket with ID $TicketID.",
);
# Run() tests
my @Tests = (
{
Name => 'No Params',
Config => undef,
Success => 0,
},
{
Name => 'No UserID',
Config => {
UserID => undef,
Ticket => \%Ticket,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Ticket',
Config => {
UserID => $UserID,
Ticket => undef,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {},
},
Success => 0,
},
{
Name => 'Wrong Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
NoAgentNotify => 0,
},
},
Success => 0,
},
{
Name => 'Wrong Ticket Format',
Config => {
UserID => $UserID,
Ticket => 1,
Config => {
Responsible => $TestUserLogin,
},
},
Success => 0,
},
{
Name => 'Wrong Config Format',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => 1,
},
Success => 0,
},
# This tests are disabled since MySQL is more tolerant to NULL
# TicketResponsibleSet should verify if the NewUserID has a value to set
# {
# Name => 'Wrong Responsible',
# Config => {
# UserID => $UserID,
# Ticket => \%Ticket,
# Config => {
# Responsible => 'NotExisting' . $RandomID,
# },
# },
# Success => 0,
# },
# {
# Name => 'Wrong ResponsibleID',
# Config => {
# UserID => $UserID,
# Ticket => \%Ticket,
# Config => {
# ResponsibleID => 'NotExisting' . $RandomID,
# },
# },
# Success => 0,
# },
{
Name => 'Correct Responsible TestUser',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
Responsible => $TestUserLogin,
},
},
Success => 1,
},
{
Name => 'Correct Responsible root@localhost',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
Responsible => 'root@localhost',
},
},
Success => 1,
},
{
Name => 'Correct ResponsibleID TestUser',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
ResponsibleID => $TestUserID,
},
},
Success => 1,
},
{
Name => 'Correct ResponsibleID root@localhost',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
ResponsibleID => 1,
},
},
Success => 1,
},
);
for my $Test (@Tests) {
my $Success = $ModuleObject->Run( %{ $Test->{Config} } );
if ( $Test->{Success} ) {
$Self->True(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with True"
);
# get ticket
%Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => 1,
);
ATTRIBUTE:
for my $Attribute ( sort keys %{ $Test->{Config}->{Config} } ) {
$Self->True(
$Ticket{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID exists with True",
);
$Self->Is(
$Ticket{$Attribute},
$Test->{Config}->{Config}->{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID match expected value",
);
}
}
else {
$Self->False(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with False"
);
}
}
# ----------------------------------------
#-----------------------------------------
# Destructors to remove our Testitems
# ----------------------------------------
# Ticket
my $Delete = $TicketObject->TicketDelete(
TicketID => $TicketID,
UserID => 1,
);
$Self->True(
$Delete,
"TicketDelete() - $TicketID",
);
# ----------------------------------------
1;
Author: cr
--- NEW FILE: TicketStateSet.t ---
# --
# TicketStateSet.t - TicketStateSet testscript
# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id: TicketStateSet.t,v 1.1 2013/01/11 06:09:05 cr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
use strict;
use warnings;
use utf8;
use vars qw($Self);
use Kernel::Config;
use Kernel::System::UnitTest::Helper;
use Kernel::System::Ticket;
use Kernel::System::ProcessManagement::TransitionAction::TicketStateSet;
use Kernel::System::VariableCheck qw(:all);
# create local objects
my $HelperObject = Kernel::System::UnitTest::Helper->new(
%{$Self},
UnitTestObject => $Self,
RestoreSystemConfiguration => 0,
);
my $ConfigObject = Kernel::Config->new();
my $TicketObject = Kernel::System::Ticket->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $ModuleObject = Kernel::System::ProcessManagement::TransitionAction::TicketStateSet->new(
%{$Self},
ConfigObject => $ConfigObject,
TicketObject => $TicketObject,
);
# define variables
my $UserID = 1;
my $ModuleName = 'TicketStateSet';
my $RandomID = $HelperObject->GetRandomID();
# ----------------------------------------
# Create a test ticket
# ----------------------------------------
my $TicketID = $TicketObject->TicketCreate(
TN => undef,
Title => 'test',
QueueID => 1,
Lock => 'unlock',
Priority => '3 normal',
StateID => 1,
TypeID => 1,
Service => undef,
SLA => undef,
CustomerID => undef,
CustomerUser => undef,
OwnerID => 1,
ResponsibleID => 1,
ArchiveFlag => undef,
UserID => $UserID,
);
# sanity checks
$Self->True(
$TicketID,
"TicketCreate() - $TicketID",
);
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => $UserID,
);
$Self->True(
IsHashRefWithData( \%Ticket ),
"TicketGet() - Get Ticket with ID $TicketID.",
);
# ----------------------------------------
# Run() tests
my @Tests = (
{
Name => 'No Params',
Config => undef,
Success => 0,
},
{
Name => 'No UserID',
Config => {
UserID => undef,
Ticket => \%Ticket,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Ticket',
Config => {
UserID => $UserID,
Ticket => undef,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {},
},
Success => 0,
},
{
Name => 'Wrong Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
NoAgentNotify => 0,
},
},
Success => 0,
},
{
Name => 'Wrong Ticket Format',
Config => {
UserID => $UserID,
Ticket => 1,
Config => {
State => 'open',
},
},
Success => 0,
},
{
Name => 'Wrong Config Format',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => 1,
},
Success => 0,
},
{
Name => 'Wrong State',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
State => 'NotExisting' . $RandomID,
},
},
Success => 0,
},
{
Name => 'Wrong StateID',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
StateID => 'NotExisting' . $RandomID,
},
},
Success => 0,
},
{
Name => 'Correct State open',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
State => 'open',
},
},
Success => 1,
},
{
Name => 'Correct State closed successful',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
State => 'closed successful',
},
},
Success => 1,
},
{
Name => 'Correct StateID open',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
StateID => 4,
},
},
Success => 1,
},
{
Name => 'Correct StateID closed successful',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
StateID => 2,
},
},
Success => 1,
},
);
for my $Test (@Tests) {
my $Success = $ModuleObject->Run( %{ $Test->{Config} } );
if ( $Test->{Success} ) {
$Self->True(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with True"
);
# get ticket
%Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => 1,
);
ATTRIBUTE:
for my $Attribute ( sort keys %{ $Test->{Config}->{Config} } ) {
$Self->True(
$Ticket{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID exists with True",
);
$Self->Is(
$Ticket{$Attribute},
$Test->{Config}->{Config}->{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID match expected value",
);
}
}
else {
$Self->False(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with False"
);
}
}
#-----------------------------------------
# Destructors to remove our Testitems
# ----------------------------------------
# Ticket
my $Delete = $TicketObject->TicketDelete(
TicketID => $TicketID,
UserID => 1,
);
$Self->True(
$Delete,
"TicketDelete() - $TicketID",
);
# ----------------------------------------
1;
--- CustomerSet.t DELETED ---
Author: cr
--- NEW FILE: TicketLockSet.t ---
# --
# TicketLockSet.t - TicketLockSet testscript
# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
# --
# $Id: TicketLockSet.t,v 1.1 2013/01/11 06:09:05 cr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
use strict;
use warnings;
use utf8;
use vars qw($Self);
use Kernel::Config;
use Kernel::System::UnitTest::Helper;
use Kernel::System::Ticket;
use Kernel::System::ProcessManagement::TransitionAction::TicketLockSet;
use Kernel::System::VariableCheck qw(:all);
# create local objects
my $HelperObject = Kernel::System::UnitTest::Helper->new(
%{$Self},
UnitTestObject => $Self,
RestoreSystemConfiguration => 0,
);
my $ConfigObject = Kernel::Config->new();
my $TicketObject = Kernel::System::Ticket->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $ModuleObject = Kernel::System::ProcessManagement::TransitionAction::TicketLockSet->new(
%{$Self},
ConfigObject => $ConfigObject,
TicketObject => $TicketObject,
);
# define variables
my $UserID = 1;
my $ModuleName = 'TicketLockSet';
my $RandomID = $HelperObject->GetRandomID();
# ----------------------------------------
# Create a test ticket
# ----------------------------------------
my $TicketID = $TicketObject->TicketCreate(
TN => undef,
Title => 'test',
QueueID => 1,
Lock => 'lock', # This value is specially important for this test
Priority => '3 normal',
StateID => 1,
TypeID => 1,
Service => undef,
SLA => undef,
CustomerID => undef,
CustomerUser => undef,
OwnerID => 1,
ResponsibleID => 1,
ArchiveFlag => undef,
UserID => $UserID,
);
# sanity checks
$Self->True(
$TicketID,
"TicketCreate() - $TicketID",
);
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => $UserID,
);
$Self->True(
IsHashRefWithData( \%Ticket ),
"TicketGet() - Get Ticket with ID $TicketID.",
);
# ----------------------------------------
# Run() tests
my @Tests = (
{
Name => 'No Params',
Config => undef,
Success => 0,
},
{
Name => 'No UserID',
Config => {
UserID => undef,
Ticket => \%Ticket,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Ticket',
Config => {
UserID => $UserID,
Ticket => undef,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {},
},
Success => 0,
},
{
Name => 'Wrong Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
NoAgentNotify => 0,
},
},
Success => 0,
},
{
Name => 'Wrong Ticket Format',
Config => {
UserID => $UserID,
Ticket => 1,
Config => {
Lock => 'lock',
},
},
Success => 0,
},
{
Name => 'Wrong Config Format',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => 1,
},
Success => 0,
},
{
Name => 'Wrong Lock',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
Lock => 'NotExisting' . $RandomID,
},
},
Success => 0,
},
{
Name => 'Wrong LockID',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
LockID => 'NotExisting' . $RandomID,
},
},
Success => 0,
},
{
Name => 'Correct Lock unlock',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
Lock => 'unlock',
},
},
Success => 1,
},
{
Name => 'Correct Lock lock',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
Lock => 'lock',
},
},
Success => 1,
},
{
Name => 'Correct LockID unlock',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
LockID => 1,
},
},
Success => 1,
},
{
Name => 'Correct LockID lock',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
LockID => 2,
},
},
Success => 1,
},
);
for my $Test (@Tests) {
my $Success = $ModuleObject->Run( %{ $Test->{Config} } );
if ( $Test->{Success} ) {
$Self->True(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with True"
);
# get ticket
%Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => 1,
);
ATTRIBUTE:
for my $Attribute ( sort keys %{ $Test->{Config}->{Config} } ) {
$Self->True(
$Ticket{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID exists with True",
);
$Self->Is(
$Ticket{$Attribute},
$Test->{Config}->{Config}->{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID match expected value",
);
}
}
else {
$Self->False(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with False"
);
}
}
#-----------------------------------------
# Destructors to remove our Testitems
# ----------------------------------------
# Ticket
my $Delete = $TicketObject->TicketDelete(
TicketID => $TicketID,
UserID => 1,
);
$Self->True(
$Delete,
"TicketDelete() - $TicketID",
);
# ----------------------------------------
1;
--- TicketUnlock.t DELETED ---
Author: cr
--- NEW FILE: TicketSLASet.t ---
# --
# TicketSLASet.t - TicketSLASet testscript
# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id: TicketSLASet.t,v 1.1 2013/01/11 06:09:05 cr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
use strict;
use warnings;
use utf8;
use vars qw($Self);
use Kernel::Config;
use Kernel::System::UnitTest::Helper;
use Kernel::System::Ticket;
use Kernel::System::Service;
use Kernel::System::SLA;
use Kernel::System::ProcessManagement::TransitionAction::TicketSLASet;
use Kernel::System::VariableCheck qw(:all);
# create local objects
my $HelperObject = Kernel::System::UnitTest::Helper->new(
%{$Self},
UnitTestObject => $Self,
RestoreSystemConfiguration => 0,
);
my $ConfigObject = Kernel::Config->new();
my $TicketObject = Kernel::System::Ticket->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $ServiceObject = Kernel::System::Service->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $SLAObject = Kernel::System::SLA->new(
%{$Self},
ConfigObject => $ConfigObject,
);
my $ModuleObject = Kernel::System::ProcessManagement::TransitionAction::TicketSLASet->new(
%{$Self},
ConfigObject => $ConfigObject,
TicketObject => $TicketObject,
);
# define variables
my $UserID = 1;
my $ModuleName = 'TicketSLASet';
my $RandomID = $HelperObject->GetRandomID();
# add a customer user
my $TestUserLogin = $HelperObject->TestCustomerUserCreate();
# ----------------------------------------
# Create new services
# ----------------------------------------
my @Services = (
{
Name => 'Service0' . $RandomID,
ValidID => 1,
UserID => 1,
},
);
for my $ServiceData (@Services) {
my $ServiceID = $ServiceObject->ServiceAdd( %{$ServiceData} );
# sanity test
$Self->IsNot(
$ServiceID,
undef,
"ServiceADD() for $ServiceData->{Name}, ServiceID should not be undef",
);
# store the ServiceID
$ServiceData->{ServiceID} = $ServiceID;
}
# ----------------------------------------
# Create new SLAs
# ----------------------------------------
my @SLAs = (
{
Name => 'SLA0' . $RandomID,
ServiceIDs => [ $Services[0]->{ServiceID} ],
ValidID => 1,
UserID => 1,
},
{
Name => 'SLA1' . $RandomID,
ServiceIDs => [ $Services[0]->{ServiceID} ],
ValidID => 1,
UserID => 1,
},
{
Name => 'SLA2' . $RandomID,
ServiceIDs => [],
ValidID => 1,
UserID => 1,
},
);
for my $SLAData (@SLAs) {
my $SLAID = $SLAObject->SLAAdd( %{$SLAData} );
# sanity test
$Self->IsNot(
$SLAID,
undef,
"SLAADD() for $SLAData->{Name}, SLAID should not be undef",
);
# store the SLAID
$SLAData->{SLAID} = $SLAID;
}
# ----------------------------------------
# ----------------------------------------
# Assign services to customer (0 and 1)
# ----------------------------------------
my $Success = $ServiceObject->CustomerUserServiceMemberAdd(
CustomerUserLogin => $TestUserLogin,
ServiceID => $Services[0]->{ServiceID},
Active => 1,
UserID => 1,
);
# sanity test
$Self->True(
$Success,
"CustomerUserServiceMemberAdd() for user $TestUserLogin, and Service $Services[0]->{Name}"
. " with true",
);
# ----------------------------------------
# ----------------------------------------
# Create a test tickets
# ----------------------------------------
my $TicketID1 = $TicketObject->TicketCreate(
TN => undef,
Title => 'test',
QueueID => 1,
Lock => 'unlock',
Priority => '3 normal',
StateID => 1,
TypeID => 1,
Service => $Services[0]->{Name},
SLA => undef,
CustomerID => undef,
CustomerUser => $TestUserLogin,
OwnerID => 1,
ResponsibleID => 1,
ArchiveFlag => undef,
UserID => $UserID,
);
# sanity checks
$Self->True(
$TicketID1,
"TicketCreate() - $TicketID1",
);
my %Ticket1 = $TicketObject->TicketGet(
TicketID => $TicketID1,
UserID => $UserID,
);
$Self->True(
IsHashRefWithData( \%Ticket1 ),
"TicketGet() - Get Ticket with ID $TicketID1.",
);
my $TicketID2 = $TicketObject->TicketCreate(
TN => undef,
Title => 'test',
QueueID => 1,
Lock => 'unlock',
Priority => '3 normal',
StateID => 1,
TypeID => 1,
Service => undef,
SLA => undef,
CustomerID => undef,
CustomerUser => undef,
OwnerID => 1,
ResponsibleID => 1,
ArchiveFlag => undef,
UserID => $UserID,
);
# sanity checks
$Self->True(
$TicketID2,
"TicketCreate() - $TicketID2",
);
my %Ticket2 = $TicketObject->TicketGet(
TicketID => $TicketID2,
UserID => $UserID,
);
$Self->True(
IsHashRefWithData( \%Ticket2 ),
"TicketGet() - Get Ticket with ID $TicketID2.",
);
# ----------------------------------------
# Run() tests
my @Tests = (
{
Name => 'No Params',
Config => undef,
Success => 0,
},
{
Name => 'No UserID',
Config => {
UserID => undef,
Ticket => \%Ticket1,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Ticket',
Config => {
UserID => $UserID,
Ticket => undef,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {},
},
Success => 0,
},
{
Name => 'Wrong Config',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
NoAgentNotify => 0,
},
},
Success => 0,
},
{
Name => 'Wrong Ticket Format',
Config => {
UserID => $UserID,
Ticket => 1,
Config => {
SLA => 'open',
},
},
Success => 0,
},
{
Name => 'Wrong Config Format',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => 1,
},
Success => 0,
},
{
Name => 'Wrong SLA',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
SLA => 'NotExisting' . $RandomID,
},
},
Success => 0,
},
{
Name => 'Wrong SLAID',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
SLAID => 'NotExisting' . $RandomID,
},
},
Success => 0,
},
{
Name => 'Not assigned SLA',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
SLA => $SLAs[2]->{Name},
},
},
Success => 0,
},
{
Name => 'Not Assigned SLAID',
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
SLAID => $SLAs[2]->{SLAID},
},
},
Success => 0,
},
{
Name => "Ticket without service with SLA $SLAs[0]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket2,
Config => {
SLAID => $SLAs[0]->{Name},
},
},
Success => 0,
},
{
Name => "Ticket without service with SLAID $SLAs[1]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket2,
Config => {
SLAID => $SLAs[0]->{SLAID},
},
},
Success => 0,
},
{
Name => "Correct SLA $SLAs[0]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
SLA => $SLAs[0]->{Name},
},
},
Success => 1,
},
{
Name => "Correct SLA $SLAs[1]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
SLA => $SLAs[1]->{Name},
},
},
Success => 1,
},
{
Name => "Correct SLAID $SLAs[0]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
SLAID => $SLAs[0]->{SLAID},
},
},
Success => 1,
},
{
Name => "Correct SLAID $SLAs[1]->{Name}",
Config => {
UserID => $UserID,
Ticket => \%Ticket1,
Config => {
SLAID => $SLAs[0]->{SLAID},
},
},
Success => 1,
},
);
for my $Test (@Tests) {
my $Success = $ModuleObject->Run( %{ $Test->{Config} } );
if ( $Test->{Success} ) {
$Self->True(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with True"
);
# get ticket
my $TicketID = $TicketID1;
if ( $Test->{Config}->{Ticket}->{TicketID} eq $TicketID2 ) {
$TicketID = $TicketID2;
}
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => 1,
);
ATTRIBUTE:
for my $Attribute ( sort keys %{ $Test->{Config}->{Config} } ) {
$Self->True(
$Ticket{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID exists with True",
);
$Self->Is(
$Ticket{$Attribute},
$Test->{Config}->{Config}->{$Attribute},
"$ModuleName - Test:'$Test->{Name}' | Attribute: $Attribute for TicketID:"
. " $TicketID match expected value",
);
}
}
else {
$Self->False(
$Success,
"$ModuleName Run() - Test:'$Test->{Name}' | excecuted with False"
);
}
}
#-----------------------------------------
# Destructors to remove our Testitems
# ----------------------------------------
# Tickets
my $Delete = $TicketObject->TicketDelete(
TicketID => $TicketID1,
UserID => 1,
);
$Self->True(
$Delete,
"TicketDelete() - $TicketID2",
);
$Delete = $TicketObject->TicketDelete(
TicketID => $TicketID1,
UserID => 1,
);
$Self->True(
$Delete,
"TicketDelete() - $TicketID2",
);
# SLA
for my $SLAData (@SLAs) {
my $Success = $SLAObject->SLAUpdate(
%{$SLAData},
ValidID => 2,
);
# sanity test
$Self->True(
$Success,
"SLAUpdate() for $SLAData->{Name}, Set SLA to invalid with true",
);
}
# Services
for my $ServiceData (@Services) {
my $Success = $ServiceObject->ServiceUpdate(
%{$ServiceData},
ValidID => 2,
);
# sanity test
$Self->True(
$Success,
"ServiceUpdate() for $ServiceData->{Name}, Set service to invalid with true",
);
}
# ----------------------------------------
1;
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log