Ejemplo n.º 1
0
def langstring_subject(request, test_session):
    """An Empty Langstring fixture"""

    from assembl.models.langstrings import LangString

    ls = LangString()
    test_session.add(ls)
    test_session.flush()

    def fin():
        test_session.delete(ls)
        test_session.flush()

    request.addfinalizer(fin)
    return ls
Ejemplo n.º 2
0
def en_langstring(request, test_session, undefined_locale):
    from assembl.models.langstrings import LangString

    ls = LangString.create("The quick brown fox jumps over the lazy dog.",
                           "en")
    test_session.add(ls)
    test_session.flush()

    def fin():
        for entry in ls.entries:
            test_session.delete(entry)
        test_session.delete(ls)
        test_session.flush()

    request.addfinalizer(fin)
    return ls
Ejemplo n.º 3
0
def ambiguous_langstring(request, test_session, undefined_locale):
    from assembl.models.langstrings import LangString

    # This string is chosen because it is close to 50/50
    # en vs fr in the langdetect algorithm.
    ls = LangString.create("testa", "und")
    test_session.add(ls)
    test_session.flush()

    def fin():
        for entry in ls.entries:
            test_session.delete(entry)
        test_session.delete(ls)
        test_session.flush()

    request.addfinalizer(fin)
    return ls