Ignore:
Timestamp:
10 Mar 2015, 15:52:18 (10 years ago)
Author:
uli
Message:

contract finder does not complain about missing catalog.

Location:
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/contracts.py

    r12717 r12718  
    2121import grok
    2222from zope.catalog.interfaces import ICatalog
    23 from zope.component import getUtility
     23from zope.component import getUtility, queryUtility
    2424from zope.component.interfaces import IFactory
    2525from zope.interface import implementedBy
     
    266266
    267267    def get_payable_by_id(self, contract_id):
    268         catalog = getUtility(ICatalog, 'contracts_catalog')
     268        catalog = queryUtility(ICatalog, 'contracts_catalog')
     269        if catalog is None:
     270            return None
    269271        result = catalog.searchResults(
    270272            contract_id=(contract_id, contract_id))
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/tests/test_contract.py

    r12717 r12718  
    181181        result = finder.get_payable_by_id('Not-a-valid-id')
    182182        self.assertTrue(result is None)
     183
     184    def test_contract_finder_no_catalog(self):
     185        # contract finder does not complain about missing catalog
     186        finder = ContractFinder()
     187        result = finder.get_payable_by_id('CON1234')
     188        self.assertTrue(result is None)
Note: See TracChangeset for help on using the changeset viewer.