Index: main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_container_data.csv
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_container_data.csv	(revision 8008)
+++ main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_container_data.csv	(revision 8033)
@@ -1,7 +1,7 @@
-code,title,prefix,entry_level,year,provider,application_category,description,startdate,enddate,strict_deadline
-app2012,General Studies 2012/2013,app,100,2012,waeup.kofa.applicants.ApplicantsContainer,basic,"This text can been seen by anonymous users.
+code,title,prefix,entry_level,year,application_category,description,startdate,enddate,strict_deadline,mode
+app2012,General Studies 2012/2013,app,100,2012,basic,"This text can been seen by anonymous users.
 >>de<<
-Dieser Text kann von anonymen Benutzern gelesen werden.",2012-03-01,2012-04-25,1
-app2013,General Studies 2013/2014,app,100,2012,waeup.kofa.applicants.ApplicantsContainer,basic,"This text can been seen by anonymous users.
+Dieser Text kann von anonymen Benutzern gelesen werden.",2012-03-01,2012-04-25,1,create
+app2013,General Studies 2013/2014,app,100,2012,basic,"This text can been seen by anonymous users.
 >>de<<
-Dieser Text kann von anonymen Benutzern gelesen werden.",2013-03-01,2013-04-25,1
+Dieser Text kann von anonymen Benutzern gelesen werden.",2013-03-01,2013-04-25,1,create
Index: main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 8008)
+++ main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 8033)
@@ -84,4 +84,5 @@
         applicantscontainer.entry_level = 100
         applicantscontainer.application_category = 'basic'
+        applicantscontainer.mode = 'create'
         delta = timedelta(days=10)
         applicantscontainer.startdate = date.today() - delta
@@ -248,4 +249,5 @@
         self.browser.getControl(name="form.year").value = ['2010']
         self.browser.getControl(name="form.entry_level").value = ['100']
+        self.browser.getControl(name="form.mode").value = ['create']
         self.browser.getControl(
             name="form.application_category").value = ['basic']
@@ -262,4 +264,5 @@
         self.browser.getControl(name="form.year").value = ['2010']
         self.browser.getControl(name="form.entry_level").value = ['100']
+        self.browser.getControl(name="form.mode").value = ['create']
         self.browser.getControl(
             name="form.application_category").value = ['basic']
@@ -276,4 +279,5 @@
         self.browser.getControl(name="form.year").value = ['2010']
         self.browser.getControl(name="form.entry_level").value = ['100']
+        self.browser.getControl(name="form.mode").value = ['create']
         #self.browser.getControl(name="form.ac_prefix").value = ['APP']
         self.browser.getControl(
@@ -788,5 +792,5 @@
     layer = FunctionalLayer
 
-    def test_register_applicant(self):
+    def test_register_applicant_create(self):
         # An applicant can register himself.
         self.browser.open(self.container_path)
@@ -802,4 +806,32 @@
         self.assertEqual(self.browser.url,
             self.container_path + '/registration_complete?email=xx%40yy.zz')
+        # Now we change the application mode and check if applicants
+        # can find and update imported records instead of creating new records.
+        # First we check what happens if record can't be found.
+        self.applicantscontainer.mode = 'update'
+        self.browser.open(self.container_path + '/register')
+        #self.browser.getControl(name="form.firstname").value = 'John'
+        self.browser.getControl(name="form.reg_number").value = 'anynumber'
+        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
+        self.browser.getControl("Get login credentials").click()
+        self.assertTrue('No application record found.'
+            in self.browser.contents)
+        # Now we check if password has already been set.
+        #self.browser.getControl(name="form.firstname").value = 'John'
+        self.browser.getControl(name="form.reg_number").value = '1234'
+        self.browser.getControl("Get login credentials").click()
+        self.assertTrue('Your password has already been set.'
+            in self.browser.contents)
+        # We unset the password and try to register again.
+        IUserAccount(
+            self.app['applicants']['app2009'][
+            self.applicant.application_number]).context.password = None
+        self.browser.open(self.container_path + '/register')
+        #self.browser.getControl(name="form.firstname").value = 'John'
+        self.browser.getControl(name="form.reg_number").value = '1234'
+        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
+        self.browser.getControl("Get login credentials").click()
+        self.assertTrue('Your registration was successful.'
+            in self.browser.contents)
         return
 
