1
0
bthlabs-jsonrpc/packages/bthlabs-jsonrpc-django/tests/conftest.py

47 lines
866 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
import factory
import pytest
class UserFactory(factory.django.DjangoModelFactory):
username = factory.Faker('email')
first_name = factory.Faker('first_name')
last_name = factory.Faker('last_name')
email = factory.Faker('email')
is_staff = False
is_superuser = False
is_active = True
class Meta:
model = User
@pytest.fixture
def user(db):
return UserFactory()
@pytest.fixture
def inactive_user(db):
return UserFactory(is_active=False)
@pytest.fixture
def staff_user(db):
return UserFactory(is_staff=True)
@pytest.fixture
def super_user(db):
return UserFactory(is_superuser=True)
@pytest.fixture
def call():
return {
'jsonrpc': '2.0',
'id': 'system.list_methods',
'method': 'system.list_methods',
}