[otrs-cvs] ImportExport/scripts/test ImportExport.t,1.7,1.8

cvs-log at otrs.org cvs-log at otrs.org
Tue Mar 18 08:09:56 GMT 2008


Comments:
Update of /home/cvs/ImportExport/scripts/test
In directory lancelot:/tmp/cvs-serv14876/scripts/test

Modified Files:
	ImportExport.t 
Log Message:
Improved unittests to runs on Oracle and DB2 databases.

Author: mh

Index: ImportExport.t
===================================================================
RCS file: /home/cvs/ImportExport/scripts/test/ImportExport.t,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ImportExport.t	14 Feb 2008 13:34:52 -0000	1.7
--- ImportExport.t	18 Mar 2008 08:09:51 -0000	1.8
***************
*** 12,21 ****
--- 12,55 ----
  use strict;
  use warnings;
+ use utf8;
  
  use vars qw($Self);
  
  use Kernel::System::ImportExport;
+ use Kernel::System::User;
  
  $Self->{ImportExportObject} = Kernel::System::ImportExport->new( %{$Self} );
+ $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,
+ );
  
  # ------------------------------------------------------------ #
***************
*** 175,179 ****
          Update => {
              ValidID => 2,
!             UserID  => 2,
          },
      },
--- 209,213 ----
          Update => {
              ValidID => 2,
!             UserID  => $UserID1,
          },
      },
***************
*** 183,187 ****
          Update => {
              Name   => $TemplateRandName2 . 'Update1',
!             UserID => 2,
          },
      },
--- 217,221 ----
          Update => {
              Name   => $TemplateRandName2 . 'Update1',
!             UserID => $UserID1,
          },
      },
***************
*** 201,205 ****
              Comment => 'This is a second test!',
              ValidID => 2,
!             UserID  => 2,
          },
          UpdateGet => {
--- 235,239 ----
              Comment => 'This is a second test!',
              ValidID => 2,
!             UserID  => $UserID1,
          },
          UpdateGet => {
***************
*** 208,212 ****
              Comment  => 'This is a second test!',
              CreateBy => 1,
!             ChangeBy => 2,
          },
      },
--- 242,246 ----
              Comment  => 'This is a second test!',
              CreateBy => 1,
!             ChangeBy => $UserID1,
          },
      },
***************
*** 340,345 ****
  
          # update the template
!         my $UpdateSucess = $Self->{ImportExportObject}
!             ->TemplateUpdate( %{ $Template->{Update} }, TemplateID => $LastAddedTemplateID );
  
          # check if template was updated successfully or not
--- 374,381 ----
  
          # update the template
!         my $UpdateSucess = $Self->{ImportExportObject}->TemplateUpdate(
!             %{ $Template->{Update} },
!             TemplateID => $LastAddedTemplateID,
!         );
  
          # check if template was updated successfully or not
***************
*** 360,364 ****
          my $TemplateGet = $Self->{ImportExportObject}->TemplateGet(
              TemplateID => $LastAddedTemplateID,
!             UserID => $Template->{Update}->{UserID} || 1,
          );
  
--- 396,400 ----
          my $TemplateGet = $Self->{ImportExportObject}->TemplateGet(
              TemplateID => $LastAddedTemplateID,
!             UserID     => $Template->{Update}->{UserID} || 1,
          );
  
***************
*** 439,441 ****
--- 475,484 ----
  );
  
+ # clean the system user table
+ my $UserTable = $Self->{ConfigObject}->Get('DatabaseUserTable') || 'system_user';
+ 
+ $Self->{DBObject}->Do(
+     SQL => "DELETE FROM $UserTable WHERE login LIKE 'UnitTest-ImportExport-%'",
+ );
+ 
  1;


More information about the cvs-log mailing list