Clear existing groups before readding, stops people with removed groups persisting

This commit is contained in:
2012-10-19 23:30:09 +01:00
parent fe6a1cc1ff
commit 0e9af4b93a

View File

@@ -46,6 +46,7 @@ class TESTAuthBackend:
user.save()
if getattr(settings, 'TEST_AUTH_CREATE_GROUPS', False):
user.groups.clear()
for g in groups:
group, created = Group.objects.get_or_create(name=g['name'])
user.groups.add(group)