Debian Codegraph @

tests/fixtures/__init__.py

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