Refactor and add tests for new grade report.

* Handle grading errors
This commit is contained in:
Daniel Friedman
2015-05-05 17:55:55 +00:00
committed by Diana Huang
parent 84f3c33df7
commit 3acd7a008c
19 changed files with 425 additions and 286 deletions

View File

@@ -24,12 +24,16 @@ class GradesheetTest(unittest.TestCase):
scores.append(Score(earned=3, possible=5, graded=True, section="summary", module_id=None))
all_total, graded_total = aggregate_scores(scores)
self.assertAlmostEqual(all_total, Score(earned=3, possible=10, graded=False, section="summary", module_id=None))
self.assertAlmostEqual(graded_total, Score(earned=3, possible=5, graded=True, section="summary", module_id=None))
self.assertAlmostEqual(
graded_total, Score(earned=3, possible=5, graded=True, section="summary", module_id=None)
)
scores.append(Score(earned=2, possible=5, graded=True, section="summary", module_id=None))
all_total, graded_total = aggregate_scores(scores)
self.assertAlmostEqual(all_total, Score(earned=5, possible=15, graded=False, section="summary", module_id=None))
self.assertAlmostEqual(graded_total, Score(earned=5, possible=10, graded=True, section="summary", module_id=None))
self.assertAlmostEqual(
graded_total, Score(earned=5, possible=10, graded=True, section="summary", module_id=None)
)
class GraderTest(unittest.TestCase):

View File

@@ -703,7 +703,7 @@ class DataDownloadPage(PageObject):
return self.q(css='a[data-section=data_download].active-section').present
@property
def generate_student_profile_report_button(self):
def generate_student_report_button(self):
"""
Returns the "Download profile information as a CSV" button.
"""
@@ -717,7 +717,7 @@ class DataDownloadPage(PageObject):
return self.q(css='input[name=calculate-grades-csv]')
@property
def generate_problem_grade_report_button(self):
def generate_problem_report_button(self):
"""
Returns the "Generate Problem Grade Report" button.
"""

View File

@@ -320,24 +320,16 @@ class DataDownloadsTest(BaseInstructorDashboardTest):
"""
Verifies that the correct event is emitted when a report is requested.
"""
self.verify_events_of_type(
self.instructor_username,
u"edx.instructor.report.requested",
[{
u"report_type": report_type
}]
self.assert_matching_events_were_emitted(
event_filter={'name': u'edx.instructor.report.requested', 'report_type': report_type}
)
def verify_report_downloaded_event(self, report_url):
"""
Verifies that the correct event is emitted when a report is downloaded.
"""
self.verify_events_of_type(
self.instructor_username,
u"edx.instructor.report.downloaded",
[{
u"report_url": report_url
}]
self.assert_matching_events_were_emitted(
event_filter={'name': u'edx.instructor.report.downloaded', 'report_url': report_url}
)
def verify_report_download(self, report_name):
@@ -364,7 +356,7 @@ class DataDownloadsTest(BaseInstructorDashboardTest):
Then a report downloaded event should be emitted
"""
report_name = u"student_profile_info"
self.data_download_section.generate_student_profile_report_button.click()
self.data_download_section.generate_student_report_button.click()
self.data_download_section.wait_for_available_report()
self.verify_report_requested_event(report_name)
self.verify_report_download(report_name)
@@ -400,7 +392,7 @@ class DataDownloadsTest(BaseInstructorDashboardTest):
Then a report downloaded event should be emitted
"""
report_name = u"problem_grade_report"
self.data_download_section.generate_problem_grade_report_button.click()
self.data_download_section.generate_problem_report_button.click()
self.data_download_section.wait_for_available_report()
self.verify_report_requested_event(report_name)
self.verify_report_download(report_name)