Skip to content

Instantly share code, notes, and snippets.

@Glyphack
Created August 23, 2019 14:36
Show Gist options
  • Save Glyphack/7617d6df0c9cbe71e28440feb02ba36a to your computer and use it in GitHub Desktop.
Save Glyphack/7617d6df0c9cbe71e28440feb02ba36a to your computer and use it in GitHub Desktop.
graphql test case
from django.contrib.auth import get_user_model
from utils.test_utils import APITestCase
from .graphql_requests import (
CREATE_LINK_MUTATION
)
class LinkTestCase(APITestCase):
def setUp(self):
super().setUp()
self.dummy_user = get_user_model().objects.create(
username="dummy_user",
password="dummy_password"
)
def test_create_link_user_logged_in(self):
self.snapshot_graphql_request(
request_string=CREATE_LINK_MUTATION,
variables={"url": "example.com", "desc": "example link"},
context={"user": self.dummy_user}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment