Skip to content

Commit ed070b6

Browse files
committed
Merge pull request #178 from AlecAivazis/master
Fixed bug when no middlewares are present
2 parents 91a2423 + 427a081 commit ed070b6

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

graphene/core/tests/test_schema.py

+16
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,22 @@ def test_schema_no_query():
104104
assert 'define a base query type' in str(excinfo)
105105

106106

107+
def test_auto_camelcase_off():
108+
schema = Schema(name='My own schema', auto_camelcase=False)
109+
110+
class Query(ObjectType):
111+
test_field = String(resolver=lambda *_: 'Dog')
112+
113+
schema.query = Query
114+
115+
query = "query {test_field}"
116+
expected = {"test_field": "Dog"}
117+
118+
result = graphql(schema.schema, query, root_value=Query(object()))
119+
assert not result.errors
120+
assert result.data == expected
121+
122+
107123
def test_schema_register():
108124
schema = Schema(name='My own schema')
109125

graphene/core/types/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ def get_named_type(self, schema, type):
147147
name = type.name
148148
if not name and schema.auto_camelcase:
149149
name = to_camel_case(type.default_name)
150+
elif not name:
151+
name = type.default_name
150152
return name, schema.T(type)
151153

152154
def iter_types(self, schema):

0 commit comments

Comments
 (0)