Changeset 11973 for main/waeup.ikoba/trunk/src/waeup/ikoba
- Timestamp:
- 16 Nov 2014, 22:40:10 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r11972 r11973 369 369 return 370 370 371 372 371 def test_manage_import(self): 372 # Managers can import customer data files 373 datacenter_path = 'http://localhost/app/datacenter' 374 # Prepare a csv file for customers 375 open('customers.csv', 'wb').write( 376 """firstname,lastname,reg_number,date_of_birth,email,phone,sex,password 377 Aaren,Pieri,1,1990-01-02,aa@aa.ng,1234,m,mypwd1 378 Claus,Finau,2,1990-01-03,aa@aa.ng,1234,m,mypwd1 379 Brit,Berson,2,1990-01-04,aa@aa.ng,1234,m,mypwd1 380 """) 381 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 382 self.browser.open(datacenter_path) 383 self.browser.getLink('Upload data').click() 384 filecontents = StringIO(open('customers.csv', 'rb').read()) 385 filewidget = self.browser.getControl(name='uploadfile:file') 386 filewidget.add_file(filecontents, 'text/plain', 'customers.csv') 387 self.browser.getControl(name='SUBMIT').click() 388 self.browser.getLink('Process data').click() 389 button = lookup_submit_value( 390 'select', 'customers_zope.mgr.csv', self.browser) 391 button.click() 392 importerselect = self.browser.getControl(name='importer') 393 modeselect = self.browser.getControl(name='mode') 394 importerselect.getControl('Customer Processor').selected = True 395 modeselect.getControl(value='create').selected = True 396 self.browser.getControl('Proceed to step 3').click() 397 self.assertTrue('Header fields OK' in self.browser.contents) 398 self.browser.getControl('Perform import').click() 399 self.assertTrue('Processing of 1 rows failed' in self.browser.contents) 400 self.assertTrue('Successfully processed 2 rows' in self.browser.contents) 401 self.assertTrue('Batch processing finished' in self.browser.contents) 402 403 # The customers are properly indexed and we can 404 # thus find a customer in the department 405 self.browser.open(self.manage_container_path) 406 # We can search for a new customer by name ... 407 self.browser.getControl(name="searchtype").value = ['fullname'] 408 self.browser.getControl(name="searchterm").value = 'Claus' 409 self.browser.getControl("Find customer(s)").click() 410 self.assertTrue('Claus Finau' in self.browser.contents) 411 # ... and check if the imported password has been properly set 412 ctrl = self.browser.getControl(name='entries') 413 value = ctrl.options[0] 414 claus = self.app['customers'][value] 415 self.assertTrue(IUserAccount(claus).checkPassword('mypwd1')) 416 return 417 418 419
Note: See TracChangeset for help on using the changeset viewer.