forked from DGNum/gestioCOF
Fix tests
This commit is contained in:
parent
c145191e55
commit
d6fa738a25
2 changed files with 18 additions and 14 deletions
|
@ -10,7 +10,7 @@ from kfet.models import Account
|
|||
|
||||
from . import KFET_GENERIC_TRIGRAMME, KFET_GENERIC_USERNAME
|
||||
from .backends import AccountBackend, GenericBackend
|
||||
from .models import GenericTeamToken
|
||||
from .models import GenericTeamToken, KFetGroup
|
||||
from .utils import get_kfet_generic_user
|
||||
from .views import GenericLoginView
|
||||
|
||||
|
@ -27,11 +27,8 @@ class UserGroupFormTests(TestCase):
|
|||
self.user = User.objects.create(username="foo", password="foo")
|
||||
|
||||
# create some K-Fêt groups
|
||||
prefix_name = "K-Fêt "
|
||||
names = ["Group 1", "Group 2", "Group 3"]
|
||||
self.kfet_groups = [
|
||||
Group.objects.create(name=prefix_name + name) for name in names
|
||||
]
|
||||
self.kfet_groups = [KFetGroup.objects.create(name=name) for name in names]
|
||||
|
||||
# create a non-K-Fêt group
|
||||
self.other_group = Group.objects.create(name="Other group")
|
||||
|
@ -41,7 +38,9 @@ class UserGroupFormTests(TestCase):
|
|||
form = UserGroupForm(instance=self.user)
|
||||
groups_field = form.fields["groups"]
|
||||
self.assertQuerysetEqual(
|
||||
groups_field.queryset, [repr(g) for g in self.kfet_groups], ordered=False
|
||||
groups_field.queryset,
|
||||
[repr(g.group_ptr) for g in self.kfet_groups],
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
def test_keep_others(self):
|
||||
|
@ -59,7 +58,8 @@ class UserGroupFormTests(TestCase):
|
|||
form.save()
|
||||
self.assertQuerysetEqual(
|
||||
user.groups.all(),
|
||||
[repr(g) for g in [self.other_group] + self.kfet_groups],
|
||||
[self.other_group.pk] + [group.pk for group in self.kfet_groups],
|
||||
transform=lambda group: group.pk,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue