mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
autopep8 --in-place -a -a -a -a -a -r data/ doc/ tests/ src/yunohost/tests/ src/yunohost/utils/ src/yunohost/data_migrations/
This commit is contained in:
parent
31b68b9463
commit
485044335d
4 changed files with 17 additions and 8 deletions
|
@ -729,7 +729,7 @@ def test_parse_args_in_yunohost_format_boolean_input_test_ask_with_default():
|
|||
|
||||
|
||||
def test_parse_args_in_yunohost_format_domain_empty():
|
||||
questions = [{"name": "some_domain", "type": "domain",}]
|
||||
questions = [{"name": "some_domain", "type": "domain", }]
|
||||
main_domain = "my_main_domain.com"
|
||||
expected_result = OrderedDict({"some_domain": (main_domain, "domain")})
|
||||
answers = {}
|
||||
|
|
|
@ -34,7 +34,7 @@ def setup_function(function):
|
|||
|
||||
assert len(backup_list()["archives"]) == 0
|
||||
|
||||
markers = {m.name: {'args':m.args, 'kwargs':m.kwargs} for m in function.__dict__.get("pytestmark",[])}
|
||||
markers = {m.name: {'args': m.args, 'kwargs': m.kwargs} for m in function.__dict__.get("pytestmark", [])}
|
||||
|
||||
if "with_wordpress_archive_from_2p4" in markers:
|
||||
add_archive_wordpress_from_2p4()
|
||||
|
@ -82,7 +82,7 @@ def teardown_function(function):
|
|||
delete_all_backups()
|
||||
uninstall_test_apps_if_needed()
|
||||
|
||||
markers = {m.name: {'args':m.args, 'kwargs':m.kwargs} for m in function.__dict__.get("pytestmark",[])}
|
||||
markers = {m.name: {'args': m.args, 'kwargs': m.kwargs} for m in function.__dict__.get("pytestmark", [])}
|
||||
|
||||
if "clean_opt_dir" in markers:
|
||||
shutil.rmtree("/opt/test_backup_output_directory")
|
||||
|
@ -94,6 +94,7 @@ def teardown_function(function):
|
|||
domain = markers['with_custom_domain']['args'][0]
|
||||
domain_remove(domain)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def check_LDAP_db_integrity_call():
|
||||
check_LDAP_db_integrity()
|
||||
|
|
|
@ -25,6 +25,7 @@ dummy_password = "test123Ynh"
|
|||
|
||||
prv_getaddrinfo = socket.getaddrinfo
|
||||
|
||||
|
||||
def _permission_create_with_dummy_app(permission, allowed=None,
|
||||
url=None, additional_urls=None, auth_header=True,
|
||||
label=None, show_tile=False,
|
||||
|
@ -84,7 +85,7 @@ def setup_function(function):
|
|||
global other_domains
|
||||
maindomain = _get_maindomain()
|
||||
|
||||
markers = {m.name: {'args':m.args, 'kwargs':m.kwargs} for m in function.__dict__.get("pytestmark",[])}
|
||||
markers = {m.name: {'args': m.args, 'kwargs': m.kwargs} for m in function.__dict__.get("pytestmark", [])}
|
||||
|
||||
if "other_domains" in markers:
|
||||
other_domains = ["domain_%s.dev" % string.ascii_lowercase[number] for number in range(markers['other_domains']['kwargs']['number'])]
|
||||
|
@ -109,7 +110,7 @@ def setup_function(function):
|
|||
|
||||
user_create("alice", "Alice", "White", maindomain, dummy_password)
|
||||
user_create("bob", "Bob", "Snow", maindomain, dummy_password)
|
||||
_permission_create_with_dummy_app(permission="wiki.main", url="/", additional_urls=['/whatever','/idontnow'], auth_header=False,
|
||||
_permission_create_with_dummy_app(permission="wiki.main", url="/", additional_urls=['/whatever', '/idontnow'], auth_header=False,
|
||||
label="Wiki", show_tile=True,
|
||||
allowed=["all_users"], protected=False, sync_perm=False,
|
||||
domain=maindomain, path='/wiki')
|
||||
|
@ -119,6 +120,7 @@ def setup_function(function):
|
|||
allowed=["alice"], domain=maindomain, path='/blog')
|
||||
_permission_create_with_dummy_app(permission="blog.api", allowed=["visitors"], protected=True, sync_perm=True)
|
||||
|
||||
|
||||
def teardown_function(function):
|
||||
clean_user_groups_permission()
|
||||
global other_domains
|
||||
|
@ -378,6 +380,7 @@ def test_permission_create_with_tile_management(mocker):
|
|||
assert res['site.main']['label'] == "The Site"
|
||||
assert res['site.main']['show_tile'] is False
|
||||
|
||||
|
||||
def test_permission_create_with_tile_management_with_main_default_value(mocker):
|
||||
with message(mocker, "permission_created", permission="site.main"):
|
||||
_permission_create_with_dummy_app("site.main", allowed=["all_users"], show_tile=True, url="/",
|
||||
|
@ -388,6 +391,7 @@ def test_permission_create_with_tile_management_with_main_default_value(mocker):
|
|||
assert res['site.main']['label'] == "Site"
|
||||
assert res['site.main']['show_tile'] is True
|
||||
|
||||
|
||||
def test_permission_create_with_tile_management_with_not_main_default_value(mocker):
|
||||
with message(mocker, "permission_created", permission="wiki.api"):
|
||||
_permission_create_with_dummy_app("wiki.api", allowed=["all_users"], show_tile=True, url="/",
|
||||
|
@ -414,7 +418,7 @@ def test_permission_create_with_urls_management_without_url(mocker):
|
|||
def test_permission_create_with_urls_management_simple_domain(mocker):
|
||||
with message(mocker, "permission_created", permission="site.main"):
|
||||
_permission_create_with_dummy_app("site.main", allowed=["all_users"],
|
||||
url="/", additional_urls=['/whatever','/idontnow'], auth_header=False,
|
||||
url="/", additional_urls=['/whatever', '/idontnow'], auth_header=False,
|
||||
domain=maindomain, path='/site')
|
||||
|
||||
res = user_permission_list(full=True, absolute_urls=True)['permissions']
|
||||
|
@ -659,7 +663,7 @@ def test_permission_main_url_regex():
|
|||
assert res["blog.main"]["url"] == "re:/[a-z]+reboy/.*"
|
||||
|
||||
res = user_permission_list(full=True, absolute_urls=True)['permissions']
|
||||
assert res["blog.main"]["url"] == "re:%s/blog/[a-z]+reboy/.*" % maindomain.replace('.', '\.')
|
||||
assert res["blog.main"]["url"] == "re:%s/blog/[a-z]+reboy/.*" % maindomain.replace('.', r'\.')
|
||||
|
||||
|
||||
def test_permission_main_url_bad_regex(mocker):
|
||||
|
@ -686,7 +690,7 @@ def test_permission_add_additional_regex():
|
|||
assert res["blog.main"]["additional_urls"] == ["re:/[a-z]+reboy/.*"]
|
||||
|
||||
res = user_permission_list(full=True, absolute_urls=True)['permissions']
|
||||
assert res["blog.main"]["additional_urls"] == ["re:%s/blog/[a-z]+reboy/.*" % maindomain.replace('.', '\.')]
|
||||
assert res["blog.main"]["additional_urls"] == ["re:%s/blog/[a-z]+reboy/.*" % maindomain.replace('.', r'\.')]
|
||||
|
||||
|
||||
def test_permission_add_additional_bad_regex(mocker):
|
||||
|
|
|
@ -132,18 +132,22 @@ def test_create_user_already_exists(mocker):
|
|||
with raiseYunohostError(mocker, "user_already_exists"):
|
||||
user_create("alice", "Alice", "White", maindomain, "test123Ynh")
|
||||
|
||||
|
||||
def test_create_user_with_domain_that_doesnt_exists(mocker):
|
||||
with raiseYunohostError(mocker, "domain_name_unknown"):
|
||||
user_create("alice", "Alice", "White", "doesnt.exists", "test123Ynh")
|
||||
|
||||
|
||||
def test_update_user_with_mail_address_already_taken(mocker):
|
||||
with raiseYunohostError(mocker, "user_update_failed"):
|
||||
user_update("bob", add_mailalias="alice@" + maindomain)
|
||||
|
||||
|
||||
def test_update_user_with_mail_address_with_unknown_domain(mocker):
|
||||
with raiseYunohostError(mocker, "mail_domain_unknown"):
|
||||
user_update("alice", add_mailalias="alice@doesnt.exists")
|
||||
|
||||
|
||||
def test_del_user_that_does_not_exist(mocker):
|
||||
with raiseYunohostError(mocker, "user_unknown"):
|
||||
user_delete("doesnt_exist")
|
||||
|
|
Loading…
Add table
Reference in a new issue