Index: main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_applicant.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_applicant.py	(revision 7113)
+++ main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_applicant.py	(revision 7121)
@@ -23,5 +23,9 @@
 """
 import grok
+import os
+import shutil
+import tempfile
 import unittest
+from StringIO import StringIO
 from zope.component import adapts, queryUtility
 from zope.component.interfaces import IFactory
@@ -48,4 +52,14 @@
     layer = FunctionalLayer
 
+    def setUp(self):
+        super(HelperTests, self).setUp()
+        self.workdir = tempfile.mkdtemp()
+        return
+
+    def tearDown(self):
+        super(HelperTests, self).tearDown()
+        shutil.rmtree(self.workdir)
+        return
+
     def test_get_regno_or_ac(self):
         # we can get reg_no or access_code of an applicants if it is set
@@ -85,9 +99,31 @@
             store, '/fake-root', '__img-applicant__dir1/dir2/sample.jpg')
         self.assertEqual(
-            result1, '/fake-root/applicants/sample.jpg')
-        self.assertEqual(
-            result2, '/fake-root/applicants/dir1/sample.jpg')
-        self.assertEqual(
-            result3, '/fake-root/applicants/dir1/dir2/sample.jpg')
+            result1, '/fake-root/applicants/sample')
+        self.assertEqual(
+            result2, '/fake-root/applicants/dir1/sample')
+        self.assertEqual(
+            result3, '/fake-root/applicants/dir1/dir2/sample')
+        return
+
+    def test_image_store_handler_create(self):
+        # we can create files in image store with the applicant image
+        # store handler
+        store = DefaultStorage(self.workdir)
+        handler = queryUtility(IFileStoreHandler, name='img-applicant')
+        file_obj, path, waeup_file = handler.createFile(
+            store, store.root, 'sample.jpg', '__img_applicant__sample',
+            StringIO('I am a JPG file'))
+        self.assertEqual(path[-21:], 'applicants/sample.jpg')
+        return
+
+    def test_image_store_handler_invalid_filename_ext(self):
+        # we only accept '.jpg' and '.png' as filename extensions.
+        store = DefaultStorage()
+        handler = queryUtility(IFileStoreHandler, name='img-applicant')
+        self.assertRaises(
+            ValueError,
+            handler.createFile,
+            store, store.root, 'sample.txt', '__img_applicant__sample',
+            StringIO('I am a txt file'))
         return
 
