Ignore:
Timestamp:
20 Jan 2020, 14:01:54 (5 years ago)
Author:
Henrik Bettermann
Message:

Copy also files from applicants to students section.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicantcopier.py

    r15932 r15941  
    2121import os
    2222import grok
     23from StringIO import StringIO
    2324from datetime import datetime
    2425from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
     
    5960        self.prepare_applicant()
    6061        storage = getUtility(IExtFileStore)
     62        # The stored image can be fetched
    6163        file_id = IFileStoreNameChooser(self.applicant).chooseName()
    62         # The stored image can be fetched
    6364        fd = storage.getFile(file_id)
    6465        file_len_orig = len(fd.read())
     66        # We store a test pdf file
     67        dummy_file = StringIO('test file')
     68        testfile_id = IFileStoreNameChooser(
     69            self.applicant).chooseName(attr='testfile.pdf')
     70        test_file = storage.createFile(testfile_id, dummy_file)
     71        # The stored file can be fetched
     72        fd = storage.getFile(testfile_id)
     73        testfile_len_orig = len(fd.read())
    6574        self.assertEqual(self.app['students']._curr_stud_id, 1000000)
    6675        # Let's try to create the student
     
    111120        self.assertEqual(self.applicant.student_id, student.student_id)
    112121        # Check if passport image has been copied
    113         storage = getUtility(IExtFileStore)
    114         file_id = IFileStoreNameChooser(
    115             student).chooseName(attr='passport.jpg')
     122        file_id = IFileStoreNameChooser(student).chooseName(attr='passport.jpg')
    116123        fd = storage.getFile(file_id)
    117124        file_len = len(fd.read())
    118125        self.assertEqual(file_len_orig, file_len)
     126        # Check if test file has been copied too (new)
     127        file_id = IFileStoreNameChooser(student).chooseName(attr='testfile.jpg')
     128        fd = storage.getFile(file_id)
     129        file_len = len(fd.read())
     130        self.assertEqual(testfile_len_orig, file_len)
    119131        # Check if application slip exists and is a PDF file
    120132        file_id = IFileStoreNameChooser(
Note: See TracChangeset for help on using the changeset viewer.