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
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
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