-
Notifications
You must be signed in to change notification settings - Fork 766
Closed
Description
I have this node
class ConversationNode(DjangoObjectType):
unread_count = graphene.Int()
def resolve_unread_count(self, info):
comments = self.comments_set.all()
unread_count = # logic for determing unread status
return unread_count
and I want to run a test like this
def test_unread_count(create_mock_info, create_converstaion):
mock_info = create_mock_info()
conversation = create_converstaion()
conversation_node = ConversationNode(conversation)
assert conversation_node.resolve_unread_count(mock_info) == 3but self is refering to the node and not the model,
so I get this error
E AttributeError: 'NoneType' object has no attribute 'all'
how do I run resolvers but have self refer to the model instead of the node?
Edit
Interestingly self.id refers to the model in the resolver