# Path: tests/factories.py
# class UserFactory(factory.DjangoModelFactory):
#     class Meta:
#         model = User
# 
#     username = factory.Sequence(lambda x: "user{}".format(x))
#     email = factory.Sequence(lambda x: "user{}@example.com".format(x))
#     password = factory.PostGenerationMethodCall('set_password', "password")


from django.test import (LiveServerTestCase as BaseLiveServerTestCase,
                         TransactionTestCase)
from splinter import Browser
from ..factories import UserFactory



class TestCaseMixin(object):

    username = "username"
    password = "password"

    def create_user(self, **kwargs):
        attrs = {
            'username': self.username,
            'password': self.password,
        }
        attrs.update(kwargs)
        return UserFactory(**attrs)


class APITestCase(TestCaseMixin, TransactionTestCase):

    def login(self):

# Path: tests/factories.py
# class UserFactory(factory.DjangoModelFactory):
#     class Meta:
#         model = User
# 
#     username = factory.Sequence(lambda x: "user{}".format(x))
#     email = factory.Sequence(lambda x: "user{}@example.com".format(x))
#     password = factory.PostGenerationMethodCall('set_password', "password")


# Path: tests/functional/testcases.py
from django.test import (LiveServerTestCase as BaseLiveServerTestCase,
                         TransactionTestCase)
from splinter import Browser
from ..factories import UserFactory




class TestCaseMixin(object):

    username = "username"
    password = "password"

    def create_user(self, **kwargs):
        attrs = {
            'username': self.username,
            'password': self.password,
        }
        attrs.update(kwargs)
        return UserFactory(**attrs)


class APITestCase(TestCaseMixin, TransactionTestCase):

    def login(self):

        self.client.login(username=self.username, password=self.password)