Moar fixes

This commit is contained in:
Alexandre Aubin 2020-09-09 23:24:39 +02:00
parent c6905ed2c8
commit 250f69028a
4 changed files with 7 additions and 16 deletions

View file

@ -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",

View file

@ -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

View file

@ -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

View file

@ -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):