def test_get_students_problem_grades_max(self):

        with patch('class_dashboard.dashboard_data.MAX_SCREEN_LIST_LENGTH', 2):
            attributes = '?module_id=' + self.item.location.to_deprecated_string()
            request = self.request_factory.get(reverse('get_students_problem_grades') + attributes)

            response = get_students_problem_grades(request)
            response_results = json.loads(response.content)['results']
            response_max_exceeded = json.loads(response.content)['max_exceeded']

            # Only 2 students in the list and response_max_exceeded is True
            self.assertEquals(2, len(response_results))
            self.assertEquals(True, response_max_exceeded)
예제 #2
0
    def test_get_students_problem_grades_max(self):

        with patch('class_dashboard.dashboard_data.MAX_SCREEN_LIST_LENGTH', 2):
            attributes = '?module_id=' + text_type(self.item.location)
            request = self.request_factory.get(reverse('get_students_problem_grades') + attributes)

            response = get_students_problem_grades(request)
            response_results = json.loads(response.content)['results']
            response_max_exceeded = json.loads(response.content)['max_exceeded']

            # Only 2 students in the list and response_max_exceeded is True
            self.assertEquals(2, len(response_results))
            self.assertEquals(True, response_max_exceeded)
    def test_get_students_problem_grades(self):

        attributes = '?module_id=' + self.item.location.to_deprecated_string()
        request = self.request_factory.get(reverse('get_students_problem_grades') + attributes)

        response = get_students_problem_grades(request)
        response_content = json.loads(response.content)['results']
        response_max_exceeded = json.loads(response.content)['max_exceeded']

        self.assertEquals(USER_COUNT, len(response_content))
        self.assertEquals(False, response_max_exceeded)
        for item in response_content:
            if item['grade'] == 0:
                self.assertEquals(0, item['percent'])
            else:
                self.assertEquals(100, item['percent'])
예제 #4
0
    def test_get_students_problem_grades(self):

        attributes = '?module_id=' + text_type(self.item.location)
        request = self.request_factory.get(reverse('get_students_problem_grades') + attributes)

        response = get_students_problem_grades(request)
        response_content = json.loads(response.content)['results']
        response_max_exceeded = json.loads(response.content)['max_exceeded']

        self.assertEquals(USER_COUNT, len(response_content))
        self.assertEquals(False, response_max_exceeded)
        for item in response_content:
            if item['grade'] == 0:
                self.assertEquals(0, item['percent'])
            else:
                self.assertEquals(100, item['percent'])
    def test_get_students_problem_grades(self):

        attributes = "?module_id=" + self.item.location.to_deprecated_string()
        request = self.request_factory.get(reverse("get_students_problem_grades") + attributes)

        response = get_students_problem_grades(request)
        response_content = json.loads(response.content)["results"]
        response_max_exceeded = json.loads(response.content)["max_exceeded"]

        self.assertEquals(USER_COUNT, len(response_content))
        self.assertEquals(False, response_max_exceeded)
        for item in response_content:
            if item["grade"] == 0:
                self.assertEquals(0, item["percent"])
            else:
                self.assertEquals(100, item["percent"])
    def test_get_students_problem_grades_csv(self):

        tooltip = 'P1.2.1 Q1 - 3382 Students (100%: 1/1 questions)'
        attributes = '?module_id=' + self.item.location.to_deprecated_string() + '&tooltip=' + tooltip + '&csv=true'
        request = self.request_factory.get(reverse('get_students_problem_grades') + attributes)

        response = get_students_problem_grades(request)
        # Check header and a row for each student in csv response
        self.assertContains(response, '"Name","Username","Grade","Percent"')
        self.assertContains(response, '"metric0","0.0","0.0"')
        self.assertContains(response, '"metric1","0.0","0.0"')
        self.assertContains(response, '"metric2","0.0","0.0"')
        self.assertContains(response, '"metric3","0.0","0.0"')
        self.assertContains(response, '"metric4","0.0","0.0"')
        self.assertContains(response, '"metric5","0.0","0.0"')
        self.assertContains(response, '"metric6","0.0","0.0"')
        self.assertContains(response, '"metric7","0.0","0.0"')
        self.assertContains(response, '"metric8","0.0","0.0"')
        self.assertContains(response, '"metric9","0.0","0.0"')
        self.assertContains(response, '"metric10","1.0","100.0"')
예제 #7
0
    def test_get_students_problem_grades_csv(self):

        tooltip = 'P1.2.1 Q1 - 3382 Students (100%: 1/1 questions)'
        attributes = '?module_id=' + text_type(self.item.location) + '&tooltip=' + tooltip + '&csv=true'
        request = self.request_factory.get(reverse('get_students_problem_grades') + attributes)

        response = get_students_problem_grades(request)
        # Check header and a row for each student in csv response
        self.assertContains(response, '"Name","Username","Grade","Percent"')
        self.assertContains(response, '"metric0","0.0","0.0"')
        self.assertContains(response, '"metric1","0.0","0.0"')
        self.assertContains(response, '"metric2","0.0","0.0"')
        self.assertContains(response, '"metric3","0.0","0.0"')
        self.assertContains(response, '"metric4","0.0","0.0"')
        self.assertContains(response, '"metric5","0.0","0.0"')
        self.assertContains(response, '"metric6","0.0","0.0"')
        self.assertContains(response, '"metric7","0.0","0.0"')
        self.assertContains(response, '"metric8","0.0","0.0"')
        self.assertContains(response, '"metric9","0.0","0.0"')
        self.assertContains(response, '"metric10","1.0","100.0"')