diff --git a/locales/ar.json b/locales/ar.json index d2853799..260d614f 100644 --- a/locales/ar.json +++ b/locales/ar.json @@ -18,7 +18,6 @@ "invalid_password": "كلمة السر خاطئة", "invalid_usage": "إستعمال غير صالح، إستخدم --help لعرض المساعدة", "ldap_attribute_already_exists": "الخاصية '{attribute}' موجودة مسبقا و تحمل القيمة '{value}'", - "ldap_operation_error": "طرأ هناك خطأ أثناء عملية في LDAP", "ldap_server_down": "لا يمكن الإتصال بخادم LDAP", "logged_in": "مُتّصل", "logged_out": "تم تسجيل خروجك", diff --git a/locales/ca.json b/locales/ca.json index c0f1e040..bde04548 100644 --- a/locales/ca.json +++ b/locales/ca.json @@ -18,7 +18,6 @@ "invalid_password": "Contrasenya invàlida", "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_operation_error": "Hi ha hagut un error durant l'operació de LDAP", "ldap_server_down": "No s'ha pogut connectar amb el servidor LDAP", "logged_in": "Sessió iniciada", "logged_out": "Sessió tancada", diff --git a/locales/cmn.json b/locales/cmn.json index 634868a4..e9b8b52d 100644 --- a/locales/cmn.json +++ b/locales/cmn.json @@ -19,7 +19,6 @@ "invalid_password": "密码错误", "invalid_usage": "用法错误,输入 --help 查看帮助信息", "ldap_attribute_already_exists": "参数{attribute}已赋值{value}", - "ldap_operation_error": "LDAP操作时发生了错误", "ldap_server_down": "无法连接LDAP服务器", "logged_in": "登录成功", "logged_out": "登出", diff --git a/locales/de.json b/locales/de.json index 0b9f409f..c779dbfd 100644 --- a/locales/de.json +++ b/locales/de.json @@ -16,7 +16,6 @@ "invalid_password": "Passwort falsch", "invalid_usage": "Falscher Aufruf, verwende --help für den Hilfstext", "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", "logged_in": "Angemeldet", "logged_out": "Abgemeldet", diff --git a/locales/eo.json b/locales/eo.json index d0f3ebd9..45435701 100644 --- a/locales/eo.json +++ b/locales/eo.json @@ -34,7 +34,6 @@ "not_logged_in": "Vi ne estas ensalutinta", "logged_in": "Ensalutinta", "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}'", "invalid_usage": "Nevalida uzado, preterpase '--help' por vidi helpon", "invalid_password": "Nevalida pasvorto", diff --git a/locales/es.json b/locales/es.json index 0e18bb58..399ad276 100644 --- a/locales/es.json +++ b/locales/es.json @@ -18,7 +18,6 @@ "invalid_password": "Contraseña no válida", "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_operation_error": "Ha ocurrido un error durante la operación de LDAP", "ldap_server_down": "No se pudo conectar con el servidor LDAP", "logged_in": "Sesión iniciada", "logged_out": "Sesión cerrada", diff --git a/locales/fr.json b/locales/fr.json index b0f63470..a30d4bab 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -18,7 +18,6 @@ "invalid_password": "Mot de passe incorrect", "invalid_usage": "Utilisation erronée, utilisez --help pour accéder à l’aide", "ldap_attribute_already_exists": "L’attribut '{attribute}' existe déjà avec la valeur suivante : '{value}'", - "ldap_operation_error": "Une erreur est survenue lors de l’opération LDAP", "ldap_server_down": "Impossible d’atteindre le serveur LDAP", "logged_in": "Connecté", "logged_out": "Déconnecté", diff --git a/locales/hi.json b/locales/hi.json index 5f98ea16..8ddc1a11 100644 --- a/locales/hi.json +++ b/locales/hi.json @@ -18,7 +18,6 @@ "invalid_password": "अवैध पासवर्ड", "invalid_usage": "अवैध उपयोग, सहायता देखने के लिए --help साथ लिखे।", "ldap_attribute_already_exists": "'{attribute}' तर्क पहले इस वैल्यू '{value}' से मौजूद है।", - "ldap_operation_error": "LDAP ऑपरेशन के दौरान त्रुटि हो गई है।", "ldap_server_down": "LDAP सर्वर तक पहुंचने में असमर्थ।", "logged_in": "लोग्ड इन", "logged_out": "लॉग आउट", diff --git a/locales/it.json b/locales/it.json index c7fc2864..fa228abc 100644 --- a/locales/it.json +++ b/locales/it.json @@ -20,7 +20,6 @@ "invalid_password": "Password non valida", "invalid_usage": "Utilizzo non valido, usa --help per vedere l'aiuto", "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", "logged_in": "Connesso", "not_logged_in": "Non hai effettuato l'accesso", diff --git a/locales/nl.json b/locales/nl.json index cbbee8cc..df4fb116 100644 --- a/locales/nl.json +++ b/locales/nl.json @@ -16,7 +16,6 @@ "invalid_password": "Ongeldig wachtwoord", "invalid_usage": "Ongeldig gebruik, doe --help om de hulptekst te lezen", "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", "logged_in": "Ingelogd", "logged_out": "Uitgelogd", diff --git a/locales/oc.json b/locales/oc.json index f2de095f..5db9677f 100644 --- a/locales/oc.json +++ b/locales/oc.json @@ -31,7 +31,6 @@ "warning": "Atencion :", "invalid_usage": "Usatge invalid, utilizatz --help per accedir a l’ajuda", "ldap_attribute_already_exists": "L’atribut « {attribute} » existís ja amb la valor : {value}", - "ldap_operation_error": "Una error s’es producha pendent l’operacion LDAP", "operation_interrupted": "Operacion interrompuda", "server_already_running": "Un servidor es ja en execucion sus aqueste pòrt", "success": "Capitada !", diff --git a/locales/pl.json b/locales/pl.json index d02a6f65..e816f4b6 100644 --- a/locales/pl.json +++ b/locales/pl.json @@ -34,7 +34,6 @@ "not_logged_in": "Nie jesteś zalogowany", "logged_in": "Zalogowany", "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}”", "invalid_usage": "Nieprawidłowe użycie. Przejdź --help, aby wyświetlić pomoc", "invalid_token": "Nieprawidłowy token - proszę uwierzytelnić", diff --git a/locales/pt.json b/locales/pt.json index 97c96a61..a7e70aea 100644 --- a/locales/pt.json +++ b/locales/pt.json @@ -15,7 +15,6 @@ "invalid_password": "Senha incorreta", "invalid_usage": "Uso invalido, utilizar --help para ver a ajuda", "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", "logged_in": "Sessão iniciada", "logged_out": "Sessão terminada", diff --git a/locales/ru.json b/locales/ru.json index 03465b52..e22cbc65 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -41,7 +41,6 @@ "download_timeout": "Превышено время ожидания ответа от {url:s}.", "download_unknown_error": "Ошибка при загрузке данных с {url:s} : {error:s}", "instance_already_running": "Операция YunoHost уже запущена. Пожалуйста, подождите, пока он закончится, прежде чем запускать другой.", - "ldap_operation_error": "Ошибка в процессе работы LDAP", "root_required": "Чтобы выполнить это действие, вы должны иметь права root", "corrupted_json": "Повреждённый json получен от {ressource:s} (причина: {error:s})", "command_unknown": "Команда '{command:s}' неизвестна ?", diff --git a/locales/sv.json b/locales/sv.json index eee34d09..d4a80f60 100644 --- a/locales/sv.json +++ b/locales/sv.json @@ -49,7 +49,6 @@ "unable_retrieve_session": "Det gick inte att hämta sessionen eftersom '{exception}'", "unable_authenticate": "Det går inte att verifiera", "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_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.", diff --git a/locales/tr.json b/locales/tr.json index 7e6673e1..2b89424c 100644 --- a/locales/tr.json +++ b/locales/tr.json @@ -11,7 +11,6 @@ "invalid_argument": "Geçersiz argüman '{argument}': {error}", "invalid_password": "Geçersiz parola", "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", "logged_in": "Giriş yapıldı", "logged_out": "Çıkış yapıldı", diff --git a/moulinette/authenticators/ldap.py b/moulinette/authenticators/ldap.py index 1e990c0f..2683772d 100644 --- a/moulinette/authenticators/ldap.py +++ b/moulinette/authenticators/ldap.py @@ -150,9 +150,8 @@ class Authenticator(BaseAuthenticator): except Exception as e: raise MoulinetteError( "error during LDAP search operation with: base='%s', " - "filter='%s', attrs=%s and exception %s" - % (base, filter, attrs, e), - raw_msg=True + "filter='%s', attrs=%s and exception %s" % (base, filter, attrs, e), + raw_msg=True, ) result_list = [] @@ -184,9 +183,8 @@ class Authenticator(BaseAuthenticator): except Exception as e: raise MoulinetteError( "error during LDAP add operation with: rdn='%s', " - "attr_dict=%s and exception %s" - % (rdn, attr_dict, e), - raw_msg=True + "attr_dict=%s and exception %s" % (rdn, attr_dict, e), + raw_msg=True, ) else: return True @@ -209,7 +207,7 @@ class Authenticator(BaseAuthenticator): raise MoulinetteError( "error during LDAP delete operation with: rdn='%s' and exception %s" % (rdn, e), - raw_msg=True + raw_msg=True, ) else: return True @@ -247,7 +245,7 @@ class Authenticator(BaseAuthenticator): "error during LDAP update operation with: rdn='%s', " "attr_dict=%s, new_rdn=%s and exception: %s" % (rdn, attr_dict, new_rdn, e), - raw_msg=True + raw_msg=True, ) else: return True diff --git a/test/test_ldap.py b/test/test_ldap.py index fd1fcb4e..fadff9e6 100644 --- a/test/test_ldap.py +++ b/test/test_ldap.py @@ -208,9 +208,10 @@ class TestLDAP: with pytest.raises(MoulinetteError) as exception: self.add_new_user(ldap_interface) - translation = m18n.g("ldap_operation_error", action="add") - expected_msg = translation.format(action="add") - assert expected_msg in str(exception) + expected_message = "error during LDAP add operation with: rdn=" + expected_error = "modifications require authentication" + assert expected_error in str(exception) + assert expected_message in str(exception) def remove_new_user(self, ldap_interface): new_user_info = self.add_new_user( @@ -229,9 +230,10 @@ class TestLDAP: "uid=%s,ou=users,dc=yunohost,dc=org" % uid, attrs=None ) - translation = m18n.g("ldap_operation_error", action="search") - expected_msg = translation.format(action="search") - assert expected_msg in str(exception) + expected_message = "error during LDAP search operation with: base=" + expected_error = "No such object" + assert expected_error in str(exception) + assert expected_message in str(exception) def test_admin_remove(self, ldap_server): self.ldap_conf["parameters"]["uri"] = ldap_server.uri @@ -257,9 +259,10 @@ class TestLDAP: with pytest.raises(MoulinetteError) as exception: self.remove_new_user(ldap_interface) - translation = m18n.g("ldap_operation_error", action="remove") - expected_msg = translation.format(action="remove") - assert expected_msg in str(exception) + expected_message = "error during LDAP delete operation with: rdn=" + expected_error = "modifications require authentication" + assert expected_error in str(exception) + assert expected_message in str(exception) def update_new_user(self, ldap_interface, new_rdn=False): new_user_info = self.add_new_user( @@ -336,9 +339,10 @@ class TestLDAP: with pytest.raises(MoulinetteError) as exception: self.update_new_user(ldap_interface) - translation = m18n.g("ldap_operation_error", action="update") - expected_msg = translation.format(action="update") - assert expected_msg in str(exception) + expected_message = "error during LDAP update operation with: rdn=" + expected_error = "modifications require authentication" + assert expected_error in str(exception) + assert expected_message in str(exception) def test_anonymous_update_new_rdn(self, ldap_server): self.ldap_conf["parameters"]["uri"] = ldap_server.uri @@ -347,9 +351,10 @@ class TestLDAP: with pytest.raises(MoulinetteError) as exception: self.update_new_user(ldap_interface, True) - translation = m18n.g("ldap_operation_error", action="update") - expected_msg = translation.format(action="update") - assert expected_msg in str(exception) + expected_message = "error during LDAP update operation with: rdn=" + expected_error = "modifications require authentication" + assert expected_error in str(exception) + assert expected_message in str(exception) def test_empty_update(self, ldap_server): self.ldap_conf["parameters"]["uri"] = ldap_server.uri