[otrs-cvs] otrs/scripts/test/SMIME EmailHandling.t, 1.1.2.3, 1.1.2.4

"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/SMIME
In directory lancelot:/tmp/cvs-serv13441/scripts/test/SMIME

Modified Files:
      Tag: rel-3_1
	EmailHandling.t 
Log Message:
Added test with HTML content in 'text/html' MimeType.

Author: cr

Index: EmailHandling.t
===================================================================
RCS file: /home/cvs/otrs/scripts/test/SMIME/EmailHandling.t,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -2 -u -d -r1.1.2.3 -r1.1.2.4
--- EmailHandling.t	23 May 2012 15:44:24 -0000	1.1.2.3
+++ EmailHandling.t	8 Feb 2013 14:48:04 -0000	1.1.2.4
@@ -1,5 +1,5 @@
 # --
 # EmailHandling.t - SMIME email handling tests
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -25,4 +25,5 @@
 use Kernel::Output::HTML::Layout;
 use Kernel::Output::HTML::ArticleCheckSMIME;
+use Kernel::System::HTMLUtils;
 
 # create local objects
@@ -155,4 +156,10 @@
 );
 
+my $HTMLUtilsObject = Kernel::System::HTMLUtils->new(
+    %{$Self},
+    MainObject   => $MainObject,
+    ConfigObject => $Self->{ConfigObject},
+);
+
 #
 # Setup environment
@@ -282,5 +289,6 @@
         Name        => 'simple string',
         ArticleData => {
-            Body => 'Simple string',
+            Body     => 'Simple string',
+            MimeType => 'text/plain',
         },
     },
@@ -288,5 +296,6 @@
         Name        => 'simple string with unix newline',
         ArticleData => {
-            Body => 'Simple string \n with unix newline',
+            Body     => 'Simple string \n with unix newline',
+            MimeType => 'text/plain',
         },
     },
@@ -294,5 +303,6 @@
         Name        => 'simple string with windows newline',
         ArticleData => {
-            Body => 'Simple string \r\n with windows newline',
+            Body     => 'Simple string \r\n with windows newline',
+            MimeType => 'text/plain',
         },
     },
@@ -302,4 +312,5 @@
             Body =>
                 'SimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleStringSimpleString',
+            MimeType => 'text/plain',
         },
     },
@@ -309,4 +320,5 @@
             Body =>
                 'Simple string Simple string Simple string Simple string Simple string Simple string Simple string Simple string Simple string Simple string Simple string Simple string Simple string Simple string Simple string Simple string',
+            MimeType => 'text/plain',
         },
     },
@@ -314,5 +326,14 @@
         Name        => 'simple string with unicode data',
         ArticleData => {
-            Body => 'äöüßø@«∑€©ƒ',
+            Body     => 'äöüßø@«∑€©ƒ',
+            MimeType => 'text/plain',
+        },
+    },
+    {
+        Name        => 'Multiline HTML',
+        ArticleData => {
+            Body =>
+                '<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body style="font-family:Geneva,Helvetica,Arial,sans-serif; font-size: 12px;">Simple Line<br/><br/><br/>Your Ticket-Team<br/><br/>Your Agent<br/><br/>--<br/> Super Support - Waterford Business Park<br/> 5201 Blue Lagoon Drive - 8th Floor &amp; 9th Floor - Miami, 33126 USA<br/> Email: [email protected] - Web: <a href="http://www.example.com/" title="http://www.example.com/" target="_blank">http://www.example.com/</a><br/>--</body></html>',
+            MimeType => 'text/html',
         },
     },
@@ -444,5 +465,5 @@
         Subject        => 'Unittest data',
         Charset        => 'utf-8',
-        MimeType       => 'text/plain',                   # "text/plain" or "text/html"
+        MimeType       => $Test->{ArticleData}->{MimeType},    # "text/plain" or "text/html"
         Body           => 'Some nice text\n.',
         Sign           => {
@@ -506,7 +527,16 @@
     );
 
+    my $TestBody = $Test->{ArticleData}->{Body};
+
+    # convert test body to ASCII if it was HTML
+    if ( $Test->{ArticleData}->{MimeType} eq 'text/html' ) {
+        $TestBody = $HTMLUtilsObject->ToAscii(
+            String => $TestBody,
+        );
+    }
+
     $Self->Is(
         $FinalArticleData{Body},
-        $Test->{ArticleData}->{Body},
+        $TestBody,
         "$Test->{Name} - verified body content",
     );

---------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.