32 lines
725 B
Python
32 lines
725 B
Python
import pytest
|
|
|
|
import django_webtest
|
|
from django.contrib.auth.models import User
|
|
|
|
|
|
@pytest.fixture
|
|
def app(request):
|
|
wtm = django_webtest.WebTestMixin()
|
|
wtm._patch_settings()
|
|
request.addfinalizer(wtm._unpatch_settings)
|
|
return django_webtest.DjangoTestApp()
|
|
|
|
|
|
@pytest.fixture
|
|
def john_doe(db):
|
|
u = User(username='john.doe', first_name='John', last_name='Doe', email='john.doe@example.net')
|
|
u.set_password('john.doe')
|
|
u.save()
|
|
return u
|
|
|
|
|
|
@pytest.fixture
|
|
def admin(db):
|
|
u = User(username='super.user', first_name='Super', last_name='User',
|
|
email='super.user@example.net')
|
|
u.set_password('super.user')
|
|
u.is_superuser = True
|
|
u.is_staff = True
|
|
u.save()
|
|
return u
|