def tearDown(self): print("function teardown") tt = MCategory.get_by_uid(self.uid) if tt: MCategory.delete(self.uid) tt = MPost.get_by_uid(self.postid) if tt: MPost.delete(self.postid) # a=MPost2Catalog.query_by_post(self.postid) # a=MPost2Catalog.query_by_entity_uid(self.postid) # print(a.count()) # # MPost2Catalog.del_by_uid(a[0].uid) tt = MPost2Catalog.query_by_id(self.uid) if tt: MPost2Catalog.del_by_uid(self.uid)
def test_del_by_uid(self): self.add_message() self.add_P2C() ss = MPost2Catalog.query_by_post(self.post_id) a = MPost2Catalog.del_by_uid(ss[0].uid) assert a self.tearDown()
def test_get_first_category(self): self.add_message() self.add_P2C() a = MPost2Catalog.get_first_category(self.post_id) b = MPost2Catalog.del_by_uid(a) assert b self.tearDown()
from torcms.model.post2catalog_model import MPost2Catalog from torcms.model.post_model import MPost all_post2tag_recs = MPost2Catalog.just_query_all() for post2tag_rec in all_post2tag_recs: post_id = post2tag_rec.post_id tag_id = post2tag_rec.tag_id test_select = MPost.get_by_uid(post_id) if test_select: pass else: print(post_id) MPost2Catalog.del_by_uid(post2tag_rec.uid)
def tearDown(self): print("function teardown") tt = MPost2Catalog.query_by_id(self.uid) if tt: MPost2Catalog.del_by_uid(self.uid)