Index: main/waeup.sirp/trunk/src/waeup/sirp/students/tests/sample_studylevel_data.csv
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/tests/sample_studylevel_data.csv	(revision 7536)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/tests/sample_studylevel_data.csv	(revision 7536)
@@ -0,0 +1,6 @@
+reg_number,matric_number,level_session,level_verdict,level
+1,,2008,A,100
+2,,2008,B,100
+,100002,2009,C,100
+1,,2008,A,111
+1,,2008,A,nonsense
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_batching.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_batching.py	(revision 7534)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_batching.py	(revision 7536)
@@ -31,5 +31,6 @@
 from waeup.sirp.university.department import Department
 from waeup.sirp.students.batching import (
-    StudentProcessor, StudentStudyCourseProcessor)
+    StudentProcessor, StudentStudyCourseProcessor,
+    StudentStudyLevelProcessor)
 from waeup.sirp.students.student import Student
 from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase
@@ -69,4 +70,11 @@
 
 STUDENT_HEADER_FIELDS_MIGRATION = STUDENT_SAMPLE_DATA_MIGRATION.split(
+    '\n')[0].split(',')
+
+STUDYLEVEL_SAMPLE_DATA = open(
+    os.path.join(os.path.dirname(__file__), 'sample_studylevel_data.csv'),
+    'rb').read()
+
+STUDYLEVEL_HEADER_FIELDS = STUDYLEVEL_SAMPLE_DATA.split(
     '\n')[0].split(',')
 
@@ -212,4 +220,5 @@
         shutil.rmtree(os.path.dirname(fin_file))
 
+
 class StudentStudyCourseImporterTest(FunctionalTestCase):
 
@@ -218,17 +227,11 @@
     def setUp(self):
         super(StudentStudyCourseImporterTest, self).setUp()
+        self.dc_root = tempfile.mkdtemp()
+        self.workdir = tempfile.mkdtemp()
         app = University()
-        self.dc_root = tempfile.mkdtemp()
         app['datacenter'].setStoragePath(self.dc_root)
-
         self.getRootFolder()['app'] = app
         self.app = self.getRootFolder()['app']
         setSite(app)
-
-        self.workdir = tempfile.mkdtemp()
-        self.importer = StudentStudyCourseProcessor()
-        self.csv_file = os.path.join(
-            self.workdir, 'sample_studycourse_data.csv')
-        open(self.csv_file, 'wb').write(STUDYCOURSE_SAMPLE_DATA)
 
         # Import students with subobjects
@@ -249,4 +252,9 @@
         self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
             self.certificate)
+
+        self.importer = StudentStudyCourseProcessor()
+        self.csv_file = os.path.join(
+            self.workdir, 'sample_studycourse_data.csv')
+        open(self.csv_file, 'wb').write(STUDYCOURSE_SAMPLE_DATA)
         return
 
@@ -283,9 +291,83 @@
         shutil.rmtree(os.path.dirname(fin_file))
 
+class StudentStudyLevelImporterTest(FunctionalTestCase):
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(StudentStudyLevelImporterTest, self).setUp()
+        self.dc_root = tempfile.mkdtemp()
+        self.workdir = tempfile.mkdtemp()
+        app = University()
+        app['datacenter'].setStoragePath(self.dc_root)
+        self.getRootFolder()['app'] = app
+        self.app = self.getRootFolder()['app']
+        setSite(app)
+
+        # Import students with subobjects
+        student_file = os.path.join(self.workdir, 'sample_student_data.csv')
+        open(student_file, 'wb').write(STUDENT_SAMPLE_DATA)
+        num, num_warns, fin_file, fail_file = StudentProcessor().doImport(
+            student_file, STUDENT_HEADER_FIELDS)
+        shutil.rmtree(os.path.dirname(fin_file))
+
+        # Populate university
+        self.certificate = createObject('waeup.Certificate')
+        self.certificate.code = 'CERT1'
+        self.certificate.application_category = 'basic'
+        self.certificate.start_level = 200
+        self.certificate.end_level = 500
+        self.app['faculties']['fac1'] = Faculty()
+        self.app['faculties']['fac1']['dep1'] = Department()
+        self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
+            self.certificate)
+
+        # Update study courses
+        studycourse_file = os.path.join(
+            self.workdir, 'sample_studycourse_data.csv')
+        open(studycourse_file, 'wb').write(STUDYCOURSE_SAMPLE_DATA)
+        importer = StudentStudyCourseProcessor()
+        num, num_warns, fin_file, fail_file = importer.doImport(
+            studycourse_file, STUDYCOURSE_HEADER_FIELDS,'update')
+        shutil.rmtree(os.path.dirname(fin_file))
+
+        self.importer = StudentStudyLevelProcessor()
+        self.csv_file = os.path.join(
+            self.workdir, 'sample_studylevel_data.csv')
+        open(self.csv_file, 'wb').write(STUDYLEVEL_SAMPLE_DATA)
+
+    def tearDown(self):
+        super(StudentStudyLevelImporterTest, self).tearDown()
+        shutil.rmtree(self.workdir)
+        shutil.rmtree(self.dc_root)
+        clearSite()
+        return
+
+    def test_interface(self):
+        # Make sure we fulfill the interface contracts.
+        assert verifyObject(IBatchProcessor, self.importer) is True
+        assert verifyClass(
+            IBatchProcessor, StudentStudyLevelProcessor) is True
+
+    def test_import(self):
+        num, num_warns, fin_file, fail_file = self.importer.doImport(
+            self.csv_file, STUDYLEVEL_HEADER_FIELDS,'create')
+        self.assertEqual(num_warns,2)
+        assert self.importer.entryExists(
+            dict(reg_number='1', level='100'), self.app) is True
+        studylevel = self.importer.getEntry(
+            dict(reg_number='1', level='100'), self.app)
+        self.assertEqual(studylevel.__parent__.certificate.code, u'CERT1')
+        self.assertEqual(studylevel.level_session, 2008)
+        self.assertEqual(studylevel.level_verdict, 'A')
+        self.assertEqual(studylevel.level, 100)
+        shutil.rmtree(os.path.dirname(fin_file))
+        
+
 def test_suite():
     suite = unittest.TestSuite()
     for testcase in [
         StudentImporterTest,StudentStudyCourseImporterTest,
-        ]:
+        StudentStudyLevelImporterTest,]:
         suite.addTest(unittest.TestLoader().loadTestsFromTestCase(
                 testcase
@@ -293,2 +375,4 @@
         )
     return suite
+
+
