diff --git a/locales/en.json b/locales/en.json index cb880b761..c5a54e499 100644 --- a/locales/en.json +++ b/locales/en.json @@ -577,8 +577,8 @@ "service_stop_failed": "Could not stop the service '{service:s}'\n\nRecent service logs:{logs:s}", "service_stopped": "Service '{service:s}' stopped", "service_unknown": "Unknown service '{service:s}'", - "show_tile_cant_be_enabled_for_url_not_defined": "To enable show_tile, you must first define an URL for the permission '{permission}'", - "show_tile_cant_be_enabled_for_regex": "You cannot enable 'show_tile' because the URL for the permission '{permission}' is a regex", + "show_tile_cant_be_enabled_for_url_not_defined": "You cannot enable 'show_tile' right now, because you must first define an URL for the permission '{permission}'", + "show_tile_cant_be_enabled_for_regex": "You cannot enable 'show_tile' right no, because the URL for the permission '{permission}' is a regex", "ssowat_conf_generated": "SSOwat configuration generated", "ssowat_conf_updated": "SSOwat configuration updated", "system_upgraded": "System upgraded", diff --git a/src/yunohost/domain.py b/src/yunohost/domain.py index 8c1c317e2..4d2b6ab53 100644 --- a/src/yunohost/domain.py +++ b/src/yunohost/domain.py @@ -482,7 +482,7 @@ def _check_and_sanitize_permission_path(url, app_main_path, permission): try: re.compile(path) except Exception: - raise YunohostError('invalid_regex', regex=regex) + raise YunohostError('invalid_regex', regex=path) return 're:' + domain + path diff --git a/src/yunohost/tests/test_permission.py b/src/yunohost/tests/test_permission.py index 259ac7cec..7c2135599 100644 --- a/src/yunohost/tests/test_permission.py +++ b/src/yunohost/tests/test_permission.py @@ -775,11 +775,10 @@ def test_ssowat_conf(): permissions = res['permissions'] assert "wiki.main" in permissions assert "blog.main" in permissions - assert "blog.api" in permissions + assert "blog.api" not in permissions # blog.api has no url/additional url defined and therefore is not added to ssowat conf assert set(permissions['wiki.main']['users']) == {'alice', 'bob'} assert permissions['blog.main']['users'] == ['alice'] - assert permissions['blog.api']['users'] == [] assert permissions['wiki.main']['uris'][0] == maindomain + "/wiki" @@ -787,26 +786,21 @@ def test_ssowat_conf(): maindomain + "/wiki/whatever", maindomain + "/wiki/idontnow"} assert permissions['blog.main']['uris'] == [maindomain + "/blog"] - assert permissions['blog.api']['uris'] == [] assert permissions['wiki.main']['public'] == False assert permissions['blog.main']['public'] == False - assert permissions['blog.api']['public'] == True assert permissions['wiki.main']['auth_header'] == False assert permissions['blog.main']['auth_header'] == True - assert permissions['blog.api']['auth_header'] == True assert permissions['wiki.main']['label'] == "Wiki" assert permissions['blog.main']['label'] == "Blog" - assert permissions['blog.api']['label'] == "Blog (api)" assert permissions['wiki.main']['show_tile'] == True assert permissions['blog.main']['show_tile'] == False - assert permissions['blog.api']['show_tile'] == False -def test_ssowat_conf_show_tile_impossible(): +def test_show_tile_cant_be_enabled(): _permission_create_with_dummy_app(permission="site.main", auth_header=False, label="Site", show_tile=True, allowed=["all_users"], protected=False, sync_perm=False, @@ -817,10 +811,7 @@ def test_ssowat_conf_show_tile_impossible(): allowed=["all_users"], protected=False, sync_perm=True, domain=maindomain, path="/web") - with open("/etc/ssowat/conf.json") as f: - res = json.load(f) - - permissions = res['permissions'] + permissions = user_permission_list(full=True, full_path=False)['permissions'] assert permissions['site.main']['show_tile'] == False assert permissions['web.main']['show_tile'] == False diff --git a/src/yunohost/tests/test_user-group.py b/src/yunohost/tests/test_user-group.py index 964f2dd72..ea55fb3fe 100644 --- a/src/yunohost/tests/test_user-group.py +++ b/src/yunohost/tests/test_user-group.py @@ -133,7 +133,7 @@ def test_create_user_already_exists(mocker): user_create("alice", "Alice", "White", maindomain, "test123Ynh") def test_create_user_with_domain_that_doesnt_exists(mocker): - with raiseYunohostError(mocker, "domain_unknown"): + with raiseYunohostError(mocker, "domain_name_unknown"): user_create("alice", "Alice", "White", "doesnt.exists", "test123Ynh") def test_update_user_with_mail_address_already_taken(mocker):