Files
edx-platform/common/test/acceptance/edxapp_pages/studio/helpers.py
Will Daly 4afd5ea49f Refactored bok-choy directory structure
Added fixtures for course and xblock creation
Added bok-choy Studio tests
Added bok-choy tests for ora self- and ai- assessment
Refactored auto-auth; added staff and course-enrollment options
Removed extra javascript properties from page objects
2014-01-15 09:37:32 -05:00

29 lines
741 B
Python

"""
Helper functions for Studio page objects.
"""
class InvalidCourseID(Exception):
"""
The course ID does not have the correct format.
"""
pass
def parse_course_id(course_id):
"""
Parse a `course_id` string of the form "org.number.run"
and return the components as a tuple.
Raises an `InvalidCourseID` exception if the course ID is not in the right format.
"""
if course_id is None:
raise InvalidCourseID("Invalid course ID: '{0}'".format(course_id))
elements = course_id.split('.')
# You need at least 3 parts to a course ID: org, number, and run
if len(elements) < 3:
raise InvalidCourseID("Invalid course ID: '{0}'".format(course_id))
return tuple(elements)