[otrs-cvs] ImportExport/scripts/test ImportExport.t,1.12,1.13

cvs-log at otrs.org cvs-log at otrs.org
Wed Mar 26 18:03:47 GMT 2008


Comments:
Update of /home/cvs/ImportExport/scripts/test
In directory lancelot:/tmp/cvs-serv10231/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.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ImportExport.t	26 Mar 2008 17:35:14 -0000	1.12
--- ImportExport.t	26 Mar 2008 18:03:42 -0000	1.13
***************
*** 315,321 ****
  # ------------------------------------------------------------ #
  
! my $TestCount  = 1;
! my $AddCounter = 0;
! my $LastAddedTemplateID;
  
  TEMPLATE:
--- 315,320 ----
  # ------------------------------------------------------------ #
  
! my $TestCount = 1;
! my @AddedTemplateIDs;
  
  TEMPLATE:
***************
*** 328,333 ****
  
          if ($TemplateID) {
!             $LastAddedTemplateID = $TemplateID;
!             $AddCounter++;
          }
  
--- 327,331 ----
  
          if ($TemplateID) {
!             push @AddedTemplateIDs, $TemplateID;
          }
  
***************
*** 348,352 ****
          # get template data to check the values after template was added
          my $TemplateGet = $Self->{ImportExportObject}->TemplateGet(
!             TemplateID => $LastAddedTemplateID,
              UserID => $Item->{Add}->{UserID} || 1,
          );
--- 346,350 ----
          # get template data to check the values after template was added
          my $TemplateGet = $Self->{ImportExportObject}->TemplateGet(
!             TemplateID => $AddedTemplateIDs[-1],
              UserID => $Item->{Add}->{UserID} || 1,
          );
***************
*** 365,369 ****
  
          # check last template id varaible
!         if ( !$LastAddedTemplateID ) {
              $Self->False(
                  1,
--- 363,367 ----
  
          # check last template id varaible
!         if ( !$AddedTemplateIDs[-1] ) {
              $Self->False(
                  1,
***************
*** 376,380 ****
          my $UpdateSucess = $Self->{ImportExportObject}->TemplateUpdate(
              %{ $Item->{Update} },
!             TemplateID => $LastAddedTemplateID,
          );
  
--- 374,378 ----
          my $UpdateSucess = $Self->{ImportExportObject}->TemplateUpdate(
              %{ $Item->{Update} },
!             TemplateID => $AddedTemplateIDs[-1],
          );
  
***************
*** 383,387 ****
              $Self->True(
                  $UpdateSucess,
!                 "Test $TestCount: TemplateUpdate() - TemplateKey: $LastAddedTemplateID",
              );
          }
--- 381,385 ----
              $Self->True(
                  $UpdateSucess,
!                 "Test $TestCount: TemplateUpdate() - TemplateKey: $AddedTemplateIDs[-1]",
              );
          }
***************
*** 398,402 ****
          # get template data to check the values after the update
          my $TemplateGet = $Self->{ImportExportObject}->TemplateGet(
!             TemplateID => $LastAddedTemplateID,
              UserID => $Item->{Update}->{UserID} || 1,
          );
--- 396,400 ----
          # get template data to check the values after the update
          my $TemplateGet = $Self->{ImportExportObject}->TemplateGet(
!             TemplateID => $AddedTemplateIDs[-1],
              UserID => $Item->{Update}->{UserID} || 1,
          );
***************
*** 461,465 ****
  # check correct number of new items
  $Self->True(
!     $TemplateListCount eq $AddCounter,
      "Test $TestCount: TemplateList() - correct number of new items",
  );
--- 459,463 ----
  # check correct number of new items
  $Self->True(
!     $TemplateListCount eq scalar @AddedTemplateIDs,
      "Test $TestCount: TemplateList() - correct number of new items",
  );
***************
*** 525,528 ****
--- 523,547 ----
  
  # ------------------------------------------------------------ #
+ # TemplateDelete test 2 (delete all unittest templates)
+ # ------------------------------------------------------------ #
+ 
+ for my $TemplateID (@AddedTemplateIDs) {
+ 
+     # delete the template
+     my $Success = $Self->{ImportExportObject}->TemplateDelete(
+         TemplateID => $TemplateID,
+         UserID     => 1,
+     );
+ 
+     # check success
+     $Self->True(
+         $Success,
+         "Test $TestCount: TemplateDelete() TemplateID $TemplateID",
+     );
+ 
+     $TestCount++;
+ }
+ 
+ # ------------------------------------------------------------ #
  # ObjectList test 1 (check general functionality)
  # ------------------------------------------------------------ #


More information about the cvs-log mailing list