mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-10-30 23:47:55 +03:00 
			
		
		
		
	Fixed issues
This commit is contained in:
		
							parent
							
								
									5a949ce209
								
							
						
					
					
						commit
						11a5ee189e
					
				|  | @ -25,18 +25,18 @@ class ConnectionField(Field): | |||
|             **kwargs) | ||||
|         self.connection_type = connection_type | ||||
|         self.edge_type = edge_type | ||||
|      | ||||
| 
 | ||||
|     @with_context | ||||
|     def resolver(self, instance, args, context, info): | ||||
|         schema = info.schema.graphene_schema | ||||
|         connection_type = self.get_type(schema) | ||||
|          | ||||
| 
 | ||||
|         resolver = super(ConnectionField, self).resolver | ||||
|         if has_context(resolver): | ||||
|             resolved = super(ConnectionField, self).resolver(instance, args, context, info) | ||||
|         else: | ||||
|             resolved = super(ConnectionField, self).resolver(instance, args, info) | ||||
|              | ||||
| 
 | ||||
|         if isinstance(resolved, connection_type): | ||||
|             return resolved | ||||
|         return self.from_list(connection_type, resolved, args, context, info) | ||||
|  |  | |||
|  | @ -36,7 +36,7 @@ class Query(graphene.ObjectType): | |||
|     special_node = relay.NodeField(SpecialNode) | ||||
|     all_my_nodes = relay.ConnectionField( | ||||
|         MyNode, connection_type=MyConnection, customArg=graphene.String()) | ||||
|      | ||||
| 
 | ||||
|     context_nodes = relay.ConnectionField( | ||||
|         MyNode, connection_type=MyConnection, customArg=graphene.String()) | ||||
| 
 | ||||
|  | @ -44,7 +44,7 @@ class Query(graphene.ObjectType): | |||
|         custom_arg = args.get('customArg') | ||||
|         assert custom_arg == "1" | ||||
|         return [MyNode(name='my')] | ||||
|      | ||||
| 
 | ||||
|     @with_context | ||||
|     def resolve_context_nodes(self, args, context, info): | ||||
|         custom_arg = args.get('customArg') | ||||
|  | @ -71,7 +71,7 @@ def test_nodefield_query(): | |||
|     } | ||||
|     ''' | ||||
|     expected = { | ||||
|         'allMyNodes': { | ||||
|         'contextNodes': { | ||||
|             'edges': [{ | ||||
|                 'node': { | ||||
|                     'name': 'my' | ||||
|  | @ -87,6 +87,7 @@ def test_nodefield_query(): | |||
|     assert not result.errors | ||||
|     assert result.data == expected | ||||
| 
 | ||||
| 
 | ||||
| def test_connectionfield_context_query(): | ||||
|     query = ''' | ||||
|     query RebelsShipsQuery { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user