Simpler fix

This commit is contained in:
Lars Eggert 2023-10-02 11:43:11 +03:00
parent 510570521d
commit 250e045ec3
No known key found for this signature in database
GPG key ID: 54B5C309BF70C157

View file

@ -27,7 +27,7 @@ class GroupFactory(factory.django.DjangoModelFactory):
django_get_or_create = ('acronym',)
skip_postgeneration_save = True
name = factory.Faker('sentence',nb_words=6)
name = factory.Faker('text', max_nb_chars=80)
acronym = factory.Sequence(lambda n: 'acronym%d' %n)
state_id = 'active'
type_id = 'wg'
@ -35,13 +35,6 @@ class GroupFactory(factory.django.DjangoModelFactory):
uses_milestone_dates = True
used_roles = [] # type: List[str]
@classmethod
def _create(cls, model_class, *args, **kwargs):
obj = model_class(*args, **kwargs)
obj.name = obj.name[0:80] # db only allows names of 80 characters max
obj.save()
return obj
@factory.lazy_attribute
def parent(self):
if self.type_id in ['wg','ag']: