Fix tests

This commit is contained in:
Kay0u 2020-04-10 00:12:19 +02:00
parent cbc776aedb
commit 0f37a70f27
No known key found for this signature in database
GPG key ID: AE1DCADB6415A156
18 changed files with 26 additions and 39 deletions

View file

@ -18,7 +18,6 @@
"invalid_password": "كلمة السر خاطئة", "invalid_password": "كلمة السر خاطئة",
"invalid_usage": "إستعمال غير صالح، إستخدم --help لعرض المساعدة", "invalid_usage": "إستعمال غير صالح، إستخدم --help لعرض المساعدة",
"ldap_attribute_already_exists": "الخاصية '{attribute}' موجودة مسبقا و تحمل القيمة '{value}'", "ldap_attribute_already_exists": "الخاصية '{attribute}' موجودة مسبقا و تحمل القيمة '{value}'",
"ldap_operation_error": "طرأ هناك خطأ أثناء عملية في LDAP",
"ldap_server_down": "لا يمكن الإتصال بخادم LDAP", "ldap_server_down": "لا يمكن الإتصال بخادم LDAP",
"logged_in": "مُتّصل", "logged_in": "مُتّصل",
"logged_out": "تم تسجيل خروجك", "logged_out": "تم تسجيل خروجك",

View file

@ -18,7 +18,6 @@
"invalid_password": "Contrasenya invàlida", "invalid_password": "Contrasenya invàlida",
"invalid_usage": "Utilització invàlida, utilitzeu --help per veure l'ajuda", "invalid_usage": "Utilització invàlida, utilitzeu --help per veure l'ajuda",
"ldap_attribute_already_exists": "L'atribut '{attribute}' ja existeix amb el valor '{value}'", "ldap_attribute_already_exists": "L'atribut '{attribute}' ja existeix amb el valor '{value}'",
"ldap_operation_error": "Hi ha hagut un error durant l'operació de LDAP",
"ldap_server_down": "No s'ha pogut connectar amb el servidor LDAP", "ldap_server_down": "No s'ha pogut connectar amb el servidor LDAP",
"logged_in": "Sessió iniciada", "logged_in": "Sessió iniciada",
"logged_out": "Sessió tancada", "logged_out": "Sessió tancada",

View file

@ -19,7 +19,6 @@
"invalid_password": "密码错误", "invalid_password": "密码错误",
"invalid_usage": "用法错误,输入 --help 查看帮助信息", "invalid_usage": "用法错误,输入 --help 查看帮助信息",
"ldap_attribute_already_exists": "参数{attribute}已赋值{value}", "ldap_attribute_already_exists": "参数{attribute}已赋值{value}",
"ldap_operation_error": "LDAP操作时发生了错误",
"ldap_server_down": "无法连接LDAP服务器", "ldap_server_down": "无法连接LDAP服务器",
"logged_in": "登录成功", "logged_in": "登录成功",
"logged_out": "登出", "logged_out": "登出",

View file

@ -16,7 +16,6 @@
"invalid_password": "Passwort falsch", "invalid_password": "Passwort falsch",
"invalid_usage": "Falscher Aufruf, verwende --help für den Hilfstext", "invalid_usage": "Falscher Aufruf, verwende --help für den Hilfstext",
"ldap_attribute_already_exists": "Attribute existieren bereits: '{attribute}={value}'", "ldap_attribute_already_exists": "Attribute existieren bereits: '{attribute}={value}'",
"ldap_operation_error": "Ein Fehler trat während der LDAP Abfrage auf",
"ldap_server_down": "LDAP-Server nicht erreichbar", "ldap_server_down": "LDAP-Server nicht erreichbar",
"logged_in": "Angemeldet", "logged_in": "Angemeldet",
"logged_out": "Abgemeldet", "logged_out": "Abgemeldet",

View file

