'Test ordering of proctoring blocks.'

def test_credit_requirement_blocks_ordering(self):

    self.add_credit_course(self.course.id)
    subsection = ItemFactory.create(parent=self.section, category='sequential', display_name='Dummy    Subsection')
    create_exam(course_id=unicode(self.course.id), content_id=unicode(subsection.location), exam_name='A    Proctored    Exam', time_limit_mins=10, is_proctored=True, is_active=True)
    requirements = get_credit_requirements(self.course.id)
    self.assertEqual(len(requirements), 0)
    on_course_publish(self.course.id)
    requirements = get_credit_requirements(self.course.id)
    self.assertEqual(len(requirements), 2)
    self.assertEqual(requirements[1]['namespace'], 'proctored_exam')
    self.assertEqual(requirements[1]['name'], unicode(subsection.location))
    self.assertEqual(requirements[1]['display_name'], 'A    Proctored    Exam')
    self.assertEqual(requirements[1]['criteria'], {})
    on_course_publish(self.course.id)
    requirements = get_credit_requirements(self.course.id)
    self.assertEqual(len(requirements), 2)
    self.assertEqual(requirements[0]['display_name'], 'Minimum    Grade')
    self.assertEqual(requirements[1]['display_name'], 'A    Proctored    Exam')
