@@ -109,6 +109,30 @@ def test_string_url_quote(self):
109109 p = StringHTMLProperty (self .client , 'test' , '1' , None , 'test' , 'test string< foo@bar' )
110110 self .assertEqual (p .url_quote (), 'test%20string%3C%20foo%40bar' )
111111
112+ def test_string_email (self ):
113+ ''' test that email obscures the email '''
114+ p = StringHTMLProperty (
self .
client ,
'test' ,
'1' ,
None ,
'test' ,
'[email protected] ' )
115+ self .assertEqual (p .email (), 'rouilj at foo example ...' )
116+
117+ def test_string_plain_or_hyperlinked (self ):
118+ ''' test that email obscures the email '''
119+ p = StringHTMLProperty (
self .
client ,
'test' ,
'1' ,
None ,
'test' ,
'A string <b> with [email protected] embedded < html</b>' )
120+ self .
assertEqual (
p .
plain (),
'A string <b> with [email protected] embedded < html</b>' )
121+ self .
assertEqual (
p .
plain (
escape = 1 ),
'A string <b> with [email protected] embedded &lt; html</b>' )
122+ self .
assertEqual (
p .
plain (
hyperlink = 1 ),
'A string <b> with <a href="mailto:[email protected] ">[email protected] </a> embedded &lt; html</b>' )
123+ self .
assertEqual (
p .
plain (
escape = 1 ,
hyperlink = 1 ),
'A string <b> with <a href="mailto:[email protected] ">[email protected] </a> embedded &lt; html</b>' )
124+
125+ self .
assertEqual (
p .
hyperlinked (),
'A string <b> with <a href="mailto:[email protected] ">[email protected] </a> embedded &lt; html</b>' )
126+
127+ def test_string_field (self ):
128+ p = StringHTMLProperty (
self .
client ,
'test' ,
'1' ,
None ,
'test' ,
'A string <b> with [email protected] embedded < html</b>' )
129+ self .
assertEqual (
p .
field (),
'<input type="text" name="test1@test" value="A string <b> with [email protected] embedded &lt; html</b>" size="30">' )
130+
131+ def test_string_multiline (self ):
132+ p = StringHTMLProperty (
self .
client ,
'test' ,
'1' ,
None ,
'test' ,
'A string <b> with [email protected] embedded < html</b>' )
133+ self .
assertEqual (
p .
multiline (),
'<textarea name="test1@test" id="test1@test" rows="5" cols="40">A string <b> with [email protected] embedded &lt; html</b></textarea>' )
134+ self .
assertEqual (
p .
multiline (
rows = 300 ,
cols = 100 ,
** {
'class' :
'css_class' }),
'<textarea class="css_class" name="test1@test" id="test1@test" rows="300" cols="100">A string <b> with [email protected] embedded &lt; html</b></textarea>' )
135+
112136 def test_url_match (self ):
113137 '''Test the URL regular expression in StringHTMLProperty.
114138 '''
0 commit comments