當前位置: 首頁>>代碼示例>>Python>>正文


Python models.LdapGroup類代碼示例

本文整理匯總了Python中examples.models.LdapGroup的典型用法代碼示例。如果您正苦於以下問題:Python LdapGroup類的具體用法?Python LdapGroup怎麽用?Python LdapGroup使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了LdapGroup類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_scope

    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,代碼行數:30,代碼來源:tests.py

示例2: test_scope

    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,代碼行數:26,代碼來源:tests.py

示例3: test_save

    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,代碼行數:11,代碼來源:tests.py

示例4: test_insert

    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,代碼行數:12,代碼來源:tests.py

示例5: test_insert

    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,代碼行數:13,代碼來源:tests.py

示例6: test_insert

    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,代碼行數:16,代碼來源:tests.py

示例7: setUp

 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)
開發者ID:ResearchComputing,項目名稱:django-ldapdb,代碼行數:5,代碼來源:tests.py

示例8: setUp

 def setUp(self):
     super(ScopedTestCase, self).setUp()
     self.scoped_model = LdapGroup.scoped("ou=contacts,%s" %
                                          LdapGroup.base_dn)
開發者ID:django-ldapdb,項目名稱:django-ldapdb,代碼行數:4,代碼來源:tests.py

示例9: setUp

    def setUp(self):
        super(GroupTestCase, 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()

        g = LdapGroup()
        g.name = "wizgroup"
        g.gid = 1002
        g.usernames = ['wizuser', 'baruser']
        g.save()
開發者ID:BangorUniversity,項目名稱:django-ldapdb,代碼行數:20,代碼來源:tests.py


注:本文中的examples.models.LdapGroup類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。