예제 #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'