Skip to content

Commit 260cd83

Browse files
committed
Added support for pluggable backends
1 parent 5dcccf6 commit 260cd83

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from setuptools import setup, find_packages
22

33
required_packages = [
4-
'graphql-core>=2.0', 'webob', 'graphql-server-core>=1.0.dev'
4+
'graphql-core>=2.1rc2', 'webob', 'graphql-server-core>=1.1rc0'
55
]
66

77
tests_require = ['pytest>=2.7.3', 'mako']
88

99
setup(
1010
name='WebOb-GraphQL',
11-
version='1.0',
11+
version='2.0rc0',
1212
description=
1313
'Adds GraphQL support to your WebOb (Pyramid/Pylons/...) application',
1414
long_description=open('README.rst').read(),

tests/schema.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ def resolve_raises(*_):
1212
fields={
1313
'thrower': GraphQLField(GraphQLNonNull(GraphQLString), resolver=resolve_raises),
1414
'request': GraphQLField(GraphQLNonNull(GraphQLString),
15-
resolver=lambda obj, args, context, info: context.params.get('q')),
15+
resolver=lambda obj, info: info.context.params.get('q')),
1616
'context': GraphQLField(GraphQLNonNull(GraphQLString),
17-
resolver=lambda obj, args, context, info: context),
17+
resolver=lambda obj, info: info.context),
1818
'test': GraphQLField(
1919
type=GraphQLString,
2020
args={
2121
'who': GraphQLArgument(GraphQLString)
2222
},
23-
resolver=lambda obj, args, context, info: 'Hello %s' % (args.get('who') or 'World')
23+
resolver=lambda obj, info, who='World': 'Hello %s' % who
2424
)
2525
}
2626
)

tests/test_graphql.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def test_handles_field_errors_caught_by_graphql(client):
341341
assert response.status_code == 200
342342
assert response_json(response) == {
343343
'data': None,
344-
'errors': [{'locations': [{'column': 2, 'line': 1}], 'message': 'Throws!'}]
344+
'errors': [{'locations': [{'column': 2, 'line': 1}], 'message': 'Throws!', 'path': ['thrower']}]
345345
}
346346

347347

@@ -350,7 +350,7 @@ def test_handles_syntax_errors_caught_by_graphql(client):
350350
assert response.status_code == 400
351351
assert response_json(response) == {
352352
'errors': [{'locations': [{'column': 1, 'line': 1}],
353-
'message': 'Syntax Error GraphQL request (1:1) '
353+
'message': 'Syntax Error GraphQL (1:1) '
354354
'Unexpected Name "syntaxerror"\n\n1: syntaxerror\n ^\n'}]
355355
}
356356

tox.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ setenv =
77
PYTHONPATH = {toxinidir}
88
deps =
99
pytest>=2.7.2
10-
graphql-core>=1.0
11-
graphql-server-core>=1.0.dev
10+
graphql-core>=2.1rc2
11+
graphql-server-core>=1.1rc0
1212
WebOb
1313
mako
1414
pytest-cov

webob_graphql/base.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,10 @@ def serve_graphql_request(request, schema, pretty=None, response_class=None, gra
4242
query_data=request.params,
4343
batch_enabled=batch_enabled,
4444
catch=catch,
45-
4645
# Execute options
4746
**execute_options
48-
# root_value=self.get_root_value(request),
49-
# context_value=self.get_context(request),
50-
# middleware=self.get_middleware(request),
51-
# executor=self.get_executor(request),
5247
)
48+
5349
result, status_code = encode_execution_results(
5450
execution_results,
5551
is_batch=isinstance(data, list),

0 commit comments

Comments
 (0)