Mercurial > p > roundup > code
comparison test/test_cgi.py @ 1631:8a908bbad1ef
A couple of form value handling changes:
- multilink properties may hhave multiple form values "1", "2,4", "5", ...
- string search properties are split on whitespace and match any of the
values
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 09 May 2003 01:47:51 +0000 |
| parents | 4074e2336eed |
| children | b87c40d1b8fb |
comparison
equal
deleted
inserted
replaced
| 1629:27768800be5c | 1631:8a908bbad1ef |
|---|---|
| 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_cgi.py,v 1.15 2003-04-17 06:51:44 richard Exp $ | 11 # $Id: test_cgi.py,v 1.16 2003-05-09 01:47:50 richard Exp $ |
| 12 | 12 |
| 13 import unittest, os, shutil, errno, sys, difflib, cgi, re | 13 import unittest, os, shutil, errno, sys, difflib, cgi, re |
| 14 | 14 |
| 15 from roundup.cgi import client | 15 from roundup.cgi import client |
| 16 from roundup import init, instance, password, hyperdb, date | 16 from roundup import init, instance, password, hyperdb, date |
| 231 self.assertEqual(self.parseForm({'nosy': '1,2'}, 'issue'), | 231 self.assertEqual(self.parseForm({'nosy': '1,2'}, 'issue'), |
| 232 ({('issue', None): {'nosy': ['1','2']}}, [])) | 232 ({('issue', None): {'nosy': ['1','2']}}, [])) |
| 233 self.assertEqual(self.parseForm({'nosy': 'admin,2'}, 'issue'), | 233 self.assertEqual(self.parseForm({'nosy': 'admin,2'}, 'issue'), |
| 234 ({('issue', None): {'nosy': ['1','2']}}, [])) | 234 ({('issue', None): {'nosy': ['1','2']}}, [])) |
| 235 | 235 |
| 236 def testMixedMultilink(self): | |
| 237 form = cgi.FieldStorage() | |
| 238 form.list.append(cgi.MiniFieldStorage('nosy', '1,2')) | |
| 239 form.list.append(cgi.MiniFieldStorage('nosy', '3')) | |
| 240 cl = client.Client(self.instance, None, {'PATH_INFO':'/'}, form) | |
| 241 cl.classname = 'issue' | |
| 242 cl.nodeid = None | |
| 243 cl.db = self.db | |
| 244 self.assertEqual(cl.parsePropsFromForm(), | |
| 245 ({('issue', None): {'nosy': ['1','2', '3']}}, [])) | |
| 246 | |
| 236 def testEmptyMultilinkSet(self): | 247 def testEmptyMultilinkSet(self): |
| 237 nodeid = self.db.issue.create(nosy=['1','2']) | 248 nodeid = self.db.issue.create(nosy=['1','2']) |
| 238 self.assertEqual(self.parseForm({'nosy': ''}, 'issue', nodeid), | 249 self.assertEqual(self.parseForm({'nosy': ''}, 'issue', nodeid), |
| 239 ({('issue', nodeid): {'nosy': []}}, [])) | 250 ({('issue', nodeid): {'nosy': []}}, [])) |
| 240 nodeid = self.db.issue.create(nosy=['1','2']) | 251 nodeid = self.db.issue.create(nosy=['1','2']) |
