diff test/test_cgi.py @ 3982:efcea2fe69be

add new test for multiple message creation
author Richard Jones <richard@users.sourceforge.net>
date Thu, 07 Aug 2008 06:12:57 +0000
parents 3167ad1c19cd
children 34434785f308
line wrap: on
line diff
--- a/test/test_cgi.py	Thu Aug 07 06:05:53 2008 +0000
+++ b/test/test_cgi.py	Thu Aug 07 06:12:57 2008 +0000
@@ -8,7 +8,7 @@
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
-# $Id: test_cgi.py,v 1.35 2008-08-07 05:59:18 richard Exp $
+# $Id: test_cgi.py,v 1.36 2008-08-07 06:12:57 richard Exp $
 
 import unittest, os, shutil, errno, sys, difflib, cgi, re
 
@@ -77,7 +77,7 @@
             string=hyperdb.String(), number=hyperdb.Number(),
             boolean=hyperdb.Boolean(), link=hyperdb.Link('test'),
             multilink=hyperdb.Multilink('test'), date=hyperdb.Date(),
-            interval=hyperdb.Interval())
+            messages=hyperdb.Multilink('msg'), interval=hyperdb.Interval())
 
         # compile the labels re
         classes = '|'.join(self.db.classes.keys())
@@ -574,6 +574,18 @@
             )
         )
 
+    def testMessages(self):
+        self.assertEqual(self.parseForm({
+            'msg-1@content': 'asdf',
+            'msg-2@content': 'qwer',
+            '@link@messages': 'msg-1, msg-2'}),
+            ({('test', None): {},
+              ('msg', '-2'): {'content': 'qwer'},
+              ('msg', '-1'): {'content': 'asdf'}},
+             [('test', None, 'messages', [('msg', '-1'), ('msg', '-2')])]
+            )
+        )
+
     def testLinkBadDesignator(self):
         self.assertRaises(FormError, self.parseForm,
             {'test-1@link@link': 'blah'})

Roundup Issue Tracker: http://roundup-tracker.org/