Add checks for change_url script

This commit is contained in:
Alexandre Aubin 2021-02-22 18:00:03 +01:00
parent 12117dad7d
commit a684cc4d1b

View file

@ -320,7 +320,7 @@ class TestSuite():
# Actual high-level checks
# ############################################################################
scriptnames = ["_common.sh", "install", "remove", "upgrade", "backup", "restore"]
scriptnames = ["_common.sh", "install", "remove", "upgrade", "backup", "restore", "change_url"]
class App(TestSuite):
@ -532,6 +532,18 @@ class App(TestSuite):
if app.scripts[name].exists and not app.scripts[name].contains("ynh_install_app_dependencies"):
yield Warning("ynh_install_app_dependencies should also be in %s script" % name)
@test()
def consistency_changeurl_for_absolute_permissions_url(app):
if not app.scripts["change_url"].exists:
return
if app.scripts["install"].containsregex("ynh_app_setting_set.*ed_regex.*\$domain") and not app.scripts["change_url"].containsregex("ynh_app_setting_set.*ed_regex.*\$domain"):
yield Error("It looks like you added an absolute-url (regex?) legacy permission based on the domain, but change_url does not correctly propagate a possible domain change on that url")
if app.scripts["install"].containsregex("ynh_permission_create.*url.*\$domain") and not app.scripts["change_url"].containsregex("ynh_permission_create.*url.*\$domain"):
yield Error("It looks like you added an absolute-url permission based on the domain, but change_url does not correctly propagate a possible domain change on that url")
@test()
def helper_consistency_service_add(app):