X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=examples%2Ftests.py;h=26d07d3ee1649282f4d82d02022dd103b5defd67;hb=326c4e332a9447a6972a0f53f9769a5a3b965fba;hp=533df5c04dbbda6bdec0b44de51f96085107d230;hpb=8ce4d769e2f75d829afbcc761b01c06a6219e3e0;p=matthijs%2Fupstream%2Fdjango-ldapdb.git diff --git a/examples/tests.py b/examples/tests.py index 533df5c..26d07d3 100644 --- a/examples/tests.py +++ b/examples/tests.py @@ -78,7 +78,7 @@ class GroupTestCase(BaseTestCase): self.assertEquals(g.gid, 1000) self.assertEquals(g.usernames, ['foouser', 'baruser']) - # try to get non-existent entry + # try to filter non-existent entries qs = LdapGroup.objects.filter(name='does_not_exist') self.assertEquals(len(qs), 0) @@ -89,6 +89,7 @@ class GroupTestCase(BaseTestCase): self.assertEquals(g.gid, 1000) self.assertEquals(g.usernames, ['foouser', 'baruser']) + # try to get a non-existent entry self.assertRaises(LdapGroup.DoesNotExist, LdapGroup.objects.get, name='does_not_exist') def test_order_by(self): @@ -116,6 +117,12 @@ class GroupTestCase(BaseTestCase): self.assertEquals(qs[0].gid, 1001) self.assertEquals(qs[1].gid, 1000) + def test_bulk_delete(self): + LdapGroup.objects.all().delete() + + qs = LdapGroup.objects.all() + self.assertEquals(len(qs), 0) + def test_update(self): g = LdapGroup.objects.get(name='foogroup') @@ -243,6 +250,10 @@ class AdminTestCase(BaseTestCase): self.assertContains(response, "foogroup") self.assertContains(response, "1000") + def test_group_delete(self): + response = self.client.post('/admin/examples/ldapgroup/foogroup/delete/', {'yes': 'post'}) + self.assertRedirects(response, '/admin/examples/ldapgroup/') + def test_group_search(self): response = self.client.get('/admin/examples/ldapgroup/?q=foo') self.assertContains(response, "Ldap groups") @@ -271,3 +282,8 @@ class AdminTestCase(BaseTestCase): response = self.client.get('/admin/examples/ldapuser/foouser/') self.assertContains(response, "foouser") self.assertContains(response, "2000") + + def test_user_delete(self): + response = self.client.post('/admin/examples/ldapuser/foouser/delete/', {'yes': 'post'}) + self.assertRedirects(response, '/admin/examples/ldapuser/') +