mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #1724 from YunoHost/ci-format-debian/11.2.5
[CI] Format code with Black
This commit is contained in:
commit
022870be9b
3 changed files with 14 additions and 5 deletions
|
@ -2255,11 +2255,11 @@ def _parse_app_doc_and_notifications(path):
|
||||||
|
|
||||||
|
|
||||||
def _hydrate_app_template(template, data):
|
def _hydrate_app_template(template, data):
|
||||||
|
|
||||||
# Apply jinja for stuff like {% if .. %} blocks,
|
# Apply jinja for stuff like {% if .. %} blocks,
|
||||||
# but only if there's indeed an if block (to try to reduce overhead or idk)
|
# but only if there's indeed an if block (to try to reduce overhead or idk)
|
||||||
if "{%" in template:
|
if "{%" in template:
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
||||||
template = Template(template).render(**data)
|
template = Template(template).render(**data)
|
||||||
|
|
||||||
stuff_to_replace = set(re.findall(r"__[A-Z0-9]+?[A-Z0-9_]*?[A-Z0-9]*?__", template))
|
stuff_to_replace = set(re.findall(r"__[A-Z0-9]+?[A-Z0-9_]*?[A-Z0-9]*?__", template))
|
||||||
|
@ -3187,7 +3187,9 @@ def _filter_and_hydrate_notifications(notifications, current_version=None, data=
|
||||||
}
|
}
|
||||||
|
|
||||||
# Filter out empty notifications (notifications may be empty because of if blocks)
|
# Filter out empty notifications (notifications may be empty because of if blocks)
|
||||||
return {name:content for name, content in out.items() if content and content.strip()}
|
return {
|
||||||
|
name: content for name, content in out.items() if content and content.strip()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def _display_notifications(notifications, force=False):
|
def _display_notifications(notifications, force=False):
|
||||||
|
|
|
@ -546,7 +546,11 @@ def _get_registrar_config_section(domain):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
registrar_infos["recovery_password"] = OrderedDict(
|
registrar_infos["recovery_password"] = OrderedDict(
|
||||||
{"type": "password", "ask": m18n.n("ask_dyndns_recovery_password"), "default": ""}
|
{
|
||||||
|
"type": "password",
|
||||||
|
"ask": m18n.n("ask_dyndns_recovery_password"),
|
||||||
|
"default": "",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
return OrderedDict(registrar_infos)
|
return OrderedDict(registrar_infos)
|
||||||
elif is_special_use_tld(dns_zone):
|
elif is_special_use_tld(dns_zone):
|
||||||
|
|
|
@ -95,14 +95,17 @@ def test_domain_dyndns_recovery():
|
||||||
domain_add(TEST_DYNDNS_DOMAIN)
|
domain_add(TEST_DYNDNS_DOMAIN)
|
||||||
assert TEST_DYNDNS_DOMAIN in domain_list()["domains"]
|
assert TEST_DYNDNS_DOMAIN in domain_list()["domains"]
|
||||||
# set the recovery password with config panel
|
# set the recovery password with config panel
|
||||||
domain_config_set(TEST_DYNDNS_DOMAIN, "dns.registrar.recovery_password", TEST_DYNDNS_PASSWORD)
|
domain_config_set(
|
||||||
|
TEST_DYNDNS_DOMAIN, "dns.registrar.recovery_password", TEST_DYNDNS_PASSWORD
|
||||||
|
)
|
||||||
# remove domain without unsubscribing
|
# remove domain without unsubscribing
|
||||||
domain_remove(TEST_DYNDNS_DOMAIN, ignore_dyndns=True)
|
domain_remove(TEST_DYNDNS_DOMAIN, ignore_dyndns=True)
|
||||||
assert TEST_DYNDNS_DOMAIN not in domain_list()["domains"]
|
assert TEST_DYNDNS_DOMAIN not in domain_list()["domains"]
|
||||||
# readding domain with bad password should fail
|
# readding domain with bad password should fail
|
||||||
with pytest.raises(YunohostValidationError):
|
with pytest.raises(YunohostValidationError):
|
||||||
domain_add(
|
domain_add(
|
||||||
TEST_DYNDNS_DOMAIN, dyndns_recovery_password="wrong" + TEST_DYNDNS_PASSWORD
|
TEST_DYNDNS_DOMAIN,
|
||||||
|
dyndns_recovery_password="wrong" + TEST_DYNDNS_PASSWORD,
|
||||||
)
|
)
|
||||||
assert TEST_DYNDNS_DOMAIN not in domain_list()["domains"]
|
assert TEST_DYNDNS_DOMAIN not in domain_list()["domains"]
|
||||||
# readding domain with password should work
|
# readding domain with password should work
|
||||||
|
|
Loading…
Add table
Reference in a new issue