Index: /main/waeup.sirp/trunk/src/waeup/sirp/utils/tests/test_converters.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/utils/tests/test_converters.py	(revision 6257)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/utils/tests/test_converters.py	(revision 6257)
@@ -0,0 +1,112 @@
+##
+## test_converters.py
+## Login : <uli@pu.smp.net>
+## Started on  Tue May 31 08:34:44 2011 Uli Fouquet
+## $Id$
+## 
+## Copyright (C) 2011 Uli Fouquet
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+## 
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+"""
+Tests for converterts.
+"""
+import os
+import shutil
+import tempfile
+import unittest
+from zope.app.testing.functional import FunctionalTestCase
+from zope.component.hooks import setSite, clearSite
+from zope.interface.verify import verifyClass, verifyObject
+
+from waeup.sirp.app import University
+from waeup.sirp.interfaces import ISchemaTypeConverter
+from waeup.sirp.testing import FunctionalLayer, doctestsuite_for_module
+
+
+class ConverterTests(FunctionalTestCase):
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(ConverterTests, self).setUp()
+
+        # Setup a sample site for each test
+        app = University()
+        self.dc_root = tempfile.mkdtemp()
+        app['datacenter'].setStoragePath(self.dc_root)
+
+        # Prepopulate the ZODB...
+        self.getRootFolder()['app'] = app
+        self.app = self.getRootFolder()['app']
+
+        self.workdir = tempfile.mkdtemp()
+        return
+
+    def tearDown(self):
+        super(ConverterTests, self).tearDown()
+        shutil.rmtree(self.workdir)
+        shutil.rmtree(self.dc_root)
+        clearSite()
+        return
+
+    def test_foo(self):
+        from zope import schema
+        from zope.interface import Interface, implements
+
+        class IContact(Interface):
+            name = schema.TextLine(
+                title = u'name',
+                default = u'Manfred'
+                )
+            age = schema.Int(
+                title = u'age',
+                default = 23,
+                required = True,
+                )
+            city = schema.TextLine(
+                title = u'city',
+                required = True,
+                )
+
+
+        class Contact(object):
+            implements(IContact)
+            name = None
+            age = None
+
+        from waeup.sirp.utils.helpers import attrs_to_fields
+        Contact = attrs_to_fields(Contact)
+
+        #field = IContact['name']
+        context = Contact()
+        conv = ISchemaTypeConverter(IContact)
+        input_data = dict(name='Foo')
+        err, inv_err, data = conv.applyRowData(input_data, context)
+        print context.name, context.age
+        print err, inv_err, data
+        #val = conv._convertValueFromString('Foo', context=context)
+        #print field, conv
+
+def test_suite():
+    suite = unittest.TestSuite()
+    for testcase in [
+        ConverterTests,
+        ]:
+        suite.addTest(unittest.TestLoader().loadTestsFromTestCase(
+                testcase
+                )
+        )
+    return suite
+
