[Zope3-checkins] CVS: Zope3/src/zope/app/browser/component/tests - test_interfacewidget.py:1.11

Steve Alexander steve@cat-box.net
Thu, 9 Jan 2003 04:37:48 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/component/tests
In directory cvs.zope.org:/tmp/cvs-serv31617/src/zope/app/browser/component/tests

Modified Files:
	test_interfacewidget.py 
Log Message:
exchanged another XXX request for a unit test for a real unit test


=== Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py:1.10	Thu Jan  9 04:13:03 2003
+++ Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py	Thu Jan  9 04:37:16 2003
@@ -708,7 +708,51 @@
         self.assertEqual(widget.hidden(), out)
         
 
+class TestRenderInterfaceSelect(TestCase):
+
+    def testInterfaceSelect(self):
+        from zope.app.browser.component.interfacewidget \
+            import renderInterfaceSelect
+        interfaces = ['foo', 'bar', 'baz']
+        selected = 'bar'
+        search_name = 'searchname'
+        search_string = 'foo"blee'
+        select_name = 'selectname'
+        out = (
+        '''<input type="text" name="searchname" value='foo"blee'>'''
+        '''<select name="selectname">'''
+        '''<option value="">---select interface---</option>'''
+        '''<option value="foo">foo</option>'''
+        '''<option value="bar" selected>bar</option>'''
+        '''<option value="baz">baz</option>'''
+        '''</select>'''
+        )
+        self.assertEqual(
+            renderInterfaceSelect(interfaces, selected, search_name,
+                                  search_string, select_name),
+            out)
+
+    def testEmptyInterfaceSelect(self):
+        from zope.app.browser.component.interfacewidget \
+            import renderInterfaceSelect
+        interfaces = []
+        selected = 'bar'
+        search_name = 'searchname'
+        search_string = 'fooblee'
+        select_name = 'selectname'
+        out = (
+        '<input type="text" name="searchname" value="fooblee">'
+        '<select name="selectname">'
+        '<option value="">---select interface---</option>'
+        '</select>'
+        )
+        self.assertEqual(
+            renderInterfaceSelect(interfaces, selected, search_name,
+                                  search_string, select_name),
+            out)
+
 def test_suite():
     return TestSuite((makeSuite(TestInterfaceWidget),
-                      makeSuite(TestMultiInterfaceWidget)
+                      makeSuite(TestMultiInterfaceWidget),
+                      makeSuite(TestRenderInterfaceSelect),
                     ))