1
0
bthlabs-jsonrpc/packages/bthlabs-jsonrpc-django/tests/conftest.py
Tomek Wójcik c75ea4ea9d Initial public releases
* `bthlabs-jsonrpc-aiohttp` v1.0.0
* `bthlabs-jsonrpc-core` v1.0.0
* `bthlabs-jsonrpc-django` v1.0.0
2022-06-04 10:41:53 +02:00

47 lines
866 B
Python

# -*- 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',
}