示例#1
0
def test_negotiate_cookie(locale_negotiator_request):
    """locale_negotiator - negotiate locale from cookie."""
    locale_negotiator_request._LOCALE_ = None
    locale_negotiator_request.path = '/page'
    locale = locale_negotiator(locale_negotiator_request)

    assert locale == 'cz'
示例#2
0
def test_negotiate_cookie(locale_negotiator_request):
    """locale_negotiator - negotiate locale from cookie."""
    locale_negotiator_request._LOCALE_ = None
    locale_negotiator_request.path = "/page"
    locale = locale_negotiator(locale_negotiator_request)

    assert locale == "cz"
示例#3
0
def test_negotiate_headers(locale_negotiator_request):
    """
    Locale_negotiator:header.

    Negotiate locale from a header.
    """
    locale_negotiator_request._LOCALE_ = None
    locale_negotiator_request.path = "/page"
    locale_negotiator_request.cookies = {}
    locale = locale_negotiator(locale_negotiator_request)

    assert locale == "de"
示例#4
0
def test_negotiate_headers(locale_negotiator_request):
    """
    Locale_negotiator:header.

    Negotiate locale from a header.
    """
    locale_negotiator_request._LOCALE_ = None
    locale_negotiator_request.path = '/page'
    locale_negotiator_request.cookies = {}
    locale = locale_negotiator(locale_negotiator_request)

    assert locale == 'de'
示例#5
0
def test_negotiate_default(locale_negotiator_request):
    """
    Locale_negotiator:default.

    Other ways fail, return default locale.
    """
    locale_negotiator_request.path = "/page"
    locale_negotiator_request._LOCALE_ = None
    locale_negotiator_request.cookies = {}
    locale_negotiator_request.accept_language = None
    locale = locale_negotiator(locale_negotiator_request)

    assert locale == "en"
示例#6
0
def test_negotiate_default(locale_negotiator_request):
    """
    Locale_negotiator:default.

    Other ways fail, return default locale.
    """
    locale_negotiator_request.path = '/page'
    locale_negotiator_request._LOCALE_ = None
    locale_negotiator_request.cookies = {}
    locale_negotiator_request.accept_language = None
    locale = locale_negotiator(locale_negotiator_request)

    assert locale == 'en'
示例#7
0
def test_negotiate_attr(locale_negotiator_request):
    """Locale_negotiator - negotiate locale from request attribute."""
    locale = locale_negotiator(locale_negotiator_request)

    assert locale == "fr"
示例#8
0
def test_negotiate_path(locale_negotiator_request):
    """Locale_negotiator - negotiate locale from path."""
    locale_negotiator_request._LOCALE_ = None
    locale = locale_negotiator(locale_negotiator_request)

    assert locale == "pl"
示例#9
0
def test_negotiate_attr(locale_negotiator_request):
    """Locale_negotiator - negotiate locale from request attribute."""
    locale = locale_negotiator(locale_negotiator_request)

    assert locale == 'fr'
示例#10
0
def test_negotiate_path(locale_negotiator_request):
    """Locale_negotiator - negotiate locale from path."""
    locale_negotiator_request._LOCALE_ = None
    locale = locale_negotiator(locale_negotiator_request)

    assert locale == 'pl'