Changeset 7037 for main/waeup.sirp/branches/ulif-extimgstore/src
- Timestamp:
- 8 Nov 2011, 20:44:12 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/branches/ulif-extimgstore/src/waeup/sirp/applicants/tests/test_applicant.py
r7034 r7037 23 23 """ 24 24 import grok 25 import md526 25 import unittest 27 from StringIO import StringIO 28 from hurry.file.interfaces import IFileRetrieval 29 from zope.component import ( 30 provideAdapter, adapts, getGlobalSiteManager, provideUtility, 31 queryUtility) 32 from zope.component.hooks import setSite 26 from zope.component import adapts, queryUtility 33 27 from zope.component.interfaces import IFactory 34 28 from zope.interface import verify, implements 35 29 from zope.location.interfaces import ILocation 36 from zope.publisher.base import TestRequest37 from zope.publisher.interfaces import NotFound38 from waeup.sirp.app import University39 from waeup.sirp.image import WAeUPImageFile, createWAeUPImageFile40 30 from waeup.sirp.image.interfaces import IWAeUPImageFile 41 31 from waeup.sirp.imagestorage import DefaultStorage … … 45 35 ApplicantImageStoreHandler, ApplicantImageNameChooser, 46 36 ) 47 from waeup.sirp.applicants.interfaces import ( 48 IResultEntry, IApplicant, 49 ) 50 51 from waeup.sirp.testing import (FunctionalTestCase, FunctionalLayer) 37 from waeup.sirp.applicants.interfaces import IResultEntry, IApplicant 38 from waeup.sirp.testing import FunctionalTestCase, FunctionalLayer 52 39 53 40 class FakeImageLocation(object): … … 183 170 return 184 171 185 def DISABLEDtest_passport_no_site(self):186 # make sure we get a real image stored in passport attr187 image = self.applicant.passport.file.read()188 self.assertEqual(len(image), 2059)189 return190 191 def DISABLEDtest_passport_insite(self):192 # make sure we get a real image in passport attr when inside a site.193 # When an applicant is created 'inside a site', its passport194 # photograph should be put inside the images folder of the195 # site, even if it is only a placeholder.196 self.getRootFolder()['app'] = University()197 app = self.getRootFolder()['app']198 setSite(app)199 applicant = Applicant()200 image = self.applicant.passport.file.read()201 # The image is really the placeholder_m.jpg image202 self.assertEqual(len(image), 2059)203 self.assertEqual(md5.new(image).hexdigest(),204 u'b48a1d39bbcb32e955d9ff2dea4ed0e6')205 # As the applicant has no reg_no yet, the image data is 'empty'206 self.assertEqual(self.applicant.passport.data,207 '__img_appl__placeholder_m.jpg')208 # The image contains a file_id instead of real image-data209 self.assertEqual(self.applicant.passport.data,210 u'b48a1d39bbcb32e955d9ff2dea4ed0e6-1')211 assert u'b48a1d39bbcb32e955d9ff2dea4ed0e6' in app['images'].keys()212 return213 214 172 class ApplicantFactoryTest(FunctionalTestCase): 215 173
Note: See TracChangeset for help on using the changeset viewer.