skillbox/server/portfolio/tests/test_project_mutations.py

31 lines
914 B
Python

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)