from django.test import RequestFactory, TestCase
from graphene.test import Client
from api.schema import schema
from users.models import User
from users.services import create_users


def create_client(user):
    request = RequestFactory().get('/')
    request.user = user
    return Client(schema=schema, context_value=request)


class DefaultUserTestCase(TestCase):
    def setUp(self):
        create_users()

        self.teacher = User.objects.get(username='teacher')
        self.teacher2 = User.objects.get(username='teacher2')
        self.student1 = User.objects.get(username='student1')
        self.student2 = User.objects.get(username='student2')
        self.student_second_class = User.objects.get(username='student_second_class')

