mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
More fixes
This commit is contained in:
@@ -123,8 +123,6 @@ async function updateGeneralSettings() {
|
||||
.updateAccount(form.value)
|
||||
.then(() => {
|
||||
busStore.displayNotification({ msg: $gettext('Profile updated') })
|
||||
console.log(authStore.accountLanguage)
|
||||
console.log(available)
|
||||
if (!(authStore.accountLanguage in available)) {
|
||||
languageError.value = $gettext('Language does no exist')
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class DomainAPITestCase(ModoAPITestCase):
|
||||
self.assertEqual(dom.name, "pouét.com")
|
||||
self.assertEqual(dom.quota, 1000)
|
||||
self.assertEqual(dom.default_mailbox_quota, 100)
|
||||
self.assertEqual(dom.enabled, False)
|
||||
self.assertTrue(dom.enabled)
|
||||
self.assertFalse(dom.admins)
|
||||
|
||||
@mock.patch.object(dns.resolver.Resolver, "resolve")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Admin API v2 serializers."""
|
||||
|
||||
import ipaddress
|
||||
import os
|
||||
from typing import List
|
||||
|
||||
from django.conf import settings
|
||||
@@ -262,6 +263,8 @@ class AdminGlobalParametersSerializer(serializers.Serializer):
|
||||
raise serializers.ValidationError(
|
||||
_("openssl not found, please make sure it is installed.")
|
||||
)
|
||||
if not os.path.exists(value):
|
||||
raise serializers.ValidationError(_("Directory not found."))
|
||||
return value
|
||||
|
||||
def validate_valid_mxs(self, value):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Modoboa admin settings."""
|
||||
|
||||
import collections
|
||||
import copy
|
||||
import os
|
||||
|
||||
from django.conf import settings
|
||||
@@ -242,7 +243,8 @@ GLOBAL_PARAMETERS_STRUCT = collections.OrderedDict(
|
||||
)
|
||||
|
||||
|
||||
def init_structure():
|
||||
def init_structure() -> dict:
|
||||
structure = copy.deepcopy(GLOBAL_PARAMETERS_STRUCT)
|
||||
hide_fields = False
|
||||
dpath = None
|
||||
code, output = exec_cmd("which dovecot")
|
||||
@@ -269,7 +271,8 @@ def init_structure():
|
||||
else:
|
||||
hide_fields = True
|
||||
if hide_fields:
|
||||
del GLOBAL_PARAMETERS_STRUCT["mailboxes"]["params"]["handle_mailboxes"]
|
||||
del structure["mailboxes"]["params"]["handle_mailboxes"]
|
||||
return structure
|
||||
|
||||
|
||||
def load_admin_settings():
|
||||
@@ -277,11 +280,11 @@ def load_admin_settings():
|
||||
from modoboa.parameters import tools as param_tools
|
||||
from .api.v2 import serializers
|
||||
|
||||
init_structure()
|
||||
structure = init_structure()
|
||||
param_tools.registry.add2(
|
||||
"global",
|
||||
"admin",
|
||||
gettext_lazy("Administration"),
|
||||
GLOBAL_PARAMETERS_STRUCT,
|
||||
structure,
|
||||
serializers.AdminGlobalParametersSerializer,
|
||||
)
|
||||
|
||||
@@ -114,8 +114,8 @@ class DKIMTestCase(ModoAPITestCase):
|
||||
response = self.client.put(url, settings, format="json")
|
||||
self.assertEqual(response.status_code, 400)
|
||||
compare(response.json(), {"dkim_keys_storage_dir": ["Directory not found."]})
|
||||
settings["admin-dkim_keys_storage_dir"] = self.workdir
|
||||
response = self.client.post(url, settings, format="json")
|
||||
settings["dkim_keys_storage_dir"] = self.workdir
|
||||
response = self.client.put(url, settings, format="json")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_dkim_key_creation(self):
|
||||
|
||||
@@ -65,9 +65,10 @@ class MailboxOperationTestCase(ModoAPITestCase):
|
||||
"language": "en",
|
||||
"mailbox": {"use_domain_quota": True},
|
||||
}
|
||||
self.client.post(
|
||||
response = self.client.put(
|
||||
reverse("v2:account-detail", args=[mb.user.pk]), values, format="json"
|
||||
)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
path = f"{self.workdir}/test.com/admin2"
|
||||
mail_home_mock.__get__ = mock.Mock(return_value=path)
|
||||
call_command("handle_mailbox_operations")
|
||||
|
||||
@@ -124,6 +124,7 @@ class APICommunicationTestCase(ModoTestCase):
|
||||
|
||||
# Enable notifications
|
||||
self.set_global_parameter("send_new_versions_email", True)
|
||||
self.set_global_parameter("new_versions_email_rcpt", "postmaster@domain.test")
|
||||
with httmock.HTTMock(
|
||||
mocks.modo_api_instance_search,
|
||||
mocks.modo_api_instance_create,
|
||||
|
||||
@@ -233,7 +233,7 @@ OAUTH2_PROVIDER = {
|
||||
REST_FRAMEWORK = {
|
||||
"DEFAULT_THROTTLE_RATES": {
|
||||
"user": "400/minute",
|
||||
"ddos": "10/second",
|
||||
"ddos": "50/second",
|
||||
"ddos_lesser": "200/minute",
|
||||
"login": "10/minute",
|
||||
"password_recovery_request": "12/hour",
|
||||
|
||||
Reference in New Issue
Block a user