Esempio n. 1
0
def test_alt_fallback(pad):
    # page that is missing a german tranlation
    wolf_page = pad.get("/projects/wolf", alt="de")

    # Falls back to primary
    assert wolf_page.alt == "de"
    assert wolf_page["_source_alt"] == "_primary"
    assert wolf_page["name"] == "Wolf"

    # If we ask for the alts of that page, we will only get english
    assert get_alts(wolf_page) == ["en"]

    # Unless we include fallbacks in which case we will also see german
    # show up in the list.
    assert get_alts(wolf_page, fallback=True) == ["en", "de"]
def test_alt_fallback(pad):
    # page that is missing a german tranlation
    wolf_page = pad.get('/projects/wolf', alt='de')

    # Falls back to primary
    assert wolf_page.alt == 'de'
    assert wolf_page['_source_alt'] == '_primary'
    assert wolf_page['name'] == 'Wolf'

    # If we ask for the alts of that page, we will only get english
    assert get_alts(wolf_page) == ['en']

    # Unless we include fallbacks in which case we will also see german
    # show up in the list.
    assert get_alts(wolf_page, fallback=True) == ['en', 'de']
Esempio n. 3
0
def test_alt_fallback(pad):
    # page that is missing a german tranlation
    wolf_page = pad.get('/projects/wolf', alt='de')

    # Falls back to primary
    assert wolf_page.alt == 'de'
    assert wolf_page['_source_alt'] == '_primary'
    assert wolf_page['name'] == 'Wolf'

    # If we ask for the alts of that page, we will only get english
    assert get_alts(wolf_page) == ['en']

    # Unless we include fallbacks in which case we will also see german
    # show up in the list.
    assert get_alts(wolf_page, fallback=True) == ['en', 'de']
def test_url_matching_with_customized_slug_in_alt(pad):
    en = pad.resolve_url_path('/projects/slave/')
    assert en.alt == 'en'
    assert en['_source_alt'] == '_primary'
    assert en.path == '/projects/slave'

    de = pad.resolve_url_path('/de/projects/sklave/')
    assert de.alt == 'de'
    assert de['_source_alt'] == 'de'
    assert de.path == '/projects/slave'

    assert get_alts(en) == ['en', 'de']
Esempio n. 5
0
def test_url_matching_with_customized_slug_in_alt(pad):
    en = pad.resolve_url_path("/projects/slave/")
    assert en.alt == "en"
    assert en["_source_alt"] == "_primary"
    assert en.path == "/projects/slave"

    de = pad.resolve_url_path("/de/projects/sklave/")
    assert de.alt == "de"
    assert de["_source_alt"] == "de"
    assert de.path == "/projects/slave"

    assert get_alts(en) == ["en", "de"]
Esempio n. 6
0
def test_url_matching_with_customized_slug_in_alt(pad):
    en = pad.resolve_url_path('/projects/slave/')
    assert en.alt == 'en'
    assert en['_source_alt'] == '_primary'
    assert en.path == '/projects/slave'

    de = pad.resolve_url_path('/de/projects/sklave/')
    assert de.alt == 'de'
    assert de['_source_alt'] == 'de'
    assert de.path == '/projects/slave'

    assert get_alts(en) == ['en', 'de']
def test_basic_alts(pad):
    with Context(pad=pad):
        assert get_alts() == ['en', 'de']
Esempio n. 8
0
def test_basic_alts(pad):
    with Context(pad=pad):
        assert get_alts() == ["en", "de"]
Esempio n. 9
0
def test_basic_alts(pad):
    with Context(pad=pad):
        assert get_alts() == ['en', 'de']