Пример #1
0
 def setUp(self):
     self.system = test_system()
     self.org = "org"
     self.course = "course"
     self.location = Location(['i4x', self.org, self.course, None, None])
     self.valid_xml = u"<problem>ABC \N{SNOWMAN}</problem>"
     self.error_msg = "Error"
Пример #2
0
 def setUp(self):
     self.system = test_system()
     self.org = "org"
     self.course = "course"
     self.fake_xml = "<problem />"
     self.broken_xml = "<problem>"
     self.error_msg = "Error"
Пример #3
0
 def setUp(self):
     self.system = test_system()
     self.org = "org"
     self.course = "course"
     self.location = Location(['i4x', self.org, self.course, None, None])
     self.valid_xml = u"<problem>ABC \N{SNOWMAN}</problem>"
     self.error_msg = "Error"
Пример #4
0
 def setUp(self):
     self.system = test_system()
     self.org = "org"
     self.course = "course"
     self.fake_xml = "<problem />"
     self.broken_xml = "<problem>"
     self.error_msg = "Error"
Пример #5
0
 def setUp(self):
     self.system = test_system()
     self.org = "org"
     self.course = "course"
     self.location = Location(['i4x', self.org, self.course, None, None])
     self.valid_xml = "<problem />"
     self.broken_xml = "<problem>"
     self.error_msg = "Error"
Пример #6
0
 def setUp(self):
     self.system = test_system()
     self.org = "org"
     self.course = "course"
     self.location = Location(['i4x', self.org, self.course, None, None])
     self.valid_xml = "<problem />"
     self.broken_xml = "<problem>"
     self.error_msg = "Error"
Пример #7
0
    def create():
        """Method return Video Xmodule instance."""
        location = Location(["i4x", "edX", "video", "default",
                             "SampleProblem1"])
        model_data = {'data': VideoFactory.sample_problem_xml_youtube}

        descriptor = Mock(weight="1")

        system = test_system()
        system.render_template = lambda template, context: context
        module = VideoModule(system, location, descriptor, model_data)

        return module
Пример #8
0
    def create():
        """Method return Video Xmodule instance."""
        location = Location(
            ["i4x", "edX", "video", "default", "SampleProblem1"])
        model_data = {'data': VideoFactory.sample_problem_xml_youtube}

        descriptor = Mock(weight="1")

        system = test_system()
        system.render_template = lambda template, context: context
        module = VideoModule(system, location, descriptor, model_data)

        return module
Пример #9
0
    def setUp(self):

        self.course = CourseFactory.create(data=self.COURSE_DATA)

        # Turn off cache.
        modulestore().request_cache = None
        modulestore().metadata_inheritance_cache_subsystem = None

        chapter = ItemFactory.create(
            parent_location=self.course.location,
            template="i4x://edx/templates/sequential/Empty",
        )
        section = ItemFactory.create(
            parent_location=chapter.location,
            template="i4x://edx/templates/sequential/Empty"
        )

        # username = robot{0}, password = '******'
        self.users = [
            UserFactory.create(username='******' % i, email='*****@*****.**' % i)
            for i in range(self.USER_COUNT)
        ]

        for user in self.users:
            CourseEnrollmentFactory.create(user=user, course_id=self.course.id)

        self.item_descriptor = ItemFactory.create(
            parent_location=section.location,
            template=self.TEMPLATE_NAME,
            data=self.DATA
        )

        system = test_system()
        system.render_template = lambda template, context: context
        model_data = {'location': self.item_descriptor.location}
        model_data.update(self.MODEL_DATA)

        self.item_module = self.item_descriptor.module_class(
            system, self.item_descriptor, model_data
        )
        self.item_url = Location(self.item_module.location).url()

        # login all users for acces to Xmodule
        self.clients = {user.username: Client() for user in self.users}
        self.login_statuses = [
            self.clients[user.username].login(
                username=user.username, password='******')
            for user in self.users
        ]

        self.assertTrue(all(self.login_statuses))
Пример #10
0
    def setUp(self):

        self.course = CourseFactory.create(data=self.COURSE_DATA)

        # Turn off cache.
        modulestore().request_cache = None
        modulestore().metadata_inheritance_cache_subsystem = None

        chapter = ItemFactory.create(
            parent_location=self.course.location,
            template="i4x://edx/templates/sequential/Empty",
        )
        section = ItemFactory.create(
            parent_location=chapter.location,
            template="i4x://edx/templates/sequential/Empty")

        # username = robot{0}, password = '******'
        self.users = [
            UserFactory.create(username='******' % i,
                               email='*****@*****.**' % i)
            for i in range(self.USER_COUNT)
        ]

        for user in self.users:
            CourseEnrollmentFactory.create(user=user, course_id=self.course.id)

        self.item_descriptor = ItemFactory.create(
            parent_location=section.location,
            template=self.TEMPLATE_NAME,
            data=self.DATA)

        location = self.item_descriptor.location
        system = test_system()
        system.render_template = lambda template, context: context

        self.item_module = self.item_descriptor.module_class(
            system, location, self.item_descriptor, self.MODEL_DATA)
        self.item_url = Location(location).url()

        # login all users for acces to Xmodule
        self.clients = {user.username: Client() for user in self.users}
        self.login_statuses = [
            self.clients[user.username].login(username=user.username,
                                              password='******')
            for user in self.users
        ]

        self.assertTrue(all(self.login_statuses))