Skip to content

Commit

Permalink
Merge pull request #178 from AlecAivazis/master
Browse files Browse the repository at this point in the history
Fixed bug when no middlewares are present
  • Loading branch information
syrusakbary committed May 23, 2016
2 parents 91a2423 + 427a081 commit ed070b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions graphene/core/tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@ def test_schema_no_query():
assert 'define a base query type' in str(excinfo)


def test_auto_camelcase_off():
schema = Schema(name='My own schema', auto_camelcase=False)

class Query(ObjectType):
test_field = String(resolver=lambda *_: 'Dog')

schema.query = Query

query = "query {test_field}"
expected = {"test_field": "Dog"}

result = graphql(schema.schema, query, root_value=Query(object()))
assert not result.errors
assert result.data == expected


def test_schema_register():
schema = Schema(name='My own schema')

Expand Down
2 changes: 2 additions & 0 deletions graphene/core/types/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def get_named_type(self, schema, type):
name = type.name
if not name and schema.auto_camelcase:
name = to_camel_case(type.default_name)
elif not name:
name = type.default_name
return name, schema.T(type)

def iter_types(self, schema):
Expand Down

0 comments on commit ed070b6

Please sign in to comment.