-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_create_user_mutation.py
63 lines (51 loc) · 1.37 KB
/
test_create_user_mutation.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
import logging
from collections import OrderedDict
import logging
from help.graphql import SchemaBuilder
schema_builder = SchemaBuilder()
test_schema = schema_builder.build()
logger = logging.getLogger()
import faker
import graphene
logging.getLogger(faker.__name__).setLevel(logging.ERROR)
logging.getLogger(graphene.__name__).setLevel(logging.ERROR)
#logger.info(test_schema)
create_user_mutation_ql ='''
mutation myCreateUser {
user(user_data: {
username: "test",
email: "[email protected]",
password: "479332973"
}) {
user {
username
email
password
}
}
}
'''
create_user_mutation_ql_01 = '''
mutation SomeOperationName {
user(user_data:{username:"one", password:"two",email:"three"}) {
username,
password
email
}
}
'''
def test_empty_mutation(client):
"""Start with a blank database."""
logger.info(dir(test_schema))
schema_mutation = '''mutation {}'''
result = test_schema.execute(schema_mutation)
logger.info("result: {}".format(result))
assert result is not None
print(result)
from graphene.test import Client
def test_create_user_mutation():
logger.debug(type(test_schema))
client = Client(test_schema)
executed = client.execute(create_user_mutation_ql)
logger.debug(executed)
assert executed == {'data': OrderedDict([('user', None)])}