Skip to content

Commit 7d9d754

Browse files
committed
Merge branch 'master' into contributing-docs
2 parents e845156 + d29cc6f commit 7d9d754

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

setup.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
from setuptools import setup, find_packages
22

3-
install_requires = ["graphql-core>=2.1,<3", "flask>=0.7.0", "graphql-server-core>=1.1,<2"]
3+
install_requires = [
4+
"graphql-core>=2.3,<3",
5+
"flask>=0.7.0",
6+
"graphql-server-core>=1.1,<2",
7+
]
48

59
tests_requires = [
6-
'pytest >=2.7.2',
7-
'pytest-flask >=0.10.0',
8-
'graphql-core >=2.1,<3',
9-
'graphql-server-core >=1.1,<2',
10-
'Flask >=0.10.0',
10+
'pytest>=2.7.2',
11+
'pytest-flask>=0.10.0',
12+
'graphql-core>=2.1,<3',
13+
'graphql-server-core>=1.1,<2',
14+
'Flask>=0.10.0',
1115
]
1216

1317
dev_requires = [
1418
'flake8==3.7.9',
15-
'isort <4.0.0'
19+
'isort<4.0.0'
1620
] + tests_require
1721

1822
setup(

tests/test_graphqlview.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ def response_json(response):
4545
return json.loads(response.data.decode())
4646

4747

48-
j = lambda **kwargs: json.dumps(kwargs)
49-
jl = lambda **kwargs: json.dumps([kwargs])
48+
def json_dump_kwarg(**kwargs):
49+
return json.dumps(kwargs)
50+
51+
52+
def json_dump_kwarg_list(**kwargs):
53+
return json.dumps([kwargs])
5054

5155

5256
def test_allows_get_with_query_param(app, client):
@@ -188,7 +192,7 @@ def test_allows_mutation_to_exist_within_a_get(app, client):
188192

189193

190194
def test_allows_post_with_json_encoding(app, client):
191-
response = client.post(url_string(app), data=j(query='{test}'), content_type='application/json')
195+
response = client.post(url_string(app), data=json_dump_kwarg(query='{test}'), content_type='application/json')
192196

193197
assert response.status_code == 200
194198
assert response_json(response) == {
@@ -197,7 +201,7 @@ def test_allows_post_with_json_encoding(app, client):
197201

198202

199203
def test_allows_sending_a_mutation_via_post(app, client):
200-
response = client.post(url_string(app), data=j(query='mutation TestMutation { writeTest { test } }'), content_type='application/json')
204+
response = client.post(url_string(app), data=json_dump_kwarg(query='mutation TestMutation { writeTest { test } }'), content_type='application/json')
201205

202206
assert response.status_code == 200
203207
assert response_json(response) == {
@@ -228,7 +232,7 @@ def test_allows_post_with_url_encoding(app, client):
228232

229233

230234
def test_supports_post_json_query_with_string_variables(app, client):
231-
response = client.post(url_string(app), data=j(
235+
response = client.post(url_string(app), data=json_dump_kwarg(
232236
query='query helloWho($who: String){ test(who: $who) }',
233237
variables=json.dumps({'who': "Dolly"})
234238
), content_type='application/json')
@@ -240,7 +244,7 @@ def test_supports_post_json_query_with_string_variables(app, client):
240244

241245

242246
def test_supports_post_json_query_with_json_variables(app, client):
243-
response = client.post(url_string(app), data=j(
247+
response = client.post(url_string(app), data=json_dump_kwarg(
244248
query='query helloWho($who: String){ test(who: $who) }',
245249
variables={'who': "Dolly"}
246250
), content_type='application/json')
@@ -267,7 +271,7 @@ def test_supports_post_json_quey_with_get_variable_values(app, client):
267271
response = client.post(url_string(
268272
app,
269273
variables=json.dumps({'who': "Dolly"})
270-
), data=j(
274+
), data=json_dump_kwarg(
271275
query='query helloWho($who: String){ test(who: $who) }',
272276
), content_type='application/json')
273277

@@ -307,7 +311,7 @@ def test_supports_post_raw_text_query_with_get_variable_values(app, client):
307311

308312

309313
def test_allows_post_with_operation_name(app, client):
310-
response = client.post(url_string(app), data=j(
314+
response = client.post(url_string(app), data=json_dump_kwarg(
311315
query='''
312316
query helloYou { test(who: "You"), ...shared }
313317
query helloWorld { test(who: "World"), ...shared }
@@ -508,7 +512,7 @@ def test_post_multipart_data(app, client):
508512
def test_batch_allows_post_with_json_encoding(app, client):
509513
response = client.post(
510514
url_string(app),
511-
data=jl(
515+
data=json_dump_kwarg_list(
512516
# id=1,
513517
query='{test}'
514518
),
@@ -526,7 +530,7 @@ def test_batch_allows_post_with_json_encoding(app, client):
526530
def test_batch_supports_post_json_query_with_json_variables(app, client):
527531
response = client.post(
528532
url_string(app),
529-
data=jl(
533+
data=json_dump_kwarg_list(
530534
# id=1,
531535
query='query helloWho($who: String){ test(who: $who) }',
532536
variables={'who': "Dolly"}
@@ -545,7 +549,7 @@ def test_batch_supports_post_json_query_with_json_variables(app, client):
545549
def test_batch_allows_post_with_operation_name(app, client):
546550
response = client.post(
547551
url_string(app),
548-
data=jl(
552+
data=json_dump_kwarg_list(
549553
# id=1,
550554
query='''
551555
query helloYou { test(who: "You"), ...shared }

0 commit comments

Comments
 (0)