test_translations.py 515 B

12345678910111213
  1. from flask import current_app
  2. from babel.support import Translations
  3. def test_flaskbbdomain_translations(default_settings):
  4. domain = current_app.extensions.get("babel").domain
  5. with current_app.test_request_context():
  6. # no translations accessed and thus the cache is empty
  7. assert domain.get_translations_cache() == {}
  8. # load translations into cache
  9. assert isinstance(domain.get_translations(), Translations)
  10. assert len(domain.get_translations_cache()) == 1 # 'en'