diff --git a/tests/factories.py b/tests/factories.py index 178ddef2..9b87787e 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -92,8 +92,8 @@ class Params: @factory.post_generation def with_answer(question, creation_strategy, value, **kwargs): if value is True: - AnswerFactory(question=question, with_multiple_choice=kwargs.get("with_multiple_choice")) - question.save() + answer = AnswerFactory(question=question, with_multiple_choice=kwargs.get("with_multiple_choice")) + answer.save() @factory.post_generation def with_multiple_choice(question, creation_strategy, value, **kwargs): @@ -104,12 +104,12 @@ def with_multiple_choice(question, creation_strategy, value, **kwargs): @factory.post_generation def with_free_text(question, creation_strategy, value, **kwargs): if value is True: - AnswerFactory( + answer = AnswerFactory( question=question, with_multiple_choice=kwargs.get("with_multiple_choice"), with_free_text=kwargs.get("with_free_text"), ) - question.save() + answer.save() class ConsultationResponseFactory(factory.django.DjangoModelFactory):