def test_get_post_other_ok(user): post = user.get_post(138982, 'borderline') assert post.post_id == 138982 assert post.author == 'test2' assert post.private is True assert post.blog == 'borderline' assert post.draft is False assert post.short is False assert time.strftime("%Y-%m-%d %H:%M:%S", post.time) == "2015-09-10 15:39:13" assert post.title == 'Тестирование ката' assert post.raw_body == '<img src="https://i.imgur.com/V3KzzyAs.png"/>Текст до ката<br/>\n<a></a> <br/>\nТекст после ката<img src="https://i.imgur.com/NAg929K.jpg"/>' assert post.tags == ["Луна", "аликорны", "новость"] assert post.comments_count == 0 assert post.cut_text is None assert post.vote_count == 35 assert post.vote_total == 36 assert post.context['username'] == 'test' assert post.context['http_host'] == 'https://tabun.everypony.ru' assert post.context['url'] == 'https://tabun.everypony.ru/blog/borderline/138982.html' assert post.context['can_comment'] is False assert post.context['can_edit'] is False assert post.context['can_delete'] is False assert post.context['can_vote'] is False assert post.context['vote_value'] == 1 assert post.context['favourited'] is True assert post.context['subscribed_to_comments'] is False assert post.context['unread_comments_count'] == 0
def test_get_post_ok(user): post = user.get_post(132085) assert post.post_id == 132085 assert post.author == 'test' assert post.private is False assert post.blog is None assert post.draft is True assert post.short is False assert time.strftime("%Y-%m-%d %H:%M:%S", post.time) == "2015-05-30 19:14:04" assert post.utctime.strftime('%Y-%m-%d %H:%M:%S') == '2015-05-30 16:14:04' assert post.title == 'Тест' assert post.raw_body == '<strong>Раз</strong><br/>\n<h4>Два</h4>И ломаем вёрстку <img src="http://ya.ru/" alt="' assert post.tags == ["тег1", "тег2"] assert post.cut_text is None assert post.comments_count == 5 assert post.context['username'] == 'test' assert post.context['http_host'] == 'https://tabun.everypony.ru' assert post.context['url'] == 'https://tabun.everypony.ru/blog/132085.html' assert post.context['can_comment'] is True assert post.context['can_edit'] is True assert post.context['can_delete'] is True assert post.context['can_vote'] is False assert post.context['vote_value'] is None assert post.context['favourited'] is False assert post.context['subscribed_to_comments'] is True assert post.context['unread_comments_count'] == 0
def test_get_post_ok(user): post = user.get_post(132085) assert post.post_id == 132085 assert post.author == 'test' assert post.private == False assert post.draft == True assert time.strftime("%Y-%m-%d %H:%M:%S", post.time) == "2015-05-30 19:14:04" assert post.title == 'Тест' assert post.raw_body == '<strong>Раз</strong><br/>\n<h4>Два</h4>И ломаем вёрстку <img src="http://ya.ru/" alt="' assert post.tags == ["тег1", "тег2"] assert post.comments_count == 5 assert post.comments_new_count == 0
def test_get_post_other_blog_2(set_mock, user): set_mock({'/blog/blog/132085.html': ('132085.html', {'url': '/blog/132085.html'})}) assert user.get_post(132085, 'blog').blog is None
def test_find_images_cutted(user): post = user.get_post(138982, 'borderline') assert utils.find_images(post.body) == [['https://i.imgur.com/V3KzzyAs.png'], ['https://i.imgur.com/NAg929K.jpg']]
def test_formatter_without_cutted_spoiler(user): post = user.get_post(138983) assert hf(post.body, with_cutted=False) == 'Перед катом'
def test_formatter_with_cutted_with_spoiler_title(user): post = user.get_post(138983) assert hf(post.body, fancy=False) == 'Кат внутри спойлераПеред катом После ката'
def test_formatter_with_cutted_spoiler(user): post = user.get_post(138983) assert hf(post.body) == 'Перед катом После ката'
def test_formatter_without_cutted(user): post = user.get_post(138982, 'borderline') assert hf(post.body, with_cutted=False) == 'Текст до ката'
def test_formatter_with_cutted(user): post = user.get_post(138982, 'borderline') assert hf(post.body) == 'Текст до ката\n\nТекст после ката'