@ -34,7 +34,6 @@
"not_logged_in": "Vi ne estas ensalutinta", "not_logged_in": "Vi ne estas ensalutinta",
"logged_in": "Ensalutinta", "logged_in": "Ensalutinta",
"ldap_server_down": "Ne eblas atingi la servilon LDAP", "ldap_server_down": "Ne eblas atingi la servilon LDAP",
"ldap_operation_error": "Eraro okazis dum LDAP-operacio",
"ldap_attribute_already_exists": "Atributo '{attribute}' jam ekzistas kun valoro '{value}'", "ldap_attribute_already_exists": "Atributo '{attribute}' jam ekzistas kun valoro '{value}'",
"invalid_usage": "Nevalida uzado, preterpase '--help' por vidi helpon", "invalid_usage": "Nevalida uzado, preterpase '--help' por vidi helpon",
"invalid_password": "Nevalida pasvorto", "invalid_password": "Nevalida pasvorto",

View file

@ -18,7 +18,6 @@
"invalid_password": "Contraseña no válida", "invalid_password": "Contraseña no válida",
"invalid_usage": "Uso no válido, utilice --help para ver la ayuda", "invalid_usage": "Uso no válido, utilice --help para ver la ayuda",
"ldap_attribute_already_exists": "El atributo «{attribute}» ya existe con el valor «{value}»", "ldap_attribute_already_exists": "El atributo «{attribute}» ya existe con el valor «{value}»",
"ldap_operation_error": "Ha ocurrido un error durante la operación de LDAP",
"ldap_server_down": "No se pudo conectar con el servidor LDAP", "ldap_server_down": "No se pudo conectar con el servidor LDAP",
"logged_in": "Sesión iniciada", "logged_in": "Sesión iniciada",
"logged_out": "Sesión cerrada", "logged_out": "Sesión cerrada",

View file

@ -18,7 +18,6 @@
"invalid_password": "Mot de passe incorrect", "invalid_password": "Mot de passe incorrect",
"invalid_usage": "Utilisation erronée, utilisez --help pour accéder à laide", "invalid_usage": "Utilisation erronée, utilisez --help pour accéder à laide",
"ldap_attribute_already_exists": "Lattribut '{attribute}' existe déjà avec la valeur suivante : '{value}'", "ldap_attribute_already_exists": "Lattribut '{attribute}' existe déjà avec la valeur suivante : '{value}'",
"ldap_operation_error": "Une erreur est survenue lors de lopération LDAP",
"ldap_server_down": "Impossible datteindre le serveur LDAP", "ldap_server_down": "Impossible datteindre le serveur LDAP",
"logged_in": "Connecté", "logged_in": "Connecté",
"logged_out": "Déconnecté", "logged_out": "Déconnecté",

View file

@ -18,7 +18,6 @@
"invalid_password": "अवैध पासवर्ड", "invalid_password": "अवैध पासवर्ड",
"invalid_usage": "अवैध उपयोग, सहायता देखने के लिए --help साथ लिखे।", "invalid_usage": "अवैध उपयोग, सहायता देखने के लिए --help साथ लिखे।",
"ldap_attribute_already_exists": "'{attribute}' तर्क पहले इस वैल्यू '{value}' से मौजूद है।", "ldap_attribute_already_exists": "'{attribute}' तर्क पहले इस वैल्यू '{value}' से मौजूद है।",
"ldap_operation_error": "LDAP ऑपरेशन के दौरान त्रुटि हो गई है।",
"ldap_server_down": "LDAP सर्वर तक पहुंचने में असमर्थ।", "ldap_server_down": "LDAP सर्वर तक पहुंचने में असमर्थ।",
"logged_in": "लोग्ड इन", "logged_in": "लोग्ड इन",
"logged_out": "लॉग आउट", "logged_out": "लॉग आउट",

View file

@ -20,7 +20,6 @@
"invalid_password": "Password non valida", "invalid_password": "Password non valida",
"invalid_usage": "Utilizzo non valido, usa --help per vedere l'aiuto", "invalid_usage": "Utilizzo non valido, usa --help per vedere l'aiuto",
"ldap_attribute_already_exists": "L'attributo '{attribute}' esiste già con valore '{value}'", "ldap_attribute_already_exists": "L'attributo '{attribute}' esiste già con valore '{value}'",
"ldap_operation_error": "Si è verificato un errore durante l'operazione LDAP",
"ldap_server_down": "Impossibile raggiungere il server LDAP", "ldap_server_down": "Impossibile raggiungere il server LDAP",
"logged_in": "Connesso", "logged_in": "Connesso",
"not_logged_in": "Non hai effettuato l'accesso", "not_logged_in": "Non hai effettuato l'accesso",

