def get_graphene_client(self):
     assert (
         self.schema is not None
     ), "Please call `set_schema` before calling `get_graphene_client`."
     c = Client(self.schema)
     c.user = self.user
     return c
def test_resolve_current_user():
    req = RequestFactory().get('/')
    req.user = AnonymousUser()
    client = Client(my_schema)
    client.user = AnonymousUser()
    executed = client.execute(''' { currentUser { id } }''', context_value=req)

    assert executed['data'][
        'currentUser'] is None, 'Should return None if user is not authenticated'

    req.user = mixer.blend('auth.User')
    executed = client.execute('''{ currentUser { id } }''', context_value=req)
    assert executed['data']['currentUser']['id'] == str(
        req.user.id), 'Should return the current user if is authenticated'