From 96261d3607e5ae8bd8cf815e1c05f91f4deb271a Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 20 Nov 2023 12:06:22 -0800 Subject: [PATCH] Update factories for postgeneration save deprecation v3.3.0 deprecates saving the model after the post_generation method. Follow the factoryboy instructions for handling this warning: https://factoryboy.readthedocs.io/en/stable/changelog.html#id1 --- primed/cdsa/tests/factories.py | 1 + primed/dbgap/tests/factories.py | 2 ++ primed/users/tests/factories.py | 2 ++ 3 files changed, 5 insertions(+) diff --git a/primed/cdsa/tests/factories.py b/primed/cdsa/tests/factories.py index bf0459b8..e71482ef 100644 --- a/primed/cdsa/tests/factories.py +++ b/primed/cdsa/tests/factories.py @@ -126,3 +126,4 @@ def authorization_domains(self, create, extracted, **kwargs): class Meta: model = models.CDSAWorkspace + skip_postgeneration_save = True diff --git a/primed/dbgap/tests/factories.py b/primed/dbgap/tests/factories.py index de6f3e98..02f9bbd8 100644 --- a/primed/dbgap/tests/factories.py +++ b/primed/dbgap/tests/factories.py @@ -61,6 +61,7 @@ def studies(self, create, extracted, **kwargs): class Meta: model = models.dbGaPStudyAccession + skip_postgeneration_save = True class dbGaPWorkspaceFactory(TimeStampedModelFactory, DjangoModelFactory): @@ -78,6 +79,7 @@ class dbGaPWorkspaceFactory(TimeStampedModelFactory, DjangoModelFactory): class Meta: model = models.dbGaPWorkspace + skip_postgeneration_save = True @post_generation def authorization_domains(self, create, extracted, **kwargs): diff --git a/primed/users/tests/factories.py b/primed/users/tests/factories.py index 9fc0a2ee..6a0e0384 100644 --- a/primed/users/tests/factories.py +++ b/primed/users/tests/factories.py @@ -27,10 +27,12 @@ def password(self, create: bool, extracted: Sequence[Any], **kwargs): ).evaluate(None, None, extra={"locale": None}) ) self.set_password(password) + self.save() class Meta: model = get_user_model() django_get_or_create = ["username"] + skip_postgeneration_save = True class GroupFactory(DjangoModelFactory):