@@ -5,19 +5,15 @@ hypothesis-graphql
55
66Hypothesis strategies for GraphQL schemas, queries and data.
77
8- **NOTE ** This package is experimental, many things don't work yet and documented in a way they are planned to be used .
8+ **NOTE ** This package is experimental, some features are not supported yet .
99
1010Usage
1111-----
1212
13- There are four strategies for different use cases.
13+ There are two strategies for different use cases.
1414
15151. Schema generation - ``hypothesis_graphql.strategies.schema() ``
16162. Query - ``hypothesis_graphql.strategies.query(schema) ``.
17- 3. Response for a query - ``hypothesis_graphql.strategies.response(schema, query) ``
18- 4. Data for a type - ``hypothesis_graphql.strategies.data(schema, type_name) ``
19-
20- At the moment only ``schema `` & ``query `` are working with some limitations.
2117
2218Lets take this schema as an example:
2319
@@ -45,9 +41,9 @@ Then strategies might be used in this way:
4541 from hypothesis import given
4642 from hypothesis_graphql import strategies as gql_st
4743
48- SCHEMA = """ ..."" " # the one above
44+ SCHEMA = " ..." # the one above
4945
50- @given (query = gql_st.query(schema ))
46+ @given (query = gql_st.query(SCHEMA ))
5147 def test_query (query ):
5248 ...
5349 # This query might be generated:
@@ -58,29 +54,6 @@ Then strategies might be used in this way:
5854 # }
5955 # }
6056
61- @given (response = gql_st.response(schema, query))
62- def test_response (response ):
63- ...
64- # Example response with a query from the example above:
65- #
66- # {
67- # "data": {
68- # "getBooks": [
69- # {"title": "War and Peace"}
70- # ]
71- # }
72- # }
73-
74- @given (data = gql_st.data(schema, " Book" ))
75- def test_data (data ):
76- ...
77- # Example data:
78- #
79- # {
80- # "title": "War and Peace"
81- # "author": {"name": "Leo Tolstoy"}
82- # }
83-
8457 .. |Build | image :: https://github.com/Stranger6667/hypothesis-graphql/workflows/build/badge.svg
8558 :target: https://github.com/Stranger6667/hypothesis-graphql/actions
8659.. |Coverage | image :: https://codecov.io/gh/Stranger6667/hypothesis-graphql/branch/master/graph/badge.svg
0 commit comments