@@ -6,7 +6,7 @@ import ddt
|
||||
import json
|
||||
import copy
|
||||
import mock
|
||||
from mock import patch
|
||||
from mock import Mock, patch
|
||||
import unittest
|
||||
|
||||
from django.conf import settings
|
||||
@@ -19,7 +19,7 @@ from models.settings.course_metadata import CourseMetadata
|
||||
from models.settings.encoder import CourseSettingsEncoder
|
||||
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
|
||||
from openedx.core.djangoapps.models.course_details import CourseDetails
|
||||
from student.roles import CourseInstructorRole
|
||||
from student.roles import CourseInstructorRole, CourseStaffRole
|
||||
from student.tests.factories import UserFactory
|
||||
from xmodule.fields import Date
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
@@ -28,7 +28,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from xmodule.tabs import InvalidTabsException
|
||||
from milestones.tests.utils import MilestonesTestCaseMixin
|
||||
|
||||
from .utils import CourseTestCase
|
||||
from .utils import CourseTestCase, AjaxEnabledTestClient
|
||||
|
||||
|
||||
def get_url(course_id, handler_name='settings_handler'):
|
||||
@@ -949,6 +949,23 @@ class CourseMetadataEditingTest(CourseTestCase):
|
||||
tab_list.append(self.notes_tab)
|
||||
self.assertEqual(tab_list, course.tabs)
|
||||
|
||||
@patch.dict(settings.FEATURES, {'ENABLE_EDXNOTES': True})
|
||||
@patch('xmodule.util.django.get_current_request')
|
||||
def test_post_settings_with_staff_not_enrolled(self, mock_request):
|
||||
"""
|
||||
Tests that we can post advance settings when course staff is not enrolled.
|
||||
"""
|
||||
mock_request.return_value = Mock(META={'HTTP_HOST': 'localhost'})
|
||||
user = UserFactory.create(is_staff=True)
|
||||
CourseStaffRole(self.course.id).add_users(user)
|
||||
|
||||
client = AjaxEnabledTestClient()
|
||||
client.login(username=user.username, password=user.password)
|
||||
response = self.client.ajax_post(self.course_setting_url, {
|
||||
'advanced_modules': {"value": [""]}
|
||||
})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class CourseGraderUpdatesTest(CourseTestCase):
|
||||
"""
|
||||
|
||||
@@ -79,7 +79,7 @@ class LMSLinksTestCase(TestCase):
|
||||
link = utils.get_lms_link_for_item(location, True)
|
||||
self.assertEquals(
|
||||
link,
|
||||
"//preview/courses/mitX/101/test/jump_to/i4x://mitX/101/vertical/contacting_us"
|
||||
"//preview.localhost/courses/mitX/101/test/jump_to/i4x://mitX/101/vertical/contacting_us"
|
||||
)
|
||||
|
||||
# now test with the course' location
|
||||
|
||||
Reference in New Issue
Block a user