LMS-11286 Paver Bokchoy support for Split; default store set to Split.
This commit is contained in:
@@ -11,6 +11,8 @@ from textwrap import dedent
|
||||
from collections import namedtuple
|
||||
from path import path
|
||||
from lazy import lazy
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
|
||||
from . import STUDIO_BASE_URL
|
||||
|
||||
@@ -204,6 +206,7 @@ class CourseFixture(StudioApiFixture):
|
||||
self.children = []
|
||||
self._assets = []
|
||||
self._advanced_settings = {}
|
||||
self._course_key = None
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
@@ -263,19 +266,13 @@ class CourseFixture(StudioApiFixture):
|
||||
|
||||
return self
|
||||
|
||||
@property
|
||||
def _course_key(self):
|
||||
"""
|
||||
Return the locator string for the course.
|
||||
"""
|
||||
return "{org}/{number}/{run}".format(**self._course_dict)
|
||||
|
||||
@property
|
||||
def _course_location(self):
|
||||
"""
|
||||
Return the locator string for the course.
|
||||
"""
|
||||
return "i4x://{org}/{number}/course/{run}".format(**self._course_dict)
|
||||
course_key = CourseKey.from_string(self._course_key)
|
||||
return unicode(course_key.make_usage_key('course', self._course_dict['run']))
|
||||
|
||||
@property
|
||||
def _assets_url(self):
|
||||
@@ -289,7 +286,8 @@ class CourseFixture(StudioApiFixture):
|
||||
"""
|
||||
Return the locator string for the course handouts
|
||||
"""
|
||||
return "i4x://{org}/{number}/course_info/handouts".format(**self._course_dict)
|
||||
course_key = CourseKey.from_string(self._course_key)
|
||||
return unicode(course_key.make_usage_key('course_info', 'handouts'))
|
||||
|
||||
def _create_course(self):
|
||||
"""
|
||||
@@ -315,7 +313,9 @@ class CourseFixture(StudioApiFixture):
|
||||
if err is not None:
|
||||
raise CourseFixtureError("Could not create course {0}. Error message: '{1}'".format(self, err))
|
||||
|
||||
if not response.ok:
|
||||
if response.ok:
|
||||
self._course_key = response.json()['course_key']
|
||||
else:
|
||||
raise CourseFixtureError(
|
||||
"Could not create course {0}. Status was {1}".format(
|
||||
self._course_dict, response.status_code))
|
||||
|
||||
@@ -5,8 +5,10 @@ import json
|
||||
import unittest
|
||||
import functools
|
||||
import requests
|
||||
import os
|
||||
from path import path
|
||||
from bok_choy.web_app_test import WebAppTest
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
|
||||
|
||||
def skip_if_browser(browser):
|
||||
@@ -170,8 +172,6 @@ class UniqueCourseTest(WebAppTest):
|
||||
Test that provides a unique course ID.
|
||||
"""
|
||||
|
||||
COURSE_ID_SEPARATOR = "/"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
Create a unique course ID.
|
||||
@@ -190,11 +190,18 @@ class UniqueCourseTest(WebAppTest):
|
||||
|
||||
@property
|
||||
def course_id(self):
|
||||
return self.COURSE_ID_SEPARATOR.join([
|
||||
"""
|
||||
Returns the serialized course_key for the test
|
||||
"""
|
||||
# TODO - is there a better way to make this agnostic to the underlying default module store?
|
||||
default_store = os.environ.get('DEFAULT_STORE', 'draft')
|
||||
course_key = CourseLocator(
|
||||
self.course_info['org'],
|
||||
self.course_info['number'],
|
||||
self.course_info['run']
|
||||
])
|
||||
self.course_info['run'],
|
||||
deprecated=(default_store == 'draft')
|
||||
)
|
||||
return unicode(course_key)
|
||||
|
||||
|
||||
class YouTubeConfigError(Exception):
|
||||
|
||||
Reference in New Issue
Block a user