Ignore:
Timestamp:
20 Jun 2011, 19:47:52 (13 years ago)
Author:
uli
Message:

Add test for 'disabled' index of catalog.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/tests/test_catalog.py

    r6434 r6435  
    3131from waeup.sirp.testing import FunctionalLayer
    3232from waeup.sirp.accesscodes.accesscodes import (
    33     AccessCode, AccessCodeBatch, invalidate_accesscode,)
     33    AccessCode, AccessCodeBatch, invalidate_accesscode, disable_accesscode)
    3434
    3535
     
    104104        assert len(results) == 1
    105105        assert results[0] is self.ac1
     106
     107    def test_search_disabled(self):
     108        # We can seach for disabled access codes
     109        disable_accesscode('APP-1-11111111')
     110        # Now we want to find the term ``Tester`` in histories of all acs
     111        cat = queryUtility(ICatalog, name='accesscodes_catalog')
     112        results1 = cat.searchResults(disabled=(True, True))
     113        results2 = cat.searchResults(disabled=(False, False))
     114        results1 = [x for x in results1] # Turn results generator into list
     115        # We found 1 accescode disabled
     116        assert len(results1) == 1
     117        assert results1[0] is self.ac1
     118        # We found 2 accesscodes not disabled
     119        assert len(results2) == 2
     120        assert [x for x in results2] == [self.ac2, self.ac3]
Note: See TracChangeset for help on using the changeset viewer.