Ignore:
Timestamp:
8 Aug 2011, 16:30:43 (13 years ago)
Author:
uli
Message:

Add test to prove that uploaded images if not changed are equal
(although not identical).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py

    r6541 r6583  
    459459        self.edit_path = 'http://localhost/app/applicants/app2009/%s/edit' % (
    460460            self.pin)
     461        self.edit_full_path = 'http://localhost/app/applicants/%s/%s/%s' % (
     462            'app2009', self.pin, 'edit_full')
    461463
    462464    def tearDown(self):
     
    640642        self.assertEqual(
    641643            file_id, u'18e57c7eac6ca7fb15b54b5b2bd4106d-1')
     644
     645    def test_uploaded_images_equal(self):
     646        # Make sure uploaded images do really differ if we eject a
     647        # change notfication (and do not if we don't)
     648        self.login() # Create applicant form
     649        self.fill_correct_values() # fill other fields with correct values
     650        self.browser.getControl("Save").click() # submit form
     651        # Now go on as an officer
     652        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     653        self.browser.open(self.edit_full_path)
     654
     655        # Create a pseudo image file and select it to be uploaded in form
     656        pseudo_image = StringIO('I pretend to be a graphics file')
     657        ctrl = self.browser.getControl(name='form.passport')
     658        file_ctrl = ctrl.mech_control
     659        file_ctrl.add_file(pseudo_image, filename='myphoto.jpg')
     660        passport0 = self.applicant.passport
     661        self.browser.getControl("Save").click() # submit form with changed pic
     662        passport1 = self.applicant.passport
     663        self.browser.getControl("Save").click() # submit form w/o changes
     664        passport2 = self.applicant.passport
     665        self.assertTrue(passport0 != passport1)
     666        self.assertTrue(passport1 == passport2)
     667        self.assertTrue(passport1 is not passport2)
     668        return
Note: See TracChangeset for help on using the changeset viewer.