View file

@ -16,7 +16,6 @@
"invalid_password": "Ongeldig wachtwoord", "invalid_password": "Ongeldig wachtwoord",
"invalid_usage": "Ongeldig gebruik, doe --help om de hulptekst te lezen", "invalid_usage": "Ongeldig gebruik, doe --help om de hulptekst te lezen",
"ldap_attribute_already_exists": "Attribuut '{attribute}' bestaat al met waarde '{value}'", "ldap_attribute_already_exists": "Attribuut '{attribute}' bestaat al met waarde '{value}'",
"ldap_operation_error": "Er is een fout opgetreden bij het uitvoeren van LDAP operatie",
"ldap_server_down": "Kan LDAP server niet bereiken", "ldap_server_down": "Kan LDAP server niet bereiken",
"logged_in": "Ingelogd", "logged_in": "Ingelogd",
"logged_out": "Uitgelogd", "logged_out": "Uitgelogd",

View file

@ -31,7 +31,6 @@
"warning": "Atencion:", "warning": "Atencion:",
"invalid_usage": "Usatge invalid, utilizatz --help per accedir a lajuda", "invalid_usage": "Usatge invalid, utilizatz --help per accedir a lajuda",
"ldap_attribute_already_exists": "Latribut « {attribute} » existís ja amb la valor: {value}", "ldap_attribute_already_exists": "Latribut « {attribute} » existís ja amb la valor: {value}",
"ldap_operation_error": "Una error ses producha pendent loperacion LDAP",
"operation_interrupted": "Operacion interrompuda", "operation_interrupted": "Operacion interrompuda",
"server_already_running": "Un servidor es ja en execucion sus aqueste pòrt", "server_already_running": "Un servidor es ja en execucion sus aqueste pòrt",
"success": "Capitada!", "success": "Capitada!",

View file

@ -34,7 +34,6 @@
"not_logged_in": "Nie jesteś zalogowany", "not_logged_in": "Nie jesteś zalogowany",
"logged_in": "Zalogowany", "logged_in": "Zalogowany",
"ldap_server_down": "Nie można połączyć się z serwerem LDAP", "ldap_server_down": "Nie można połączyć się z serwerem LDAP",
"ldap_operation_error": "Wystąpił błąd podczas operacji LDAP",
"ldap_attribute_already_exists": "Atrybut „{attribute}” już istnieje z wartością „{value}”", "ldap_attribute_already_exists": "Atrybut „{attribute}” już istnieje z wartością „{value}”",
"invalid_usage": "Nieprawidłowe użycie. Przejdź --help, aby wyświetlić pomoc", "invalid_usage": "Nieprawidłowe użycie. Przejdź --help, aby wyświetlić pomoc",
"invalid_token": "Nieprawidłowy token - proszę uwierzytelnić", "invalid_token": "Nieprawidłowy token - proszę uwierzytelnić",

View file

@ -15,7 +15,6 @@
"invalid_password": "Senha incorreta", "invalid_password": "Senha incorreta",
"invalid_usage": "Uso invalido, utilizar --help para ver a ajuda", "invalid_usage": "Uso invalido, utilizar --help para ver a ajuda",
"ldap_attribute_already_exists": "O atributo '{attribute}' já existe com valor '{value}'", "ldap_attribute_already_exists": "O atributo '{attribute}' já existe com valor '{value}'",
"ldap_operation_error": "Um erro ocorreu durante a operação LDAP",
"ldap_server_down": "Não foi possível comunicar com o servidor LDAP", "ldap_server_down": "Não foi possível comunicar com o servidor LDAP",
"logged_in": "Sessão iniciada", "logged_in": "Sessão iniciada",
"logged_out": "Sessão terminada", "logged_out": "Sessão terminada",

View file

