本文整理汇总了Python中modoboa.lib.parameters.save_admin函数的典型用法代码示例。如果您正苦于以下问题:Python save_admin函数的具体用法?Python save_admin怎么用?Python save_admin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_admin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
super(AccessRuleTestCase, self).setUp()
self.activate_extensions('radicale')
populate_database()
self.rights_file_path = tempfile.mktemp()
parameters.save_admin(
"RIGHTS_FILE_PATH", self.rights_file_path, app="radicale")
示例2: setUpTestData
def setUpTestData(cls):
"""Create test data."""
super(AliasAPITestCase, cls).setUpTestData()
parameters.save_admin("ENABLE_ADMIN_LIMITS", "no", app="limits")
factories.populate_database()
cls.da_token = Token.objects.create(
user=core_models.User.objects.get(username="[email protected]"))
示例3: setUpTestData
def setUpTestData(cls):
"""Create test data."""
super(APIDomainLimitsTestCase, cls).setUpTestData()
parameters.save_admin("ENABLE_DOMAIN_LIMITS", "yes")
for name, tpl in utils.get_domain_limit_templates():
parameters.save_admin(
"DEFLT_DOMAIN_{}_LIMIT".format(name.upper()), 2)
populate_database()
示例4: setUp
def setUp(self):
super(LimitsTestCase, self).setUp()
for tpl in LimitTemplates().templates:
parameters.save_admin("DEFLT_{0}".format(tpl[0].upper()), 2, app="limits")
self.user = UserFactory.create(username="reseller", groups=("Resellers",))
self.clt.logout()
self.clt.login(username="reseller", password="toto")
示例5: unset_default_topredirection
def unset_default_topredirection(extension):
"""
Simple callback to change the default redirection if the
corresponding extension is being disabled.
"""
topredirection = parameters.get_admin("DEFAULT_TOP_REDIRECTION")
if topredirection == extension.name:
parameters.save_admin("DEFAULT_TOP_REDIRECTION", "userprefs")
示例6: setUpTestData
def setUpTestData(cls):
"""Custom setUpTestData method."""
super(ResourceTestCase, cls).setUpTestData()
for name, tpl in utils.get_limit_templates():
parameters.save_admin(
"DEFLT_{0}_LIMIT".format(name.upper()), 2,
app="limits"
)
populate_database()
示例7: setUpTestData
def setUpTestData(cls):
"""Custom setUpTestData method."""
super(ResourceTestCase, cls).setUpTestData()
for tpl in LimitTemplates().templates:
parameters.save_admin(
"DEFLT_{0}".format(tpl[0].upper()), 2,
app="limits"
)
populate_database()
示例8: setUp
def setUp(self):
"""Custom setUp method.
The 'limits' is manually loaded to ensure extra parameters
provided by 'postfix_relay_domains' are properly received.
"""
super(ResourceTestCase, self).setUp()
for tpl in LimitTemplates().templates:
parameters.save_admin('DEFLT_%s' % tpl[0].upper(), 2, app='limits')
populate_database()
示例9: test_autocreate_disabled
def test_autocreate_disabled(self):
"""Check if objects are not created as expected."""
self.activate_ldap_authentication()
self.searchbind_mode()
parameters.save_admin("AUTO_CREATE_DOMAIN_AND_MAILBOX", "no")
username = "[email protected]"
self.authenticate(username, "test")
self.assertFalse(
models.Domain.objects.filter(name="example.com").exists())
self.assertFalse(
models.Mailbox.objects.filter(address="testuser").exists())
示例10: setUpTestData
def setUpTestData(cls):
"""Create test data."""
super(LimitsTestCase, cls).setUpTestData()
for tpl in LimitTemplates().templates:
parameters.save_admin(
"DEFLT_{0}".format(tpl[0].upper()), 2, app="limits"
)
cls.user = UserFactory.create(
username='reseller', groups=('Resellers',)
)
示例11: test_model
def test_model(self):
"""Check few things about the model."""
Radicale().load()
mbox = Mailbox.objects.get(address="admin", domain__name="test.com")
cal = UserCalendarFactory(name="MyCal", mailbox=mbox)
with self.assertRaises(lib_exceptions.InternalError) as cm:
url = cal.url
self.assertEqual(
str(cm.exception), "Server location is not set, please fix it.")
parameters.save_admin(
"SERVER_LOCATION", "http://localhost", app="modoboa_radicale")
self.assertEqual(cal.url, "http://localhost/test.com/user/admin/MyCal")
示例12: setUp
def setUp(self):
"""Custom setUp method.
The 'limits' is manually loaded to ensure extra parameters
provided by 'postfix_relay_domains' are properly received.
"""
super(ResourceTestCase, self).setUp()
#exts_pool.load_extension("modoboa_admin_limits")
for tpl in LimitTemplates().templates:
parameters.save_admin(
"DEFLT_{0}".format(tpl[0].upper()), 2,
app="modoboa_admin_limits"
)
populate_database()
示例13: setUp
def setUp(self):
super(LimitsTestCase, self).setUp()
from modoboa_admin_limits.models import LimitTemplates
for tpl in LimitTemplates().templates:
parameters.save_admin(
"DEFLT_{0}".format(tpl[0].upper()), 2,
app="modoboa_admin_limits"
)
self.user = UserFactory.create(
username='reseller', groups=('Resellers',)
)
self.clt.logout()
self.clt.login(username='reseller', password='toto')
示例14: test_searchbind_authentication
def test_searchbind_authentication(self):
"""Test the bind&search method."""
self.searchbind_mode()
username = "[email protected]"
self.authenticate(username, "test")
self.check_created_user(username)
self.client.logout()
parameters.save_admin("LDAP_ADMIN_GROUPS", "admins")
parameters.save_admin(
"LDAP_GROUPS_SEARCH_BASE", "ou=groups,dc=example,dc=com")
username = "[email protected]"
self.authenticate(username, "test", False)
self.check_created_user(username, "DomainAdmins")
示例15: test_create_using_default_quota
def test_create_using_default_quota(self):
parameters.save_admin('DEFAULT_DOMAIN_QUOTA', 50, app='admin')
values = {
"name": "pouet.com", "create_dom_admin": "yes",
"dom_admin_username": "toto", "create_aliases": "yes",
"type": "domain", "stepid": 'step3'
}
self.ajax_post(
reverse("admin:domain_add"),
values
)
dom = Domain.objects.get(name="pouet.com")
self.assertEqual(dom.quota, 50)
da = User.objects.get(username="[email protected]")
self.assertEqual(da.mailbox.quota, 50)