mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
i18n tests: simplify hardcoded stuff
This commit is contained in:
parent
1543984a29
commit
ae03be3bad
6 changed files with 29 additions and 41 deletions
|
@ -199,6 +199,7 @@ class DNSRecordsDiagnoser(Diagnoser):
|
||||||
status_ns, _ = dig(domain, "NS", resolvers="force_external")
|
status_ns, _ = dig(domain, "NS", resolvers="force_external")
|
||||||
status_a, _ = dig(domain, "A", resolvers="force_external")
|
status_a, _ = dig(domain, "A", resolvers="force_external")
|
||||||
if "ok" not in [status_ns, status_a]:
|
if "ok" not in [status_ns, status_a]:
|
||||||
|
# i18n: diagnosis_domain_not_found_details
|
||||||
details["not_found"].append(
|
details["not_found"].append(
|
||||||
(
|
(
|
||||||
"diagnosis_domain_%s_details" % (expire_date),
|
"diagnosis_domain_%s_details" % (expire_date),
|
||||||
|
@ -233,6 +234,12 @@ class DNSRecordsDiagnoser(Diagnoser):
|
||||||
# Allow to ignore specifically a single domain
|
# Allow to ignore specifically a single domain
|
||||||
if len(details[alert_type]) == 1:
|
if len(details[alert_type]) == 1:
|
||||||
meta["domain"] = details[alert_type][0][1]["domain"]
|
meta["domain"] = details[alert_type][0][1]["domain"]
|
||||||
|
|
||||||
|
# i18n: diagnosis_domain_expiration_not_found
|
||||||
|
# i18n: diagnosis_domain_expiration_error
|
||||||
|
# i18n: diagnosis_domain_expiration_warning
|
||||||
|
# i18n: diagnosis_domain_expiration_success
|
||||||
|
# i18n: diagnosis_domain_expiration_not_found_details
|
||||||
yield dict(
|
yield dict(
|
||||||
meta=meta,
|
meta=meta,
|
||||||
data={},
|
data={},
|
||||||
|
|
|
@ -121,6 +121,10 @@ class WebDiagnoser(Diagnoser):
|
||||||
|
|
||||||
for domain in domains:
|
for domain in domains:
|
||||||
|
|
||||||
|
# i18n: diagnosis_http_bad_status_code
|
||||||
|
# i18n: diagnosis_http_connection_error
|
||||||
|
# i18n: diagnosis_http_timeout
|
||||||
|
|
||||||
# If both IPv4 and IPv6 (if applicable) are good
|
# If both IPv4 and IPv6 (if applicable) are good
|
||||||
if all(
|
if all(
|
||||||
results[ipversion][domain]["status"] == "ok" for ipversion in ipversions
|
results[ipversion][domain]["status"] == "ok" for ipversion in ipversions
|
||||||
|
|
|
@ -35,11 +35,11 @@ class MailDiagnoser(Diagnoser):
|
||||||
# TODO check that the recent mail logs are not filled with thousand of email sending (unusual number of mail sent)
|
# TODO check that the recent mail logs are not filled with thousand of email sending (unusual number of mail sent)
|
||||||
# TODO check for unusual failed sending attempt being refused in the logs ?
|
# TODO check for unusual failed sending attempt being refused in the logs ?
|
||||||
checks = [
|
checks = [
|
||||||
"check_outgoing_port_25",
|
"check_outgoing_port_25", # i18n: diagnosis_mail_outgoing_port_25_ok
|
||||||
"check_ehlo",
|
"check_ehlo", # i18n: diagnosis_mail_ehlo_ok
|
||||||
"check_fcrdns",
|
"check_fcrdns", # i18n: diagnosis_mail_fcrdns_ok
|
||||||
"check_blacklist",
|
"check_blacklist", # i18n: diagnosis_mail_blacklist_ok
|
||||||
"check_queue",
|
"check_queue", # i18n: diagnosis_mail_queue_ok
|
||||||
]
|
]
|
||||||
for check in checks:
|
for check in checks:
|
||||||
self.logger_debug("Running " + check)
|
self.logger_debug("Running " + check)
|
||||||
|
@ -102,6 +102,10 @@ class MailDiagnoser(Diagnoser):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if r["status"] != "ok":
|
if r["status"] != "ok":
|
||||||
|
# i18n: diagnosis_mail_ehlo_bad_answer
|
||||||
|
# i18n: diagnosis_mail_ehlo_bad_answer_details
|
||||||
|
# i18n: diagnosis_mail_ehlo_unreachable
|
||||||
|
# i18n: diagnosis_mail_ehlo_unreachable_details
|
||||||
summary = r["status"].replace("error_smtp_", "diagnosis_mail_ehlo_")
|
summary = r["status"].replace("error_smtp_", "diagnosis_mail_ehlo_")
|
||||||
yield dict(
|
yield dict(
|
||||||
meta={"test": "mail_ehlo", "ipversion": ipversion},
|
meta={"test": "mail_ehlo", "ipversion": ipversion},
|
||||||
|
|
|
@ -820,6 +820,10 @@ def app_install(
|
||||||
if confirm is None or force or Moulinette.interface.type == "api":
|
if confirm is None or force or Moulinette.interface.type == "api":
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# i18n: confirm_app_install_warning
|
||||||
|
# i18n: confirm_app_install_danger
|
||||||
|
# i18n: confirm_app_install_thirdparty
|
||||||
|
|
||||||
if confirm in ["danger", "thirdparty"]:
|
if confirm in ["danger", "thirdparty"]:
|
||||||
answer = Moulinette.prompt(
|
answer = Moulinette.prompt(
|
||||||
m18n.n("confirm_app_install_" + confirm, answers="Yes, I understand"),
|
m18n.n("confirm_app_install_" + confirm, answers="Yes, I understand"),
|
||||||
|
|
|
@ -111,8 +111,13 @@ class PasswordValidator(object):
|
||||||
listed = password in SMALL_PWD_LIST or self.is_in_most_used_list(password)
|
listed = password in SMALL_PWD_LIST or self.is_in_most_used_list(password)
|
||||||
strength_level = self.strength_level(password)
|
strength_level = self.strength_level(password)
|
||||||
if listed:
|
if listed:
|
||||||
|
# i18n: password_listed
|
||||||
return ("error", "password_listed")
|
return ("error", "password_listed")
|
||||||
if strength_level < self.validation_strength:
|
if strength_level < self.validation_strength:
|
||||||
|
# i18n: password_too_simple_1
|
||||||
|
# i18n: password_too_simple_2
|
||||||
|
# i18n: password_too_simple_3
|
||||||
|
# i18n: password_too_simple_4
|
||||||
return ("error", "password_too_simple_%s" % self.validation_strength)
|
return ("error", "password_too_simple_%s" % self.validation_strength)
|
||||||
|
|
||||||
return ("success", "")
|
return ("success", "")
|
||||||
|
|
|
@ -8,14 +8,6 @@ import yaml
|
||||||
import subprocess
|
import subprocess
|
||||||
import toml
|
import toml
|
||||||
|
|
||||||
ignore = [
|
|
||||||
"password_too_simple_",
|
|
||||||
"password_listed",
|
|
||||||
"backup_method_",
|
|
||||||
"backup_applying_method_",
|
|
||||||
"confirm_app_install_",
|
|
||||||
]
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Find used keys in python code #
|
# Find used keys in python code #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -138,34 +130,6 @@ def find_expected_string_keys():
|
||||||
yield "backup_applying_method_%s" % method
|
yield "backup_applying_method_%s" % method
|
||||||
yield "backup_method_%s_finished" % method
|
yield "backup_method_%s_finished" % method
|
||||||
|
|
||||||
for level in ["danger", "thirdparty", "warning"]:
|
|
||||||
yield "confirm_app_install_%s" % level
|
|
||||||
|
|
||||||
for errortype in ["not_found", "error", "warning", "success", "not_found_details"]:
|
|
||||||
yield "diagnosis_domain_expiration_%s" % errortype
|
|
||||||
yield "diagnosis_domain_not_found_details"
|
|
||||||
|
|
||||||
for errortype in ["bad_status_code", "connection_error", "timeout"]:
|
|
||||||
yield "diagnosis_http_%s" % errortype
|
|
||||||
|
|
||||||
yield "password_listed"
|
|
||||||
for i in [1, 2, 3, 4]:
|
|
||||||
yield "password_too_simple_%s" % i
|
|
||||||
|
|
||||||
checks = [
|
|
||||||
"outgoing_port_25_ok",
|
|
||||||
"ehlo_ok",
|
|
||||||
"fcrdns_ok",
|
|
||||||
"blacklist_ok",
|
|
||||||
"queue_ok",
|
|
||||||
"ehlo_bad_answer",
|
|
||||||
"ehlo_unreachable",
|
|
||||||
"ehlo_bad_answer_details",
|
|
||||||
"ehlo_unreachable_details",
|
|
||||||
]
|
|
||||||
for check in checks:
|
|
||||||
yield "diagnosis_mail_%s" % check
|
|
||||||
|
|
||||||
registrars = toml.load(open('data/other/registrar_list.toml'))
|
registrars = toml.load(open('data/other/registrar_list.toml'))
|
||||||
supported_registrars = ["ovh", "gandi", "godaddy"]
|
supported_registrars = ["ovh", "gandi", "godaddy"]
|
||||||
for registrar in supported_registrars:
|
for registrar in supported_registrars:
|
||||||
|
|
Loading…
Add table
Reference in a new issue