I am using
from graphene_django.utils.testing import GraphQLTestCase
to implement my tests. However, the result from
class PeopleTests(GraphQLTestCase):
GRAPHQL_SCHEMA = schema
def test_all_person_query_admin_token(self):
response = self.query(
'''
query getPersons{
persons{
firstName,
lastName
}
}
''',
op_name='persons',
headers={'HTTP_AUTHORIZATION': f'JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNTY2MTk4Mzg5LCJvcmlnSWF0IjoxNTY2MTk4MDg5fQ.P4u7PNKPLFsc4dvhBLw-EfuN8jg2d-lqdZjWruEDlpc'}
)
is always returns an empty list of Person. I read in Django Test Database looks empty while test is runnin that this is a result from GraphQLTestCase inheriting from TestCase. This post is very old (2012) but I can not seem to find any documentation on how to use a propper test database.
Sorry if I have missed something, and the answer was obvious.
Thanks