summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 08d27de)
raw | patch | inline | side by side (parent: 08d27de)
author | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 24 Sep 2003 14:54:23 +0000 (14:54 +0000) | ||
committer | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 24 Sep 2003 14:54:23 +0000 (14:54 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1886 57a73879-2fb5-44c3-a270-3262357dd7e2
test/test_cgi.py | patch | blob | history |
diff --git a/test/test_cgi.py b/test/test_cgi.py
index 0a5602587f879b0f558fbca784ad9e1b1b6c161f..9e40feb8f1f802938db774d734ac67293adc54a6 100644 (file)
--- a/test/test_cgi.py
+++ b/test/test_cgi.py
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test_cgi.py,v 1.19 2003-09-07 20:37:33 jlgijsbers Exp $
+# $Id: test_cgi.py,v 1.20 2003-09-24 14:54:23 jlgijsbers Exp $
import unittest, os, shutil, errno, sys, difflib, cgi, re
from roundup.cgi import client
+from roundup.cgi.client import FormError
from roundup import init, instance, password, hyperdb, date
NEEDS_INSTANCE = 1
self.assertEqual(self.parseForm({}), ({('test', None): {}}, []))
def testNothingWithRequired(self):
- self.assertRaises(ValueError, self.parseForm, {':required': 'string'})
- self.assertRaises(ValueError, self.parseForm,
+ self.assertRaises(FormError, self.parseForm, {':required': 'string'})
+ self.assertRaises(FormError, self.parseForm,
{':required': 'title,status', 'status':'1'}, 'issue')
- self.assertRaises(ValueError, self.parseForm,
+ self.assertRaises(FormError, self.parseForm,
{':required': ['title','status'], 'status':'1'}, 'issue')
- self.assertRaises(ValueError, self.parseForm,
+ self.assertRaises(FormError, self.parseForm,
{':required': 'status', 'status':''}, 'issue')
- self.assertRaises(ValueError, self.parseForm,
+ self.assertRaises(FormError, self.parseForm,
{':required': 'nosy', 'nosy':''}, 'issue')
#
# Nonexistant edit
#
def testEditNonexistant(self):
- self.assertRaises(IndexError, self.parseForm, {'boolean': ''},
+ self.assertRaises(FormError, self.parseForm, {'boolean': ''},
'test', '1')
#
({('test', None): {}}, []))
self.assertEqual(self.parseForm({'string': ' '}),
({('test', None): {}}, []))
- self.assertRaises(ValueError, self.parseForm, {'string': ['', '']})
+ self.assertRaises(FormError, self.parseForm, {'string': ['', '']})
def testSetString(self):
self.assertEqual(self.parseForm({'string': 'foo'}),
({('test', None): {}}, []))
self.assertEqual(self.parseForm({'link': ' '}),
({('test', None): {}}, []))
- self.assertRaises(ValueError, self.parseForm, {'link': ['', '']})
+ self.assertRaises(FormError, self.parseForm, {'link': ['', '']})
self.assertEqual(self.parseForm({'link': '-1'}),
({('test', None): {}}, []))
# XXX This is not the current behaviour - should we enforce this?
# self.assertRaises(IndexError, self.parseForm,
# {'status': '4'}))
- self.assertRaises(ValueError, self.parseForm, {'link': 'frozzle'})
- self.assertRaises(ValueError, self.parseForm, {'status': 'frozzle'},
+ self.assertRaises(FormError, self.parseForm, {'link': 'frozzle'})
+ self.assertRaises(FormError, self.parseForm, {'status': 'frozzle'},
'issue')
#
# XXX This is not the current behaviour - should we enforce this?
# self.assertRaises(IndexError, self.parseForm,
# {'nosy': '4'}))
- self.assertRaises(ValueError, self.parseForm, {'nosy': 'frozzle'},
+ self.assertRaises(FormError, self.parseForm, {'nosy': 'frozzle'},
'issue')
- self.assertRaises(ValueError, self.parseForm, {'nosy': '1,frozzle'},
+ self.assertRaises(FormError, self.parseForm, {'nosy': '1,frozzle'},
'issue')
- self.assertRaises(ValueError, self.parseForm, {'multilink': 'frozzle'})
+ self.assertRaises(FormError, self.parseForm, {'multilink': 'frozzle'})
def testMultilinkAdd(self):
nodeid = self.db.issue.create(nosy=['1'])
'issue', nodeid), ({('issue', nodeid): {'nosy': ['3']}}, []))
# remove one that doesn't exist?
- self.assertRaises(ValueError, self.parseForm, {':remove:nosy': '4'},
+ self.assertRaises(FormError, self.parseForm, {':remove:nosy': '4'},
'issue', nodeid)
def testMultilinkRetired(self):
({('issue', nodeid): {'nosy': ['1','2','3']}}, []))
def testAddRemoveNonexistant(self):
- self.assertRaises(ValueError, self.parseForm, {':remove:foo': '2'},
+ self.assertRaises(FormError, self.parseForm, {':remove:foo': '2'},
'issue')
- self.assertRaises(ValueError, self.parseForm, {':add:foo': '2'},
+ self.assertRaises(FormError, self.parseForm, {':add:foo': '2'},
'issue')
#
({('user', None): {}}, []))
self.assertEqual(self.parseForm({'password': ''}, 'user'),
({('user', None): {}}, []))
- self.assertRaises(ValueError, self.parseForm, {'password': ['', '']},
+ self.assertRaises(FormError, self.parseForm, {'password': ['', '']},
'user')
- self.assertRaises(ValueError, self.parseForm, {'password': 'foo',
+ self.assertRaises(FormError, self.parseForm, {'password': 'foo',
':confirm:password': ['', '']}, 'user')
def testSetPassword(self):
({('user', None): {'password': 'foo'}}, []))
def testSetPasswordConfirmBad(self):
- self.assertRaises(ValueError, self.parseForm, {'password': 'foo'},
+ self.assertRaises(FormError, self.parseForm, {'password': 'foo'},
'user')
- self.assertRaises(ValueError, self.parseForm, {'password': 'foo',
+ self.assertRaises(FormError, self.parseForm, {'password': 'foo',
':confirm:password': 'bar'}, 'user')
def testEmptyPasswordNotSet(self):
({('test', None): {}}, []))
self.assertEqual(self.parseForm({'boolean': ' '}),
({('test', None): {}}, []))
- self.assertRaises(ValueError, self.parseForm, {'boolean': ['', '']})
+ self.assertRaises(FormError, self.parseForm, {'boolean': ['', '']})
def testSetBoolean(self):
self.assertEqual(self.parseForm({'boolean': 'yes'}),
({('test', None): {}}, []))
self.assertEqual(self.parseForm({'number': ' '}),
({('test', None): {}}, []))
- self.assertRaises(ValueError, self.parseForm, {'number': ['', '']})
+ self.assertRaises(FormError, self.parseForm, {'number': ['', '']})
def testInvalidNumber(self):
- self.assertRaises(ValueError, self.parseForm, {'number': 'hi, mum!'})
+ self.assertRaises(FormError, self.parseForm, {'number': 'hi, mum!'})
def testSetNumber(self):
self.assertEqual(self.parseForm({'number': '1'}),
({('test', None): {}}, []))
self.assertEqual(self.parseForm({'date': ' '}),
({('test', None): {}}, []))
- self.assertRaises(ValueError, self.parseForm, {'date': ['', '']})
+ self.assertRaises(FormError, self.parseForm, {'date': ['', '']})
def testInvalidDate(self):
- self.assertRaises(ValueError, self.parseForm, {'date': '12'})
+ self.assertRaises(FormError, self.parseForm, {'date': '12'})
def testSetDate(self):
self.assertEqual(self.parseForm({'date': '2003-01-01'}),
)
def testLinkBadDesignator(self):
- self.assertRaises(ValueError, self.parseForm,
+ self.assertRaises(FormError, self.parseForm,
{'test-1@link@link': 'blah'})
- self.assertRaises(ValueError, self.parseForm,
+ self.assertRaises(FormError, self.parseForm,
{'test-1@link@link': 'issue'})
def testLinkNotLink(self):
- self.assertRaises(ValueError, self.parseForm,
+ self.assertRaises(FormError, self.parseForm,
{'test-1@link@boolean': 'issue-1'})
- self.assertRaises(ValueError, self.parseForm,
+ self.assertRaises(FormError, self.parseForm,
{'test-1@link@string': 'issue-1'})
def testBackwardsCompat(self):