Push coverage for osusers to 100%

This commit is contained in:
Jan Dittberner 2016-01-28 13:44:29 +00:00
parent a8e28fd595
commit e9fc8b7f89

View file

@ -153,7 +153,10 @@ class AdditionalGroupTest(TestCaseWithCeleryTasks):
def test_save_again(self): def test_save_again(self):
group2 = Group.objects.create(groupname='test2', gid=1001) group2 = Group.objects.create(groupname='test2', gid=1001)
TaskResult.objects.all().delete() TaskResult.objects.all().delete()
group2.save() addgroup = AdditionalGroup(user=self.user, group=group2)
addgroup.save()
TaskResult.objects.all().delete()
addgroup.save()
taskres = TaskResult.objects.all() taskres = TaskResult.objects.all()
self.assertEqual(len(taskres), 0) self.assertEqual(len(taskres), 0)
@ -187,6 +190,19 @@ class GroupTest(TestCaseWithCeleryTasks):
def test_save(self): def test_save(self):
group = Group(gid=10000, groupname='test') group = Group(gid=10000, groupname='test')
self.assertIs(group.save(), group) self.assertIs(group.save(), group)
taskres = TaskResult.objects.all()
self.assertTrue(len(taskres), 1)
creators = [r.creator for r in taskres]
for tcount, tcreator in [
(1, 'handle_group_created')]:
self.assertEqual(creators.count(tcreator), tcount)
def test_save_again(self):
group = Group.objects.create(gid=10000, groupname='test')
taskres = TaskResult.objects.all().delete()
group.save()
taskres = TaskResult.objects.all()
self.assertEqual(len(taskres), 0)
def test_delete(self): def test_delete(self):
group = Group.objects.create(gid=10000, groupname='test') group = Group.objects.create(gid=10000, groupname='test')