From feb0825a639876ed02ea0914d4ce1163d1fd20ca Mon Sep 17 00:00:00 2001 From: Alec Aivazis Date: Sun, 22 May 2016 16:52:30 -0700 Subject: [PATCH 1/3] fixed bug when no middlewares are present --- graphene/core/types/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphene/core/types/base.py b/graphene/core/types/base.py index b99d2213..6dd14aaf 100644 --- a/graphene/core/types/base.py +++ b/graphene/core/types/base.py @@ -147,6 +147,8 @@ class GroupNamedType(InstanceType): 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): From 161f19845163ca0323483d7045e26bf52df1c6c9 Mon Sep 17 00:00:00 2001 From: Alec Aivazis Date: Sun, 22 May 2016 17:11:55 -0700 Subject: [PATCH 2/3] added test for auto_camelcase flag --- graphene/core/tests/test_schema.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/graphene/core/tests/test_schema.py b/graphene/core/tests/test_schema.py index 8a182515..c1df7eaf 100644 --- a/graphene/core/tests/test_schema.py +++ b/graphene/core/tests/test_schema.py @@ -104,6 +104,21 @@ 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') From 427a08106b8c27457a383557aba707a3abe0a46f Mon Sep 17 00:00:00 2001 From: Alec Aivazis Date: Sun, 22 May 2016 17:17:07 -0700 Subject: [PATCH 3/3] fixed linting error --- graphene/core/tests/test_schema.py | 1 + 1 file changed, 1 insertion(+) diff --git a/graphene/core/tests/test_schema.py b/graphene/core/tests/test_schema.py index c1df7eaf..8fca0c3d 100644 --- a/graphene/core/tests/test_schema.py +++ b/graphene/core/tests/test_schema.py @@ -119,6 +119,7 @@ def test_auto_camelcase_off(): assert not result.errors assert result.data == expected + def test_schema_register(): schema = Schema(name='My own schema')