Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cms/djangoapps/auth/authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ def is_user_in_creator_group(user):
return True

# On edx, we only allow edX staff to create courses. This may be relaxed in the future.
if settings.MITX_FEATURES.get('DISABLE_COURSE_CREATION', False):
if settings.FEATURES.get('DISABLE_COURSE_CREATION', False):
return False

# Feature flag for using the creator group setting. Will be removed once the feature is complete.
if settings.MITX_FEATURES.get('ENABLE_CREATOR_GROUP', False):
if settings.FEATURES.get('ENABLE_CREATOR_GROUP', False):
return user.groups.filter(name=COURSE_CREATOR_GROUP_NAME).count() > 0

return True
Expand Down
12 changes: 6 additions & 6 deletions cms/djangoapps/auth/tests/test_authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_creator_group_not_enabled(self):

def test_creator_group_enabled_but_empty(self):
""" Tests creator group feature on, but group empty. """
with mock.patch.dict('django.conf.settings.MITX_FEATURES', {"ENABLE_CREATOR_GROUP": True}):
with mock.patch.dict('django.conf.settings.FEATURES', {"ENABLE_CREATOR_GROUP": True}):
self.assertFalse(is_user_in_creator_group(self.user))

# Make user staff. This will cause is_user_in_creator_group to return True.
Expand All @@ -42,7 +42,7 @@ def test_creator_group_enabled_but_empty(self):

def test_creator_group_enabled_nonempty(self):
""" Tests creator group feature on, user added. """
with mock.patch.dict('django.conf.settings.MITX_FEATURES', {"ENABLE_CREATOR_GROUP": True}):
with mock.patch.dict('django.conf.settings.FEATURES', {"ENABLE_CREATOR_GROUP": True}):
self.assertTrue(add_user_to_creator_group(self.admin, self.user))
self.assertTrue(is_user_in_creator_group(self.user))

Expand Down Expand Up @@ -70,7 +70,7 @@ def test_add_user_not_active(self):

