add authenticated User LangPreference tracking

+ Use User.LangPreference when there is no set AURSID
  if request.user.is_authenticated is true.
+ Updated post /language to update LangPreference when
  request.user.is_authenticated.
+ Restore language during test where we change it.
+ Added the user attribute to aurweb.testing.requests.Request.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-01-08 20:10:45 -08:00
parent a33d076d8b
commit 9fdbe3f775
5 changed files with 59 additions and 14 deletions

View file

@ -54,7 +54,7 @@ def test_get_passreset():
def test_get_passreset_translation():
# Test that translation works.
# Test that translation works; set it to de.
with client as request:
response = request.get("/passreset", cookies={"AURLANG": "de"})
@ -68,6 +68,10 @@ def test_get_passreset_translation():
# And the button.
assert "Weiter".encode("utf-8") in response.content
# Restore english.
with client as request:
response = request.get("/passreset", cookies={"AURLANG": "en"})
def test_get_passreset_with_resetkey():
with client as request: