Code

- fix case where action isn't present in form, e.g., for xmlrpc
[roundup.git] / test / test_templating.py
index 80bae0efded1cb673c1ef865946d6e8accf8709c..ad6d7585ac94ee37522bc94d37b4f3edefc0462d 100644 (file)
@@ -72,6 +72,22 @@ class FunctionsTestCase(TemplatingTestCase):
 
 class HTMLClassTestCase(TemplatingTestCase) :
 
+    def test_link(self):
+        """Make sure lookup of a Link property works even in the
+        presence of multiple values in the form."""
+        def lookup(key) :
+            self.assertEqual(key, key.strip())
+            return "Status%s"%key
+        self.form.list.append(MiniFieldStorage("status", "1"))
+        self.form.list.append(MiniFieldStorage("status", "2"))
+        status = hyperdb.Link("status")
+        self.client.db.classes = dict \
+            ( issue = MockNull(getprops = lambda : dict(status = status))
+            , status  = MockNull(get = lambda id, name : id, lookup = lookup)
+            )
+        cls = HTMLClass(self.client, "issue")
+        cls["status"]
+
     def test_multilink(self):
         """`lookup` of an item will fail if leading or trailing whitespace
            has not been stripped.
@@ -134,6 +150,7 @@ class HTMLClassTestCase(TemplatingTestCase) :
         ae(t('http://roundup.net/'), '<a href="http://roundup.net/">http://roundup.net/</a>')
         ae(t('&lt;HTTP://roundup.net/&gt;'), '&lt;<a href="HTTP://roundup.net/">HTTP://roundup.net/</a>&gt;')
         ae(t('&lt;www.roundup.net&gt;'), '&lt;<a href="http://www.roundup.net">www.roundup.net</a>&gt;')
+        ae(t('item123123123123'), 'item123123123123')
 
 '''
 class HTMLPermissions: