comparison test/test_htmltemplate.py @ 574:d41d94511170

more htmltemplate cleanups and unit tests
author Richard Jones <richard@users.sourceforge.net>
date Tue, 22 Jan 2002 22:46:22 +0000
parents c7ead967db85
children f98f37697f4c
comparison
equal deleted inserted replaced
573:f0513f650042 574:d41d94511170
6 # 6 #
7 # This module is distributed in the hope that it will be useful, 7 # This module is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # 10 #
11 # $Id: test_htmltemplate.py,v 1.3 2002-01-22 06:35:40 richard Exp $ 11 # $Id: test_htmltemplate.py,v 1.4 2002-01-22 22:46:22 richard Exp $
12 12
13 import unittest, cgi 13 import unittest, cgi
14 14
15 from roundup import date, password 15 from roundup import date, password
16 from roundup.htmltemplate import TemplateFunctions 16 from roundup.htmltemplate import TemplateFunctions
181 </select>''') 181 </select>''')
182 182
183 # def do_link(self, property=None, is_download=0): 183 # def do_link(self, property=None, is_download=0):
184 def testLink_novalue(self): 184 def testLink_novalue(self):
185 self.assertEqual(self.tf.do_link('novalue'), 185 self.assertEqual(self.tf.do_link('novalue'),
186 _('[no %(propname)s]')%{'propname':'novalue'.capitalize()}) 186 _('[no %(propname)s]')%{'propname':'novalue'.capitalize()})
187 187
188 def testLink_string(self): 188 def testLink_string(self):
189 self.assertEqual(self.tf.do_link('string'), 189 self.assertEqual(self.tf.do_link('string'),
190 '<a href="test_class1">Node 1: I am a string</a>') 190 '<a href="test_class1">Node 1: I am a string</a>')
191 191
207 207
208 def testLink_multilink(self): 208 def testLink_multilink(self):
209 self.assertEqual(self.tf.do_link('multilink'), 209 self.assertEqual(self.tf.do_link('multilink'),
210 '<a href="other1">the key</a>, <a href="other2">the key</a>') 210 '<a href="other1">the key</a>, <a href="other2">the key</a>')
211 211
212 # def do_count(self, property, **args):
213 def testCount_nonlinks(self):
214 s = _('[Count: not a Multilink]')
215 self.assertEqual(self.tf.do_count('string'), s)
216 self.assertEqual(self.tf.do_count('date'), s)
217 self.assertEqual(self.tf.do_count('interval'), s)
218 self.assertEqual(self.tf.do_count('password'), s)
219 self.assertEqual(self.tf.do_count('link'), s)
220
221 def testCount_multilink(self):
222 self.assertEqual(self.tf.do_count('multilink'), '2')
223
224 # def do_reldate(self, property, pretty=0):
225 def testReldate_nondate(self):
226 s = _('[Reldate: not a Date]')
227 self.assertEqual(self.tf.do_reldate('string'), s)
228 self.assertEqual(self.tf.do_reldate('interval'), s)
229 self.assertEqual(self.tf.do_reldate('password'), s)
230 self.assertEqual(self.tf.do_reldate('link'), s)
231 self.assertEqual(self.tf.do_reldate('multilink'), s)
232
233 def testReldate_date(self):
234 self.assertEqual(self.tf.do_reldate('date'), '- 2y 1m')
235 self.assertEqual(self.tf.do_reldate('date', pretty=1),
236 ' 1 January 2000')
237
212 def suite(): 238 def suite():
213 return unittest.makeSuite(NodeCase, 'test') 239 return unittest.makeSuite(NodeCase, 'test')
214 240
215 241
216 # 242 #
217 # $Log: not supported by cvs2svn $ 243 # $Log: not supported by cvs2svn $
244 # Revision 1.3 2002/01/22 06:35:40 richard
245 # more htmltemplate tests and cleanup
246 #
218 # Revision 1.2 2002/01/22 00:12:07 richard 247 # Revision 1.2 2002/01/22 00:12:07 richard
219 # Wrote more unit tests for htmltemplate, and while I was at it, I polished 248 # Wrote more unit tests for htmltemplate, and while I was at it, I polished
220 # off the implementation of some of the functions so they behave sanely. 249 # off the implementation of some of the functions so they behave sanely.
221 # 250 #
222 # Revision 1.1 2002/01/21 11:05:48 richard 251 # Revision 1.1 2002/01/21 11:05:48 richard

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