Changeset 13806 for main/waeup.ikoba/trunk/src/waeup/ikoba/products
- Timestamp:
- 6 Apr 2016, 10:27:11 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/products/tests/test_batching.py
r12490 r13806 33 33 from zope.interface.verify import verifyClass, verifyObject 34 34 from zope.securitypolicy.interfaces import IPrincipalRoleManager 35 from zope.testbrowser.testing import Browser 35 36 36 37 from waeup.ikoba.app import Company … … 64 65 self.workdir = tempfile.mkdtemp() 65 66 app = Company() 67 self.browser = Browser() 68 self.browser.handleErrors = False 69 self.datacenter_path = 'http://localhost/app/datacenter' 66 70 app['datacenter'].setStoragePath(self.dc_root) 67 71 self.getRootFolder()['app'] = app … … 202 206 in failcontent) 203 207 shutil.rmtree(os.path.dirname(fin_file)) 208 209 210 def test_upload_import_reupload(self): 211 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 212 self.browser.open(self.datacenter_path) 213 self.assertEqual(self.browser.headers['Status'], '200 Ok') 214 self.assertEqual(self.browser.url, self.datacenter_path) 215 self.browser.getLink("Upload data").click() 216 file = open(self.csv_file) 217 ctrl = self.browser.getControl(name='uploadfile:file') 218 file_ctrl = ctrl.mech_control 219 file_ctrl.add_file(file, filename='sample_product_data.csv') 220 self.browser.getControl('Upload').click() 221 self.browser.getLink('Process data').click() 222 self.assertTrue('Portal must be in maintenance mode for data import.' 223 in self.browser.contents) 224 self.browser.getLink("Switch").click() 225 self.assertTrue('Maintenance mode enabled' in self.browser.contents) 226 # Maintenance mode is now set. 227 self.assertEqual( 228 self.app['configuration'].maintmode_enabled_by, 'zope.mgr') 229 self.browser.getControl(name="select").click() 230 importerselect = self.browser.getControl(name='importer') 231 importerselect.getControl('Product Processor').selected = True 232 modeselect = self.browser.getControl(name='mode') 233 modeselect.getControl(value='create').selected = True 234 self.browser.getControl('Proceed to step 3').click() 235 self.assertTrue('Header fields OK' in self.browser.contents) 236 self.browser.getControl('Perform import').click() 237 self.assertTrue('Successfully processed 3 rows' in self.browser.contents) 238 self.assertTrue('Maintenance mode disabled' in self.browser.contents) 239 # Maintenance mode is really disabled. 240 self.assertEqual( 241 self.app['configuration'].maintmode_enabled_by, None) 242 # We import the same file a second time. 243 self.browser.open(self.datacenter_path) 244 self.browser.getLink("Upload data").click() 245 file = open(self.csv_file) 246 ctrl = self.browser.getControl(name='uploadfile:file') 247 file_ctrl = ctrl.mech_control 248 file_ctrl.add_file(file, filename='sample_product_data.csv') 249 self.browser.getControl('Upload').click() 250 self.assertTrue( 251 'File with same name was uploaded earlier' in self.browser.contents) 252 return
Note: See TracChangeset for help on using the changeset viewer.