Ignore:
Timestamp:
4 May 2012, 23:26:58 (13 years ago)
Author:
uli
Message:
  • Improve readability of a tiny part.
  • Reorder imports.
  • Test password settings.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r8340 r8354  
    2929
    3030from waeup.kofa.app import University
    31 from waeup.kofa.university.faculty import Faculty
    32 from waeup.kofa.university.department import Department
     31from waeup.kofa.interfaces import IBatchProcessor, FatalCSVError, IUserAccount
    3332from waeup.kofa.students.batching import (
    3433    StudentProcessor, StudentStudyCourseProcessor,
     
    3837from waeup.kofa.students.studylevel import StudentStudyLevel, CourseTicket
    3938from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase
    40 from waeup.kofa.interfaces import IBatchProcessor, FatalCSVError
     39from waeup.kofa.university.faculty import Faculty
     40from waeup.kofa.university.department import Department
     41
    4142
    4243STUDENT_SAMPLE_DATA = open(
     
    328329        assert len(self.app['students'].keys()) == 5
    329330        self.assertEqual(self.app['students']['X666666'].reg_number,'1')
    330         self.assertEqual(self.app['students']['X666666'].state,'courses validated')
     331        self.assertEqual(
     332            self.app['students']['X666666'].state, 'courses validated')
    331333        shutil.rmtree(os.path.dirname(fin_file))
    332334
     
    412414            '5,John,E123456,x,aa@aa.ng,1234,,1990-01-06,Kennedy,,100004,sex: Invalid value\r\n'
    413415            )
    414         self.assertTrue('A123456' in self.app['students'].keys())
    415         self.assertEqual(self.app['students']['A123456'].state,'clearance started')
    416         self.assertEqual(self.app['students']['A123456'].date_of_birth,
    417             datetime.date(1990, 1, 2))
    418         self.assertFalse(self.app['students']['A123456'].clearance_locked)
    419         self.assertEqual(self.app['students']['B123456'].state,'cleared')
    420         self.assertEqual(self.app['students']['B123456'].date_of_birth,
    421             datetime.date(1990, 1, 3))
    422         self.assertTrue(self.app['students']['B123456'].clearance_locked)
    423         history = ' '.join(self.app['students']['A123456'].history.messages)
     416        students = self.app['students']
     417        self.assertTrue('A123456' in students.keys())
     418        self.assertEqual(students['A123456'].state, 'clearance started')
     419        self.assertEqual(students['A123456'].date_of_birth,
     420                         datetime.date(1990, 1, 2))
     421        self.assertFalse(students['A123456'].clearance_locked)
     422        self.assertEqual(students['B123456'].state, 'cleared')
     423        self.assertEqual(students['B123456'].date_of_birth,
     424                         datetime.date(1990, 1, 3))
     425        self.assertTrue(students['B123456'].clearance_locked)
     426        history = ' '.join(students['A123456'].history.messages)
    424427        self.assertTrue(
    425428            "State 'clearance started' set by system" in history)
    426429        # state was empty and student is thus in state created
    427         self.assertEqual(self.app['students']['F123456'].state,'created')
     430        self.assertEqual(students['F123456'].state,'created')
     431        # passwords were set correctly
     432        self.assertEqual(
     433            IUserAccount(students['A123456']).checkPassword('mypw1'), True)
     434        self.assertEqual(
     435            IUserAccount(students['C123456']).checkPassword('mypw1'), True)
    428436        shutil.rmtree(os.path.dirname(fin_file))
    429437
Note: See TracChangeset for help on using the changeset viewer.