housekeep: define filters in their own modules

This patch cleans up aurweb.templates and removes direct
module-level initialization of the environment.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-01-18 03:06:17 -08:00
parent fca175ed84
commit 211ca5e49c
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
16 changed files with 159 additions and 159 deletions

View file

@ -1,5 +1,5 @@
""" Test our l10n module. """
from aurweb import l10n
from aurweb import filters, l10n
from aurweb.testing.requests import Request
@ -43,8 +43,10 @@ def test_tn_filter():
request.cookies["AURLANG"] = "en"
context = {"language": "en", "request": request}
translated = l10n.tn(context, 1, "%d package found.", "%d packages found.")
translated = filters.tn(context, 1, "%d package found.",
"%d packages found.")
assert translated == "%d package found."
translated = l10n.tn(context, 2, "%d package found.", "%d packages found.")
translated = filters.tn(context, 2, "%d package found.",
"%d packages found.")
assert translated == "%d packages found."