annotate test/test_template_parser.py @ 1018:b0527d9c8e11

call the cookie something else since it changed
author Richard Jones <richard@users.sourceforge.net>
date Tue, 03 Sep 2002 03:23:56 +0000
parents a43fa69c1b70
children 9b910e8d987d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
932
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1 # $Id: test_template_parser.py,v 1.1 2002-08-02 23:45:41 richard Exp $
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
2
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
3 import unittest
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
4 from roundup import template_parser
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
5
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
6 class TemplateParserTestCase(unittest.TestCase):
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
7 def testParser(self):
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
8 parser = template_parser.RoundupTemplate()
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
9 s = '''
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
10 <table border=0 cellspacing=5 cellpadding=0>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
11 <tr>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
12 <td bgcolor="ffffea">
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
13 <property name="prop1">
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
14 <require permission="perm1">
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
15 <display call="field('prop1')">
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
16 <else>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
17 <display call="plain('prop1')">
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
18 </require>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
19 </property>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
20 </td>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
21 </tr>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
22 </table>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
23
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
24 <table border=0 cellspacing=5 cellpadding=0>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
25 <property name="prop2">
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
26 <tr>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
27 <td class="form-label">Prop2:</td>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
28 <td class="form-text">
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
29 <require permission="perm2">
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
30 <display call="field('prop2')">
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
31 <else>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
32 <display call="plain('prop2')">
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
33 </require>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
34 </td>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
35 </tr>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
36 </property>
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
37 </table>'''
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
38 parser.feed(s)
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
39 self.assertEqual(template_parser.display(parser.structure),
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
40 '\n<table border="0" cellspacing="5" cellpadding="0">\n <tr>\n <td bgcolor="ffffea">\n PROPERTY: [(\'name\', \'prop1\')] \n TEST: [(\'permission\', \'perm1\')]\n OK... \n DISPLAY: [(\'call\', "field(\'prop1\')")] \n FAIL... \n DISPLAY: [(\'call\', "plain(\'prop1\')")] \n \n \n </td>\n </tr>\n</table>\n\n<table border="0" cellspacing="5" cellpadding="0">\n PROPERTY: [(\'name\', \'prop2\')] \n <tr>\n <td class="form-label">Prop2:</td>\n <td class="form-text">\n TEST: [(\'permission\', \'perm2\')]\n OK... \n DISPLAY: [(\'call\', "field(\'prop2\')")] \n FAIL... \n DISPLAY: [(\'call\', "plain(\'prop2\')")] \n \n </td>\n </tr>\n \n</table>')
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
41
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
42 def suite():
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
43 return unittest.makeSuite(TemplateParserTestCase, 'test')
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
44
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
45
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
46 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
47 # $Log: not supported by cvs2svn $
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
48 # Revision 1.12 2002/07/14 06:05:50 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
49 # . fixed the date module so that Date(". - 2d") works
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
50 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
51 # Revision 1.11 2002/02/21 23:34:52 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
52 # Oops, there's 24 hours in a day, and subtraction of intervals now works
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
53 # properly.
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
54 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
55 # Revision 1.10 2002/02/21 23:11:45 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
56 # . fixed some problems in date calculations (calendar.py doesn't handle over-
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
57 # and under-flow). Also, hour/minute/second intervals may now be more than
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
58 # 99 each.
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
59 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
60 # Revision 1.9 2002/02/21 06:57:39 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
61 # . Added popup help for classes using the classhelp html template function.
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
62 # - add <display call="classhelp('priority', 'id,name,description')">
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
63 # to an item page, and it generates a link to a popup window which displays
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
64 # the id, name and description for the priority class. The description
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
65 # field won't exist in most installations, but it will be added to the
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
66 # default templates.
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
67 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
68 # Revision 1.8 2002/01/16 07:02:57 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
69 # . lots of date/interval related changes:
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
70 # - more relaxed date format for input
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
71 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
72 # Revision 1.7 2001/08/13 23:01:53 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
73 # fixed a 2.1-ism
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
74 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
75 # Revision 1.6 2001/08/07 00:24:43 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
76 # stupid typo
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
77 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
78 # Revision 1.5 2001/08/07 00:15:51 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
79 # Added the copyright/license notice to (nearly) all files at request of
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
80 # Bizar Software.
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
81 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
82 # Revision 1.4 2001/07/29 23:32:13 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
83 # Fixed bug in unit test ;)
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
84 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
85 # Revision 1.3 2001/07/29 07:01:39 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
86 # Added vim command to all source so that we don't get no steenkin' tabs :)
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
87 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
88 # Revision 1.2 2001/07/29 06:42:20 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
89 # Added Interval tests.
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
90 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
91 # Revision 1.1 2001/07/27 06:55:07 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
92 # moving tests -> test
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
93 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
94 # Revision 1.2 2001/07/25 04:34:31 richard
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
95 # Added id and log to tests files...
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
96 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
97 #
a43fa69c1b70 fixes to the new template parser
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
98 # vim: set filetype=python ts=4 sw=4 et si

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