Ignore:
Timestamp:
24 Jul 2011, 02:41:42 (13 years ago)
Author:
uli
Message:

Add tests for searching accesscodes via browser. Browser test coverage
for accesscode not at 100%, test coverage at all for accesscode at
96%.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/browser.txt

    r6470 r6552  
    255255    ...
    256256
     257Searching Access Codes
     258======================
     259
     260We can search for access codes already created.
     261
     262First we pick some really existing access codes to look for:
     263
     264    >>> codes = getRootFolder()['myuniversity']['accesscodes']
     265    >>> app_1_codes = codes[u'APP-1']
     266    >>> app_2_codes = codes[u'APP-2']
     267    >>> bla_1_codes = codes[u'BLA-1']
     268
     269    >>> browser.open('http://localhost/myuniversity/accesscodes/search')
     270    >>> ctrl = browser.getControl(name='searchtype')
     271    >>> ctrl.getControl(value='code').selected = True
     272    >>> browser.getControl(name='searchterm').value = app_1_codes.keys()[0]
     273    >>> browser.getControl('Search').click()
     274
     275The first access code in the ``APP-1`` batch is displayed:
     276
     277    >>> print browser.contents
     278    <!DOCTYPE html ...
     279    ...
     280      value="APP-1..." /></td>
     281      <td>...</td>
     282      <td>APP-1-...</td>
     283      <td>initialized</td>
     284      <td>... - AC initialized by zope.mgr</td>
     285    ...
     286
     287We can also search for batch serials (the number of an access code
     288inside its batch). Looking for number ``1`` will display first access
     289code of each batch ('APP-1', 'APP-2', and 'BLA-1')
     290
     291    >>> browser.open('http://localhost/myuniversity/accesscodes/search')
     292    >>> ctrl = browser.getControl(name='searchtype')
     293    >>> ctrl.getControl(value='batch_serial').selected = True
     294    >>> browser.getControl(name='searchterm').value = '1'
     295    >>> browser.getControl('Search').click()
     296    >>> print browser.contents
     297    <!DOCTYPE html ...
     298    ...
     299      value="APP-1..." /></td>
     300      <td>1</td>
     301      <td>APP-1-...</td>
     302      <td>initialized</td>
     303      <td>... - AC initialized by zope.mgr</td>
     304    ...
     305
     306And we can search for text in history messages of access
     307codes. Looking for the string ``AC initialized`` we get nearly all
     308entries:
     309
     310    >>> browser.open('http://localhost/myuniversity/accesscodes/search')
     311    >>> ctrl = browser.getControl(name='searchtype')
     312    >>> ctrl.getControl(value='history').selected = True
     313    >>> browser.getControl(name='searchterm').value = 'AC initialized'
     314    >>> browser.getControl('Search').click()
     315    >>> print browser.contents
     316    <!DOCTYPE html ...
     317    ...
     318      value="APP-1-<10-DIGITS>" /></td>
     319      <td>1</td>
     320      <td>APP-1-<10-DIGITS></td>
     321      <td>initialized</td>
     322      <td>... - AC initialized by zope.mgr</td>
     323    ...
     324
     325Enabling and Disabling Found Access Codes
     326-----------------------------------------
     327
     328If a search is successfull, we can enable or disable the found access
     329codes:
     330
     331    >>> browser.open('http://localhost/myuniversity/accesscodes/search')
     332    >>> ctrl = browser.getControl(name='searchtype')
     333    >>> ctrl.getControl(value='history').selected = True
     334    >>> browser.getControl(name='searchterm').value = 'AC initialized'
     335    >>> browser.getControl('Search').click()
     336
     337This lists all access codes. We now tick one to disable it and click
     338on the appropriate button:
     339
     340    >>> entries = browser.getControl(name='entries')
     341    >>> entries.controls[0].selected = True
     342    >>> browser.getControl('Disable ACs').click()
     343    >>> print browser.contents
     344    <!DOCTYPE html ...
     345    <li class="message">APP-1-<10-DIGITS> disabled.</li>
     346    ...
     347
     348We cannot disable the same entry again:
     349
     350    >>> entries = browser.getControl(name='entries')
     351    >>> entries.controls[0].selected = True
     352    >>> browser.getControl('Disable ACs').click()
     353    >>> print browser.contents
     354    <!DOCTYPE html ...
     355    <li ...>APP-1-<10-DIGITS>: Disable transition not allowed.</li>
     356    ...
     357
     358But we can reenable the same entry:
     359
     360    >>> entries = browser.getControl(name='entries')
     361    >>> entries.controls[0].selected = True
     362    >>> browser.getControl('Enable ACs').click()
     363    >>> print browser.contents
     364    <!DOCTYPE html ...
     365    <li class="message">APP-1-<10-DIGITS> (re-)enabled.</li>
     366    ...
     367
     368Enabling already enabled items gives a warning:
     369
     370    >>> entries = browser.getControl(name='entries')
     371    >>> entries.controls[0].selected = True
     372    >>> browser.getControl('Enable ACs').click()
     373    >>> print browser.contents
     374    <!DOCTYPE html ...
     375    <li ...>APP-1-<10-DIGITS>: Re-enable transition not allowed.</li>
     376    ...
    257377
    258378Log- and Archive Files
Note: See TracChangeset for help on using the changeset viewer.