class UserFactory(DjangoModelFactory): FACTORY_FOR = get_user_model() username = '******' email = '*****@*****.**' is_staff = False @factory.post_generation def password(self, create, extracted, **kwargs): if extracted: self.set_password(extracted) if create: self.save()
from splinter.element_list import ElementList from django_webtest import WebTest from fancypages.test import factories from fancypages.compat import get_user_model from fancypages.test.mixins import MockTemplateMixin SPLINTER_WEBDRIVER = getattr( settings, 'SPLINTER_WEBDRIVER', os.environ.get('SPLINTER_WEBDRIVER', 'firefox')) SAUCE_USERNAME = os.environ.get('SAUCE_USERNAME') SAUCE_ACCESS_KEY = os.environ.get('SAUCE_ACCESS_KEY') User = get_user_model() class FancyPagesTestCase(TestCase, MockTemplateMixin): def setUp(self): super(FancyPagesTestCase, self).setUp() MockTemplateMixin.setUp(self) def tearDown(self): super(FancyPagesTestCase, self).tearDown() MockTemplateMixin.tearDown(self) class FancyPagesWebTest(WebTest, MockTemplateMixin): username = '******'
from django.db import connections, DEFAULT_DB_ALIAS from django.test import TestCase, LiveServerTestCase from splinter import Browser from splinter.element_list import ElementList from django_webtest import WebTest from fancypages.test import factories from fancypages.compat import get_user_model from fancypages.test.mixins import MockTemplateMixin SPLINTER_WEBDRIVER = getattr(settings, 'SPLINTER_WEBDRIVER', os.environ.get('SPLINTER_WEBDRIVER', 'firefox')) User = get_user_model() class FancyPagesTestCase(TestCase, MockTemplateMixin): def setUp(self): super(FancyPagesTestCase, self).setUp() MockTemplateMixin.setUp(self) def tearDown(self): super(FancyPagesTestCase, self).tearDown() MockTemplateMixin.tearDown(self) class FancyPagesWebTest(WebTest, MockTemplateMixin): username = '******' email = '*****@*****.**'
class Meta: model = get_user_model()