[otrs-cvs] otrs/scripts/test CheckItem.t,1.1,1.2

cvs-log at otrs.org cvs-log at otrs.org
Fri Feb 1 14:44:01 GMT 2008


Comments:
Update of /home/cvs/otrs/scripts/test
In directory lancelot:/tmp/cvs-serv20367/scripts/test

Modified Files:
	CheckItem.t 
Log Message:
Added CheckEmail() tests.

Author: martin

Index: CheckItem.t
===================================================================
RCS file: /home/cvs/otrs/scripts/test/CheckItem.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CheckItem.t	21 Dec 2007 13:04:35 -0000	1.1
--- CheckItem.t	1 Feb 2008 14:43:56 -0000	1.2
***************
*** 1,5 ****
  # --
  # CheckItem.t - check item tests
! # Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
  # --
  # $Id$
--- 1,5 ----
  # --
  # CheckItem.t - check item tests
! # Copyright (C) 2001-2008 OTRS AG, http://otrs.org/
  # --
  # $Id$
***************
*** 7,19 ****
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
  # --
  
  use Kernel::System::CheckItem;
  
  $Self->{CheckItemObject} = Kernel::System::CheckItem->new(%{$Self});
  
  # string clean tests
! my $StringCleanTests = [
      {
          String => ' ',
--- 7,62 ----
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl-2.0.txt.
  # --
  
  use Kernel::System::CheckItem;
  
+ # disable dns lookups
+ $Self->{ConfigObject}->Set( Key => 'CheckMXRecord', Value => 0 );
+ $Self->{ConfigObject}->Set( Key => 'CheckEmailAddresses', Value => 1 );
+ 
+ # create new object
  $Self->{CheckItemObject} = Kernel::System::CheckItem->new(%{$Self});
  
+ # email address checks
+ my @EmailTests = (
+     {
+         Email => 'somebod y at somehost.com',
+         Valid => 0,
+     },
+     {
+         Email => 'somebody at somehost.com',
+         Valid => 1,
+     },
+     {
+         Email => 'ä@somehost.com',
+         Valid => 0,
+     },
+ );
+ 
+ for my $Test ( @EmailTests ) {
+ 
+     # check address
+     my $Valid = $Self->{CheckItemObject}->CheckEmail(
+         Address => $Test->{Email},
+     );
+ 
+     # execute unit test
+     if ( $Test->{Valid} ) {
+         $Self->True(
+             $Test->{Valid},
+             "CheckEmail() - $Test->{Email}",
+         );
+     }
+     else {
+         $Self->False(
+             $Test->{Valid},
+             "CheckEmail() - $Test->{Email}",
+         );
+     }
+ }
+ 
  # string clean tests
! my @StringCleanTests = (
      {
          String => ' ',
***************
*** 143,149 ****
          Result => "TesttestTest",
      },
! ];
  
! for my $Test ( @{$StringCleanTests} ) {
  
      # copy string to leave the original untouched
--- 186,192 ----
          Result => "TesttestTest",
      },
! );
  
! for my $Test ( @StringCleanTests ) {
  
      # copy string to leave the original untouched
***************
*** 164,166 ****
  }
  
! 1;
\ No newline at end of file
--- 207,209 ----
  }
  
! 1;


More information about the cvs-log mailing list