[otrs-cvs] ImportExport/scripts/test ImportExport.t,1.10,1.11
cvs-log at otrs.org
cvs-log at otrs.org
Wed Mar 26 12:26:38 GMT 2008
Comments:
Update of /home/cvs/ImportExport/scripts/test
In directory lancelot:/tmp/cvs-serv18738/scripts/test
Modified Files:
ImportExport.t
Log Message:
Improved unittests.
Author: mh
Index: ImportExport.t
===================================================================
RCS file: /home/cvs/ImportExport/scripts/test/ImportExport.t,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ImportExport.t 19 Mar 2008 13:24:32 -0000 1.10
--- ImportExport.t 26 Mar 2008 12:26:33 -0000 1.11
***************
*** 22,55 ****
$Self->{UserObject} = Kernel::System::User->new( %{$Self} );
! # disable email checks to create new user
! my $CheckEmailAddressesOrg = $Self->{ConfigObject}->Get('CheckEmailAddresses') || 1;
! $Self->{ConfigObject}->Set(
! Key => 'CheckEmailAddresses',
! Value => 0,
! );
! # create new users for the tests
! my $UserID1 = $Self->{UserObject}->UserAdd(
! UserFirstname => 'ImportExport1',
! UserLastname => 'UnitTest',
! UserLogin => 'UnitTest-ImportExport-1' . int( rand(1_000_000) ),
! UserEmail => 'UnitTest-ImportExport-1 at localhost',
! ValidID => 1,
! ChangeUserID => 1,
! );
! my $UserID2 = $Self->{UserObject}->UserAdd(
! UserFirstname => 'ImportExport2',
! UserLastname => 'UnitTest',
! UserLogin => 'UnitTest-ImportExport-2' . int( rand(1_000_000) ),
! UserEmail => 'UnitTest-ImportExport-2 at localhost',
! ValidID => 1,
! ChangeUserID => 1,
! );
! # restore original email check param
! $Self->{ConfigObject}->Set(
! Key => 'CheckEmailAddresses',
! Value => $CheckEmailAddressesOrg,
! );
# ------------------------------------------------------------ #
--- 22,77 ----
$Self->{UserObject} = Kernel::System::User->new( %{$Self} );
! # ------------------------------------------------------------ #
! # make preparations
! # ------------------------------------------------------------ #
! # create needed users
! my @UserIDs;
! {
! # disable email checks to create new user
! my $CheckEmailAddressesOrg = $Self->{ConfigObject}->Get('CheckEmailAddresses') || 1;
! $Self->{ConfigObject}->Set(
! Key => 'CheckEmailAddresses',
! Value => 0,
! );
!
! for my $Counter ( 1 .. 2 ) {
!
! # create new users for the tests
! my $UserID = $Self->{UserObject}->UserAdd(
! UserFirstname => 'ImportExport' . $Counter,
! UserLastname => 'UnitTest',
! UserLogin => 'UnitTest-ImportExport-' . $Counter . int rand 1_000_000,
! UserEmail => 'UnitTest-ImportExport-' . $Counter . '@localhost',
! ValidID => 1,
! ChangeUserID => 1,
! );
!
! push @UserIDs, $UserID;
! }
!
! # restore original email check param
! $Self->{ConfigObject}->Set(
! Key => 'CheckEmailAddresses',
! Value => $CheckEmailAddressesOrg,
! );
! }
!
! # create needed random template names
! my @TemplateName;
!
! for my $Counter ( 1 .. 3 ) {
!
! push @TemplateName, 'UnitTest' . int rand 1_000_000;
! }
!
! # create needed random object names
! my @ObjectName;
!
! for my $Counter ( 1 .. 1 ) {
!
! push @ObjectName, 'UnitTest' . int rand 1_000_000;
! }
# ------------------------------------------------------------ #
***************
*** 83,92 ****
# ------------------------------------------------------------ #
- # create a random object name
- my $ObjectRand = 'UnitTest' . int rand 1_000_000;
-
# get template list
my $TemplateList1 = $Self->{ImportExportObject}->TemplateList(
! Object => $ObjectRand,
UserID => 1,
);
--- 105,111 ----
# ------------------------------------------------------------ #
# get template list
my $TemplateList1 = $Self->{ImportExportObject}->TemplateList(
! Object => $ObjectName[0],
UserID => 1,
);
***************
*** 102,109 ****
# ------------------------------------------------------------ #
- my $TemplateRandName1 = 'UnitTest' . int rand 1_000_000;
- my $TemplateRandName2 = 'UnitTest' . int rand 1_000_000;
- my $TemplateRandName3 = 'UnitTest' . int rand 1_000_000;
-
my $TemplateChecks = [
--- 121,124 ----
***************
*** 111,115 ****
{
Add => {
! Name => $TemplateRandName1,
ValidID => 1,
UserID => 1,
--- 126,130 ----
{
Add => {
! Name => $TemplateName[0],
ValidID => 1,
UserID => 1,
***************
*** 120,124 ****
{
Add => {
! Object => $ObjectRand,
ValidID => 1,
UserID => 1,
--- 135,139 ----
{
Add => {
! Object => $ObjectName[0],
ValidID => 1,
UserID => 1,
***************
*** 129,134 ****
{
Add => {
! Object => $ObjectRand,
! Name => $TemplateRandName1,
UserID => 1,
},
--- 144,149 ----
{
Add => {
! Object => $ObjectName[0],
! Name => $TemplateName[0],
UserID => 1,
},
***************
*** 138,143 ****
{
Add => {
! Object => $ObjectRand,
! Name => $TemplateRandName1,
ValidID => 1,
},
--- 153,158 ----
{
Add => {
! Object => $ObjectName[0],
! Name => $TemplateName[0],
ValidID => 1,
},
***************
*** 147,151 ****
{
Add => {
! Object => $ObjectRand,
Format => 'CSV',
ValidID => 1,
--- 162,166 ----
{
Add => {
! Object => $ObjectName[0],
Format => 'CSV',
ValidID => 1,
***************
*** 156,169 ****
{
Add => {
! Object => $ObjectRand,
Format => 'CSV',
! Name => $TemplateRandName1,
ValidID => 1,
UserID => 1,
},
AddGet => {
! Object => $ObjectRand,
Format => 'CSV',
! Name => $TemplateRandName1,
ValidID => 1,
Comment => '',
--- 171,184 ----
{
Add => {
! Object => $ObjectName[0],
Format => 'CSV',
! Name => $TemplateName[0],
ValidID => 1,
UserID => 1,
},
AddGet => {
! Object => $ObjectName[0],
Format => 'CSV',
! Name => $TemplateName[0],
ValidID => 1,
Comment => '',
***************
*** 176,182 ****
{
Add => {
! Object => $ObjectRand,
Format => 'CSV',
! Name => $TemplateRandName1,
ValidID => 1,
UserID => 1,
--- 191,197 ----
{
Add => {
! Object => $ObjectName[0],
Format => 'CSV',
! Name => $TemplateName[0],
ValidID => 1,
UserID => 1,
***************
*** 187,193 ****
{
Add => {
! Object => $ObjectRand,
Format => 'CSV',
! Name => $TemplateRandName2,
ValidID => 1,
Comment => 'This is a test!',
--- 202,208 ----
{
Add => {
! Object => $ObjectName[0],
Format => 'CSV',
! Name => $TemplateName[1],
ValidID => 1,
Comment => 'This is a test!',
***************
*** 195,201 ****
},
AddGet => {
! Object => $ObjectRand,
Format => 'CSV',
! Name => $TemplateRandName2,
ValidID => 1,
Comment => 'This is a test!',
--- 210,216 ----
},
AddGet => {
! Object => $ObjectName[0],
Format => 'CSV',
! Name => $TemplateName[1],
ValidID => 1,
Comment => 'This is a test!',
***************
*** 209,213 ****
Update => {
ValidID => 2,
! UserID => $UserID1,
},
},
--- 224,228 ----
Update => {
ValidID => 2,
! UserID => $UserIDs[0],
},
},
***************
*** 216,221 ****
{
Update => {
! Name => $TemplateRandName2 . 'UPDATE1',
! UserID => $UserID1,
},
},
--- 231,236 ----
{
Update => {
! Name => $TemplateName[1] . 'UPDATE1',
! UserID => $UserIDs[0],
},
},
***************
*** 224,228 ****
{
Update => {
! Name => $TemplateRandName2 . 'UPDATE2',
ValidID => 2,
},
--- 239,243 ----
{
Update => {
! Name => $TemplateName[1] . 'UPDATE2',
ValidID => 2,
},
***************
*** 232,246 ****
{
Update => {
! Name => $TemplateRandName2 . 'UPDATE3',
Comment => 'This is a second test!',
ValidID => 2,
! UserID => $UserID1,
},
UpdateGet => {
! Name => $TemplateRandName2 . 'UPDATE3',
ValidID => 2,
Comment => 'This is a second test!',
CreateBy => 1,
! ChangeBy => $UserID1,
},
},
--- 247,261 ----
{
Update => {
! Name => $TemplateName[1] . 'UPDATE3',
Comment => 'This is a second test!',
ValidID => 2,
! UserID => $UserIDs[0],
},
UpdateGet => {
! Name => $TemplateName[1] . 'UPDATE3',
ValidID => 2,
Comment => 'This is a second test!',
CreateBy => 1,
! ChangeBy => $UserIDs[0],
},
},
***************
*** 249,253 ****
{
Update => {
! Name => $TemplateRandName2 . 'UPDATE4',
ValidID => 1,
Comment => '',
--- 264,268 ----
{
Update => {
! Name => $TemplateName[1] . 'UPDATE4',
ValidID => 1,
Comment => '',
***************
*** 255,259 ****
},
UpdateGet => {
! Name => $TemplateRandName2 . 'UPDATE4',
ValidID => 1,
Comment => '',
--- 270,274 ----
},
UpdateGet => {
! Name => $TemplateName[1] . 'UPDATE4',
ValidID => 1,
Comment => '',
***************
*** 266,270 ****
{
Update => {
! Name => $TemplateRandName2 . 'Update5',
ValidID => 1,
Comment => 'This is a comment.',
--- 281,285 ----
{
Update => {
! Name => $TemplateName[1] . 'Update5',
ValidID => 1,
Comment => 'This is a comment.',
***************
*** 272,276 ****
},
UpdateGet => {
! Name => $TemplateRandName2 . 'Update5',
ValidID => 1,
Comment => 'This is a comment.',
--- 287,291 ----
},
UpdateGet => {
! Name => $TemplateName[1] . 'Update5',
ValidID => 1,
Comment => 'This is a comment.',
***************
*** 283,296 ****
{
Add => {
! Object => " \t \n \r " . $ObjectRand . " \t \n \r ",
Format => " \t \n \r CSV \t \n \r ",
! Name => " \t \n \r " . $TemplateRandName3 . " \t \n \r ",
ValidID => 1,
UserID => 1,
},
AddGet => {
! Object => $ObjectRand,
Format => 'CSV',
! Name => $TemplateRandName3,
ValidID => 1,
Comment => '',
--- 298,311 ----
{
Add => {
! Object => " \t \n \r " . $ObjectName[0] . " \t \n \r ",
Format => " \t \n \r CSV \t \n \r ",
! Name => " \t \n \r " . $TemplateName[2] . " \t \n \r ",
ValidID => 1,
UserID => 1,
},
AddGet => {
! Object => $ObjectName[0],
Format => 'CSV',
! Name => $TemplateName[2],
ValidID => 1,
Comment => '',
***************
*** 303,312 ****
{
Update => {
! Name => " \t \n \r " . $TemplateRandName3 . "UPDATE1 \t \n \r ",
ValidID => 1,
UserID => 1,
},
UpdateGet => {
! Name => $TemplateRandName3 . 'UPDATE1',
ValidID => 1,
CreateBy => 1,
--- 318,327 ----
{
Update => {
! Name => " \t \n \r " . $TemplateName[2] . "UPDATE1 \t \n \r ",
ValidID => 1,
UserID => 1,
},
UpdateGet => {
! Name => $TemplateName[2] . 'UPDATE1',
ValidID => 1,
CreateBy => 1,
***************
*** 396,400 ****
my $TemplateGet = $Self->{ImportExportObject}->TemplateGet(
TemplateID => $LastAddedTemplateID,
! UserID => $Template->{Update}->{UserID} || 1,
);
--- 411,415 ----
my $TemplateGet = $Self->{ImportExportObject}->TemplateGet(
TemplateID => $LastAddedTemplateID,
! UserID => $Template->{Update}->{UserID} || 1,
);
***************
*** 421,425 ****
# get template list
my $TemplateList2 = $Self->{ImportExportObject}->TemplateList(
! Object => $ObjectRand,
UserID => 1,
);
--- 436,440 ----
# get template list
my $TemplateList2 = $Self->{ImportExportObject}->TemplateList(
! Object => $ObjectName[0],
UserID => 1,
);
***************
*** 465,469 ****
# get template list
my $TemplateList3 = $Self->{ImportExportObject}->TemplateList(
! Object => $ObjectRand,
UserID => 1,
);
--- 480,484 ----
# get template list
my $TemplateList3 = $Self->{ImportExportObject}->TemplateList(
! Object => $ObjectName[0],
UserID => 1,
);
***************
*** 475,477 ****
);
! 1;
\ No newline at end of file
--- 490,492 ----
);
! 1;
More information about the cvs-log
mailing list