Index: main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py	(revision 12094)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py	(revision 12095)
@@ -16,4 +16,5 @@
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 ##
+import os
 import grok
 import shutil
@@ -167,2 +168,24 @@
         assert results[0] is self.customer['applications'][self.application_id]
         assert results[0].product is self.product
+
+    def test_product_removal(self):
+        # This test does not only test catalog components, it also ensures
+        # that the product attribute of an application is cleared
+        # but the last_product_id is not.
+        del self.app['products'][self.product_id]
+        self.assertTrue(self.application.product is None)
+        self.assertEqual(self.application.last_product_id, 'SAM')
+        cat = queryUtility(ICatalog, name='applications_catalog')
+        results = cat.searchResults(last_product_id=('SAM', 'SAM'))
+        results = [x for x in results]
+        assert len(results) == 1
+        assert results[0] is self.customer['applications'][self.application_id]
+        assert results[0].product is None
+        # Product removal is being logged in customers.log
+        logfile = os.path.join(
+            self.app['datacenter'].storage, 'logs', 'customers.log')
+        logcontent = open(logfile).read()
+        self.assertTrue(
+            'INFO - system - ObjectRemovedEvent - K1000000 - a101 - removed: product\n'
+            in logcontent)
+
