mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix i18n tests
This commit is contained in:
parent
d161d0744a
commit
1543984a29
3 changed files with 26 additions and 9 deletions
|
@ -831,7 +831,7 @@ def domain_dns_push(operation_logger, domain, dry_run=False, force=False, purge=
|
|||
#
|
||||
|
||||
operation_logger.start()
|
||||
logger.info(m18n.n("domain_dns_puhsing"))
|
||||
logger.info(m18n.n("domain_dns_pushing"))
|
||||
|
||||
new_managed_dns_records_hashes = [_hash_dns_record(r) for r in changes["unchanged"]]
|
||||
results = {"warnings": [], "errors": []}
|
||||
|
@ -882,13 +882,13 @@ def domain_dns_push(operation_logger, domain, dry_run=False, force=False, purge=
|
|||
|
||||
# Everything succeeded
|
||||
if len(results["errors"]) == 0:
|
||||
logger.success(m18n.("domain_dns_push_success"))
|
||||
logger.success(m18n.n("domain_dns_push_success"))
|
||||
return {}
|
||||
# Everything failed
|
||||
elif len(results["errors"]) + len(results["warnings"]) == progress.total:
|
||||
logger.error(m18n.("domain_dns_push_failed"))
|
||||
logger.error(m18n.n("domain_dns_push_failed"))
|
||||
else:
|
||||
logger.warning(m18n.("domain_dns_push_partial_failure"))
|
||||
logger.warning(m18n.n("domain_dns_push_partial_failure"))
|
||||
|
||||
return results
|
||||
|
||||
|
|
|
@ -103,14 +103,12 @@ def test_change_main_domain():
|
|||
def test_domain_config_get_default():
|
||||
assert domain_config_get(TEST_DOMAINS[0], "feature.xmpp.xmpp") == 1
|
||||
assert domain_config_get(TEST_DOMAINS[1], "feature.xmpp.xmpp") == 0
|
||||
assert domain_config_get(TEST_DOMAINS[1], "dns.advanced.ttl") == 3600
|
||||
|
||||
|
||||
def test_domain_config_get_export():
|
||||
|
||||
assert domain_config_get(TEST_DOMAINS[0], export=True)["xmpp"] == 1
|
||||
assert domain_config_get(TEST_DOMAINS[1], export=True)["xmpp"] == 0
|
||||
assert domain_config_get(TEST_DOMAINS[1], export=True)["ttl"] == 3600
|
||||
|
||||
|
||||
def test_domain_config_set():
|
||||
|
@ -118,9 +116,6 @@ def test_domain_config_set():
|
|||
domain_config_set(TEST_DOMAINS[1], "feature.xmpp.xmpp", "yes")
|
||||
assert domain_config_get(TEST_DOMAINS[1], "feature.xmpp.xmpp") == 1
|
||||
|
||||
domain_config_set(TEST_DOMAINS[1], "dns.advanced.ttl", 10)
|
||||
assert domain_config_get(TEST_DOMAINS[1], "dns.advanced.ttl") == 10
|
||||
|
||||
|
||||
def test_domain_configs_unknown():
|
||||
with pytest.raises(YunohostValidationError):
|
||||
|
|
|
@ -6,6 +6,7 @@ import glob
|
|||
import json
|
||||
import yaml
|
||||
import subprocess
|
||||
import toml
|
||||
|
||||
ignore = [
|
||||
"password_too_simple_",
|
||||
|
@ -165,6 +166,24 @@ def find_expected_string_keys():
|
|||
for check in checks:
|
||||
yield "diagnosis_mail_%s" % check
|
||||
|
||||
registrars = toml.load(open('data/other/registrar_list.toml'))
|
||||
supported_registrars = ["ovh", "gandi", "godaddy"]
|
||||
for registrar in supported_registrars:
|
||||
for key in registrars[registrar].keys():
|
||||
yield f"domain_config_{key}"
|
||||
|
||||
domain_config = toml.load(open('data/other/config_domain.toml'))
|
||||
for panel in domain_config.values():
|
||||
if not isinstance(panel, dict):
|
||||
continue
|
||||
for section in panel.values():
|
||||
if not isinstance(section, dict):
|
||||
continue
|
||||
for key, values in section.items():
|
||||
if not isinstance(values, dict):
|
||||
continue
|
||||
yield f"domain_config_{key}"
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Load en locale json keys #
|
||||
|
@ -204,3 +223,6 @@ def test_unused_i18n_keys():
|
|||
raise Exception(
|
||||
"Those i18n keys appears unused:\n" " - " + "\n - ".join(unused_keys)
|
||||
)
|
||||
|
||||
test_undefined_i18n_keys()
|
||||
test_unused_i18n_keys()
|
||||
|
|
Loading…
Add table
Reference in a new issue