Fix test
This commit is contained in:
parent
2a6993cad8
commit
c3274b4a65
|
|
@ -8,6 +8,7 @@ from portfolio.inputs import AddProjectArgument, AddProjectEntryArgument, Update
|
||||||
from portfolio.models import Project, ProjectEntry
|
from portfolio.models import Project, ProjectEntry
|
||||||
from portfolio.schema import ProjectEntryNode, ProjectNode
|
from portfolio.schema import ProjectEntryNode, ProjectNode
|
||||||
from portfolio.serializers import ProjectEntrySerializer, ProjectSerializer
|
from portfolio.serializers import ProjectEntrySerializer, ProjectSerializer
|
||||||
|
from users.models import UserSetting
|
||||||
|
|
||||||
|
|
||||||
def check_owner(user, project):
|
def check_owner(user, project):
|
||||||
|
|
@ -40,6 +41,7 @@ class AddProject(MutateProject):
|
||||||
def mutate_and_get_payload(cls, root, info, **kwargs):
|
def mutate_and_get_payload(cls, root, info, **kwargs):
|
||||||
data = kwargs.get('project')
|
data = kwargs.get('project')
|
||||||
data['student'] = info.context.user.id
|
data['student'] = info.context.user.id
|
||||||
|
data['school_class'] = info.context.user.selected_class.id
|
||||||
|
|
||||||
serializer = ProjectSerializer(data=data)
|
serializer = ProjectSerializer(data=data)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class NewRoomMutationTestCase(SkillboxTestCase):
|
||||||
def test_create_new_room(self):
|
def test_create_new_room(self):
|
||||||
self.assertEqual(Room.objects.count(), 0)
|
self.assertEqual(Room.objects.count(), 0)
|
||||||
title = 'some title'
|
title = 'some title'
|
||||||
appearance='blue'
|
appearance = 'blue'
|
||||||
res = self.get_client().execute(self.mutation, variables={
|
res = self.get_client().execute(self.mutation, variables={
|
||||||
'input': {
|
'input': {
|
||||||
'room': {
|
'room': {
|
||||||
|
|
@ -87,7 +87,9 @@ class NewRoomMutationTestCase(SkillboxTestCase):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
self.assertIsNotNone(result.errors)
|
|
||||||
self.assertTrue('Permission' in result.errors)
|
self.assertEqual(Room.objects.count(), 1)
|
||||||
self.assertEqual(Room.objects.count(), 0)
|
|
||||||
|
room = Room.objects.all()[0]
|
||||||
|
self.assertEqual(room.school_class.id, self.teacher2.selected_class.id)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue