Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_reports.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_reports.py	(revision 9633)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_reports.py	(revision 9633)
@@ -0,0 +1,58 @@
+# Tests for student related reports
+from waeup.kofa.students.reports import get_students_by_session, StudentReport
+from waeup.kofa.students.tests.test_catalog import CatalogTestSetup
+from waeup.kofa.testing import FunctionalLayer
+
+class StudentReportTests(CatalogTestSetup):
+
+    layer = FunctionalLayer
+
+    states = ('created', 'admitted', 'clearance started',
+              'clearance requested', 'cleared', 'school fee paid',
+              'returning', 'courses registered', 'courses validated', 'Total')
+
+    def test_get_students_by_session_simple(self):
+        # we can get a table with one student
+        result1 = get_students_by_session(2010)
+        result2 = get_students_by_session(2009)
+        self.assertEqual(
+            result1,
+            ((u'fac1', u'Total',),
+             self.states,
+             ((1, 0, 0, 0, 0, 0, 0, 0, 0, 1),
+              (1, 0, 0, 0, 0, 0, 0, 0, 0, 1),)))
+        self.assertEqual(
+            result2,
+            ((u'fac1', u'Total'),
+             self.states,
+             ((0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+              (0, 0, 0, 0, 0, 0, 0, 0, 0, 0),)))
+        return
+
+    def test_get_students_by_session_multiple(self):
+        # we can get a table with several students
+        self.create_cert('fac2', 'dept2', 'CERT2')
+        result1 = get_students_by_session(2010)
+        result2 = get_students_by_session(2009)
+        self.assertEqual(
+            result1,
+            ((u'fac1', u'fac2', u'Total'),
+             self.states,
+             ((1, 0, 0, 0, 0, 0, 0, 0, 0, 1),
+              (0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+              (1, 0, 0, 0, 0, 0, 0, 0, 0, 1),)))
+        self.assertEqual(
+            result2,
+            ((u'fac1', u'fac2', u'Total'),
+             self.states,
+             ((0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+              (0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
+              (0, 0, 0, 0, 0, 0, 0, 0, 0, 0),)))
+        return
+
+    def test_create_pdf(self):
+        self.create_cert('FAC2', 'dept2', 'CERT2')
+        report = StudentReport(2010)
+        result = report.create_pdf()
+        self.assertTrue(result.startswith('%PDF-'))
+        return
