<gh_stars>1-10
from factory import DjangoModelFactory, Sequence, SubFactory, PostGenerationMethodCall
from users.models import User
from rest_framework.authtoken.models import Token


TEST_PASSWORD = '<PASSWORD>'


class UserFactory(DjangoModelFactory):

    class Meta:
        model = User

    username = Sequence(lambda x: 'user_{0}'.format(x))
    password = PostGenerationMethodCall('set_password', TEST_PASSWORD)
    email = Sequence(lambda x: '<EMAIL>'.<EMAIL>(x))


class TokenFactory(DjangoModelFactory):
    class Meta:
        model = Token

    user = SubFactory(UserFactory)

from factory import DjangoModelFactory, Sequence, SubFactory, PostGenerationMethodCall
from users.models import User
from rest_framework.authtoken.models import Token


TEST_PASSWORD = '<PASSWORD>'


class UserFactory(DjangoModelFactory):

    class Meta:
        model = User

    username = Sequence(lambda x: 'user_{0}'.format(x))
    password = PostGenerationMethodCall('set_password', TEST_PASSWORD)
    email = Sequence(lambda x: '<EMAIL>'.<EMAIL>(x))


class TokenFactory(DjangoModelFactory):
    class Meta:
        model = Token

    user = SubFactory(UserFactory)