def test_delete_product(self): product_id = "p_mus_1" tasks.delete_product(self.session_context, product_id) product_models = self.db_proxy.fetch_product_models() tf_map = self.db_proxy.fetch_tf_map("full_content", [product_id]) tfidf_map = self.db_proxy.fetch_tfidf_map("full_content", [product_id]) nose.tools.ok_(product_id not in product_models, "Product model should have been physically deleted") nose.tools.ok_(product_id not in tf_map, "TF's should have been physically deleted") nose.tools.ok_(product_id not in tfidf_map, "TFIDF's should have been physically deleted")
def main(argv): if len(argv) < 2: msg = "You must specify the environment and the external product id" log.error(msg) return {"success": False, "message": msg} try: # command-line arguments env = argv[0] product_id = argv[1] session = init_session(env) maintenance.delete_product(session, product_id) except Exception: log.exception('Exception on {0}:'.format(__name__)) return {"success": False, "message": traceback.format_exc()} return {"success": True}