def test_delete_comment(self): cid = comment.add(T_PROJ_ID, T_REF, T_AUTHOR, T_CONTENT) assert comment.get(cid) ok = comment.delete(cid) assert ok assert not comment.get(cid) assert not comment.delete(cid), "Cannot delete twice same comment"
def test_modify_comment(self): cid = comment.add(T_PROJ_ID, T_REF, T_AUTHOR, T_CONTENT) comment.update(cid, {'content': 'new content'}) assert comment.get(cid)[4] == 'new content'
def test_get_unexisting_comment(self): cid = comment.add(T_PROJ_ID, T_REF, T_AUTHOR, T_CONTENT) com = comment.get(cid + 1) assert com is None
def test_chinese_comment(self): T_CONTENT_ZH = u'test is 牛B' cid = comment.add(T_PROJ_ID, T_REF, T_AUTHOR, T_CONTENT_ZH) com = comment.get(cid) assert com[4] == T_CONTENT_ZH
def test_get_comment(self): cid = comment.add(T_PROJ_ID, T_REF, T_AUTHOR, T_CONTENT) com = comment.get(cid) assert com[1] == T_PROJ_ID assert com[2] == T_REF
def test_chinese_comment(self): T_CONTENT_ZH = 'test is 牛B' cid = comment.add(T_PROJ_ID, T_REF, T_AUTHOR, T_CONTENT_ZH) com = comment.get(cid) assert com[4] == T_CONTENT_ZH