Commit 9e8a19fa authored by Florent Chehab's avatar Florent Chehab

Bug removed in withUserTestCase and moderation testing finished !

parent a57a45ae
......@@ -68,8 +68,6 @@ class MyModelSerializer(serializers.ModelSerializer):
self.clean_validated_data()
if self.moderation_required():
print("Modération requise")
if self.instance is None: # we need to create the main model
self.instance = super(
MyModelSerializer, self).save(**kwargs)
......@@ -93,7 +91,7 @@ class MyModelSerializer(serializers.ModelSerializer):
return self.instance
else:
print("Pas besoin de modération")
moderated_and_updated = True
if self.instance is None:
self.set_model_attr_no_moder(moderated_and_updated)
......@@ -111,8 +109,8 @@ class MyModelSerializer(serializers.ModelSerializer):
objs_pending_db.delete()
self.set_model_attr_no_moder(moderated_and_updated)
return super(MyModelSerializer, self).save(**kwargs)
self.set_model_attr_no_moder(moderated_and_updated)
return super(MyModelSerializer, self).save(**kwargs)
# class MyModelVersionnedSerializer(MyModelSerializer):
......
This diff is collapsed.
......@@ -15,6 +15,7 @@ class WithUserTestCase(TestCase):
password=password
)
self.staff_user.is_staff = True
self.staff_user.save()
self.moderator_user = User.objects.create_user(
username='moderator_member',
......@@ -25,6 +26,7 @@ class WithUserTestCase(TestCase):
name='Moderators'
)[0]
self.moderator_group.user_set.add(self.moderator_user)
self.moderator_group.save()
self.authenticated_user = User.objects.create_user(
username='authenticated_user',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment