Fix merge conflicts
This commit is contained in:
@@ -23,26 +23,21 @@ class TestImport(ModuleStoreTestCase):
|
||||
Unit tests for importing a course from command line
|
||||
"""
|
||||
|
||||
<<<<<<< HEAD
|
||||
COURSE_KEY = SlashSeparatedCourseKey(u'edX', u'test_import_course', u'2013_Spring')
|
||||
BASE_COURSE_KEY = SlashSeparatedCourseKey(u'edX', u'test_import_course', u'2013_Spring')
|
||||
DIFF_KEY = SlashSeparatedCourseKey(u'edX', u'test_import_course', u'2014_Spring')
|
||||
=======
|
||||
BASE_COURSE_ID = ['EDx', '0.00x', '2013_Spring', ]
|
||||
DIFF_RUN = ['EDx', '0.00x', '2014_Spring', ]
|
||||
TRUNCATED_COURSE = ['EDx', '0.00', '2014_Spring', ]
|
||||
TRUNCATED_KEY = SlashSeparatedCourseKey(u'edX', u'test_import', u'2014_Spring')
|
||||
|
||||
def create_course_xml(self, content_dir, course_id):
|
||||
directory = tempfile.mkdtemp(dir=content_dir)
|
||||
os.makedirs(os.path.join(directory, "course"))
|
||||
with open(os.path.join(directory, "course.xml"), "w+") as f:
|
||||
f.write('<course url_name="{0[2]}" org="{0[0]}" '
|
||||
'course="{0[1]}"/>'.format(course_id))
|
||||
f.write('<course url_name="{0.run}" org="{0.org}" '
|
||||
'course="{0.course}"/>'.format(course_id))
|
||||
|
||||
with open(os.path.join(directory, "course", "{0[2]}.xml".format(course_id)), "w+") as f:
|
||||
with open(os.path.join(directory, "course", "{0.run}.xml".format(course_id)), "w+") as f:
|
||||
f.write('<course></course>')
|
||||
|
||||
return directory
|
||||
>>>>>>> edx/master
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
@@ -53,49 +48,22 @@ class TestImport(ModuleStoreTestCase):
|
||||
self.addCleanup(shutil.rmtree, self.content_dir)
|
||||
|
||||
# Create good course xml
|
||||
<<<<<<< HEAD
|
||||
self.good_dir = tempfile.mkdtemp(dir=self.content_dir)
|
||||
os.makedirs(os.path.join(self.good_dir, "course"))
|
||||
with open(os.path.join(self.good_dir, "course.xml"), "w+") as f:
|
||||
f.write('<course url_name="{0.run}" org="{0.org}" '
|
||||
'course="{0.course}"/>'.format(self.COURSE_KEY))
|
||||
|
||||
with open(os.path.join(self.good_dir, "course", "{0.run}.xml".format(self.COURSE_KEY)), "w+") as f:
|
||||
f.write('<course></course>')
|
||||
self.good_dir = self.create_course_xml(self.content_dir, self.BASE_COURSE_KEY)
|
||||
|
||||
# Create run changed course xml
|
||||
self.dupe_dir = tempfile.mkdtemp(dir=self.content_dir)
|
||||
os.makedirs(os.path.join(self.dupe_dir, "course"))
|
||||
with open(os.path.join(self.dupe_dir, "course.xml"), "w+") as f:
|
||||
f.write('<course url_name="{0.run}" org="{0.org}" '
|
||||
'course="{0.course}"/>'.format(self.DIFF_KEY))
|
||||
|
||||
with open(os.path.join(self.dupe_dir, "course", "{0.run}.xml".format(self.DIFF_KEY)), "w+") as f:
|
||||
f.write('<course></course>')
|
||||
=======
|
||||
self.good_dir = self.create_course_xml(self.content_dir, self.BASE_COURSE_ID)
|
||||
|
||||
# Create run changed course xml
|
||||
self.dupe_dir = self.create_course_xml(self.content_dir, self.DIFF_RUN)
|
||||
self.dupe_dir = self.create_course_xml(self.content_dir, self.DIFF_KEY)
|
||||
|
||||
# Create course XML where TRUNCATED_COURSE.org == BASE_COURSE_ID.org
|
||||
# and BASE_COURSE_ID.startswith(TRUNCATED_COURSE.course)
|
||||
self.course_dir = self.create_course_xml(self.content_dir, self.TRUNCATED_COURSE)
|
||||
>>>>>>> edx/master
|
||||
self.course_dir = self.create_course_xml(self.content_dir, self.TRUNCATED_KEY)
|
||||
|
||||
def test_forum_seed(self):
|
||||
"""
|
||||
Tests that forum roles were created with import.
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
self.assertFalse(are_permissions_roles_seeded(self.COURSE_KEY))
|
||||
self.assertFalse(are_permissions_roles_seeded(self.BASE_COURSE_KEY))
|
||||
call_command('import', self.content_dir, self.good_dir)
|
||||
self.assertTrue(are_permissions_roles_seeded(self.COURSE_KEY))
|
||||
=======
|
||||
self.assertFalse(are_permissions_roles_seeded('/'.join(self.BASE_COURSE_ID)))
|
||||
call_command('import', self.content_dir, self.good_dir)
|
||||
self.assertTrue(are_permissions_roles_seeded('/'.join(self.BASE_COURSE_ID)))
|
||||
>>>>>>> edx/master
|
||||
self.assertTrue(are_permissions_roles_seeded(self.BASE_COURSE_KEY))
|
||||
|
||||
def test_duplicate_with_url(self):
|
||||
"""
|
||||
@@ -106,19 +74,11 @@ class TestImport(ModuleStoreTestCase):
|
||||
# Load up base course and verify it is available
|
||||
call_command('import', self.content_dir, self.good_dir)
|
||||
store = modulestore()
|
||||
<<<<<<< HEAD
|
||||
self.assertIsNotNone(store.get_course(self.COURSE_KEY))
|
||||
self.assertIsNotNone(store.get_course(self.BASE_COURSE_KEY))
|
||||
|
||||
# Now load up duped course and verify it doesn't load
|
||||
call_command('import', self.content_dir, self.dupe_dir)
|
||||
self.assertIsNone(store.get_course(self.DIFF_KEY))
|
||||
self.assertTrue(are_permissions_roles_seeded(self.COURSE_KEY))
|
||||
=======
|
||||
self.assertIsNotNone(store.get_course('/'.join(self.BASE_COURSE_ID)))
|
||||
|
||||
# Now load up duped course and verify it doesn't load
|
||||
call_command('import', self.content_dir, self.dupe_dir)
|
||||
self.assertIsNone(store.get_course('/'.join(self.DIFF_RUN)))
|
||||
|
||||
def test_truncated_course_with_url(self):
|
||||
"""
|
||||
@@ -130,9 +90,8 @@ class TestImport(ModuleStoreTestCase):
|
||||
# Load up base course and verify it is available
|
||||
call_command('import', self.content_dir, self.good_dir)
|
||||
store = modulestore()
|
||||
self.assertIsNotNone(store.get_course('/'.join(self.BASE_COURSE_ID)))
|
||||
self.assertIsNotNone(store.get_course(self.BASE_COURSE_KEY))
|
||||
|
||||
# Now load up the course with a similar course_id and verify it loads
|
||||
call_command('import', self.content_dir, self.course_dir)
|
||||
self.assertIsNotNone(store.get_course('/'.join(self.TRUNCATED_COURSE)))
|
||||
>>>>>>> edx/master
|
||||
self.assertIsNotNone(store.get_course(self.TRUNCATED_KEY))
|
||||
|
||||
@@ -70,11 +70,6 @@ class ContentStoreImportTest(ModuleStoreTestCase):
|
||||
'''
|
||||
content_store = contentstore()
|
||||
module_store = modulestore('direct')
|
||||
<<<<<<< HEAD
|
||||
import_from_xml(module_store, 'common/test/data/', ['test_import_course'], static_content_store=content_store, do_import_static=False, verbose=True)
|
||||
course_id = SlashSeparatedCourseKey('edX', 'test_import_course', '2012_Fall')
|
||||
course = module_store.get_course(course_id)
|
||||
=======
|
||||
import_from_xml(
|
||||
module_store,
|
||||
'common/test/data/',
|
||||
@@ -83,11 +78,8 @@ class ContentStoreImportTest(ModuleStoreTestCase):
|
||||
do_import_static=False,
|
||||
verbose=True,
|
||||
)
|
||||
course_location = CourseDescriptor.id_to_location(
|
||||
'edX/test_import_course/2012_Fall'
|
||||
)
|
||||
course = module_store.get_item(course_location)
|
||||
>>>>>>> edx/master
|
||||
course_id = SlashSeparatedCourseKey('edX', 'test_import_course', '2012_Fall')
|
||||
course = module_store.get_course(course_id)
|
||||
self.assertIsNotNone(course)
|
||||
|
||||
return module_store, content_store, course
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
# pylint: disable=E0611
|
||||
from nose.tools import assert_equals, assert_raises, \
|
||||
<<<<<<< HEAD
|
||||
assert_not_equals, assert_false, assert_true, assert_greater, assert_is_instance
|
||||
=======
|
||||
assert_not_equals, assert_false, assert_true
|
||||
from itertools import ifilter
|
||||
>>>>>>> edx/master
|
||||
# pylint: enable=E0611
|
||||
from path import path
|
||||
import pymongo
|
||||
@@ -26,11 +22,8 @@ from xmodule.tests import DATA_DIR
|
||||
from xmodule.modulestore import Location, MONGO_MODULESTORE_TYPE
|
||||
from xmodule.modulestore.mongo import MongoModuleStore, MongoKeyValueStore
|
||||
from xmodule.modulestore.draft import DraftModuleStore
|
||||
<<<<<<< HEAD
|
||||
from xmodule.modulestore.locations import SlashSeparatedCourseKey, AssetLocation
|
||||
=======
|
||||
from xmodule.modulestore.xml_exporter import export_to_xml
|
||||
>>>>>>> edx/master
|
||||
from xmodule.modulestore.xml_importer import import_from_xml, perform_xlint
|
||||
from xmodule.contentstore.mongo import MongoContentStore
|
||||
|
||||
@@ -363,7 +356,6 @@ class TestMongoModuleStore(unittest.TestCase):
|
||||
}
|
||||
)
|
||||
|
||||
<<<<<<< HEAD
|
||||
def check_xblock_fields():
|
||||
def check_children(xblock):
|
||||
for child in xblock.children:
|
||||
@@ -403,7 +395,7 @@ class TestMongoModuleStore(unittest.TestCase):
|
||||
setup_test()
|
||||
check_xblock_fields()
|
||||
check_mongo_fields()
|
||||
=======
|
||||
|
||||
def test_export_course_image(self):
|
||||
"""
|
||||
Test to make sure that we have a course image in the contentstore,
|
||||
@@ -454,8 +446,6 @@ class TestMongoModuleStore(unittest.TestCase):
|
||||
shutil.rmtree(root_dir)
|
||||
|
||||
|
||||
>>>>>>> edx/master
|
||||
|
||||
class TestMongoKeyValueStore(object):
|
||||
"""
|
||||
Tests for MongoKeyValueStore.
|
||||
|
||||
@@ -188,43 +188,6 @@ def import_from_xml(
|
||||
for module in xml_module_store.modules[course_key].itervalues():
|
||||
if module.scope_ids.block_type == 'course':
|
||||
course_data_path = path(data_dir) / module.data_dir
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
course_location = module.location
|
||||
course_org_lower = course_location.org.lower()
|
||||
course_number_lower = course_location.course.lower()
|
||||
|
||||
# Check to see if a course with the same
|
||||
# pseudo_course_id, but different run exists in
|
||||
# the passed store to avoid broken courses
|
||||
courses = store.get_courses()
|
||||
bad_run = False
|
||||
if target_location_namespace is None:
|
||||
for course in courses:
|
||||
if course.location.org.lower() == course_org_lower and \
|
||||
course.location.course.lower() == course_number_lower:
|
||||
log.debug('Import is overwriting existing course')
|
||||
# Importing over existing course, check
|
||||
# that runs match or fail
|
||||
if course.location.name != module.location.name:
|
||||
log.error(
|
||||
'A course with ID %s exists, and this '
|
||||
'course has the same organization and '
|
||||
'course number, but a different term that '
|
||||
'is fully identified as %s.',
|
||||
course.location.course_id,
|
||||
module.location.course_id
|
||||
)
|
||||
bad_run = True
|
||||
break
|
||||
if bad_run:
|
||||
# Skip this course, but keep trying to import courses
|
||||
continue
|
||||
|
||||
log.debug('======> IMPORTING course to location {loc}'.format(
|
||||
loc=course_location
|
||||
))
|
||||
>>>>>>> edx/master
|
||||
|
||||
log.debug(u'======> IMPORTING course {course_key}'.format(
|
||||
course_key=course_key,
|
||||
|
||||
@@ -53,29 +53,13 @@ class TestOptoutCourseEmails(ModuleStoreTestCase):
|
||||
def navigate_to_email_view(self):
|
||||
"""Navigate to the instructor dash's email view"""
|
||||
# Pull up email view on instructor dashboard
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
# Response loads the whole instructor dashboard, so no need to explicitly
|
||||
# navigate to a particular email section
|
||||
>>>>>>> edx/master
|
||||
response = self.client.get(url)
|
||||
email_section = '<div class="vert-left send-email" id="section-send-email">'
|
||||
# If this fails, it is likely because ENABLE_INSTRUCTOR_EMAIL is set to False
|
||||
<<<<<<< HEAD
|
||||
self.assertTrue(email_link in response.content)
|
||||
|
||||
# Select the Email view of the instructor dash
|
||||
session = self.client.session
|
||||
session[u'idash_mode:{0}'.format(self.course.location.course_key.to_deprecated_string())] = 'Email'
|
||||
session.save()
|
||||
response = self.client.get(url)
|
||||
selected_email_link = '<a href="#" onclick="goto(\'Email\')" class="selectedmode">Email</a>'
|
||||
self.assertTrue(selected_email_link in response.content)
|
||||
=======
|
||||
self.assertTrue(email_section in response.content)
|
||||
>>>>>>> edx/master
|
||||
|
||||
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
|
||||
def test_optout_course(self):
|
||||
@@ -93,10 +77,6 @@ class TestOptoutCourseEmails(ModuleStoreTestCase):
|
||||
self.client.login(username=self.instructor.username, password="test")
|
||||
self.navigate_to_email_view()
|
||||
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
=======
|
||||
>>>>>>> edx/master
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'send_to': 'all',
|
||||
@@ -125,10 +105,6 @@ class TestOptoutCourseEmails(ModuleStoreTestCase):
|
||||
self.client.login(username=self.instructor.username, password="test")
|
||||
self.navigate_to_email_view()
|
||||
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
=======
|
||||
>>>>>>> edx/master
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'send_to': 'all',
|
||||
|
||||
@@ -71,34 +71,18 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
|
||||
self.client.login(username=self.instructor.username, password="test")
|
||||
|
||||
# Pull up email view on instructor dashboard
|
||||
<<<<<<< HEAD
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
=======
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
# Response loads the whole instructor dashboard, so no need to explicitly
|
||||
# navigate to a particular email section
|
||||
>>>>>>> edx/master
|
||||
response = self.client.get(self.url)
|
||||
email_section = '<div class="vert-left send-email" id="section-send-email">'
|
||||
# If this fails, it is likely because ENABLE_INSTRUCTOR_EMAIL is set to False
|
||||
<<<<<<< HEAD
|
||||
self.assertTrue(email_link in response.content)
|
||||
|
||||
# Select the Email view of the instructor dash
|
||||
session = self.client.session
|
||||
session[u'idash_mode:{0}'.format(self.course.location.course_key.to_deprecated_string())] = 'Email'
|
||||
session.save()
|
||||
response = self.client.get(self.url)
|
||||
selected_email_link = '<a href="#" onclick="goto(\'Email\')" class="selectedmode">Email</a>'
|
||||
self.assertTrue(selected_email_link in response.content)
|
||||
=======
|
||||
self.assertTrue(email_section in response.content)
|
||||
self.send_mail_url = reverse('send_email', kwargs={'course_id': self.course.id})
|
||||
self.send_mail_url = reverse('send_email', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
self.success_content = {
|
||||
'course_id': self.course.id,
|
||||
'course_id': self.course.id.to_deprecated_string(),
|
||||
'success': True,
|
||||
}
|
||||
>>>>>>> edx/master
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
|
||||
@@ -55,16 +55,12 @@ class TestEmailErrors(ModuleStoreTestCase):
|
||||
|
||||
# load initial content (since we don't run migrations as part of tests):
|
||||
call_command("loaddata", "course_email_template.json")
|
||||
<<<<<<< HEAD
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
=======
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
self.send_mail_url = reverse('send_email', kwargs={'course_id': self.course.id})
|
||||
self.send_mail_url = reverse('send_email', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
self.success_content = {
|
||||
'course_id': self.course.id,
|
||||
'course_id': self.course.id.to_deprecated_string(),
|
||||
'success': True,
|
||||
}
|
||||
>>>>>>> edx/master
|
||||
|
||||
def tearDown(self):
|
||||
patch.stopall()
|
||||
|
||||
@@ -252,20 +252,6 @@ class TestGetProblemGradeDistribution(ModuleStoreTestCase):
|
||||
b_section_has_problem = get_array_section_has_problem(self.course.id)
|
||||
self.assertEquals(b_section_has_problem[0], True)
|
||||
|
||||
<<<<<<< HEAD:lms/djangoapps/class_dashboard/tests/test_dashboard_data.py
|
||||
def test_dashboard(self):
|
||||
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
response = self.client.post(
|
||||
url,
|
||||
{
|
||||
'idash_mode': 'Metrics'
|
||||
}
|
||||
)
|
||||
self.assertContains(response, '<h2>Course Statistics At A Glance</h2>')
|
||||
|
||||
=======
|
||||
>>>>>>> edx/master:lms/djangoapps/class_dashboard/tests/test_dashboard_data.py
|
||||
def test_has_instructor_access_for_class(self):
|
||||
"""
|
||||
Test for instructor access
|
||||
|
||||
@@ -103,18 +103,9 @@ def get_opt_course_with_access(user, action, course_key):
|
||||
|
||||
|
||||
def course_image_url(course):
|
||||
<<<<<<< HEAD
|
||||
""" Determine whether this is an XML or Studio-backed course, and return the appropriate course_image URL """
|
||||
if course.static_asset_path or modulestore().get_modulestore_type(course.id) == XML_MODULESTORE_TYPE:
|
||||
return '/static/' + (course.static_asset_path or getattr(course, 'data_dir', '')) + "/images/course_image.jpg"
|
||||
else:
|
||||
loc = StaticContent.compute_location(course.location.course_key, course.course_image)
|
||||
_path = loc.to_deprecated_string()
|
||||
return _path
|
||||
=======
|
||||
"""Try to look up the image url for the course. If it's not found,
|
||||
log an error and return the dead link"""
|
||||
if course.static_asset_path or modulestore().get_modulestore_type(course.location.course_id) == XML_MODULESTORE_TYPE:
|
||||
if course.static_asset_path or modulestore().get_modulestore_type(course.id) == XML_MODULESTORE_TYPE:
|
||||
# If we are a static course with the course_image attribute
|
||||
# set different than the default, return that path so that
|
||||
# courses can use custom course image paths, otherwise just
|
||||
@@ -125,10 +116,9 @@ def course_image_url(course):
|
||||
else:
|
||||
url += '/images/course_image.jpg'
|
||||
else:
|
||||
loc = StaticContent.compute_location(course.location.org, course.location.course, course.course_image)
|
||||
url = StaticContent.get_url_path_from_location(loc)
|
||||
loc = StaticContent.compute_location(course.id, course.course_image)
|
||||
url = loc.to_deprecated_string()
|
||||
return url
|
||||
>>>>>>> edx/master
|
||||
|
||||
|
||||
def find_file(filesystem, dirs, filename):
|
||||
|
||||
@@ -86,26 +86,15 @@ def create_thread(request, course_id, commentable_id):
|
||||
if 'body' not in post or not post['body'].strip():
|
||||
return JsonError(_("Body can't be empty"))
|
||||
|
||||
<<<<<<< HEAD
|
||||
thread = cc.Thread(**extract(post, ['body', 'title']))
|
||||
thread.update_attributes(**{
|
||||
'anonymous': anonymous,
|
||||
'anonymous_to_peers': anonymous_to_peers,
|
||||
'commentable_id': commentable_id,
|
||||
'course_id': course_id.to_deprecated_string(),
|
||||
'user_id': request.user.id,
|
||||
})
|
||||
=======
|
||||
thread = cc.Thread(
|
||||
anonymous=anonymous,
|
||||
anonymous_to_peers=anonymous_to_peers,
|
||||
commentable_id=commentable_id,
|
||||
course_id=course_id,
|
||||
course_id=course_id.to_deprecated_string(),
|
||||
user_id=request.user.id,
|
||||
body=post["body"],
|
||||
title=post["title"]
|
||||
)
|
||||
>>>>>>> edx/master
|
||||
|
||||
user = cc.User.from_django_user(request.user)
|
||||
|
||||
@@ -190,26 +179,15 @@ def _create_comment(request, course_key, thread_id=None, parent_id=None):
|
||||
else:
|
||||
anonymous_to_peers = False
|
||||
|
||||
<<<<<<< HEAD
|
||||
comment.update_attributes(**{
|
||||
'anonymous': anonymous,
|
||||
'anonymous_to_peers': anonymous_to_peers,
|
||||
'user_id': request.user.id,
|
||||
'course_id': course_key.to_deprecated_string(),
|
||||
'thread_id': thread_id,
|
||||
'parent_id': parent_id,
|
||||
})
|
||||
=======
|
||||
comment = cc.Comment(
|
||||
anonymous=anonymous,
|
||||
anonymous_to_peers=anonymous_to_peers,
|
||||
user_id=request.user.id,
|
||||
course_id=course_id,
|
||||
course_id=course_id.to_deprecated_string(),
|
||||
thread_id=thread_id,
|
||||
parent_id=parent_id,
|
||||
body=post["body"]
|
||||
)
|
||||
>>>>>>> edx/master
|
||||
comment.save()
|
||||
if post.get('auto_subscribe', 'false').lower() == 'true':
|
||||
user = cc.User.from_django_user(request.user)
|
||||
|
||||
@@ -35,11 +35,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase):
|
||||
self.client.login(username=instructor.username, password="test")
|
||||
|
||||
# URL for instructor dash
|
||||
<<<<<<< HEAD
|
||||
self.url = reverse('instructor_dashboard_2', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
=======
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
>>>>>>> edx/master
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
# URL for email view
|
||||
self.email_link = '<a href="" data-section="send_email">Email</a>'
|
||||
|
||||
@@ -127,11 +123,7 @@ class TestNewInstructorDashboardEmailViewXMLBacked(ModuleStoreTestCase):
|
||||
self.client.login(username=instructor.username, password="test")
|
||||
|
||||
# URL for instructor dash
|
||||
<<<<<<< HEAD
|
||||
self.url = reverse('instructor_dashboard_2', kwargs={'course_id': self.course_key.to_deprecated_string()})
|
||||
=======
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course_name})
|
||||
>>>>>>> edx/master
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course_key.to_deprecated_string()})
|
||||
# URL for email view
|
||||
self.email_link = '<a href="" data-section="send_email">Email</a>'
|
||||
|
||||
|
||||
@@ -53,11 +53,7 @@ class TestInstructorDashboardAnonCSV(ModuleStoreTestCase, LoginEnrollmentTestCas
|
||||
|
||||
def test_download_anon_csv(self):
|
||||
course = self.toy
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
|
||||
with patch('instructor.views.legacy.unique_id_for_user') as mock_unique:
|
||||
mock_unique.return_value = 42
|
||||
|
||||
@@ -50,11 +50,7 @@ class TestInstructorDashboardGradeDownloadCSV(ModuleStoreTestCase, LoginEnrollme
|
||||
|
||||
def test_download_grades_csv(self):
|
||||
course = self.toy
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
msg = "url = {0}\n".format(url)
|
||||
response = self.client.post(url, {'action': 'Download CSV of all student grades for this course'})
|
||||
msg += "instructor dashboard download csv grades: response = '{0}'\n".format(response)
|
||||
|
||||
@@ -32,11 +32,7 @@ class TestInstructorDashboardEmailView(ModuleStoreTestCase):
|
||||
self.client.login(username=instructor.username, password="test")
|
||||
|
||||
# URL for instructor dash
|
||||
<<<<<<< HEAD
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
=======
|
||||
self.url = reverse('instructor_dashboard_legacy', kwargs={'course_id': self.course.id})
|
||||
>>>>>>> edx/master
|
||||
self.url = reverse('instructor_dashboard_legacy', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
# URL for email view
|
||||
self.email_link = '<a href="#" onclick="goto(\'Email\')" class="None">Email</a>'
|
||||
|
||||
|
||||
@@ -52,11 +52,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
course = self.course
|
||||
|
||||
# Run the Un-enroll students command
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
response = self.client.post(
|
||||
url,
|
||||
{
|
||||
@@ -88,11 +84,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
course = self.course
|
||||
|
||||
# Run the Enroll students command
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
response = self.client.post(url, {'action': 'Enroll multiple students', 'multiple_students': 'student1_1@test.com, student1_2@test.com', 'auto_enroll': 'on'})
|
||||
|
||||
# Check the page output
|
||||
@@ -137,11 +129,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
|
||||
course = self.course
|
||||
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
response = self.client.post(url, {'action': 'Enroll multiple students', 'multiple_students': 'student0@test.com', 'auto_enroll': 'on'})
|
||||
self.assertContains(response, '<td>student0@test.com</td>')
|
||||
self.assertContains(response, '<td>already enrolled</td>')
|
||||
@@ -154,11 +142,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
course = self.course
|
||||
|
||||
# Run the Enroll students command
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
response = self.client.post(url, {'action': 'Enroll multiple students', 'multiple_students': 'student2_1@test.com, student2_2@test.com'})
|
||||
|
||||
# Check the page output
|
||||
@@ -215,11 +199,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
# Create activated, but not enrolled, user
|
||||
UserFactory.create(username="student3_0", email="student3_0@test.com", first_name='Autoenrolled')
|
||||
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
response = self.client.post(url, {'action': 'Enroll multiple students', 'multiple_students': 'student3_0@test.com, student3_1@test.com, student3_2@test.com', 'auto_enroll': 'on', 'email_students': 'on'})
|
||||
|
||||
# Check the page output
|
||||
@@ -274,11 +254,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
cea = CourseEnrollmentAllowed(email='student4_0@test.com', course_id=course.id)
|
||||
cea.save()
|
||||
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
response = self.client.post(url, {'action': 'Unenroll multiple students', 'multiple_students': 'student4_0@test.com, student2@test.com, student3@test.com', 'email_students': 'on'})
|
||||
|
||||
# Check the page output
|
||||
@@ -325,11 +301,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
# Create activated, but not enrolled, user
|
||||
UserFactory.create(username="student5_0", email="student5_0@test.com", first_name="ShibTest", last_name="Enrolled")
|
||||
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
response = self.client.post(url, {'action': 'Enroll multiple students', 'multiple_students': 'student5_0@test.com, student5_1@test.com', 'auto_enroll': 'on', 'email_students': 'on'})
|
||||
|
||||
# Check the page output
|
||||
|
||||
@@ -68,11 +68,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
|
||||
def test_add_forum_admin_users_for_unknown_user(self):
|
||||
course = self.toy
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
username = 'unknown'
|
||||
for action in ['Add', 'Remove']:
|
||||
for rolename in FORUM_ROLES:
|
||||
@@ -81,11 +77,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
|
||||
def test_add_forum_admin_users_for_missing_roles(self):
|
||||
course = self.toy
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
username = 'u1'
|
||||
for action in ['Add', 'Remove']:
|
||||
for rolename in FORUM_ROLES:
|
||||
@@ -95,11 +87,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
def test_remove_forum_admin_users_for_missing_users(self):
|
||||
course = self.toy
|
||||
self.initialize_roles(course.id)
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
username = 'u1'
|
||||
action = 'Remove'
|
||||
for rolename in FORUM_ROLES:
|
||||
@@ -109,11 +97,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
def test_add_and_remove_forum_admin_users(self):
|
||||
course = self.toy
|
||||
self.initialize_roles(course.id)
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
username = 'u2'
|
||||
for rolename in FORUM_ROLES:
|
||||
response = self.client.post(url, {'action': action_name('Add', rolename), FORUM_ADMIN_USER[rolename]: username})
|
||||
@@ -126,11 +110,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
def test_add_and_read_forum_admin_users(self):
|
||||
course = self.toy
|
||||
self.initialize_roles(course.id)
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
username = 'u2'
|
||||
for rolename in FORUM_ROLES:
|
||||
# perform an add, and follow with a second identical add:
|
||||
@@ -142,11 +122,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
def test_add_nonstaff_forum_admin_users(self):
|
||||
course = self.toy
|
||||
self.initialize_roles(course.id)
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
username = 'u1'
|
||||
rolename = FORUM_ROLE_ADMINISTRATOR
|
||||
response = self.client.post(url, {'action': action_name('Add', rolename), FORUM_ADMIN_USER[rolename]: username})
|
||||
@@ -155,11 +131,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
def test_list_forum_admin_users(self):
|
||||
course = self.toy
|
||||
self.initialize_roles(course.id)
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id.to_deprecated_string()})
|
||||
username = 'u2'
|
||||
added_roles = [FORUM_ROLE_STUDENT] # u2 is already added as a student to the discussion forums
|
||||
self.assertTrue(has_forum_access(username, course.id, 'Student'))
|
||||
|
||||
@@ -68,14 +68,10 @@ class TestGradebook(ModuleStoreTestCase):
|
||||
module_state_key=item.location
|
||||
)
|
||||
|
||||
<<<<<<< HEAD
|
||||
self.response = self.client.get(reverse(
|
||||
'gradebook',
|
||||
'gradebook_legacy',
|
||||
args=(self.course.id.to_deprecated_string(),)
|
||||
))
|
||||
=======
|
||||
self.response = self.client.get(reverse('gradebook_legacy', args=(self.course.id,)))
|
||||
>>>>>>> edx/master
|
||||
|
||||
def test_response_code(self):
|
||||
self.assertEquals(self.response.status_code, 200)
|
||||
|
||||
@@ -45,11 +45,7 @@ class TestRawGradeCSV(TestSubmittingProblems):
|
||||
resp = self.submit_question_answer('p2', {'2_1': 'Correct'})
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': self.course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
msg = "url = {0}\n".format(url)
|
||||
response = self.client.post(url, {'action': 'Download CSV of all RAW grades'})
|
||||
msg += "instructor dashboard download raw csv grades: response = '{0}'\n".format(response)
|
||||
|
||||
@@ -61,11 +61,7 @@ class InstructorResetStudentStateTest(ModuleStoreTestCase, LoginEnrollmentTestCa
|
||||
sub_api.set_score(submission['uuid'], 1, 2)
|
||||
|
||||
# Delete student state using the instructor dash
|
||||
<<<<<<< HEAD
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
=======
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': self.course.id})
|
||||
>>>>>>> edx/master
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': self.course.id.to_deprecated_string()})
|
||||
response = self.client.post(url, {
|
||||
'action': 'Delete student state for module',
|
||||
'unique_student_identifier': self.student.email,
|
||||
|
||||
@@ -1082,15 +1082,11 @@ def send_email(request, course_id):
|
||||
|
||||
# Submit the task, so that the correct InstructorTask object gets created (for monitoring purposes)
|
||||
instructor_task.api.submit_bulk_course_email(request, course_id, email.id) # pylint: disable=E1101
|
||||
<<<<<<< HEAD
|
||||
response_payload = {'course_id': course_id.to_deprecated_string()}
|
||||
=======
|
||||
|
||||
response_payload = {
|
||||
'course_id': course_id,
|
||||
'course_id': course_id.to_deprecated_string(),
|
||||
'success': True,
|
||||
}
|
||||
>>>>>>> edx/master
|
||||
return JsonResponse(response_payload)
|
||||
|
||||
|
||||
|
||||
@@ -83,11 +83,7 @@ def instructor_dashboard_2(request, course_id):
|
||||
|
||||
context = {
|
||||
'course': course,
|
||||
<<<<<<< HEAD
|
||||
'old_dashboard_url': reverse('instructor_dashboard', kwargs={'course_id': course_key.to_deprecated_string()}),
|
||||
=======
|
||||
'old_dashboard_url': reverse('instructor_dashboard_legacy', kwargs={'course_id': course_id}),
|
||||
>>>>>>> edx/master
|
||||
'old_dashboard_url': reverse('instructor_dashboard_legacy', kwargs={'course_id': course_id.to_deprecated_string()}),
|
||||
'studio_url': studio_url,
|
||||
'sections': sections,
|
||||
'disable_buttons': disable_buttons,
|
||||
@@ -169,21 +165,13 @@ def _section_student_admin(course_key, access):
|
||||
'section_key': 'student_admin',
|
||||
'section_display_name': _('Student Admin'),
|
||||
'access': access,
|
||||
<<<<<<< HEAD
|
||||
'get_student_progress_url_url': reverse('get_student_progress_url', kwargs={'course_id': course_key.to_deprecated_string()}),
|
||||
'enrollment_url': reverse('students_update_enrollment', kwargs={'course_id': course_key.to_deprecated_string()}),
|
||||
'reset_student_attempts_url': reverse('reset_student_attempts', kwargs={'course_id': course_key.to_deprecated_string()}),
|
||||
'rescore_problem_url': reverse('rescore_problem', kwargs={'course_id': course_key.to_deprecated_string()}),
|
||||
'list_instructor_tasks_url': reverse('list_instructor_tasks', kwargs={'course_id': course_key.to_deprecated_string()}),
|
||||
=======
|
||||
'is_small_course': is_small_course,
|
||||
'get_student_progress_url_url': reverse('get_student_progress_url', kwargs={'course_id': course_id}),
|
||||
'enrollment_url': reverse('students_update_enrollment', kwargs={'course_id': course_id}),
|
||||
'reset_student_attempts_url': reverse('reset_student_attempts', kwargs={'course_id': course_id}),
|
||||
'rescore_problem_url': reverse('rescore_problem', kwargs={'course_id': course_id}),
|
||||
'list_instructor_tasks_url': reverse('list_instructor_tasks', kwargs={'course_id': course_id}),
|
||||
'spoc_gradebook_url': reverse('spoc_gradebook', kwargs={'course_id': course_id}),
|
||||
>>>>>>> edx/master
|
||||
'get_student_progress_url_url': reverse('get_student_progress_url', kwargs={'course_id': course_id.to_deprecated_string()}),
|
||||
'enrollment_url': reverse('students_update_enrollment', kwargs={'course_id': course_id.to_deprecated_string()}),
|
||||
'reset_student_attempts_url': reverse('reset_student_attempts', kwargs={'course_id': course_id.to_deprecated_string()}),
|
||||
'rescore_problem_url': reverse('rescore_problem', kwargs={'course_id': course_id.to_deprecated_string()}),
|
||||
'list_instructor_tasks_url': reverse('list_instructor_tasks', kwargs={'course_id': course_id.to_deprecated_string()}),
|
||||
'spoc_gradebook_url': reverse('spoc_gradebook', kwargs={'course_id': course_id.to_deprecated_string()}),
|
||||
}
|
||||
return section_data
|
||||
|
||||
|
||||
@@ -1038,14 +1038,7 @@ def instructor_dashboard(request, course_id):
|
||||
'metrics_results': metrics_results,
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if settings.FEATURES.get('ENABLE_INSTRUCTOR_BETA_DASHBOARD'):
|
||||
context['beta_dashboard_url'] = reverse(
|
||||
'instructor_dashboard_2', kwargs={'course_id': course_key.to_deprecated_string()}
|
||||
)
|
||||
=======
|
||||
context['standard_dashboard_url'] = reverse('instructor_dashboard', kwargs={'course_id': course_id})
|
||||
>>>>>>> edx/master
|
||||
context['standard_dashboard_url'] = reverse('instructor_dashboard', kwargs={'course_id': course_id.to_deprecated_string()})
|
||||
|
||||
return render_to_response('courseware/instructor_dashboard.html', context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user