Skip to content

Commit

Permalink
[CI] Format code with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
yunohost-bot committed Oct 10, 2023
1 parent 6f1a009 commit f003565
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2255,11 +2255,11 @@ def _parse_app_doc_and_notifications(path):


def _hydrate_app_template(template, data):

# Apply jinja for stuff like {% if .. %} blocks,
# but only if there's indeed an if block (to try to reduce overhead or idk)
if "{%" in template:
from jinja2 import Template

template = Template(template).render(**data)

stuff_to_replace = set(re.findall(r"__[A-Z0-9]+?[A-Z0-9_]*?[A-Z0-9]*?__", template))
Expand Down Expand Up @@ -3187,7 +3187,9 @@ def is_version_more_recent_than_current_version(name, current_version):
}

# 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):
Expand Down
6 changes: 5 additions & 1 deletion src/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,11 @@ def _get_registrar_config_section(domain):
}
)
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)
elif is_special_use_tld(dns_zone):
Expand Down
7 changes: 5 additions & 2 deletions src/tests/test_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@ def test_domain_dyndns_recovery():
domain_add(TEST_DYNDNS_DOMAIN)
assert TEST_DYNDNS_DOMAIN in domain_list()["domains"]
# 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
domain_remove(TEST_DYNDNS_DOMAIN, ignore_dyndns=True)
assert TEST_DYNDNS_DOMAIN not in domain_list()["domains"]
# readding domain with bad password should fail
with pytest.raises(YunohostValidationError):
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"]
# readding domain with password should work
Expand Down

0 comments on commit f003565

Please sign in to comment.