コード例 #1
0
    def test_transform_all_fields_for_selected_learner(self):
        """Test overriding of all fields"""
        for field in REQUESTED_FIELDS:
            override_field_for_user(
                self.learner,
                self.block,
                field,
                expected_overrides.get(field)
            )

        # collect phase
        OverrideDataTransformer.collect(self.block_structure)

        # transform phase
        OverrideDataTransformer(self.learner).transform(
            usage_info=self.course_usage_key,
            block_structure=self.block_structure,
        )

        # verify overridden data
        for field in REQUESTED_FIELDS:
            # learner has overridden data
            assert get_override_for_user(self.learner, self.block, field) == expected_overrides.get(field)
            # other learner2 dont have overridden data
            assert get_override_for_user(self.learner2, self.block, field) is None
コード例 #2
0
    def test_transform_all_fields_for_selected_learner(self):
        """Test overriding of all fields"""
        for field in REQUESTED_FIELDS:
            override_field_for_user(
                self.learner,
                self.block,
                field,
                expected_overrides.get(field)
            )

        # collect phase
        OverrideDataTransformer.collect(self.block_structure)

        # transform phase
        OverrideDataTransformer(self.learner).transform(
            usage_info=self.course_usage_key,
            block_structure=self.block_structure,
        )

        # verify overridden data
        for field in REQUESTED_FIELDS:
            # learner has overridden data
            assert get_override_for_user(self.learner, self.block, field) == expected_overrides.get(field)
            # other learner2 dont have overridden data
            assert get_override_for_user(self.learner2, self.block, field) is None
コード例 #3
0
    def test_transform(self, field):
        override_field_for_user(self.learner, self.block, field,
                                expected_overrides.get(field))

        # collect phase
        OverrideDataTransformer.collect(self.block_structure)

        # transform phase
        OverrideDataTransformer().transform(
            usage_info=self.course_usage_key,
            block_structure=self.block_structure,
        )

        # verify overridden data
        assert get_override_for_user(self.learner, self.block,
                                     field) == expected_overrides.get(field)
コード例 #4
0
    def test_transform(self, field):
        override_field_for_user(
            self.learner,
            self.block,
            field,
            expected_overrides.get(field)
        )

        # collect phase
        OverrideDataTransformer.collect(self.block_structure)

        # transform phase
        OverrideDataTransformer().transform(
            usage_info=self.course_usage_key,
            block_structure=self.block_structure,
        )

        # verify overridden data
        assert get_override_for_user(self.learner, self.block, field) == expected_overrides.get(field)
コード例 #5
0
    def test_transform_for_selected_learner(self, field):
        """
        assert that data transformed for selected learner
        """
        override_field_for_user(self.learner, self.block, field,
                                expected_overrides.get(field))

        # collect phase
        OverrideDataTransformer.collect(self.block_structure)

        # transform phase
        OverrideDataTransformer(self.learner).transform(
            usage_info=self.course_usage_key,
            block_structure=self.block_structure,
        )

        # verify learner has overridden data
        assert get_override_for_user(self.learner, self.block,
                                     field) == expected_overrides.get(field)
        # other learner2 dont have overridden data
        assert get_override_for_user(self.learner2, self.block, field) is None
コード例 #6
0
    def test_transform_for_selected_learner(self, field):
        """
        assert that data transformed for selected learner
        """
        override_field_for_user(
            self.learner,
            self.block,
            field,
            expected_overrides.get(field)
        )

        # collect phase
        OverrideDataTransformer.collect(self.block_structure)

        # transform phase
        OverrideDataTransformer(self.learner).transform(
            usage_info=self.course_usage_key,
            block_structure=self.block_structure,
        )

        # verify learner has overridden data
        assert get_override_for_user(self.learner, self.block, field) == expected_overrides.get(field)
        # other learner2 dont have overridden data
        assert get_override_for_user(self.learner2, self.block, field) is None