Ejemplo n.º 1
0
    def setUpTestData(cls):
        cls.facility = FacilityFactory.create()
        # provision device to pass the setup_wizard middleware check
        provision_device()
        cls.superuser = create_superuser(cls.facility)
        cls.user1 = FacilityUserFactory.create(facility=cls.facility)
        cls.user2 = FacilityUserFactory.create(facility=cls.facility)

        # add admin to 1st facility
        cls.admin = FacilityUserFactory.create(facility=cls.facility)
        cls.facility.add_admin(cls.admin)

        # create logs for each user
        cls.interaction_logs = [
            ContentSessionLogFactory.create(
                user=cls.user1,
                content_id=uuid.uuid4().hex,
                channel_id=uuid.uuid4().hex,
            )
            for _ in range(3)
        ]
        [
            ContentSessionLogFactory.create(
                user=cls.user2,
                content_id=uuid.uuid4().hex,
                channel_id=uuid.uuid4().hex,
            )
            for _ in range(2)
        ]

        # create classroom, learner group, add user2
        cls.classroom = ClassroomFactory.create(parent=cls.facility)
        cls.learner_group = LearnerGroupFactory.create(parent=cls.classroom)
        cls.learner_group.add_learner(cls.user2)
Ejemplo n.º 2
0
    def setUp(self):
        self.facility = FacilityFactory.create()
        # provision device to pass the setup_wizard middleware check
        provision_device()
        self.superuser = create_superuser(self.facility)
        self.user1 = FacilityUserFactory.create(facility=self.facility)
        self.user2 = FacilityUserFactory.create(facility=self.facility)

        # add admin to 1st facility
        self.admin = FacilityUserFactory.create(facility=self.facility)
        self.facility.add_admin(self.admin)

        # create logs for each user
        self.interaction_logs = [
            ContentSessionLogFactory.create(
                user=self.user1,
                content_id=uuid.uuid4().hex,
                channel_id=uuid.uuid4().hex,
            )
            for _ in range(3)
        ]
        [
            ContentSessionLogFactory.create(
                user=self.user2,
                content_id=uuid.uuid4().hex,
                channel_id=uuid.uuid4().hex,
            )
            for _ in range(2)
        ]

        # create classroom, learner group, add user2
        self.classroom = ClassroomFactory.create(parent=self.facility)
        self.learner_group = LearnerGroupFactory.create(parent=self.classroom)
        self.learner_group.add_learner(self.user2)

        self.payload = {
            "user": self.user1.pk,
            "content_id": uuid.uuid4().hex,
            "channel_id": uuid.uuid4().hex,
            "kind": "video",
            "start_timestamp": str(datetime.datetime.now()),
        }
Ejemplo n.º 3
0
    def setUp(self):
        self.facility = FacilityFactory.create()
        # provision device to pass the setup_wizard middleware check
        provision_device()
        self.superuser = create_superuser(self.facility)
        self.user1 = FacilityUserFactory.create(facility=self.facility)
        self.user2 = FacilityUserFactory.create(facility=self.facility)

        # add admin to 1st facility
        self.admin = FacilityUserFactory.create(facility=self.facility)
        self.facility.add_admin(self.admin)

        # create logs for each user
        self.session_logs = [
            UserSessionLogFactory.create(user=self.user1) for _ in range(3)
        ]
        [UserSessionLogFactory.create(user=self.user2) for _ in range(2)]

        # create classroom, learner group, add user2
        self.classroom = ClassroomFactory.create(parent=self.facility)
        self.learner_group = LearnerGroupFactory.create(parent=self.classroom)
        self.learner_group.add_learner(self.user2)
