forked from flavors/django-graphql-jwt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_mutations.py
86 lines (66 loc) · 1.98 KB
/
test_mutations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import graphene
import graphql_jwt
from . import mixins
from .testcases import CookieTestCase, SchemaTestCase
class TokenAuthTests(mixins.TokenAuthMixin, SchemaTestCase):
query = """
mutation TokenAuth($username: String!, $password: String!) {
tokenAuth(username: $username, password: $password) {
token
payload
refreshExpiresIn
}
}"""
class Mutation(graphene.ObjectType):
token_auth = graphql_jwt.ObtainJSONWebToken.Field()
class VerifyTests(mixins.VerifyMixin, SchemaTestCase):
query = """
mutation VerifyToken($token: String!) {
verifyToken(token: $token) {
payload
}
}"""
class Mutation(graphene.ObjectType):
verify_token = graphql_jwt.Verify.Field()
class RefreshTests(mixins.RefreshMixin, SchemaTestCase):
query = """
mutation RefreshToken($token: String) {
refreshToken(token: $token) {
token
payload
refreshExpiresIn
}
}"""
class Mutation(graphene.ObjectType):
refresh_token = graphql_jwt.Refresh.Field()
class CookieTokenAuthTests(mixins.CookieTokenAuthMixin, CookieTestCase):
query = """
mutation TokenAuth($username: String!, $password: String!) {
tokenAuth(username: $username, password: $password) {
token
payload
refreshExpiresIn
}
}"""
class Mutation(graphene.ObjectType):
token_auth = graphql_jwt.ObtainJSONWebToken.Field()
class CookieRefreshTests(mixins.CookieRefreshMixin, CookieTestCase):
query = """
mutation {
refreshToken {
token
payload
refreshExpiresIn
}
}"""
class Mutation(graphene.ObjectType):
refresh_token = graphql_jwt.Refresh.Field()
class DeleteCookieTests(mixins.DeleteCookieMixin, CookieTestCase):
query = """
mutation {
deleteCookie {
deleted
}
}"""
class Mutation(graphene.ObjectType):
delete_cookie = graphql_jwt.DeleteJSONWebTokenCookie.Field()