@ -41,7 +41,6 @@
"download_timeout": "Превышено время ожидания ответа от {url:s}.", "download_timeout": "Превышено время ожидания ответа от {url:s}.",
"download_unknown_error": "Ошибка при загрузке данных с {url:s} : {error:s}", "download_unknown_error": "Ошибка при загрузке данных с {url:s} : {error:s}",
"instance_already_running": "Операция YunoHost уже запущена. Пожалуйста, подождите, пока он закончится, прежде чем запускать другой.", "instance_already_running": "Операция YunoHost уже запущена. Пожалуйста, подождите, пока он закончится, прежде чем запускать другой.",
"ldap_operation_error": "Ошибка в процессе работы LDAP",
"root_required": "Чтобы выполнить это действие, вы должны иметь права root", "root_required": "Чтобы выполнить это действие, вы должны иметь права root",
"corrupted_json": "Повреждённый json получен от {ressource:s} (причина: {error:s})", "corrupted_json": "Повреждённый json получен от {ressource:s} (причина: {error:s})",
"command_unknown": "Команда '{command:s}' неизвестна ?", "command_unknown": "Команда '{command:s}' неизвестна ?",

View file

@ -49,7 +49,6 @@
"unable_retrieve_session": "Det gick inte att hämta sessionen eftersom '{exception}'", "unable_retrieve_session": "Det gick inte att hämta sessionen eftersom '{exception}'",
"unable_authenticate": "Det går inte att verifiera", "unable_authenticate": "Det går inte att verifiera",
"ldap_server_down": "Det går inte att nå LDAP-servern", "ldap_server_down": "Det går inte att nå LDAP-servern",
"ldap_operation_error": "Ett fel inträffade under LDAP-drift",
"invalid_usage": "Ogiltig användning, pass --help för att se hjälp", "invalid_usage": "Ogiltig användning, pass --help för att se hjälp",
"invalid_token": "Ogiltigt token - verifiera", "invalid_token": "Ogiltigt token - verifiera",
"instance_already_running": "Det finns redan en YunoHost-operation. Vänta tills den är klar innan du kör en annan.", "instance_already_running": "Det finns redan en YunoHost-operation. Vänta tills den är klar innan du kör en annan.",

View file

@ -11,7 +11,6 @@
"invalid_argument": "Geçersiz argüman '{argument}': {error}", "invalid_argument": "Geçersiz argüman '{argument}': {error}",
"invalid_password": "Geçersiz parola", "invalid_password": "Geçersiz parola",
"ldap_attribute_already_exists": "'{attribute}={value}' özelliği zaten mevcut", "ldap_attribute_already_exists": "'{attribute}={value}' özelliği zaten mevcut",
"ldap_operation_error": "LDAP işlemi sırasında hata oluştu",
"ldap_server_down": "LDAP sunucusuna erişilemiyor", "ldap_server_down": "LDAP sunucusuna erişilemiyor",
"logged_in": "Giriş yapıldı", "logged_in": "Giriş yapıldı",
"logged_out": ıkış yapıldı", "logged_out": ıkış yapıldı",

View file

@ -150,9 +150,8 @@ class Authenticator(BaseAuthenticator):
except Exception as e: except Exception as e:
raise MoulinetteError( raise MoulinetteError(
"error during LDAP search operation with: base='%s', " "error during LDAP search operation with: base='%s', "
"filter='%s', attrs=%s and exception %s" "filter='%s', attrs=%s and exception %s" % (base, filter, attrs, e),
% (base, filter, attrs, e), raw_msg=True,
raw_msg=True
) )
result_list = [] result_list = []
@ -184,9 +183,8 @@ class Authenticator(BaseAuthenticator):
except Exception as e: except Exception as e:
raise MoulinetteError( raise MoulinetteError(
"error during LDAP add operation with: rdn='%s', " "error during LDAP add operation with: rdn='%s', "
"attr_dict=%s and exception %s" "attr_dict=%s and exception %s" % (rdn, attr_dict, e),
% (rdn, attr_dict, e), raw_msg=True,
raw_msg=True
) )
else: else:
return True return True
@ -209,7 +207,7 @@ class Authenticator(BaseAuthenticator):
raise MoulinetteError( raise MoulinetteError(
"error during LDAP delete operation with: rdn='%s' and exception %s" "error during LDAP delete operation with: rdn='%s' and exception %s"
% (rdn, e), % (rdn, e),
raw_msg=True raw_msg=True,
) )
else: else:
return True return True
@ -247,7 +245,7 @@ class Authenticator(BaseAuthenticator):
"error during LDAP update operation with: rdn='%s', " "error during LDAP update operation with: rdn='%s', "
"attr_dict=%s, new_rdn=%s and exception: %s" "attr_dict=%s, new_rdn=%s and exception: %s"
% (rdn, attr_dict, new_rdn, e), % (rdn, attr_dict, new_rdn, e),
raw_msg=True raw_msg=True,
) )
else: else:
return True return True

