Beispiel #1
0
 def test_create_session(self):
     new_session = service.create_session(self.taskInstance)
     old_session = PracticeSession.objects.get(pk=self.session.pk)
     self.assertEquals(False, old_session.active)
     self.assertIsNotNone(new_session)
     self.assertNotEquals(old_session, new_session)
     self.assertEquals(1, new_session.task_counter)
 def test_create_session(self):
     new_session = service.create_session(self.taskInstance)
     old_session = PracticeSession.objects.get(pk=self.session.pk)
     self.assertEquals(False, old_session.active)
     self.assertIsNotNone(new_session)
     self.assertNotEquals(old_session, new_session)
     self.assertEquals(1, new_session.task_counter)
 def test_get_all_task_instances(self):
     instance1 = TaskInstanceModel.objects.create(task=self.task, student=self.student)
     instance2 = TaskInstanceModel.objects.create(task=self.task, student=self.student)
     instance3 = TaskInstanceModel.objects.create(task=self.task, student=self.student)
     session = service.create_session(instance3)
     service.next_task_in_session(self.student, instance1)
     task_instances = service.get_all_task_instances(session)
     self.assertEquals(len(task_instances), 2)
     self.assertEquals(task_instances[0].pk, instance3.pk)
     self.assertEquals(task_instances[1].pk, instance1.pk)
Beispiel #4
0
 def setUp(self):
     self.user = User.objects.create()
     self.student = StudentModel.objects.create(user=self.user)
     self.task = TaskModel.objects.create(maze_settings="{}", workspace_settings='{}')
     self.instance1 = TaskInstanceModel.objects.create(task=self.task, student=self.student, solved=True)
     self.instance2 = TaskInstanceModel.objects.create(task=self.task, student=self.student, given_up=True)
     self.instance3 = TaskInstanceModel.objects.create(task=self.task, student=self.student)
     self.session = practice_session_service.create_session(self.instance1)
     self.toolbox = []
     practice_session_service.next_task_in_session(self.student, self.instance2)
     practice_session_service.next_task_in_session(self.student, self.instance3)
Beispiel #5
0
 def test_get_all_task_instances(self):
     instance1 = TaskInstanceModel.objects.create(task=self.task,
                                                  student=self.student)
     instance2 = TaskInstanceModel.objects.create(task=self.task,
                                                  student=self.student)
     instance3 = TaskInstanceModel.objects.create(task=self.task,
                                                  student=self.student)
     session = service.create_session(instance3)
     service.next_task_in_session(self.student, instance1)
     task_instances = service.get_all_task_instances(session)
     self.assertEquals(len(task_instances), 2)
     self.assertEquals(task_instances[0].pk, instance3.pk)
     self.assertEquals(task_instances[1].pk, instance1.pk)
Beispiel #6
0
 def setUp(self):
     self.user = User.objects.create()
     self.student = StudentModel.objects.create(user=self.user)
     self.task = TaskModel.objects.create(maze_settings="{}",
                                          workspace_settings='{}')
     self.instance1 = TaskInstanceModel.objects.create(task=self.task,
                                                       student=self.student,
                                                       solved=True)
     self.instance2 = TaskInstanceModel.objects.create(task=self.task,
                                                       student=self.student,
                                                       given_up=True)
     self.instance3 = TaskInstanceModel.objects.create(task=self.task,
                                                       student=self.student)
     self.session = practice_session_service.create_session(self.instance1)
     self.toolbox = []
     practice_session_service.next_task_in_session(self.student,
                                                   self.instance2)
     practice_session_service.next_task_in_session(self.student,
                                                   self.instance3)