当前位置: 首页>>代码示例>>Python>>正文


Python LdapGroup.save方法代码示例

本文整理汇总了Python中examples.models.LdapGroup.save方法的典型用法代码示例。如果您正苦于以下问题:Python LdapGroup.save方法的具体用法?Python LdapGroup.save怎么用?Python LdapGroup.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在examples.models.LdapGroup的用法示例。


在下文中一共展示了LdapGroup.save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_scope

# 需要导入模块: from examples.models import LdapGroup [as 别名]
# 或者: from examples.models.LdapGroup import save [as 别名]
    def test_scope(self):
        ScopedGroup = self.scoped_model

        # 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)

        g2 = ScopedGroup.objects.get(name="scopedgroup")
        self.assertEquals(g2.name, u'scopedgroup')
        self.assertEquals(g2.gid, 5000)
开发者ID:BangorUniversity,项目名称:django-ldapdb,代码行数:32,代码来源:tests.py

示例2: test_scope

# 需要导入模块: from examples.models import LdapGroup [as 别名]
# 或者: from examples.models.LdapGroup import save [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)
开发者ID:crito,项目名称:django-ldapdb,代码行数:28,代码来源:tests.py

示例3: test_save

# 需要导入模块: from examples.models import LdapGroup [as 别名]
# 或者: from examples.models.LdapGroup import save [as 别名]
    def test_save(self):
        g = LdapGroup()
        g.name = 'newgroup'
        g.gid = 1010
        g.usernames = ['someuser', 'foouser']
        g.save()

        new = LdapGroup.objects.get(name='newgroup')
        self.assertEquals(new.name, 'newgroup')
        self.assertEquals(new.gid, 1010)
        self.assertEquals(new.usernames, ['someuser', 'foouser'])
开发者ID:Rolled,项目名称:django-ldapdb,代码行数:13,代码来源:tests.py

示例4: test_insert

# 需要导入模块: from examples.models import LdapGroup [as 别名]
# 或者: from examples.models.LdapGroup import save [as 别名]
    def test_insert(self):
        g = LdapGroup()
        g.name = 'newgroup'
        g.gid = 1010
        g.usernames = ['someuser', 'foouser']
        g.save()

        # check group was created
        new = LdapGroup.objects.get(name='newgroup')
        self.assertEqual(new.name, 'newgroup')
        self.assertEqual(new.gid, 1010)
        self.assertCountEqual(new.usernames, ['someuser', 'foouser'])
开发者ID:django-ldapdb,项目名称:django-ldapdb,代码行数:14,代码来源:tests.py

示例5: test_insert

# 需要导入模块: from examples.models import LdapGroup [as 别名]
# 或者: from examples.models.LdapGroup import save [as 别名]
    def test_insert(self):
        g = LdapGroup()
        g.name = "newgroup"
        g.gid = 1010
        g.usernames = ["someuser", "foouser"]
        g.save()
        self.assertEquals(self.ldapobj.methods_called(), ["initialize", "simple_bind_s", "add_s"])

        # check group was created
        new = LdapGroup.objects.get(name="newgroup")
        self.assertEquals(new.name, "newgroup")
        self.assertEquals(new.gid, 1010)
        self.assertEquals(new.usernames, ["someuser", "foouser"])
开发者ID:cshuo,项目名称:django-ldapdb,代码行数:15,代码来源:tests.py

示例6: test_insert

# 需要导入模块: from examples.models import LdapGroup [as 别名]
# 或者: from examples.models.LdapGroup import save [as 别名]
    def test_insert(self):
        g = LdapGroup()
        g.name = 'newgroup'
        g.gid = 1010
        g.usernames = ['someuser', 'foouser']
        g.save()
        self.assertEquals(self.ldapobj.methods_called(), [
            'initialize',
            'simple_bind_s',
            'add_s'])

        # check group was created
        new = LdapGroup.objects.get(name='newgroup')
        self.assertEquals(new.name, 'newgroup')
        self.assertEquals(new.gid, 1010)
        self.assertEquals(new.usernames, ['someuser', 'foouser'])
开发者ID:ResearchComputing,项目名称:django-ldapdb,代码行数:18,代码来源:tests.py

示例7: setUp

# 需要导入模块: from examples.models import LdapGroup [as 别名]
# 或者: from examples.models.LdapGroup import save [as 别名]
    def setUp(self):
        super(AdminTestCase, self).setUp()

        g = LdapGroup()
        g.name = "foogroup"
        g.gid = 1000
        g.usernames = ['foouser', 'baruser']
        g.save()

        g = LdapGroup()
        g.name = "bargroup"
        g.gid = 1001
        g.usernames = ['zoouser', 'baruser']
        g.save()

        u = LdapUser()
        u.first_name = "Foo"
        u.last_name = "User"
        u.full_name = "Foo User"
        u.group = 1000
        u.home_directory = "/home/foouser"
        u.uid = 2000
        u.username = "foouser"
        u.save()

        u = LdapUser()
        u.first_name = "Bar"
        u.last_name = "User"
        u.full_name = "Bar User"
        u.group = 1001
        u.home_directory = "/home/baruser"
        u.uid = 2001
        u.username = "baruser"
        u.save()

        self.client.login(username="test_user", password="password")
开发者ID:BangorUniversity,项目名称:django-ldapdb,代码行数:38,代码来源:tests.py


注:本文中的examples.models.LdapGroup.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。