Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
UserFactory with raw_password
class UserFactory(factory.Factory):
password = 'test'
def _prepare(cls, create, **kwargs):
password = kwargs.pop('password', None)
user = super(UserFactory, cls)._prepare(create, **kwargs)
if password:
user.raw_password = password
if create:
return user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment