Exemplo n.º 1
0
class TestPanel(LoginEnrollmentTestCase):
    """
    Run tests on the open ended panel
    """

    def setUp(self):
        # Toy courses should be loaded
        self.course_name = 'edX/open_ended/2012_Fall'
        self.course = modulestore().get_course(self.course_name)
        self.user = factories.UserFactory()

    def test_open_ended_panel(self):
        """
        Test to see if the peer grading module in the demo course is found
        @return:
        """
        found_module, peer_grading_module = views.find_peer_grading_module(self.course)
        self.assertTrue(found_module)

    @patch('open_ended_grading.views.controller_qs', controller_query_service.MockControllerQueryService(settings.OPEN_ENDED_GRADING_INTERFACE, views.system))
    def test_problem_list(self):
        """
        Ensure that the problem list from the grading controller server can be rendered properly locally
        @return:
        """
        request = Mock(user=self.user)
        response = views.student_problem_list(request, self.course.id)
        self.assertRegexpMatches(response.content, "Here are a list of open ended problems for this course.")
Exemplo n.º 2
0
class TestPanel(ModuleStoreTestCase):
    """
    Run tests on the open ended panel
    """
    def setUp(self):
        super(TestPanel, self).setUp()
        self.user = factories.UserFactory()
        store = modulestore()
        course_items = import_course_from_xml(store, self.user.id,
                                              TEST_DATA_DIR, ['open_ended'])  # pylint: disable=maybe-no-member
        self.course = course_items[0]
        self.course_key = self.course.id

    def test_open_ended_panel(self):
        """
        Test to see if the peer grading module in the demo course is found
        @return:
        """
        found_module, peer_grading_module = views.find_peer_grading_module(
            self.course)
        self.assertTrue(found_module)

    @patch(
        'open_ended_grading.utils.create_controller_query_service',
        Mock(return_value=controller_query_service.MockControllerQueryService(
            settings.OPEN_ENDED_GRADING_INTERFACE, utils.render_to_string)))
    def test_problem_list(self):
        """
        Ensure that the problem list from the grading controller server can be rendered properly locally
        @return:
        """
        request = RequestFactory().get(
            reverse("open_ended_problems",
                    kwargs={'course_id': self.course_key}))
        request.user = self.user

        mako_middleware_process_request(request)
        response = views.student_problem_list(
            request, self.course.id.to_deprecated_string())
        self.assertRegexpMatches(
            response.content,
            "Here is a list of open ended problems for this course.")
Exemplo n.º 3
0
class TestPanel(ModuleStoreTestCase):
    """
    Run tests on the open ended panel
    """
    def setUp(self):
        # Toy courses should be loaded
        self.course_key = SlashSeparatedCourseKey('edX', 'open_ended',
                                                  '2012_Fall')
        self.course = modulestore().get_course(self.course_key)
        self.user = factories.UserFactory()

    def test_open_ended_panel(self):
        """
        Test to see if the peer grading module in the demo course is found
        @return:
        """
        found_module, peer_grading_module = views.find_peer_grading_module(
            self.course)
        self.assertTrue(found_module)

    @patch(
        'open_ended_grading.utils.create_controller_query_service',
        Mock(return_value=controller_query_service.MockControllerQueryService(
            settings.OPEN_ENDED_GRADING_INTERFACE, utils.SYSTEM)))
    def test_problem_list(self):
        """
        Ensure that the problem list from the grading controller server can be rendered properly locally
        @return:
        """
        request = RequestFactory().get(
            reverse("open_ended_problems",
                    kwargs={'course_id': self.course_key}))
        request.user = self.user

        mako_middleware_process_request(request)
        response = views.student_problem_list(
            request, self.course.id.to_deprecated_string())
        self.assertRegexpMatches(
            response.content,
            "Here is a list of open ended problems for this course.")