import factory
from django.contrib.auth.hashers import make_password

from keybar.models.user import User


class UserFactory(factory.DjangoModelFactory):
    email = factory.Sequence(lambda i: '{0}@none.none'.format(i))
    is_active = True

    class Meta:
        model = User

    @classmethod
    def _prepare(cls, create, **kwargs):
        raw_password = kwargs.pop('raw_password', 'secret')
        if 'password' not in kwargs:
            kwargs['password'] = make_password(raw_password, hasher='md5')
        return super(UserFactory, cls)._prepare(create, **kwargs)

import factory
from django.contrib.auth.hashers import make_password

from keybar.models.user import User


class UserFactory(factory.DjangoModelFactory):
    email = factory.Sequence(lambda i: '{0}@none.none'.format(i))
    is_active = True

    class Meta:
        model = User

    @classmethod
    def _prepare(cls, create, **kwargs):
        raw_password = kwargs.pop('raw_password', 'secret')
        if 'password' not in kwargs:
            kwargs['password'] = make_password(raw_password, hasher='pbkdf2_sha256')
        return super(UserFactory, cls)._prepare(create, **kwargs)

Use pdbkdf_sha256 hasher for testing too.
Use pdbkdf_sha256 hasher for testing too.

  import factory
  from django.contrib.auth.hashers import make_password
  
  from keybar.models.user import User
  
  
  class UserFactory(factory.DjangoModelFactory):
      email = factory.Sequence(lambda i: '{0}@none.none'.format(i))
      is_active = True
  
      class Meta:
          model = User
  
      @classmethod
      def _prepare(cls, create, **kwargs):
          raw_password = kwargs.pop('raw_password', 'secret')
          if 'password' not in kwargs:
-             kwargs['password'] = make_password(raw_password, hasher='md5')
+             kwargs['password'] = make_password(raw_password, hasher='pbkdf2_sha256')
          return super(UserFactory, cls)._prepare(create, **kwargs)
  
Use pdbkdf_sha256 hasher for testing too.
## Code Before:
import factory
from django.contrib.auth.hashers import make_password

from keybar.models.user import User


class UserFactory(factory.DjangoModelFactory):
    email = factory.Sequence(lambda i: '{0}@none.none'.format(i))
    is_active = True

    class Meta:
        model = User

    @classmethod
    def _prepare(cls, create, **kwargs):
        raw_password = kwargs.pop('raw_password', 'secret')
        if 'password' not in kwargs:
            kwargs['password'] = make_password(raw_password, hasher='md5')
        return super(UserFactory, cls)._prepare(create, **kwargs)

## Instruction:
Use pdbkdf_sha256 hasher for testing too.
## Code After:
import factory
from django.contrib.auth.hashers import make_password

from keybar.models.user import User


class UserFactory(factory.DjangoModelFactory):
    email = factory.Sequence(lambda i: '{0}@none.none'.format(i))
    is_active = True

    class Meta:
        model = User

    @classmethod
    def _prepare(cls, create, **kwargs):
        raw_password = kwargs.pop('raw_password', 'secret')
        if 'password' not in kwargs:
            kwargs['password'] = make_password(raw_password, hasher='pbkdf2_sha256')
        return super(UserFactory, cls)._prepare(create, **kwargs)
