[otrs-cvs] otrs/scripts/test/ProcessManagement/TransitionAction TicketTitleSet.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-serv30710/scripts/test/ProcessManagement/TransitionAction
Added Files:
TicketTitleSet.t
Log Message:
Initial version, thanks to NL and MB.
Author: cr
--- NEW FILE: TicketTitleSet.t ---
# --
# TicketTitleSet.t - TicketTitleSet testscript
# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id: TicketTitleSet.t,v 1.1 2013/01/11 18:53:34 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::TicketTitleSet;
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::TicketTitleSet->new(
%{$Self},
ConfigObject => $ConfigObject,
TicketObject => $TicketObject,
);
# define variables
my $UserID = 1;
my $ModuleName = 'TicketTitleSet';
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.",
);
$Self->Is(
$Ticket{Title},
'test',
"TicketGet() - Title after creation",
);
# Run() tests
my @Tests = (
{
Name => 'No Params',
Config => undef,
Success => 0,
},
{
Name => 'No Title',
Config => {
UserID => undef,
Ticket => \%Ticket,
Config => {
CustomerID => 'test',
},
},
Success => 0,
},
{
Name => 'No Ticket',
Config => {
UserID => $UserID,
Ticket => undef,
Config => {
Title => 'test2',
},
},
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 => {
Title => 'test2',
},
},
Success => 0,
},
{
Name => 'Wrong Config Format',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => 1,
},
Success => 0,
},
{
Name => 'New title',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
Title => 'Some new title for the ticket goes here',
},
},
Success => 1,
},
{
Name => 'New empty title',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
Title => '',
},
},
Success => 1,
},
{
Name => 'New title extended',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
Title =>
'Jetzt kommen die ultrascharfen Groß-Fernseher mit vierfache HD-Auflösung',
},
},
Success => 1,
},
{
Name => 'New title UTF8',
Config => {
UserID => $UserID,
Ticket => \%Ticket,
Config => {
Title =>
'Многие пользователи сети отмечают, что тема очередной массовой акции непарламентской оппозиции выбрана крайне спорная и непатриотичная',
},
},
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->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;
---------------------------------------------------------------------
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