- Timestamp:
- 1 Feb 2015, 07:11:07 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/tests/test_browser.py
r12529 r12534 332 332 return 333 333 334 335 class CustomerUITests(CustomersFullSetup): 336 337 layer = FunctionalLayer 338 339 def setup_customizable_params(self): 340 self._contract_category = u'ron' 341 self._document_factory = 'waeup.PCNCustomerPDFDocument' 342 self._contract_factory = 'waeup.RONContract' 343 return 344 345 def test_customer_edit_upload_upload_and_request(self): 346 # Customer cant login if their password is not set 347 self.browser.open(self.login_path) 348 self.browser.getControl(name="form.login").value = self.customer_id 349 self.browser.getControl(name="form.password").value = 'cpwd' 350 self.browser.getControl("Login").click() 351 self.assertMatches( 352 '...You logged in...', self.browser.contents) 353 self.browser.getLink("Edit").click() 354 self.browser.getControl(name="form.email").value = 'new_email@aa.ng' 355 self.browser.getControl("Save", index=0).click() 356 self.assertMatches('...Form has been saved...', 357 self.browser.contents) 358 self.browser.getControl("Save and request registration").click() 359 self.assertMatches('...Passport picture is missing...', 360 self.browser.contents) 361 self.assertEqual(self.customer.state, 'started') 362 # Customer must upload a passport picture. We are already on 363 # the upload page. 364 ctrl = self.browser.getControl(name='passporteditupload') 365 file_obj = open(SAMPLE_IMAGE, 'rb') 366 file_ctrl = ctrl.mech_control 367 file_ctrl.add_file(file_obj, filename='my_photo.jpg') 368 self.browser.getControl( 369 name='upload_passporteditupload').click() 370 self.assertTrue( 371 'src="http://localhost/app/customers/K1000000/passport.jpg"' 372 in self.browser.contents) 373 self.browser.getControl(name="CANCEL").click() 374 self.assertEqual(self.browser.url, self.customer_path) 375 self.browser.getLink("Edit").click() 376 self.browser.getControl("Save and request registration").click() 377 self.assertMatches('...Birth certificate is missing...', 378 self.browser.contents) 379 self.assertEqual(self.customer.state, 'started') 380 ctrl = self.browser.getControl(name='birthcertificateeditupload') 381 file_obj = open(SAMPLE_PDF, 'rb') 382 file_ctrl = ctrl.mech_control 383 file_ctrl.add_file(file_obj, filename='my_bc.pdf') 384 self.browser.getControl( 385 name='upload_birthcertificateeditupload').click() 386 self.assertTrue( 387 'href="http://localhost/app/customers/K1000000/birth_certificate.pdf"' 388 in self.browser.contents) 389 self.browser.getControl(name="CANCEL").click() 390 self.browser.getLink("Edit").click() 391 self.browser.getControl("Save and request registration").click() 392 self.assertMatches('...Registration form has been submitted...', 393 self.browser.contents) 394 self.assertEqual(self.customer.state, 'requested') 395 # Customer can view history 396 self.browser.getLink("History").click() 397 self.assertMatches('...Customer created by system...', 398 self.browser.contents) 399 400 334 401 class DocumentUITests(CustomersFullSetup): 335 402 # Tests for customer document related views and pages … … 388 455 'attachment; filename="%s.pdf' % docid[:9]) 389 456 457 390 458 class ContractUITests(CustomersFullSetup): 391 459 # Tests for contract related views and pages
Note: See TracChangeset for help on using the changeset viewer.