コード例 #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'