def test_course_creation_disabled(self):
""" Tests that the COURSE_CREATION_DISABLED flag overrides course creator group settings. """
with mock.patch.dict('django.conf.settings.MITX_FEATURES',
with mock.patch.dict('django.conf.settings.FEATURES',
{'DISABLE_COURSE_CREATION': True, "ENABLE_CREATOR_GROUP": True}):
# Add user to creator group.
self.assertTrue(add_user_to_creator_group(self.admin, self.user))
Expand Down Expand Up @@ -129,7 +129,7 @@ def setUp(self):
""" Test case setup """
self.creator = User.objects.create_user('testcreator', 'testcreator+courses@edx.org', 'foo')
self.staff = User.objects.create_user('teststaff', 'teststaff+courses@edx.org', 'foo')
self.location = 'i4x', 'mitX', '101', 'course', 'test'
self.location = 'i4x', 'edX', '101', 'course', 'test'

def test_add_user_to_course_group(self):
"""
Expand Down Expand Up @@ -181,7 +181,7 @@ def test_get_staff(self):
create_all_course_groups(self.creator, self.location)
add_user_to_course_group(self.creator, self.staff, self.location, STAFF_ROLE_NAME)

location2 = 'i4x', 'mitX', '103', 'course', 'test2'
location2 = 'i4x', 'edX', '103', 'course', 'test2'
staff2 = User.objects.create_user('teststaff2', 'teststaff2+courses@edx.org', 'foo')
create_all_course_groups(self.creator, location2)
add_user_to_course_group(self.creator, staff2, location2, STAFF_ROLE_NAME)
Expand All @@ -193,7 +193,7 @@ def test_get_instructor(self):
create_all_course_groups(self.creator, self.location)
add_user_to_course_group(self.creator, self.staff, self.location, STAFF_ROLE_NAME)

location2 = 'i4x', 'mitX', '103', 'course', 'test2'
location2 = 'i4x', 'edX', '103', 'course', 'test2'
creator2 = User.objects.create_user('testcreator2', 'testcreator2+courses@edx.org', 'foo')
staff2 = User.objects.create_user('teststaff2', 'teststaff2+courses@edx.org', 'foo')
create_all_course_groups(creator2, location2)
Expand Down
4 changes: 2 additions & 2 deletions cms/djangoapps/contentstore/features/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def create_studio_user(

def fill_in_course_info(
name='Robot Super Course',
org='MITx',
org='edX',
num='101',
run='2013_Spring'):
world.css_fill('.new-course-name', name)
Expand Down Expand Up @@ -166,7 +166,7 @@ def add_course_author(user, course):


def create_a_course():
course = world.CourseFactory.create(org='MITx', course='999', display_name='Robot Super Course')
course = world.CourseFactory.create(org='edX', course='999', display_name='Robot Super Course')
world.scenario_dict['COURSE'] = course

user = world.scenario_dict.get("USER")
Expand Down
4 changes: 2 additions & 2 deletions cms/djangoapps/contentstore/features/course-settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def i_see_new_course_image(_step):
images = world.css_find(img_css)
assert len(images) == 1
img = images[0]
expected_src = '/c4x/MITx/999/asset/image.jpg'
expected_src = '/c4x/edX/999/asset/image.jpg'

# Don't worry about the domain in the URL
success_func = lambda _: img['src'].endswith(expected_src)
Expand All @@ -160,7 +160,7 @@ def i_see_new_course_image(_step):
@step('the image URL should be present in the field')
def image_url_present(_step):
field_css = '#course-image-url'
expected_value = '/c4x/MITx/999/asset/image.jpg'
expected_value = '/c4x/edX/999/asset/image.jpg'
assert world.css_value(field_css) == expected_value


Expand Down
12 changes: 6 additions & 6 deletions cms/djangoapps/contentstore/features/course-updates.feature
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@ Feature: CMS.Course updates
And I go to the course updates page
When I add a new update with the text "<img src='/static/my_img.jpg'/>"
# Can only do partial text matches because of the quotes with in quotes (and regexp step matching).
Then I should see the update "/c4x/MITx/999/asset/my_img.jpg"
Then I should see the update "/c4x/edX/999/asset/my_img.jpg"
And I change the update from "/static/my_img.jpg" to "<img src='/static/modified.jpg'/>"
Then I should see the update "/c4x/MITx/999/asset/modified.jpg"
Then I should see the update "/c4x/edX/999/asset/modified.jpg"
And when I reload the page
Then I should see the update "/c4x/MITx/999/asset/modified.jpg"
Then I should see the update "/c4x/edX/999/asset/modified.jpg"

Scenario: Static links are rewritten when previewing handouts
Given I have opened a new course in Studio
And I go to the course updates page
When I modify the handout to "<ol><img src='/static/my_img.jpg'/></ol>"
# Can only do partial text matches because of the quotes with in quotes (and regexp step matching).
Then I see the handout "/c4x/MITx/999/asset/my_img.jpg"
Then I see the handout "/c4x/edX/999/asset/my_img.jpg"
And I change the handout from "/static/my_img.jpg" to "<img src='/static/modified.jpg'/>"
Then I see the handout "/c4x/MITx/999/asset/modified.jpg"
Then I see the handout "/c4x/edX/999/asset/modified.jpg"
And when I reload the page
Then I see the handout "/c4x/MITx/999/asset/modified.jpg"
Then I see the handout "/c4x/edX/999/asset/modified.jpg"

Scenario: Users cannot save handouts with bad html until edit or update it properly
Given I have opened a new course in Studio
Expand Down
6 changes: 3 additions & 3 deletions cms/djangoapps/contentstore/features/signup.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Feature: CMS.Sign in
Scenario: Login with a valid redirect
Given I have opened a new course in Studio
And I am not logged in
And I visit the url "/course/MITx.999.Robot_Super_Course/branch/draft/block/Robot_Super_Course"
And I should see that the path is "/signin?next=/course/MITx.999.Robot_Super_Course/branch/draft/block/Robot_Super_Course"
And I visit the url "/course/edX.999.Robot_Super_Course/branch/draft/block/Robot_Super_Course"
And I should see that the path is "/signin?next=/course/edX.999.Robot_Super_Course/branch/draft/block/Robot_Super_Course"
When I fill in and submit the signin form
And I wait for "2" seconds
Then I should see that the path is "/course/MITx.999.Robot_Super_Course/branch/draft/block/Robot_Super_Course"
Then I should see that the path is "/course/edX.999.Robot_Super_Course/branch/draft/block/Robot_Super_Course"

Scenario: Login with an invalid redirect
Given I have opened a new course in Studio
Expand Down
4 changes: 2 additions & 2 deletions cms/djangoapps/contentstore/features/textbooks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Feature: CMS.Textbooks
And I upload the textbook "textbook.pdf"
And I wait for "2" seconds
And I save the textbook
Then I should see a textbook named "Economics" with a chapter path containing "/c4x/MITx/999/asset/textbook.pdf"
Then I should see a textbook named "Economics" with a chapter path containing "/c4x/edX/999/asset/textbook.pdf"
And I reload the page
Then I should see a textbook named "Economics" with a chapter path containing "/c4x/MITx/999/asset/textbook.pdf"
Then I should see a textbook named "Economics" with a chapter path containing "/c4x/edX/999/asset/textbook.pdf"

Scenario: Create a textbook with multiple chapters
Given I have opened a new course in Studio
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/features/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def open_course_with_locked(step, lock_state):

@step(u'Then the asset is (viewable|protected)$')
def view_asset(_step, status):
url = django_url('/c4x/MITx/999/asset/asset.html')
url = django_url('/c4x/edX/999/asset/asset.html')
if status == 'viewable':
expected_text = 'test file'
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


#
# To run from command line: rake cms:clone SOURCE_LOC=MITx/111/Foo1 DEST_LOC=MITx/135/Foo3
# To run from command line: rake cms:clone SOURCE_LOC=edX/111/Foo1 DEST_LOC=edX/135/Foo3
#
class Command(BaseCommand):
"""Clone a MongoDB-backed course to another location"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


#
# To run from command line: rake cms:delete_course LOC=MITx/111/Foo1
# To run from command line: rake cms:delete_course LOC=edX/111/Foo1
#
class Command(BaseCommand):
help = '''Delete a MongoDB backed course'''
Expand All @@ -23,7 +23,7 @@ def handle(self, *args, **options):
commit = args[1] == 'commit'

if commit:
print 'Actually going to delete the course from DB....'
print('Actually going to delete the course from DB....')

if query_yes_no("Deleting course {0}. Confirm?".format(course_id), default="no"):
if query_yes_no("Are you sure. This action cannot be undone!", default="no"):
Expand Down
8 changes: 4 additions & 4 deletions cms/djangoapps/contentstore/tests/test_checklists.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ChecklistTestCase(CourseTestCase):
def setUp(self):
""" Creates the test course. """
super(ChecklistTestCase, self).setUp()
self.course = CourseFactory.create(org='mitX', number='333', display_name='Checklists Course')
self.course = CourseFactory.create(org='edX', number='333', display_name='Checklists Course')
self.location = loc_mapper().translate_location(self.course.location.course_id, self.course.location, False, True)
self.checklists_url = self.location.url_reverse('checklists/', '')

Expand Down Expand Up @@ -42,7 +42,7 @@ def test_get_checklists(self):
response = self.client.get(self.checklists_url)
self.assertContains(response, "Getting Started With Studio")
# Verify expansion of action URL happened.
self.assertContains(response, 'course_team/mitX.333.Checklists_Course')
self.assertContains(response, 'course_team/edX.333.Checklists_Course')
# Verify persisted checklist does NOT have expanded URL.
checklist_0 = self.get_persisted_checklists()[0]
self.assertEqual('ManageUsers', get_action_url(checklist_0, 0))
Expand Down Expand Up @@ -137,8 +137,8 @@ def test_expansion(checklist, index, stored, expanded):
# Verify no side effect in the original list.
self.assertEqual(get_action_url(checklist, index), stored)

test_expansion(self.course.checklists[0], 0, 'ManageUsers', '/course_team/mitX.333.Checklists_Course/branch/draft/block/Checklists_Course')
test_expansion(self.course.checklists[1], 1, 'CourseOutline', '/course/mitX.333.Checklists_Course/branch/draft/block/Checklists_Course')
test_expansion(self.course.checklists[0], 0, 'ManageUsers', '/course_team/edX.333.Checklists_Course/branch/draft/block/Checklists_Course')
test_expansion(self.course.checklists[1], 1, 'CourseOutline', '/course/edX.333.Checklists_Course/branch/draft/block/Checklists_Course')
test_expansion(self.course.checklists[2], 0, 'http://help.edge.edx.org/', 'http://help.edge.edx.org/')


Expand Down
Loading