# Path: tests/factories.py
# class UserFactory(factory.django.DjangoModelFactory):
#     class Meta:
# 
# Path: tests/queries.py
# ALL_USERS = """query {
#   allUsers {
#     results {
#       id
#     }
#   }
# }
# """
# ALL_USERS1 = """query {
#   allUsers1 {
#       id
#       username
#       firstName
#       lastName
#       email
#   }
# }
# """
# ALL_USERS2 = """query {
#   allUsers2 {
#       username
#   }
# }
# """
# ALL_USERS3 = """query {
#   allUsers3 {
#       id
#   }
# }
# """
# ALL_USERS4 = """query {
#   allUsers4 {
#     id
#     username
#   }
# }
# """
# ALL_USERS3_WITH_FILTER = """query {
#   allUsers3 (%(filter)s) {
#     results {
#       %(fields)s
#     }
#   }
# }
# """
# USER = """query {
#   user2 (%(filter)s) {
#       %(fields)s
#   }
# }
# """
# USERS = """query {
#   users(%(filter)s){
#     results(%(pagination)s){
#         %(fields)s
#     },
#     totalCount
#   }
# }
# """
# 
# Path: tests/client.py
# class Client(BaseClient):
#     url = reverse("graphql")
# 
#     def query(self, query):
#         response = self.get(path=self.url, data={"query": query})
#         return response


import uuid
from django.test import TestCase
from tests import factories
from tests import queries
from tests.client import Client
                "totalCount": 1,
            }
        }
    }

    @property
    def query(self):
        return queries.USERS % {
            "filter": 'firstName_Icontains: "{}"'.format(self.user.first_name[:5]),
            "pagination": "limit: 1",
            "fields": "id, username, email",
        }

    def test_filter_single_object(self):
        query = queries.USER % {
            "filter": "id: {}".format(self.user.id),
            "fields": "username",
        }
        response = self.client.query(query)
        self.assertEqual(response.status_code, 200, response.content)
        data = response.json()
        self.assertIn("user2", data["data"])
        self.assertTrue(data["data"]["user2"])
        self.assertEqual(data["data"]["user2"]["username"], self.user.username)


class DjangoCustomResolverTest(ParentTest, TestCase):
    query = queries.ALL_USERS4

    def setUp(self):

# Path: tests/factories.py
# class UserFactory(factory.django.DjangoModelFactory):
#     class Meta:
# 
# Path: tests/queries.py
# ALL_USERS = """query {
#   allUsers {
#     results {
#       id
#     }
#   }
# }
# """
# ALL_USERS1 = """query {
#   allUsers1 {
#       id
#       username
#       firstName
#       lastName
#       email
#   }
# }
# """
# ALL_USERS2 = """query {
#   allUsers2 {
#       username
#   }
# }
# """
# ALL_USERS3 = """query {
#   allUsers3 {
#       id
#   }
# }
# """
# ALL_USERS4 = """query {
#   allUsers4 {
#     id
#     username
#   }
# }
# """
# ALL_USERS3_WITH_FILTER = """query {
#   allUsers3 (%(filter)s) {
#     results {
#       %(fields)s
#     }
#   }
# }
# """
# USER = """query {
#   user2 (%(filter)s) {
#       %(fields)s
#   }
# }
# """
# USERS = """query {
#   users(%(filter)s){
#     results(%(pagination)s){
#         %(fields)s
#     },
#     totalCount
#   }
# }
# """
# 
# Path: tests/client.py
# class Client(BaseClient):
#     url = reverse("graphql")
# 
#     def query(self, query):
#         response = self.get(path=self.url, data={"query": query})
#         return response


# Path: tests/test_fields.py
import uuid
from django.test import TestCase
from tests import factories
from tests import queries
from tests.client import Client

                "totalCount": 1,
            }
        }
    }

    @property
    def query(self):
        return queries.USERS % {
            "filter": 'firstName_Icontains: "{}"'.format(self.user.first_name[:5]),
            "pagination": "limit: 1",
            "fields": "id, username, email",
        }

    def test_filter_single_object(self):
        query = queries.USER % {
            "filter": "id: {}".format(self.user.id),
            "fields": "username",
        }
        response = self.client.query(query)
        self.assertEqual(response.status_code, 200, response.content)
        data = response.json()
        self.assertIn("user2", data["data"])
        self.assertTrue(data["data"]["user2"])
        self.assertEqual(data["data"]["user2"]["username"], self.user.username)


class DjangoCustomResolverTest(ParentTest, TestCase):
    query = queries.ALL_USERS4

    def setUp(self):

        self.staff_user = factories.UserFactory(