Mercurial > p > roundup > code
comparison test/test_actions.py @ 4304:df7a4400c2ce
Fix linking of an existing item to a newly created item...
...e.g. edit action in web template is name="issue-1@link@msg"
value="msg1" would trigger a traceback about an unbound variable. Add
new regression test for this case.
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Mon, 14 Dec 2009 19:43:44 +0000 |
| parents | de4c2e538e06 |
| children | 9cc6d463cfbe |
comparison
equal
deleted
inserted
replaced
| 4303:7aa72c31464d | 4304:df7a4400c2ce |
|---|---|
| 247 self.client.db.classes.set = AppendResult('set') | 247 self.client.db.classes.set = AppendResult('set') |
| 248 self.client.db.classes.getprops = lambda: \ | 248 self.client.db.classes.getprops = lambda: \ |
| 249 ({'messages':hyperdb.Multilink('msg') | 249 ({'messages':hyperdb.Multilink('msg') |
| 250 ,'content':hyperdb.String() | 250 ,'content':hyperdb.String() |
| 251 ,'files':hyperdb.Multilink('file') | 251 ,'files':hyperdb.Multilink('file') |
| 252 ,'msg':hyperdb.Link('msg') | |
| 252 }) | 253 }) |
| 253 self.action = EditItemAction(self.client) | 254 self.action = EditItemAction(self.client) |
| 254 | 255 |
| 255 def testMessageAttach(self): | 256 def testMessageAttach(self): |
| 256 expect = \ | 257 expect = \ |
| 300 self.action.handle() | 301 self.action.handle() |
| 301 except Redirect, msg: | 302 except Redirect, msg: |
| 302 pass | 303 pass |
| 303 self.assertEqual(expect, self.result) | 304 self.assertEqual(expect, self.result) |
| 304 | 305 |
| 306 def testLinkNewToExisting(self): | |
| 307 expect = [('create',(),{'msg':'1','title':'TEST'})] | |
| 308 self.client.db.classes.get = lambda a, b:['23','42'] | |
| 309 self.client.parsePropsFromForm = lambda: \ | |
| 310 ( {('issue','-1'):{'title':'TEST'},('msg','1'):{}} | |
| 311 , [('issue','-1','msg',[('msg','1')])] | |
| 312 ) | |
| 313 try : | |
| 314 self.action.handle() | |
| 315 except Redirect, msg: | |
| 316 pass | |
| 317 self.assertEqual(expect, self.result) | |
| 318 | |
| 305 def test_suite(): | 319 def test_suite(): |
| 306 suite = unittest.TestSuite() | 320 suite = unittest.TestSuite() |
| 307 suite.addTest(unittest.makeSuite(RetireActionTestCase)) | 321 suite.addTest(unittest.makeSuite(RetireActionTestCase)) |
| 308 suite.addTest(unittest.makeSuite(StandardSearchActionTestCase)) | 322 suite.addTest(unittest.makeSuite(StandardSearchActionTestCase)) |
| 309 suite.addTest(unittest.makeSuite(FakeFilterVarsTestCase)) | 323 suite.addTest(unittest.makeSuite(FakeFilterVarsTestCase)) |
