-
Notifications
You must be signed in to change notification settings - Fork 766
-
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) == 3
but 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
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 3 comments
-
Was there any success in this?
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
-
no, no updates
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
-
Does conversation_node.comment_set
return a mocked queryset or is comment_set None?
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment