File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ before_install:
22
22
install :
23
23
- |
24
24
if [ "$TEST_TYPE" = build ]; then
25
- pip install pytest pytest-cov pytest-benchmark coveralls six
25
+ pip install pytest pytest-cov pytest-benchmark coveralls six pytz iso8601
26
26
pip install -e .
27
27
python setup.py develop
28
28
elif [ "$TEST_TYPE" = lint ]; then
Original file line number Diff line number Diff line change
1
+ import json
2
+
3
+ from ..json import JSONString
4
+ from ..objecttype import ObjectType
5
+ from ..schema import Schema
6
+
7
+
8
+ class Query (ObjectType ):
9
+ json = JSONString (input = JSONString ())
10
+
11
+ def resolve_json (self , args , context , info ):
12
+ input = args .get ('input' )
13
+ return input
14
+
15
+ schema = Schema (query = Query )
16
+
17
+
18
+ def test_jsonstring_query ():
19
+ json_value = '{"key": "value"}'
20
+
21
+ json_value_quoted = json_value .replace ('"' , '\\ "' )
22
+ result = schema .execute ('''{ json(input: "%s") }''' % json_value_quoted )
23
+ assert not result .errors
24
+ assert result .data == {
25
+ 'json' : json_value
26
+ }
27
+
28
+
29
+ def test_jsonstring_query_variable ():
30
+ json_value = '{"key": "value"}'
31
+
32
+ result = schema .execute (
33
+ '''query Test($json: JSONString){ json(input: $json) }''' ,
34
+ variable_values = {'json' : json_value }
35
+ )
36
+ assert not result .errors
37
+ assert result .data == {
38
+ 'json' : json_value
39
+ }
You can’t perform that action at this time.
0 commit comments