def delete_users(cls): mutate_string = ''' mutation deleteUser { deleteUser{ success } } ''' result = schema.execute( mutate_string, operation_name='deleteUser' ) res = result.data return res
def delete_posts(cls): mutate_string = ''' mutation deletePost { deletePost{ success } } ''' result = schema.execute( mutate_string, operation_name='deletePost' ) res = result.data return res
def create_user(cls, username): mutate_string = ''' mutation createUser { createUser(username:"******"){ user{ username uuid } } } ''' % (username) result = schema.execute( mutate_string, operation_name='createUser' ) res = result.data return res
def all_user(cls): query_string = ''' query allUsers { allUsers{ edges{ node{ uuid username } } } } ''' result = schema.execute( query_string, operation_name='allUsers' ) res = result.data return res
def create_post(cls, username, title, body): mutate_string = ''' mutation createPost { createPost(username:"******", title:"%s", body:"%s"){ post{ title body author{ username } } } } ''' % (username, title, body) result = schema.execute( mutate_string, operation_name='createPost' ) res = result.data return res
def all_post(cls): query_string = ''' query allPosts{ allPosts{ edges{ node{ body title author{ uuid username } } } } } ''' result = schema.execute( query_string, operation_name='allPosts' ) res = result.data return res