This commit is contained in:
Alexandre Aubin 2022-10-09 18:03:18 +02:00
parent 2b3ec3ace8
commit f03b992c6a
3 changed files with 5 additions and 6 deletions

View file

@ -35,7 +35,6 @@ from moulinette.utils.log import getActionLogger
from moulinette.utils.filesystem import read_file, write_to_file, read_toml, mkdir from moulinette.utils.filesystem import read_file, write_to_file, read_toml, mkdir
from yunohost.domain import ( from yunohost.domain import (
domain_list,
_assert_domain_exists, _assert_domain_exists,
domain_config_get, domain_config_get,
_get_domain_settings, _get_domain_settings,

View file

@ -25,7 +25,7 @@
""" """
import os import os
import time import time
from typing import List from typing import List, Optional
from collections import OrderedDict from collections import OrderedDict
from moulinette import m18n, Moulinette from moulinette import m18n, Moulinette
@ -53,7 +53,7 @@ DOMAIN_SETTINGS_DIR = "/etc/yunohost/domains"
# yunohost CLI and API which run in different processes # yunohost CLI and API which run in different processes
domain_list_cache: List[str] = [] domain_list_cache: List[str] = []
domain_list_cache_timestamp = 0 domain_list_cache_timestamp = 0
main_domain_cache: str = None main_domain_cache: Optional[str] = None
main_domain_cache_timestamp = 0 main_domain_cache_timestamp = 0
DOMAIN_CACHE_DURATION = 15 DOMAIN_CACHE_DURATION = 15

View file

@ -49,7 +49,7 @@ def test_authenticate_with_user_who_is_not_admin():
with pytest.raises(MoulinetteError) as exception: with pytest.raises(MoulinetteError) as exception:
LDAPAuth().authenticate_credentials(credentials="bob:test123Ynh") LDAPAuth().authenticate_credentials(credentials="bob:test123Ynh")
translation = m18n.n("invalid_password") translation = m18n.n("invalid_credentials")
expected_msg = translation.format() expected_msg = translation.format()
assert expected_msg in str(exception) assert expected_msg in str(exception)
@ -58,7 +58,7 @@ def test_authenticate_with_wrong_password():
with pytest.raises(MoulinetteError) as exception: with pytest.raises(MoulinetteError) as exception:
LDAPAuth().authenticate_credentials(credentials="alice:bad_password_lul") LDAPAuth().authenticate_credentials(credentials="alice:bad_password_lul")
translation = m18n.n("invalid_password") translation = m18n.n("invalid_credentials")
expected_msg = translation.format() expected_msg = translation.format()
assert expected_msg in str(exception) assert expected_msg in str(exception)
@ -78,7 +78,7 @@ def test_authenticate_change_password():
with pytest.raises(MoulinetteError) as exception: with pytest.raises(MoulinetteError) as exception:
LDAPAuth().authenticate_credentials(credentials="alice:Yunohost") LDAPAuth().authenticate_credentials(credentials="alice:Yunohost")
translation = m18n.n("invalid_password") translation = m18n.n("invalid_credentials")
expected_msg = translation.format() expected_msg = translation.format()
assert expected_msg in str(exception) assert expected_msg in str(exception)