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


import pytest
import tabun_api as api
import testutil
    import os
    import os
    import time
    import time
from tabun_api.compat import PY2
from testutil import UserTest, intercept, form_intercept, set_mock, as_guest, user
def test_build_request_internal(user):
    req = user.build_request('/blog/2.html')
    if PY2:
        assert req.get_full_url() == b'https://tabun.everypony.ru/blog/2.html'
    else:
        assert req.get_full_url() == 'https://tabun.everypony.ru/blog/2.html'
    assert b'TABUNSESSIONID=abcdef9876543210abcdef9876543210' in req.headers[str('Cookie')]


def test_build_request_internal_other_session_cookie(user):
    user.session_cookie_name = 'PHPSESSID'
    req = user.build_request('/blog/2.html')
    if PY2:
        assert req.get_full_url() == b'https://tabun.everypony.ru/blog/2.html'
    else:
        assert req.get_full_url() == 'https://tabun.everypony.ru/blog/2.html'
    assert b'PHPSESSID=abcdef9876543210abcdef9876543210' in req.headers[str('Cookie')]


def test_build_request_external(user):
    req = user.build_request(b'https://imgur.com/', with_cookies=False)
    if PY2:
        assert req.get_full_url() == b'https://imgur.com/'
    else:
        assert req.get_full_url() == 'https://imgur.com/'
    assert str('Cookie') not in req.headers.keys()


def test_build_request_nonascii(user):
    req = user.build_request('/blog/©ы\u007f')

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


# Path: test/test_user.py
import pytest
import tabun_api as api
import testutil
    import os
    import os
    import time
    import time
from tabun_api.compat import PY2
from testutil import UserTest, intercept, form_intercept, set_mock, as_guest, user

def test_build_request_internal(user):
    req = user.build_request('/blog/2.html')
    if PY2:
        assert req.get_full_url() == b'https://tabun.everypony.ru/blog/2.html'
    else:
        assert req.get_full_url() == 'https://tabun.everypony.ru/blog/2.html'
    assert b'TABUNSESSIONID=abcdef9876543210abcdef9876543210' in req.headers[str('Cookie')]


def test_build_request_internal_other_session_cookie(user):
    user.session_cookie_name = 'PHPSESSID'
    req = user.build_request('/blog/2.html')
    if PY2:
        assert req.get_full_url() == b'https://tabun.everypony.ru/blog/2.html'
    else:
        assert req.get_full_url() == 'https://tabun.everypony.ru/blog/2.html'
    assert b'PHPSESSID=abcdef9876543210abcdef9876543210' in req.headers[str('Cookie')]


def test_build_request_external(user):
    req = user.build_request(b'https://imgur.com/', with_cookies=False)
    if PY2:
        assert req.get_full_url() == b'https://imgur.com/'
    else:
        assert req.get_full_url() == 'https://imgur.com/'
    assert str('Cookie') not in req.headers.keys()


def test_build_request_nonascii(user):
    req = user.build_request('/blog/©ы\u007f')

    if PY2: