Changeset 4759


Ignore:
Timestamp:
9 Jan 2010, 11:24:31 (15 years ago)
Author:
uli
Message:

Extend browser tests. Now also adding/modifying/deleting of
certificates is simulated. CertificateCourse? handling still missing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-layout/src/waeup/browser.txt

    r4719 r4759  
    399399  >>> browser.open('http://localhost/myuniversity/faculties/TF/TD')
    400400  >>> 'My renamed course' in browser.contents
     401  False
     402
     403
     404Certificates
     405============
     406
     407Once we have a department, we can add also certificats.
     408
     409Adding certificates
     410-------------------
     411
     412Certificates are stored in :class:`ICertificateContainer` instances
     413with their code as key. CertificateContainers are normally availabe as
     414`certificates` attribute of
     415:class:`waeup.university.department.Department` instances.
     416
     417To ease the life of users we do not require to browse the
     418certificatecontainers (which have in fact no user interface), but
     419provide adding of certificates in department views.
     420
     421Each department provides a ``Add certificate`` action button near top.
     422
     423Departments provide an add-form to add new certificates:
     424
     425  >>> dept_url = 'http://localhost/myuniversity/faculties/TF/TD'
     426  >>> browser.open(dept_url + '/addcertificate')
     427  >>> print browser.contents
     428  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
     429  ...<span class="required">*</span><span>title</span>
     430  ...
     431
     432We fill in a name for our new cert:
     433
     434  >>> ctrl = browser.getControl(name='form.title')
     435  >>> ctrl.value = 'My Certificate 1'
     436
     437Furthermore we add a code (kind of abbreviation):
     438
     439  >>> browser.getControl(name='form.code').value = 'CERT1'
     440
     441Set the remaining required fields:
     442
     443  >>> browser.getControl(name='form.category').value = 'UME'
     444  >>> browser.getControl(name='form.study_mode').value = 'combined'
     445  >>> browser.getControl(name='form.start_level').value = '100'
     446  >>> browser.getControl(name='form.end_level').value = '400'
     447  >>> browser.getControl(name='form.application_category').value = 'UME'
     448  >>> browser.getControl(name='form.m_prefix').value = 'something'
     449  >>> browser.getControl(name='form.max_pass').value = '400'
     450
     451Finally, we create the certificate:
     452
     453  >>> browser.getControl('Add certificate').click()
     454
     455If we try to register a certificate under the same code twice we will
     456get an error:
     457
     458  >>> browser.open(dept_url + '/addcertificate')
     459  >>> ctrl = browser.getControl(name='form.title')
     460  >>> ctrl.value = 'Another cert with same code'
     461  >>> browser.getControl(name='form.code').value = 'CERT1'
     462  >>> browser.getControl(name='form.category').value = 'UME'
     463  >>> browser.getControl(name='form.study_mode').value = 'combined'
     464  >>> browser.getControl(name='form.start_level').value = '100'
     465  >>> browser.getControl(name='form.end_level').value = '400'
     466  >>> browser.getControl(name='form.application_category').value = 'UME'
     467  >>> browser.getControl(name='form.m_prefix').value = 'something'
     468  >>> browser.getControl(name='form.max_pass').value = '400'
     469
     470  >>> browser.getControl('Add certificate').click()
     471  >>> print browser.contents
     472  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
     473  ...<div>The name chosen already exists in the database</div>
     474  ...
     475
     476Our certificate will be linked under the code on the department page:
     477
     478  >>> browser.open(dept_url)
     479  >>> browser.getLink('CERT1').click()
     480  >>> browser.url
     481  'http://localhost/myuniversity/faculties/TF/TD/certificates/CERT1'
     482
     483Before we really add a certificate we can cancel the action and will be
     484redirected to the department page:
     485
     486  >>> browser.open(dept_url + '/addcertificate')
     487  >>> browser.getControl('Cancel').click()
     488  >>> browser.url
     489  'http://localhost/myuniversity/faculties/TF/TD'
     490
     491
     492Modifying certificates
     493----------------------
     494
     495We can change the settings for a cert by clicking on the provided
     496'Edit settings' link:
     497
     498  >>> browser.open(dept_url + '/certificates/CERT1')
     499  >>> browser.getLink('Edit settings').click()
     500
     501When modifying a certificate, we cannot change the code any more:
     502
     503  >>> browser.getControl(name='form.code')
     504  Traceback (most recent call last):
     505  ...
     506  LookupError: name 'form.code'
     507
     508Let's set a new title and save the form:
     509
     510  >>> browser.getControl(name='form.title').value = "My test cert"
     511  >>> browser.getControl(name='form.actions.save').click()
     512
     513Clicking 'Save' we will stay on the settings form. So we can change
     514the cert again. This time we will return to the overview page
     515afterwards:
     516
     517  >>> browser.getControl(name='form.title').value = "My renamed cert"
     518  >>> ctrl = browser.getControl("Save and return")
     519  >>> ctrl.click()
     520
     521If we go to the settings page and click ``Cancel`` nothing will be
     522changed:
     523
     524  >>> browser.getLink('Edit settings').click()
     525  >>> browser.getControl(name='form.title').value = "Blah"
     526  >>> browser.getControl('Cancel').click()
     527
     528Our certificate was indeed renamed to ``My renamed cert`` and not to
     529``Blah``:
     530
     531  >>> browser.open('http://localhost/myuniversity/faculties/TF/TD')
     532  >>> print browser.contents
     533  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
     534  ...<div name="thecerttable">
     535  ...<td>My renamed cert</td>...
     536  ...
     537
     538
     539Deleting certificates
     540---------------------
     541
     542We can delete certificates by browsing the containing department and
     543clicking on the appropriate 'Delete' button. As we have only one
     544certificate, there is only one 'Delete' button yet:
     545
     546  >>> browser.open('http://localhost/myuniversity/faculties/TF/TD')
     547  >>> 'My renamed cert' in browser.contents
     548  True
     549
     550  >>> browser.getControl('Delete').click()
     551
     552  >>> browser.open('http://localhost/myuniversity/faculties/TF/TD')
     553  >>> 'My renamed cert' in browser.contents
    401554  False
    402555
Note: See TracChangeset for help on using the changeset viewer.