Ignore:
Timestamp:
18 May 2012, 00:13:37 (12 years ago)
Author:
uli
Message:

Use fileformat recognition when uploading student files.

File:
1 edited

Legend:

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

    r8452 r8467  
    130130
    131131    def create_passport_img(self, student):
    132         # create some faked passport file for `student`
     132        # create some passport file for `student`
    133133        storage = getUtility(IExtFileStore)
     134        image_path = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
     135        self.image_contents = open(image_path, 'rb').read()
    134136        file_id = IFileStoreNameChooser(student).chooseName(
    135137            attr='passport.jpg')
    136         storage.createFile(file_id, StringIO('I am a fake image.'))
     138        storage.createFile(file_id, StringIO(self.image_contents))
    137139
    138140    def test_backup_single_student_data(self):
     
    144146        del_dir = self.app['datacenter'].deleted_path
    145147        del_img_path = os.path.join(
    146             del_dir, 'media', 'students', '00111', 'A111111',
     148            del_dir, 'media', 'students', '00110', 'A111111',
    147149            'passport_A111111.jpg')
    148150
     
    151153        self.assertEqual(
    152154            open(del_img_path, 'rb').read(),
    153             'I am a fake image.')
     155            self.image_contents)
    154156
    155157        # The student data were put into CSV files
Note: See TracChangeset for help on using the changeset viewer.