from api.test_utils import create_client, DefaultUserTestCase from portfolio.models import Project class ProjectMutationsTestCase(DefaultUserTestCase): def test_add_project(self): client = create_client(self.student1) mutation = """ mutation AddProjectMutation($input: AddProjectInput!){ addProject(input: $input){ project { id } errors } } """ result = client.execute(mutation, variables={ 'input': { "project": { "title": "Rick Astley", "description": "She wants to dance with me", "objectives": "Dance with me", "appearance": "green" } } }) self.assertIsNone(result.get('errors')) self.assertEqual(Project.objects.count(), 1)