'Test course_id_from_url().'

def test_course_id_from_url(self):

    self.assertIsNone(course_id_from_url('/login'))
    self.assertIsNone(course_id_from_url('/course/edX/maths/2020'))
    self.assertIsNone(course_id_from_url('/courses/edX/maths/'))
    self.assertIsNone(course_id_from_url('/api/courses/v1/blocks/edX/maths/2020'))
    self.assertIsNone(course_id_from_url('/api/courses/v1/blocks/course-v1:incidental+courseid+formatting'))
    self.assertIsNone(course_id_from_url('/api/courses/v41/notcourses/course-v1:incidental+courseid+formatting'))
    course_id = course_id_from_url('/courses/course-v1:edX+maths+2020')
    self.assertCourseIdFieldsMatch(course_id=course_id, org='edX', course='maths', run='2020')
    course_id = course_id_from_url('/courses/edX/maths/2020')
    self.assertCourseIdFieldsMatch(course_id=course_id, org='edX', course='maths', run='2020')
    course_id = course_id_from_url('/api/courses/v1/courses/course-v1:edX+maths+2020')
    self.assertCourseIdFieldsMatch(course_id=course_id, org='edX', course='maths', run='2020')
    course_id = course_id_from_url('/api/courses/v1/courses/edX/maths/2020')
    self.assertCourseIdFieldsMatch(course_id=course_id, org='edX', course='maths', run='2020')