Ejemplo n.º 4
0
    def setUpTestData(cls):
        cls.facility = FacilityFactory.create()
        # provision device to pass the setup_wizard middleware check
        provision_device()
        cls.user1 = FacilityUserFactory.create(facility=cls.facility)
        cls.user2 = FacilityUserFactory.create(facility=cls.facility)
        cls.exam = Exam.objects.create(
            title="",
            question_count=1,
            collection=cls.facility,
            creator=cls.user2,
            active=True,
        )
        cls.examlog = ExamLog.objects.create(exam=cls.exam, user=cls.user1)
        # create classroom, learner group, add user1
        cls.classroom = ClassroomFactory.create(parent=cls.facility)
        cls.learner_group = LearnerGroupFactory.create(parent=cls.classroom)
        cls.classroom.add_member(cls.user1)
        cls.learner_group.add_learner(cls.user1)

        cls.class_coach = FacilityUserFactory.create(facility=cls.facility)
        cls.classroom.add_coach(cls.class_coach)
Ejemplo n.º 5
0
    def setUp(self):
        provision_device()
        self.facility = FacilityFactory.create()
        self.superuser = create_superuser(self.facility)
        self.user1 = FacilityUserFactory.create(facility=self.facility)
        self.user2 = FacilityUserFactory.create(facility=self.facility)
        # create classroom, learner group, add user1
        self.classroom = ClassroomFactory.create(parent=self.facility)
        self.classroom.add_member(self.user1)

        self.payload = {
            "user": self.user1.pk,
            "content_id": uuid.uuid4().hex,
            "channel_id": uuid.uuid4().hex,
            "kind": "exercise",
            "start_timestamp": str(datetime.datetime.now()),
        }
        self.channel_id = "15f32edcec565396a1840c5413c92450"
        self.lesson_id = "15f32edcec565396a1840c5413c92452"
        self.content_ids = [
            "15f32edcec565396a1840c5413c92451",
            "15f32edcec565396a1840c5413c92452",
            "15f32edcec565396a1840c5413c92453",
        ]
        self.contentnode_ids = [
            "25f32edcec565396a1840c5413c92451",
            "25f32edcec565396a1840c5413c92452",
            "25f32edcec565396a1840c5413c92453",
        ]
        self.node_1 = ContentNode.objects.create(
            title="Node 1",
            available=True,
            id=self.contentnode_ids[0],
            content_id=self.content_ids[0],
            channel_id=self.channel_id,
            kind=content_kinds.EXERCISE,
        )
        self.node_2 = ContentNode.objects.create(
            title="Node 2",
            available=True,
            id=self.contentnode_ids[1],
            content_id=self.content_ids[1],
            channel_id=self.channel_id,
            kind=content_kinds.EXERCISE,
        )
        self.lesson = Lesson.objects.create(
            id=self.lesson_id,
            title="My Lesson",
            is_active=True,
            created_by=self.superuser,
            collection=self.classroom,
            resources=json.dumps(
                [
                    {
                        "contentnode_id": self.node_1.id,
                        "content_id": self.node_1.content_id,
                        "channel_id": self.channel_id,
                    },
                    {
                        "contentnode_id": self.node_2.id,
                        "content_id": self.node_2.content_id,
                        "channel_id": self.channel_id,
                    },
                ]
            ),
        )

        self.assignment_1 = LessonAssignment.objects.create(
            lesson=self.lesson, assigned_by=self.superuser, collection=self.classroom
        )

        self.exam = Exam.objects.create(
            title="title",
            question_count=1,
            active=True,
            collection=self.classroom,
            creator=self.superuser,
        )
        self.assignment = ExamAssignment.objects.create(
            exam=self.exam, collection=self.classroom, assigned_by=self.superuser
        )
        self.summarylog1 = ContentSummaryLogFactory.create(
            user=self.user1,
            content_id=self.node_1.content_id,
            channel_id=self.channel_id,
        )

        self.summarylog2 = ContentSummaryLogFactory.create(
            user=self.user1,
            content_id=self.node_2.content_id,
            channel_id=self.channel_id,
            kind=content_kinds.EXERCISE,
        )