1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
"""Fixtures for graphql tests"""
import json
from os.path import dirname, join
from pytest import fixture
__all__ = [
"kitchen_sink_query",
"kitchen_sink_sdl",
"big_schema_sdl",
"big_schema_introspection_result",
]
def read_graphql(name):
path = join(dirname(__file__), name + ".graphql")
return open(path, encoding="utf-8").read()
def read_json(name):
path = join(dirname(__file__), name + ".json")
return json.load(open(path, encoding="utf-8"))
@fixture(scope="module")
def kitchen_sink_query():
return read_graphql("kitchen_sink")
@fixture(scope="module")
def kitchen_sink_sdl():
return read_graphql("schema_kitchen_sink")
@fixture(scope="module")
def big_schema_sdl():
return read_graphql("github_schema")
@fixture(scope="module")
def big_schema_introspection_result():
return read_json("github_schema")
|