Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data.csv
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data.csv	(revision 8268)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data.csv	(revision 8284)
@@ -1,5 +1,5 @@
 student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,sex,reg_state
 X666666,Aaren,Pieri,1,1990-01-02,100000,aa@aa.ng,1234,m,courses validated
-,Claus,Finau,2,1990-01-03,100001,aa@aa.ng,1234,m,courses validated
+Y777777,Claus,Finau,2,1990-01-03,100001,aa@aa.ng,1234,m,courses validated
 ,Susann,Berson,3,1990-01-04,100002,aa@aa.ng,1234,f,courses validated
 ,Else,Mueller,4,1990-01-05,100003,aa@aa.ng,1234,f,courses registered
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_migration.csv
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_migration.csv	(revision 8268)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_migration.csv	(revision 8284)
@@ -4,3 +4,4 @@
 C123456,Aaren,Berson,3,1990-01-04,100002,aa@aa.ng,1234,mypw1,m,admitted
 D123456,John,Wolter,4,1990-01-05,100003,aa@aa.ng,1234,mypw1,m,nonsense
-E123456,John,Kennedy,5,1990-01-06,100004,aa@aa.ng,1234,,x
+E123456,John,Kennedy,5,1990-01-06,100004,aa@aa.ng,1234,,x,
+F123456,Frank,Meyer,5,1990-01-06,100004,aa@aa.ng,1234,,m,
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_update.csv
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_update.csv	(revision 8268)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_update.csv	(revision 8284)
@@ -1,4 +1,4 @@
-reg_number,date_of_birth,matric_number
-1,1980-01-02,10
-2,1980-01-03,11
-3,1980-01-04,12
+reg_number,date_of_birth,matric_number,reg_state
+1,1980-01-02,10,admitted
+2,1980-01-03,11,
+3,1980-01-04,12,
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py	(revision 8268)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py	(revision 8284)
@@ -222,8 +222,9 @@
             dict(reg_number='1', reg_state='admitted'))
         self.assertEqual(len(errs),0)
+        # Empty reg_state is allowed
         errs, inv_errs, conv_dict = self.processor.checkConversion(
             dict(reg_number='1', reg_state=''))
-        self.assertEqual(len(errs),1)
-        self.assertTrue(('reg_state', 'no value provided') in errs)
+        self.assertEqual(len(errs),0)
+        #self.assertTrue(('reg_state', 'no value provided') in errs)
         errs, inv_errs, conv_dict = self.processor.checkConversion(
             dict(reg_number='1', reg_state='nonsense'))
@@ -243,4 +244,5 @@
         assert len(self.app['students'].keys()) == 5
         self.assertEqual(self.app['students']['X666666'].reg_number,'1')
+        self.assertEqual(self.app['students']['X666666'].state,'courses validated')
         shutil.rmtree(os.path.dirname(fin_file))
 
@@ -252,4 +254,8 @@
             self.csv_file_update, STUDENT_HEADER_FIELDS_UPDATE, 'update')
         self.assertEqual(num_warns,0)
+        # reg_state has changed
+        self.assertEqual(self.app['students']['X666666'].state,'admitted')
+        # reg_state has not changed
+        self.assertEqual(self.app['students']['Y777777'].state,'courses validated')
         shutil.rmtree(os.path.dirname(fin_file))
 
@@ -290,12 +296,12 @@
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file_migration, STUDENT_HEADER_FIELDS_MIGRATION)
+        content = open(fail_file).read()
         self.assertEqual(num_warns,2)
-        assert len(self.app['students'].keys()) == 4
-        content = open(fail_file).read()
+        assert len(self.app['students'].keys()) == 5
         self.assertEqual(
             content,
             'reg_number,firstname,student_id,sex,email,phone,date_of_birth,reg_state,lastname,password,matric_number,--ERRORS--\r\n'
             '4,John,D123456,m,aa@aa.ng,1234,1990-01-05,nonsense,Wolter,mypw1,100003,reg_state: not allowed\r\n'
-            '5,John,E123456,x,aa@aa.ng,1234,1990-01-06,,Kennedy,,100004,sex: Invalid value; reg_state: not allowed\r\n'
+            '5,John,E123456,x,aa@aa.ng,1234,1990-01-06,,Kennedy,,100004,sex: Invalid value\r\n'
             )
         self.assertTrue('A123456' in self.app['students'].keys())
@@ -311,4 +317,6 @@
         self.assertTrue(
             "State 'clearance started' set by system" in history)
+        # reg_state was empty and student is thus in state created
+        self.assertEqual(self.app['students']['F123456'].state,'created')
         shutil.rmtree(os.path.dirname(fin_file))
 
