Mercurial > p > roundup > code
comparison test/test_cgi.py @ 2027:45ad02759998
test fixes
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 17 Feb 2004 03:48:08 +0000 |
| parents | 1782fe36e7b8 |
| children | a5c5a1106e3b |
comparison
equal
deleted
inserted
replaced
| 2025:e13d11bb7ee8 | 2027:45ad02759998 |
|---|---|
| 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.22 2004-02-11 21:34:31 jlgijsbers Exp $ | 11 # $Id: test_cgi.py,v 1.23 2004-02-17 03:48:08 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.cgi.errors import FormError | 16 from roundup.cgi.exceptions import FormError |
| 17 from roundup.cgi.FormParser import FormParser | 17 from roundup.cgi.form_parser import FormParser |
| 18 from roundup import init, instance, password, hyperdb, date | 18 from roundup import init, instance, password, hyperdb, date |
| 19 | 19 |
| 20 NEEDS_INSTANCE = 1 | 20 NEEDS_INSTANCE = 1 |
| 21 | 21 |
| 22 class FileUpload: | 22 class FileUpload: |
| 97 cl = client.Client(self.instance, None, {'PATH_INFO':'/'}, | 97 cl = client.Client(self.instance, None, {'PATH_INFO':'/'}, |
| 98 makeForm(form)) | 98 makeForm(form)) |
| 99 cl.classname = classname | 99 cl.classname = classname |
| 100 cl.nodeid = nodeid | 100 cl.nodeid = nodeid |
| 101 cl.db = self.db | 101 cl.db = self.db |
| 102 return cl.parsePropsFromForm() | 102 return cl.parsePropsFromForm(create=1) |
| 103 | 103 |
| 104 def tearDown(self): | 104 def tearDown(self): |
| 105 self.db.close() | 105 self.db.close() |
| 106 try: | 106 try: |
| 107 shutil.rmtree(self.dirname) | 107 shutil.rmtree(self.dirname) |
| 271 form.list.append(cgi.MiniFieldStorage('nosy', '3')) | 271 form.list.append(cgi.MiniFieldStorage('nosy', '3')) |
| 272 cl = client.Client(self.instance, None, {'PATH_INFO':'/'}, form) | 272 cl = client.Client(self.instance, None, {'PATH_INFO':'/'}, form) |
| 273 cl.classname = 'issue' | 273 cl.classname = 'issue' |
| 274 cl.nodeid = None | 274 cl.nodeid = None |
| 275 cl.db = self.db | 275 cl.db = self.db |
| 276 self.assertEqual(cl.parsePropsFromForm(), | 276 self.assertEqual(cl.parsePropsFromForm(create=1), |
| 277 ({('issue', None): {'nosy': ['1','2', '3']}}, [])) | 277 ({('issue', None): {'nosy': ['1','2', '3']}}, [])) |
| 278 | 278 |
| 279 def testEmptyMultilinkSet(self): | 279 def testEmptyMultilinkSet(self): |
| 280 nodeid = self.db.issue.create(nosy=['1','2']) | 280 nodeid = self.db.issue.create(nosy=['1','2']) |
| 281 self.assertEqual(self.parseForm({'nosy': ''}, 'issue', nodeid), | 281 self.assertEqual(self.parseForm({'nosy': ''}, 'issue', nodeid), |
