# Path: tabun_api/compat.py
# PY2 = sys.version_info.major == 2


import time
import json
import pytest
import tabun_api as api
from io import BytesIO
from tabun_api.compat import text
from testutil import UserTest, load_file, form_intercept, as_guest, set_mock, user, assert_data
    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_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

# Path: tabun_api/compat.py
# PY2 = sys.version_info.major == 2


# Path: test/test_posts.py
import time
import json
import pytest
import tabun_api as api
from io import BytesIO
from tabun_api.compat import text
from testutil import UserTest, load_file, form_intercept, as_guest, set_mock, user, assert_data

    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_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