mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 05:59:17 +02:00
Implement tag models
This commit is contained in:
parent
c170ee9394
commit
6dde4b73cd
28 changed files with 1034 additions and 141 deletions
|
@ -42,11 +42,20 @@ class InvitationFactory(NoUpdateOnCreate, factory.django.DjangoModelFactory):
|
|||
expired = factory.Trait(expiration_date=factory.LazyFunction(timezone.now))
|
||||
|
||||
|
||||
class PasswordSetter(factory.PostGenerationMethodCall):
|
||||
def call(self, instance, step, context):
|
||||
if context.value_provided and context.value is None:
|
||||
# disable setting the password, it's set by hand outside of the factory
|
||||
return
|
||||
|
||||
return super().call(instance, step, context)
|
||||
|
||||
|
||||
@registry.register
|
||||
class UserFactory(factory.django.DjangoModelFactory):
|
||||
username = factory.Sequence(lambda n: "user-{0}".format(n))
|
||||
email = factory.Sequence(lambda n: "user-{0}@example.com".format(n))
|
||||
password = factory.PostGenerationMethodCall("set_password", "test")
|
||||
username = factory.Faker("user_name")
|
||||
email = factory.Faker("email")
|
||||
password = password = PasswordSetter("set_password", "test")
|
||||
subsonic_api_token = None
|
||||
groups = ManyToManyFromList("groups")
|
||||
avatar = factory.django.ImageField()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue