diff test/test_htmltemplate.py @ 829:37ce3f2e05b2

added email display function mangles email addrs so they're not so easily scraped from the web
author Richard Jones <richard@users.sourceforge.net>
date Tue, 09 Jul 2002 05:20:09 +0000
parents 9a17342a9e04
children a568596dbea7
line wrap: on
line diff
--- a/test/test_htmltemplate.py	Tue Jul 09 04:34:39 2002 +0000
+++ b/test/test_htmltemplate.py	Tue Jul 09 05:20:09 2002 +0000
@@ -8,7 +8,7 @@
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
-# $Id: test_htmltemplate.py,v 1.15 2002-07-08 06:39:00 richard Exp $ 
+# $Id: test_htmltemplate.py,v 1.16 2002-07-09 05:20:09 richard Exp $ 
 
 import unittest, cgi, time
 
@@ -41,6 +41,8 @@
             return '<html>hello, I am HTML</html>'
         elif attribute == 'multiline':
             return 'hello\nworld'
+        elif attribute == 'email':
+            return 'test@foo.domain.example'
     def list(self):
         return ['1', '2']
     def filter(self, search_matches, filterspec, sort, group):
@@ -50,7 +52,7 @@
             'link': Link('other'), 'multilink': Multilink('other'),
             'password': Password(), 'html': String(), 'key': String(),
             'novalue': String(), 'filename': String(), 'multiline': String(),
-            'reldate': Date()}
+            'reldate': Date(), 'email': String()}
     def labelprop(self, default_to_id=0):
         return 'key'
 
@@ -349,12 +351,27 @@
             '<a href="javascript:help_window(\'classhelp?classname=theclass'
             '&properties=prop1,prop2\', \'400\', \'400\')"><b>(?)</b></a>')
 
+#    def do_multiline(self, property, rows=5, cols=40)
+    def testEmail_string(self):
+        self.assertEqual(self.tf.do_email('email'), 'test at foo domain example')
+
+    def testEmail_nonstring(self):
+        s = _('[Email: not a string]')
+        self.assertEqual(self.tf.do_email('date'), s)
+        self.assertEqual(self.tf.do_email('interval'), s)
+        self.assertEqual(self.tf.do_email('password'), s)
+        self.assertEqual(self.tf.do_email('link'), s)
+        self.assertEqual(self.tf.do_email('multilink'), s)
+
 def suite():
    return unittest.makeSuite(NodeCase, 'test')
 
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.15  2002/07/08 06:39:00  richard
+# Fixed unit test support class so the tests ran again.
+#
 # Revision 1.14  2002/05/15 06:37:31  richard
 # ehem and the unit test
 #

Roundup Issue Tracker: http://roundup-tracker.org/