View file

@ -208,9 +208,10 @@ class TestLDAP:
with pytest.raises(MoulinetteError) as exception: with pytest.raises(MoulinetteError) as exception:
self.add_new_user(ldap_interface) self.add_new_user(ldap_interface)
translation = m18n.g("ldap_operation_error", action="add") expected_message = "error during LDAP add operation with: rdn="
expected_msg = translation.format(action="add") expected_error = "modifications require authentication"
assert expected_msg in str(exception) assert expected_error in str(exception)
assert expected_message in str(exception)
def remove_new_user(self, ldap_interface): def remove_new_user(self, ldap_interface):
new_user_info = self.add_new_user( new_user_info = self.add_new_user(
@ -229,9 +230,10 @@ class TestLDAP:
"uid=%s,ou=users,dc=yunohost,dc=org" % uid, attrs=None "uid=%s,ou=users,dc=yunohost,dc=org" % uid, attrs=None
) )
translation = m18n.g("ldap_operation_error", action="search") expected_message = "error during LDAP search operation with: base="
expected_msg = translation.format(action="search") expected_error = "No such object"
assert expected_msg in str(exception) assert expected_error in str(exception)
assert expected_message in str(exception)
def test_admin_remove(self, ldap_server): def test_admin_remove(self, ldap_server):
self.ldap_conf["parameters"]["uri"] = ldap_server.uri self.ldap_conf["parameters"]["uri"] = ldap_server.uri
@ -257,9 +259,10 @@ class TestLDAP:
with pytest.raises(MoulinetteError) as exception: with pytest.raises(MoulinetteError) as exception:
self.remove_new_user(ldap_interface) self.remove_new_user(ldap_interface)
translation = m18n.g("ldap_operation_error", action="remove") expected_message = "error during LDAP delete operation with: rdn="
expected_msg = translation.format(action="remove") expected_error = "modifications require authentication"
assert expected_msg in str(exception) assert expected_error in str(exception)
assert expected_message in str(exception)
def update_new_user(self, ldap_interface, new_rdn=False): def update_new_user(self, ldap_interface, new_rdn=False):
new_user_info = self.add_new_user( new_user_info = self.add_new_user(
@ -336,9 +339,10 @@ class TestLDAP:
with pytest.raises(MoulinetteError) as exception: with pytest.raises(MoulinetteError) as exception:
self.update_new_user(ldap_interface) self.update_new_user(ldap_interface)
translation = m18n.g("ldap_operation_error", action="update") expected_message = "error during LDAP update operation with: rdn="
expected_msg = translation.format(action="update") expected_error = "modifications require authentication"
assert expected_msg in str(exception) assert expected_error in str(exception)
assert expected_message in str(exception)
def test_anonymous_update_new_rdn(self, ldap_server): def test_anonymous_update_new_rdn(self, ldap_server):
self.ldap_conf["parameters"]["uri"] = ldap_server.uri self.ldap_conf["parameters"]["uri"] = ldap_server.uri
@ -347,9 +351,10 @@ class TestLDAP:
with pytest.raises(MoulinetteError) as exception: with pytest.raises(MoulinetteError) as exception:
self.update_new_user(ldap_interface, True) self.update_new_user(ldap_interface, True)
translation = m18n.g("ldap_operation_error", action="update") expected_message = "error during LDAP update operation with: rdn="
expected_msg = translation.format(action="update") expected_error = "modifications require authentication"
assert expected_msg in str(exception) assert expected_error in str(exception)
assert expected_message in str(exception)
def test_empty_update(self, ldap_server): def test_empty_update(self, ldap_server):
self.ldap_conf["parameters"]["uri"] = ldap_server.uri self.ldap_conf["parameters"]["uri"] = ldap_server.uri