'Helper function to ensure that the mocked event tracker
was called with the expected info based on the passed grade.'

def _assert_tracker_emitted_event(self, tracker_mock, grade):

    tracker_mock.emit.assert_called_with(u'edx.grades.subsection.grade_calculated', {'user_id': unicode(grade.user_id), 'course_id': unicode(grade.course_id), 'block_id': unicode(grade.usage_key), 'course_version': unicode(grade.course_version), 'weighted_total_earned': grade.earned_all, 'weighted_total_possible': grade.possible_all, 'weighted_graded_earned': grade.earned_graded, 'weighted_graded_possible': grade.possible_graded, 'first_attempted': unicode(grade.first_attempted), 'subtree_edited_timestamp': unicode(grade.subtree_edited_timestamp), 'event_transaction_id': unicode(get_event_transaction_id()), 'event_transaction_type': unicode(get_event_transaction_type()), 'visible_blocks_hash': unicode(grade.visible_blocks_id)})
