Test for resolvers maps merging
@@ -218,3 +218,43 @@ def test_mapping_resolver_to_object_attribute():
result = graphql(schema, "{ user { firstName } }")
assert result.errors is None
assert result.data == {"user": {"firstName": "Joe"}}
+
+
+def test_accept_list_of_resolvers_map():
+ type_defs = """
+ type Query {
+ user: User
+ test(data: TestInput): Int
+ }
+
+ type User {
+ firstName: String
+ }
+
+ input TestInput {
+ value: Int
+ }
+ """
+
+ def resolve_test(*_, data):
+ assert data == {"value": 4}
+ return "42"
+
+ resolvers = [{
+ "Query": {"user": lambda *_: Mock(first_name="Joe")},
+ "User": {"firstName": resolve_to("first_name")},
+ },
+ {
+ "Query": {"test": resolve_test}
+ }
+ ]
+
+ schema = make_executable_schema(type_defs, resolvers)
+
+ result = graphql(schema, "{ test(data: { value: 4 }) }")
+ assert result.errors is None
+ assert result.data == {"test": 42}
+
+ result = graphql(schema, "{ user { firstName } }")
+ assert result.errors is None
+ assert result.data == {"user": {"firstName": "Joe"}}
