def pre_validate_post_img_url(channel): post = Post post.title = "x" post.description = "x" post.link_url = "https://www.test.com" post.image_url = "https://www.test.com" assert pre_validate_post(channel, post) == 1 post.image_url = "test error link" assert pre_validate_post(channel, post) == 0 post.image_url = "" assert pre_validate_post(channel, post) == 1
def pre_validate_post_description(channel, maxLengthDescription): post = Post post.title = "x" post.description = "x" * maxLengthDescription post.link_url = "https://www.test.com" post.image_url = "https://www.test.com" assert pre_validate_post(channel, post) == 1 post.description += "x" assert pre_validate_post(channel, post) == 0 post.description = "" assert pre_validate_post(channel, post) == 0