Mercurial > p > roundup > code
comparison test/test_templating.py @ 4040:b6a2251394dd
Make cgi.templating more fault-tolerant towards invalid requests.
| author | Stefan Seefeld <stefan@seefeld.name> |
|---|---|
| date | Mon, 16 Feb 2009 21:02:23 +0000 |
| parents | e77bcbdc9b32 |
| children | ce684080e968 |
comparison
equal
deleted
inserted
replaced
| 4039:f44ec45cedb4 | 4040:b6a2251394dd |
|---|---|
| 69 ['green', 'eggs']) | 69 ['green', 'eggs']) |
| 70 self.assertEqual(lookupKeys(shrubbery, 'spam', ['ok','2']), ['ok', | 70 self.assertEqual(lookupKeys(shrubbery, 'spam', ['ok','2']), ['ok', |
| 71 'eggs']) | 71 'eggs']) |
| 72 | 72 |
| 73 class HTMLClassTestCase(TemplatingTestCase) : | 73 class HTMLClassTestCase(TemplatingTestCase) : |
| 74 | |
| 75 def test_link(self): | |
| 76 """Make sure lookup of a Link property works even in the | |
| 77 presence of multiple values in the form.""" | |
| 78 def lookup(key) : | |
| 79 self.assertEqual(key, key.strip()) | |
| 80 return "Status%s"%key | |
| 81 self.form.list.append(MiniFieldStorage("status", "1")) | |
| 82 self.form.list.append(MiniFieldStorage("status", "2")) | |
| 83 status = hyperdb.Link("status") | |
| 84 self.client.db.classes = dict \ | |
| 85 ( issue = MockNull(getprops = lambda : dict(status = status)) | |
| 86 , status = MockNull(get = lambda id, name : id, lookup = lookup) | |
| 87 ) | |
| 88 cls = HTMLClass(self.client, "issue") | |
| 89 cls["status"] | |
| 74 | 90 |
| 75 def test_multilink(self): | 91 def test_multilink(self): |
| 76 """`lookup` of an item will fail if leading or trailing whitespace | 92 """`lookup` of an item will fail if leading or trailing whitespace |
| 77 has not been stripped. | 93 has not been stripped. |
| 78 """ | 94 """ |
