Ignore:
Timestamp:
31 Mar 2010, 11:04:27 (15 years ago)
Author:
uli
Message:

Update tests. Coverage of catalog.py now 100%.

File:
1 edited

Legend:

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

    r5097 r5100  
    7575  similar when an access code gets invalidated.
    7676
     77Tools
     78=====
     79
     80:func:`search_invalidated`
     81--------------------------
     82
     83.. function:: search_invalidated(batch_prefix, batch_num)
     84
     85  Get set of accesscode catalog entries, where the accesscode was
     86  already invalidated and that belong to the batch given by the
     87  arguments.
     88
     89  Note, that the set returned for efficiency reasons returns a set of
     90  catalog entries (int id mappings) and not the access-code objects
     91  themselves.
     92
     93:func:`invalidated_num`
     94-----------------------
     95
     96.. function:: invalidated_num(batch_prefix, batch_num)
     97
     98  Get number of accesscodes found by `search_invalidated` for the
     99  batch specified by arguments.
     100
    77101Examples
    78102========
     
    105129     <...AccessCode object at 0x...>,
    106130     <...AccessCode object at 0x...]
     131
     132We can lookup catalog entries refering to invalidated accesscodes:
     133
     134    >>> from waeup.sirp.accesscodes.catalog import search_invalidated
     135    >>> r2 = search_invalidated(batch.prefix, batch.num)
     136    >>> list(r2)
     137    []
     138
     139And also lookup the number of entries:
     140
     141    >>> from waeup.sirp.accesscodes.catalog import invalidated_num
     142    >>> invalidated_num(batch.prefix, batch.num)
     143    0
     144
     145When we invalidate an accesscode, we will get different results:
     146
     147    >>> import grok
     148    >>> ac0 = list(r1)[0]
     149    >>> ac0.invalidation_date = datetime.now()
     150
     151We have to fire an ObjectModifiedEvent in order to inform the
     152component architechture about the changed status of the object:
     153
     154    >>> grok.notify(grok.ObjectModifiedEvent(ac0))
     155
     156    >>> invalidated_num(batch.prefix, batch.num)
     157    1
Note: See TracChangeset for help on using the changeset viewer.