Ejemplo n.º 1
0
    def test_export(
            self, solution_attribute_value, solution_element_value,
            expected_solution_attribute, expected_solution_element):
        """Export the test course with the SGA module"""
        course = self.import_test_course(solution_attribute_value, solution_element_value)

        temp_dir = tempfile.mkdtemp()
        self.addCleanup(lambda: shutil.rmtree(temp_dir))

        store = modulestore()
        export_course_to_xml(store, None, course.id, temp_dir, "2017_SGA")

        with open(os.path.join(temp_dir, "2017_SGA", "vertical", "vertical.xml")) as f:
            content = f.read()

        # If both are true the expected output should only have the attribute, since it took precedence
        # and the attribute contents are broken XML
        assert reformat_xml(content) == reformat_xml(
            self.make_test_vertical(expected_solution_attribute, expected_solution_element)
        )
Ejemplo n.º 2
0
    def test_export(
            self, solution_attribute_value, solution_element_value,
            expected_solution_attribute, expected_solution_element):
        """Export the test course with the SGA module"""
        course = self.import_test_course(solution_attribute_value, solution_element_value)

        temp_dir = tempfile.mkdtemp()
        self.addCleanup(lambda: shutil.rmtree(temp_dir))

        store = modulestore()
        export_course_to_xml(store, None, course.id, temp_dir, "2017_SGA")

        with open(os.path.join(temp_dir, "2017_SGA", "vertical", "vertical.xml")) as f:
            content = f.read()

        # If both are true the expected output should only have the attribute, since it took precedence
        # and the attribute contents are broken XML
        assert reformat_xml(content) == reformat_xml(
            self.make_test_vertical(expected_solution_attribute, expected_solution_element)
        )