[Zope3-checkins] CVS: Zope3/src/zope/app/form/browser/ftests - test_objectwidget.py:1.1.2.1 test_checkboxwidget.py:1.4.2.1 test_datetimewidget.py:1.4.2.1 test_filewidget.py:1.4.2.1 test_floatwidget.py:1.4.2.1 test_intwidget.py:1.4.2.1 test_textareawidget.py:1.3.2.1 test_textwidget.py:1.4.2.1

Martijn Faassen m.faassen at vet.uu.nl
Tue May 11 05:10:57 EDT 2004


Update of /cvs-repository/Zope3/src/zope/app/form/browser/ftests
In directory cvs.zope.org:/tmp/cvs-serv20906/src/zope/app/form/browser/ftests

Modified Files:
      Tag: faassen-interfaces-branch
	test_checkboxwidget.py test_datetimewidget.py 
	test_filewidget.py test_floatwidget.py test_intwidget.py 
	test_textareawidget.py test_textwidget.py 
Added Files:
      Tag: faassen-interfaces-branch
	test_objectwidget.py 
Log Message:
Sync up with changes in HEAD (so I can generate up to date patch file).


=== Added File Zope3/src/zope/app/form/browser/ftests/test_objectwidget.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
$Id: test_objectwidget.py,v 1.1.2.1 2004/05/11 09:10:20 faassen Exp $
"""

import unittest, doctest

from zope.interface import Interface, implements
from zope.publisher.browser import TestRequest
from zope.schema import Object, TextLine
from zope.app.form.browser import ObjectWidget
from zope.app.tests.functional import BrowserTestCase
from zope.app.form.browser.tests import support


class ITestContact(Interface):
    name = TextLine()
    email = TextLine()
    
class TestContact:
    implements(ITestContact)

class Test(BrowserTestCase, support.VerifyResults):
    
    def setUp(self):
        BrowserTestCase.setUp(self)
        self.field = Object(ITestContact, __name__=u'foo')

    def test_new(self):
        request = TestRequest()
        widget = ObjectWidget(self.field, request, TestContact)
        self.assertEquals(int(widget.hasInput()), 0)
        check_list = (
            'input', 'name="field.foo.name"',
            'input', 'name="field.foo.email"'
        )
        self.verifyResult(widget(), check_list)

    def test_edit(self):
        request = TestRequest(form={
            'field.foo.name': u'fred',
            'field.foo.email': u'fred at fred.com'
            })
        widget = ObjectWidget(self.field, request, TestContact)
        self.assertEquals(int(widget.hasInput()), 1)
        o = widget.getInputValue()
        self.assertEquals(hasattr(o, 'name'), 1)
        self.assertEquals(o.name, u'fred')
        self.assertEquals(o.email, u'fred at fred.com')
        check_list = (
            'input', 'name="field.foo.name"', 'value="fred"',
            'input', 'name="field.foo.email"', 'value="fred at fred.com"',
        )
        self.verifyResult(widget(), check_list)

def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(Test))
    return suite

if __name__=='__main__':
    unittest.main(defaultTest='test_suite')





=== Zope3/src/zope/app/form/browser/ftests/test_checkboxwidget.py 1.4 => 1.4.2.1 ===
--- Zope3/src/zope/app/form/browser/ftests/test_checkboxwidget.py:1.4	Tue Apr  6 16:58:08 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_checkboxwidget.py	Tue May 11 05:10:20 2004
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from persistence import Persistent
+from persistent import Persistent
 from transaction import get_transaction
 
 from zope.interface import Interface


=== Zope3/src/zope/app/form/browser/ftests/test_datetimewidget.py 1.4 => 1.4.2.1 ===
--- Zope3/src/zope/app/form/browser/ftests/test_datetimewidget.py:1.4	Sat Apr 24 19:19:43 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_datetimewidget.py	Tue May 11 05:10:20 2004
@@ -17,7 +17,7 @@
 """
 import unittest
 import re
-from persistence import Persistent
+from persistent import Persistent
 from transaction import get_transaction
 from datetime import datetime
 from zope.app.datetimeutils import parseDatetimetz, tzinfo


=== Zope3/src/zope/app/form/browser/ftests/test_filewidget.py 1.4 => 1.4.2.1 ===
--- Zope3/src/zope/app/form/browser/ftests/test_filewidget.py:1.4	Sat Apr 24 19:19:43 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_filewidget.py	Tue May 11 05:10:20 2004
@@ -18,7 +18,7 @@
 
 import unittest
 from StringIO import StringIO
-from persistence import Persistent
+from persistent import Persistent
 from transaction import get_transaction
 
 from zope.interface import Interface


=== Zope3/src/zope/app/form/browser/ftests/test_floatwidget.py 1.4 => 1.4.2.1 ===
--- Zope3/src/zope/app/form/browser/ftests/test_floatwidget.py:1.4	Sat Apr 24 19:19:43 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_floatwidget.py	Tue May 11 05:10:20 2004
@@ -17,7 +17,7 @@
 """
 
 import unittest
-from persistence import Persistent
+from persistent import Persistent
 from transaction import get_transaction
 
 from support import *


=== Zope3/src/zope/app/form/browser/ftests/test_intwidget.py 1.4 => 1.4.2.1 ===
--- Zope3/src/zope/app/form/browser/ftests/test_intwidget.py:1.4	Sat Apr 24 19:19:43 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_intwidget.py	Tue May 11 05:10:20 2004
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from persistence import Persistent
+from persistent import Persistent
 from transaction import get_transaction
 
 from support import *


=== Zope3/src/zope/app/form/browser/ftests/test_textareawidget.py 1.3 => 1.3.2.1 ===
--- Zope3/src/zope/app/form/browser/ftests/test_textareawidget.py:1.3	Sun Apr 11 06:34:56 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_textareawidget.py	Tue May 11 05:10:20 2004
@@ -17,7 +17,7 @@
 """
 
 import unittest
-from persistence import Persistent
+from persistent import Persistent
 from transaction import get_transaction
 
 from zope.interface import Interface


=== Zope3/src/zope/app/form/browser/ftests/test_textwidget.py 1.4 => 1.4.2.1 ===
--- Zope3/src/zope/app/form/browser/ftests/test_textwidget.py:1.4	Sat Apr 24 19:19:43 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_textwidget.py	Tue May 11 05:10:20 2004
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from persistence import Persistent
+from persistent import Persistent
 from transaction import get_transaction
 
 from zope.interface import Interface, implements




More information about the Zope3-Checkins mailing list