Index: main/waeup.sirp/trunk/src/waeup/sirp/jambtables/tests/test_batching.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/jambtables/tests/test_batching.py	(revision 5473)
+++ main/waeup.sirp/trunk/src/waeup/sirp/jambtables/tests/test_batching.py	(revision 5473)
@@ -0,0 +1,87 @@
+##
+## test_batching.py
+## Login : <uli@pu.smp.net>
+## Started on  Tue Aug 24 02:04:44 2010 Uli Fouquet
+## $Id$
+## 
+## Copyright (C) 2010 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
+##
+"""Unit tests for the applicant importer.
+"""
+import grok
+import unittest
+from zope.interface import verify
+from waeup.sirp.interfaces import IBatchProcessor
+from waeup.sirp.jambtables import ApplicantImporter
+
+class ApplicantImporterTest(unittest.TestCase):
+
+    def setUp(self):
+        self.importer = ApplicantImporter()
+        self.site1 = dict(
+            applications = {
+                'REG_NO_1': 'Application1',
+                }
+            )
+        return
+
+    def tearDown(self):
+        pass
+
+    def test_interface(self):
+        """Make sure we fulfill the interface contracts."""
+        assert verify.verifyObject(IBatchProcessor, self.importer) is True
+        assert verify.verifyClass(IBatchProcessor, ApplicantImporter) is True
+
+    def test_parentsExist(self):
+        assert self.importer.parentsExist(None, dict()) is False
+        assert self.importer.parentsExist(None, self.site1) is True
+
+    def test_entryExists(self):
+        assert self.importer.entryExists(
+            dict(reg_no='REG_NONE'), self.site1) is False
+        assert self.importer.entryExists(
+            dict(reg_no='REG_NO_1'), self.site1) is True
+
+    def test_getParent(self):
+        parent = self.importer.getParent(None, self.site1)
+        assert parent is self.site1['applications']
+
+    def test_getEntry(self):
+        assert self.importer.getEntry(
+            dict(reg_no='REG_NONE'), self.site1) is None
+        assert self.importer.getEntry(
+            dict(reg_no='REG_NO_1'), self.site1) == 'Application1'
+
+    def test_addEntry(self):
+        self.importer.addEntry(
+            'New application', dict(reg_no='REG_NO_99'), self.site1)
+        assert self.site1['applications']['REG_NO_99'] == 'New application'
+
+    def test_delEntry(self):
+        self.importer.delEntry(dict(reg_no='REG_NO_1'), self.site1)
+        assert 'REG_NO_1' not in self.site1['applications'].keys()
+        
+def test_suite():
+    suite = unittest.TestSuite()
+    for testcase in [
+        ApplicantImporterTest,
+        ]:
+        suite.addTest(unittest.TestLoader().loadTestsFromTestCase(
+                testcase
+                )
+        )
+    return suite
