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)
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)
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'])
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.assertEqual(new.usernames, ['someuser', 'foouser'])
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'])
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"])
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'])
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"])
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'])
def setUp(self): super(ScopedTestCase, self).setUp() self.scoped_model = LdapGroup.scoped("ou=contacts,%s" % LdapGroup.base_dn)
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)
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()
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 = "******" 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 = "******" u.save() self.client.login(username="******", password="******")