本文整理汇总了Python中examples.models.LdapGroup.scoped方法的典型用法代码示例。如果您正苦于以下问题:Python LdapGroup.scoped方法的具体用法?Python LdapGroup.scoped怎么用?Python LdapGroup.scoped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类examples.models.LdapGroup
的用法示例。
在下文中一共展示了LdapGroup.scoped方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_scope
# 需要导入模块: from examples.models import LdapGroup [as 别名]
# 或者: from examples.models.LdapGroup import scoped [as 别名]
def test_scope(self):
ScopedGroup = LdapGroup.scoped(self.scoped_dn)
# create group
g = LdapGroup()
g.name = "foogroup"
g.gid = 1000
g.save()
qs = LdapGroup.objects.all()
self.assertEquals(qs.count(), 1)
qs = ScopedGroup.objects.all()
self.assertEquals(qs.count(), 0)
# create scoped group
g2 = ScopedGroup()
g2.name = "scopedgroup"
g2.gid = 5000
g2.save()
qs = LdapGroup.objects.all()
self.assertEquals(qs.count(), 2)
qs = ScopedGroup.objects.all()
self.assertEquals(qs.count(), 1)
示例2: setUp
# 需要导入模块: from examples.models import LdapGroup [as 别名]
# 或者: from examples.models.LdapGroup import scoped [as 别名]
def setUp(self):
self.mockldap.start()
self.ldapobj = self.mockldap[settings.DATABASES['ldap']['NAME']]
self.scoped_model = LdapGroup.scoped("ou=contacts,%s" %
LdapGroup.base_dn)
示例3: setUp
# 需要导入模块: from examples.models import LdapGroup [as 别名]
# 或者: from examples.models.LdapGroup import scoped [as 别名]
def setUp(self):
super(ScopedTestCase, self).setUp()
self.scoped_model = LdapGroup.scoped("ou=contacts,%s" %
LdapGroup.base_dn)