Ignore:
Timestamp:
11 Dec 2014, 08:21:43 (10 years ago)
Author:
Henrik Bettermann
Message:

Improve tests.

Adjust logging.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py

    r12194 r12195  
    177177        # that the product object attribute of a contract is cleared
    178178        # but the last_product_id is not.
     179        self.assertTrue(self.contract.product_object is self.product)
    179180        del self.app['products'][self.product_id]
    180181        self.assertTrue(self.contract.product_object is None)
     182        # The document referrer wasn't touched.
     183        self.assertTrue(self.contract.document_object is self.document)
    181184        self.assertEqual(self.contract.last_product_id, 'SAM')
     185        # We can still find the contract by last_product_id.
    182186        cat = queryUtility(ICatalog, name='contracts_catalog')
    183187        results = cat.searchResults(last_product_id=('SAM', 'SAM'))
     
    191195        logcontent = open(logfile).read()
    192196        self.assertTrue(
    193             'INFO - system - ObjectRemovedEvent - K1000000 - c101 - removed: product\n'
     197            'INFO - system - ObjectRemovedEvent - K1000000 - c101 - removed: SAM\n'
    194198            in logcontent)
    195199
    196200    def test_document_removal(self):
    197         # Actually, this test does not test catalog components at all.
    198         # Tt only ensures that the document object attributes of a contract
    199         # are cleared, like in the test_product_removal above.
     201        # This test does not test catalog components at all.
     202        # It only ensures that the document object attributes of a contract
     203        # are cleared, when a document is removed, much like in the
     204        # test_product_removal above.
     205        self.assertTrue(self.contract.document_object is self.document)
    200206        del self.customer['documents'][self.document_id]
    201207        self.assertTrue(self.contract.document_object is None)
     208        # The product referrer wasn't touched.
     209        self.assertTrue(self.contract.product_object is self.product)
    202210        # Document removal is being logged in customers.log
    203211        logfile = os.path.join(
  • main/waeup.ikoba/trunk/src/waeup/ikoba/products/product.py

    r12194 r12195  
    8282        notify(grok.ObjectModifiedEvent(contract))
    8383        contract.customer.__parent__.logger.info(
    84             'ObjectRemovedEvent - %s - %s - removed: product' % (
    85                 contract.customer.customer_id, contract.contract_id))
     84            'ObjectRemovedEvent - %s - %s - removed: %s' % (
     85                contract.customer.customer_id,
     86                contract.contract_id,
     87                prodid))
    8688    return
    8789
Note: See TracChangeset for help on using the changeset viewer.