<gh_stars>0
from unittest import skip

from django.contrib.auth import get_user_model

from graphql_jwt.testcases import JSONWebTokenTestCase

User = get_user_model()


class UsersTests(JSONWebTokenTestCase):

    def setUp(self):
        self.user = User.objects.create(username="test", password="<PASSWORD>")
        self.client.authenticate(self.user)

    def test_get_user(self):
        query = """
        mutation{
          createUser(input: {
            email: "<EMAIL>", username: "sarit", password: "<PASSWORD>"
          }){
            username
            email
            errors{
              field
            }
          }
        }
        """
        _ = self.client.execute(query)
        self.assertEqual(2, User.objects.count())


    @skip(reason="It works in real enpoint, but unittest does not!")
    def test_obtain_token(self):
        query = """
        mutation{
            obtainToken(username: "test", password: "<PASSWORD>"){
            token
            }
        }
        """
        res = self.client.execute(query)

from unittest import skip

from django.contrib.auth import get_user_model

from graphql_jwt.testcases import JSONWebTokenTestCase

User = get_user_model()


class UsersTests(JSONWebTokenTestCase):

    def setUp(self):
        self.user = User.objects.create(username="test", password="<PASSWORD>")
        self.client.authenticate(self.user)

    def test_get_user(self):
        query = """
        mutation{
          createUser(input: {
            email: "<EMAIL>", username: "sarit", password: "<PASSWORD>"
          }){
            username
            email
            errors{
              field
            }
          }
        }
        """
        _ = self.client.execute(query)
        self.assertEqual(2, User.objects.count())


    @skip(reason="It works in real enpoint, but unittest does not!")
    def test_obtain_token(self):
        query = """
        mutation{
            obtainToken(username: "test", password: "<PASSWORD>"){
            token
            }
        }
        """
        res = self.client.execute(query)
mutation{           createUser(input: {             email: "<EMAIL>", username: "sarit", password: "<PASSWORD>"           }){             username             email             errors{               field             }           }         } mutation{             obtainToken(username: "test", password: "<PASSWORD>"){             token             }         }