Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d01af063
Commit
d01af063
authored
May 24, 2014
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3861 from edx/sarina/fix-quality
Fix quality violations from opaque-keys
parents
b56e12ff
6f7bc7e1
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
177 additions
and
168 deletions
+177
-168
cms/djangoapps/contentstore/views/course.py
+1
-1
cms/djangoapps/contentstore/views/import_export.py
+0
-1
common/djangoapps/course_groups/cohorts.py
+1
-0
common/djangoapps/course_groups/models.py
+0
-1
common/djangoapps/student/management/commands/anonymized_id_mapping.py
+0
-1
common/djangoapps/student/management/commands/create_random_users.py
+12
-10
common/djangoapps/student/management/commands/get_grades.py
+4
-0
common/djangoapps/student/roles.py
+0
-1
common/djangoapps/student/tests/test_roles.py
+39
-40
common/lib/xmodule/xmodule/modulestore/loc_mapper_store.py
+0
-1
common/lib/xmodule/xmodule/modulestore/locator.py
+3
-4
common/lib/xmodule/xmodule/modulestore/tests/test_locators.py
+6
-6
lms/djangoapps/bulk_email/forms.py
+1
-2
lms/djangoapps/bulk_email/tasks.py
+0
-1
lms/djangoapps/bulk_email/tests/test_email.py
+2
-2
lms/djangoapps/certificates/management/commands/cert_whitelist.py
+5
-1
lms/djangoapps/certificates/management/commands/ungenerated_certs.py
+5
-1
lms/djangoapps/course_wiki/tests/test_access.py
+2
-2
lms/djangoapps/course_wiki/tests/test_middleware.py
+1
-1
lms/djangoapps/courseware/features/lti.py
+3
-3
lms/djangoapps/courseware/models.py
+6
-1
lms/djangoapps/courseware/module_render.py
+3
-3
lms/djangoapps/courseware/tests/factories.py
+15
-10
lms/djangoapps/courseware/tests/test_access.py
+4
-5
lms/djangoapps/courseware/tests/test_lti_integration.py
+1
-1
lms/djangoapps/courseware/tests/test_masquerade.py
+1
-1
lms/djangoapps/courseware/tests/test_video_handlers.py
+0
-1
lms/djangoapps/courseware/tests/test_view_authentication.py
+5
-6
lms/djangoapps/courseware/tests/tests.py
+7
-8
lms/djangoapps/courseware/views.py
+0
-1
lms/djangoapps/django_comment_client/management/commands/seed_permissions_roles.py
+3
-0
lms/djangoapps/instructor/features/bulk_email.py
+5
-5
lms/djangoapps/instructor/features/common.py
+5
-5
lms/djangoapps/instructor/management/commands/compute_grades.py
+5
-5
lms/djangoapps/instructor/management/commands/dump_grades.py
+7
-5
lms/djangoapps/instructor/management/commands/openended_post.py
+0
-1
lms/djangoapps/instructor/management/commands/openended_stats.py
+0
-1
lms/djangoapps/instructor/offline_gradecalc.py
+8
-7
lms/djangoapps/instructor/tests/test_api.py
+14
-15
lms/djangoapps/instructor/tests/test_enrollment.py
+0
-2
lms/djangoapps/instructor/tests/test_legacy_gradebook.py
+0
-1
lms/djangoapps/instructor/tests/test_legacy_reset.py
+0
-1
lms/djangoapps/notes/api.py
+3
-3
lms/djangoapps/psychometrics/management/commands/init_psychometrics.py
+0
-1
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
d01af063
...
@@ -21,7 +21,7 @@ from xmodule.modulestore.django import modulestore
...
@@ -21,7 +21,7 @@ from xmodule.modulestore.django import modulestore
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.tabs
import
PDFTextbookTabs
from
xmodule.tabs
import
PDFTextbookTabs
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
InvalidLocationError
,
InsufficientSpecificationError
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
InvalidLocationError
from
opaque_keys
import
InvalidKeyError
from
opaque_keys
import
InvalidKeyError
from
xmodule.modulestore.locations
import
Location
,
SlashSeparatedCourseKey
from
xmodule.modulestore.locations
import
Location
,
SlashSeparatedCourseKey
...
...
cms/djangoapps/contentstore/views/import_export.py
View file @
d01af063
...
@@ -30,7 +30,6 @@ from xmodule.modulestore.xml_exporter import export_to_xml
...
@@ -30,7 +30,6 @@ from xmodule.modulestore.xml_exporter import export_to_xml
from
.access
import
has_course_access
from
.access
import
has_course_access
from
.access
import
has_course_access
from
extract_tar
import
safetar_extractall
from
extract_tar
import
safetar_extractall
from
student
import
auth
from
student
import
auth
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
,
GlobalStaff
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
,
GlobalStaff
...
...
common/djangoapps/course_groups/cohorts.py
View file @
d01af063
...
@@ -32,6 +32,7 @@ def local_random():
...
@@ -32,6 +32,7 @@ def local_random():
return
_local_random
return
_local_random
def
is_course_cohorted
(
course_key
):
def
is_course_cohorted
(
course_key
):
"""
"""
Given a course key, return a boolean for whether or not the course is
Given a course key, return a boolean for whether or not the course is
...
...
common/djangoapps/course_groups/models.py
View file @
d01af063
...
@@ -24,7 +24,6 @@ class CourseUserGroup(models.Model):
...
@@ -24,7 +24,6 @@ class CourseUserGroup(models.Model):
# Note: groups associated with particular runs of a course. E.g. Fall 2012 and Spring
# Note: groups associated with particular runs of a course. E.g. Fall 2012 and Spring
# 2013 versions of 6.00x will have separate groups.
# 2013 versions of 6.00x will have separate groups.
# TODO change field name to course_key
course_id
=
CourseKeyField
(
max_length
=
255
,
db_index
=
True
,
course_id
=
CourseKeyField
(
max_length
=
255
,
db_index
=
True
,
help_text
=
"Which course is this group associated with?"
)
help_text
=
"Which course is this group associated with?"
)
...
...
common/djangoapps/student/management/commands/anonymized_id_mapping.py
View file @
d01af063
...
@@ -13,7 +13,6 @@ import csv
...
@@ -13,7 +13,6 @@ import csv
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
,
CommandError
from
opaque_keys
import
InvalidKeyError
from
student.models
import
anonymous_id_for_user
from
student.models
import
anonymous_id_for_user
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
...
...
common/djangoapps/student/management/commands/create_random_users.py
View file @
d01af063
##
"""
##
A script to create some dummy users
A script to create some dummy users
"""
from
django.core.management.base
import
BaseCommand
from
django.core.management.base
import
BaseCommand
from
student.models
import
CourseEnrollment
from
student.models
import
CourseEnrollment
from
opaque_keys
import
InvalidKeyError
from
xmodule.modulestore.keys
import
CourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
student.views
import
_do_create_account
,
get_random_post_override
from
student.views
import
_do_create_account
,
get_random_post_override
def
create
(
n
,
course_key
):
def
create
(
n
um
,
course_key
):
"""Create n users, enrolling them in course_key if it's not None"""
"""Create n
um
users, enrolling them in course_key if it's not None"""
for
i
in
range
(
n
):
for
i
dx
in
range
(
num
):
(
user
,
user_profile
,
_
)
=
_do_create_account
(
get_random_post_override
())
(
user
,
user_profile
,
_
_
)
=
_do_create_account
(
get_random_post_override
())
if
course_key
is
not
None
:
if
course_key
is
not
None
:
CourseEnrollment
.
enroll
(
user
,
course_key
)
CourseEnrollment
.
enroll
(
user
,
course_key
)
...
@@ -31,7 +33,7 @@ Examples:
...
@@ -31,7 +33,7 @@ Examples:
print
Command
.
help
print
Command
.
help
return
return
n
=
int
(
args
[
0
])
n
um
=
int
(
args
[
0
])
if
len
(
args
)
==
2
:
if
len
(
args
)
==
2
:
try
:
try
:
...
@@ -41,4 +43,4 @@ Examples:
...
@@ -41,4 +43,4 @@ Examples:
else
:
else
:
course_key
=
None
course_key
=
None
create
(
n
,
course_key
)
create
(
n
um
,
course_key
)
common/djangoapps/student/management/commands/get_grades.py
View file @
d01af063
"""
Management command to generate a list of grades for
all students that are enrolled in a course.
"""
from
courseware
import
grades
,
courses
from
courseware
import
grades
,
courses
from
certificates.models
import
GeneratedCertificate
from
certificates.models
import
GeneratedCertificate
from
django.test.client
import
RequestFactory
from
django.test.client
import
RequestFactory
...
...
common/djangoapps/student/roles.py
View file @
d01af063
...
@@ -7,7 +7,6 @@ from abc import ABCMeta, abstractmethod
...
@@ -7,7 +7,6 @@ from abc import ABCMeta, abstractmethod
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
student.models
import
CourseAccessRole
from
student.models
import
CourseAccessRole
from
xmodule_django.models
import
CourseKeyField
class
AccessRole
(
object
):
class
AccessRole
(
object
):
...
...
common/djangoapps/student/tests/test_roles.py
View file @
d01af063
...
@@ -18,13 +18,13 @@ class RolesTestCase(TestCase):
...
@@ -18,13 +18,13 @@ class RolesTestCase(TestCase):
"""
"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course_
id
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
self
.
course_
key
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
self
.
course_loc
=
self
.
course_
id
.
make_usage_key
(
'course'
,
'2012_Fall'
)
self
.
course_loc
=
self
.
course_
key
.
make_usage_key
(
'course'
,
'2012_Fall'
)
self
.
anonymous_user
=
AnonymousUserFactory
()
self
.
anonymous_user
=
AnonymousUserFactory
()
self
.
student
=
UserFactory
()
self
.
student
=
UserFactory
()
self
.
global_staff
=
UserFactory
(
is_staff
=
True
)
self
.
global_staff
=
UserFactory
(
is_staff
=
True
)
self
.
course_staff
=
StaffFactory
(
course
=
self
.
course_id
)
self
.
course_staff
=
StaffFactory
(
course
_key
=
self
.
course_key
)
self
.
course_instructor
=
InstructorFactory
(
course
=
self
.
course_id
)
self
.
course_instructor
=
InstructorFactory
(
course
_key
=
self
.
course_key
)
def
test_global_staff
(
self
):
def
test_global_staff
(
self
):
self
.
assertFalse
(
GlobalStaff
()
.
has_user
(
self
.
student
))
self
.
assertFalse
(
GlobalStaff
()
.
has_user
(
self
.
student
))
...
@@ -55,20 +55,20 @@ class RolesTestCase(TestCase):
...
@@ -55,20 +55,20 @@ class RolesTestCase(TestCase):
Test that giving a user a course role enables access appropriately
Test that giving a user a course role enables access appropriately
"""
"""
self
.
assertFalse
(
self
.
assertFalse
(
CourseStaffRole
(
self
.
course_
id
)
.
has_user
(
self
.
student
),
CourseStaffRole
(
self
.
course_
key
)
.
has_user
(
self
.
student
),
"Student has premature access to {}"
.
format
(
self
.
course_
id
)
"Student has premature access to {}"
.
format
(
self
.
course_
key
)
)
)
CourseStaffRole
(
self
.
course_
id
)
.
add_users
(
self
.
student
)
CourseStaffRole
(
self
.
course_
key
)
.
add_users
(
self
.
student
)
self
.
assertTrue
(
self
.
assertTrue
(
CourseStaffRole
(
self
.
course_
id
)
.
has_user
(
self
.
student
),
CourseStaffRole
(
self
.
course_
key
)
.
has_user
(
self
.
student
),
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
id
))
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
key
))
)
)
# remove access and confirm
# remove access and confirm
CourseStaffRole
(
self
.
course_
id
)
.
remove_users
(
self
.
student
)
CourseStaffRole
(
self
.
course_
key
)
.
remove_users
(
self
.
student
)
self
.
assertFalse
(
self
.
assertFalse
(
CourseStaffRole
(
self
.
course_
id
)
.
has_user
(
self
.
student
),
CourseStaffRole
(
self
.
course_
key
)
.
has_user
(
self
.
student
),
"Student still has access to {}"
.
format
(
self
.
course_
id
)
"Student still has access to {}"
.
format
(
self
.
course_
key
)
)
)
def
test_org_role
(
self
):
def
test_org_role
(
self
):
...
@@ -76,68 +76,67 @@ class RolesTestCase(TestCase):
...
@@ -76,68 +76,67 @@ class RolesTestCase(TestCase):
Test that giving a user an org role enables access appropriately
Test that giving a user an org role enables access appropriately
"""
"""
self
.
assertFalse
(
self
.
assertFalse
(
OrgStaffRole
(
self
.
course_
id
.
org
)
.
has_user
(
self
.
student
),
OrgStaffRole
(
self
.
course_
key
.
org
)
.
has_user
(
self
.
student
),
"Student has premature access to {}"
.
format
(
self
.
course_
id
.
org
)
"Student has premature access to {}"
.
format
(
self
.
course_
key
.
org
)
)
)
OrgStaffRole
(
self
.
course_
id
.
org
)
.
add_users
(
self
.
student
)
OrgStaffRole
(
self
.
course_
key
.
org
)
.
add_users
(
self
.
student
)
self
.
assertTrue
(
self
.
assertTrue
(
OrgStaffRole
(
self
.
course_
id
.
org
)
.
has_user
(
self
.
student
),
OrgStaffRole
(
self
.
course_
key
.
org
)
.
has_user
(
self
.
student
),
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
id
.
org
))
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
key
.
org
))
)
)
# remove access and confirm
# remove access and confirm
OrgStaffRole
(
self
.
course_
id
.
org
)
.
remove_users
(
self
.
student
)
OrgStaffRole
(
self
.
course_
key
.
org
)
.
remove_users
(
self
.
student
)
if
hasattr
(
self
.
student
,
'_roles'
):
if
hasattr
(
self
.
student
,
'_roles'
):
del
self
.
student
.
_roles
del
self
.
student
.
_roles
self
.
assertFalse
(
self
.
assertFalse
(
OrgStaffRole
(
self
.
course_
id
.
org
)
.
has_user
(
self
.
student
),
OrgStaffRole
(
self
.
course_
key
.
org
)
.
has_user
(
self
.
student
),
"Student still has access to {}"
.
format
(
self
.
course_
id
.
org
)
"Student still has access to {}"
.
format
(
self
.
course_
key
.
org
)
)
)
def
test_org_and_course_roles
(
self
):
def
test_org_and_course_roles
(
self
):
"""
"""
Test that Org and course roles don't interfere with course roles or vice versa
Test that Org and course roles don't interfere with course roles or vice versa
"""
"""
OrgInstructorRole
(
self
.
course_
id
.
org
)
.
add_users
(
self
.
student
)
OrgInstructorRole
(
self
.
course_
key
.
org
)
.
add_users
(
self
.
student
)
CourseInstructorRole
(
self
.
course_
id
)
.
add_users
(
self
.
student
)
CourseInstructorRole
(
self
.
course_
key
)
.
add_users
(
self
.
student
)
self
.
assertTrue
(
self
.
assertTrue
(
OrgInstructorRole
(
self
.
course_
id
.
org
)
.
has_user
(
self
.
student
),
OrgInstructorRole
(
self
.
course_
key
.
org
)
.
has_user
(
self
.
student
),
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
id
.
org
))
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
key
.
org
))
)
)
self
.
assertTrue
(
self
.
assertTrue
(
CourseInstructorRole
(
self
.
course_
id
)
.
has_user
(
self
.
student
),
CourseInstructorRole
(
self
.
course_
key
)
.
has_user
(
self
.
student
),
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
id
))
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
key
))
)
)
# remove access and confirm
# remove access and confirm
OrgInstructorRole
(
self
.
course_
id
.
org
)
.
remove_users
(
self
.
student
)
OrgInstructorRole
(
self
.
course_
key
.
org
)
.
remove_users
(
self
.
student
)
self
.
assertFalse
(
self
.
assertFalse
(
OrgInstructorRole
(
self
.
course_
id
.
org
)
.
has_user
(
self
.
student
),
OrgInstructorRole
(
self
.
course_
key
.
org
)
.
has_user
(
self
.
student
),
"Student still has access to {}"
.
format
(
self
.
course_
id
.
org
)
"Student still has access to {}"
.
format
(
self
.
course_
key
.
org
)
)
)
self
.
assertTrue
(
self
.
assertTrue
(
CourseInstructorRole
(
self
.
course_
id
)
.
has_user
(
self
.
student
),
CourseInstructorRole
(
self
.
course_
key
)
.
has_user
(
self
.
student
),
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
id
))
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
key
))
)
)
# ok now keep org role and get rid of course one
# ok now keep org role and get rid of course one
OrgInstructorRole
(
self
.
course_
id
.
org
)
.
add_users
(
self
.
student
)
OrgInstructorRole
(
self
.
course_
key
.
org
)
.
add_users
(
self
.
student
)
CourseInstructorRole
(
self
.
course_
id
)
.
remove_users
(
self
.
student
)
CourseInstructorRole
(
self
.
course_
key
)
.
remove_users
(
self
.
student
)
self
.
assertTrue
(
self
.
assertTrue
(
OrgInstructorRole
(
self
.
course_
id
.
org
)
.
has_user
(
self
.
student
),
OrgInstructorRole
(
self
.
course_
key
.
org
)
.
has_user
(
self
.
student
),
"Student lost has access to {}"
.
format
(
self
.
course_
id
.
org
)
"Student lost has access to {}"
.
format
(
self
.
course_
key
.
org
)
)
)
self
.
assertFalse
(
self
.
assertFalse
(
CourseInstructorRole
(
self
.
course_
id
)
.
has_user
(
self
.
student
),
CourseInstructorRole
(
self
.
course_
key
)
.
has_user
(
self
.
student
),
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
id
))
"Student doesn't have access to {}"
.
format
(
unicode
(
self
.
course_
key
))
)
)
def
test_get_user_for_role
(
self
):
def
test_get_user_for_role
(
self
):
"""
"""
test users_for_role
test users_for_role
"""
"""
role
=
CourseStaffRole
(
self
.
course_
id
)
role
=
CourseStaffRole
(
self
.
course_
key
)
role
.
add_users
(
self
.
student
)
role
.
add_users
(
self
.
student
)
self
.
assertGreater
(
len
(
role
.
users_with_role
()),
0
)
self
.
assertGreater
(
len
(
role
.
users_with_role
()),
0
)
...
@@ -146,7 +145,7 @@ class RolesTestCase(TestCase):
...
@@ -146,7 +145,7 @@ class RolesTestCase(TestCase):
Tests that calling add_users multiple times before a single call
Tests that calling add_users multiple times before a single call
to remove_users does not result in the user remaining in the group.
to remove_users does not result in the user remaining in the group.
"""
"""
role
=
CourseStaffRole
(
self
.
course_
id
)
role
=
CourseStaffRole
(
self
.
course_
key
)
role
.
add_users
(
self
.
student
)
role
.
add_users
(
self
.
student
)
self
.
assertTrue
(
role
.
has_user
(
self
.
student
))
self
.
assertTrue
(
role
.
has_user
(
self
.
student
))
# Call add_users a second time, then remove just once.
# Call add_users a second time, then remove just once.
...
...
common/lib/xmodule/xmodule/modulestore/loc_mapper_store.py
View file @
d01af063
...
@@ -10,7 +10,6 @@ import urllib
...
@@ -10,7 +10,6 @@ import urllib
from
xmodule.modulestore.exceptions
import
InvalidLocationError
,
ItemNotFoundError
from
xmodule.modulestore.exceptions
import
InvalidLocationError
,
ItemNotFoundError
from
xmodule.modulestore.locator
import
BlockUsageLocator
,
CourseLocator
from
xmodule.modulestore.locator
import
BlockUsageLocator
,
CourseLocator
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.keys
import
UsageKey
class
LocMapperStore
(
object
):
class
LocMapperStore
(
object
):
...
...
common/lib/xmodule/xmodule/modulestore/locator.py
View file @
d01af063
...
@@ -88,13 +88,12 @@ class BlockLocatorBase(Locator):
...
@@ -88,13 +88,12 @@ class BlockLocatorBase(Locator):
({BLOCK_TYPE_PREFIX}\+(?P<block_type>{ALLOWED_ID_CHARS}+)\+?)?
({BLOCK_TYPE_PREFIX}\+(?P<block_type>{ALLOWED_ID_CHARS}+)\+?)?
({BLOCK_PREFIX}\+(?P<block_id>{ALLOWED_ID_CHARS}+))?
({BLOCK_PREFIX}\+(?P<block_id>{ALLOWED_ID_CHARS}+))?
"""
.
format
(
"""
.
format
(
ALLOWED_ID_CHARS
=
Locator
.
ALLOWED_ID_CHARS
,
BRANCH_PREFIX
=
BRANCH_PREFIX
,
ALLOWED_ID_CHARS
=
Locator
.
ALLOWED_ID_CHARS
,
BRANCH_PREFIX
=
BRANCH_PREFIX
,
VERSION_PREFIX
=
Locator
.
VERSION_PREFIX
,
BLOCK_TYPE_PREFIX
=
Locator
.
BLOCK_TYPE_PREFIX
,
BLOCK_PREFIX
=
BLOCK_PREFIX
VERSION_PREFIX
=
Locator
.
VERSION_PREFIX
,
BLOCK_TYPE_PREFIX
=
Locator
.
BLOCK_TYPE_PREFIX
,
BLOCK_PREFIX
=
BLOCK_PREFIX
)
)
URL_RE
=
re
.
compile
(
'^'
+
URL_RE_SOURCE
+
'$'
,
re
.
IGNORECASE
|
re
.
VERBOSE
|
re
.
UNICODE
)
URL_RE
=
re
.
compile
(
'^'
+
URL_RE_SOURCE
+
'$'
,
re
.
IGNORECASE
|
re
.
VERBOSE
|
re
.
UNICODE
)
@classmethod
@classmethod
def
parse_url
(
cls
,
string
):
def
parse_url
(
cls
,
string
):
"""
"""
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_locators.py
View file @
d01af063
...
@@ -158,12 +158,12 @@ class LocatorTest(TestCase):
...
@@ -158,12 +158,12 @@ class LocatorTest(TestCase):
)
)
testobj
=
UsageKey
.
from_string
(
testurn
)
testobj
=
UsageKey
.
from_string
(
testurn
)
self
.
check_block_locn_fields
(
self
.
check_block_locn_fields
(
testobj
,
testobj
,
org
=
expected_org
,
org
=
expected_org
,
offering
=
expected_offering
,
offering
=
expected_offering
,
branch
=
expected_branch
,
branch
=
expected_branch
,
block_type
=
'problem'
,
block_type
=
'problem'
,
block
=
expected_block_ref
block
=
expected_block_ref
)
)
self
.
assertEqual
(
unicode
(
testobj
),
testurn
)
self
.
assertEqual
(
unicode
(
testobj
),
testurn
)
testobj
=
testobj
.
for_version
(
ObjectId
())
testobj
=
testobj
.
for_version
(
ObjectId
())
...
...
lms/djangoapps/bulk_email/forms.py
View file @
d01af063
...
@@ -11,7 +11,6 @@ from bulk_email.models import CourseEmailTemplate, COURSE_EMAIL_MESSAGE_BODY_TAG
...
@@ -11,7 +11,6 @@ from bulk_email.models import CourseEmailTemplate, COURSE_EMAIL_MESSAGE_BODY_TAG
from
opaque_keys
import
InvalidKeyError
from
opaque_keys
import
InvalidKeyError
from
xmodule.modulestore
import
XML_MODULESTORE_TYPE
from
xmodule.modulestore
import
XML_MODULESTORE_TYPE
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
opaque_keys
import
InvalidKeyError
from
xmodule.modulestore.keys
import
CourseKey
from
xmodule.modulestore.keys
import
CourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
...
@@ -67,7 +66,7 @@ class CourseAuthorizationAdminForm(forms.ModelForm): # pylint: disable=R0924
...
@@ -67,7 +66,7 @@ class CourseAuthorizationAdminForm(forms.ModelForm): # pylint: disable=R0924
try
:
try
:
course_key
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
cleaned_id
)
course_key
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
cleaned_id
)
except
InvalidKeyError
:
except
InvalidKeyError
:
msg
=
u'Course id invalid.'
msg
=
u'Course id invalid.'
msg
+=
u' --- Entered course id was: "{0}". '
.
format
(
cleaned_id
)
msg
+=
u' --- Entered course id was: "{0}". '
.
format
(
cleaned_id
)
msg
+=
'Please recheck that you have supplied a valid course id.'
msg
+=
'Please recheck that you have supplied a valid course id.'
raise
forms
.
ValidationError
(
msg
)
raise
forms
.
ValidationError
(
msg
)
...
...
lms/djangoapps/bulk_email/tasks.py
View file @
d01af063
...
@@ -192,7 +192,6 @@ def perform_delegate_email_batches(entry_id, course_id, task_input, action_name)
...
@@ -192,7 +192,6 @@ def perform_delegate_email_batches(entry_id, course_id, task_input, action_name)
log
.
warning
(
u"Task
%
s: "
+
format_msg
,
task_id
,
course_id
,
email_obj
.
course_id
)
log
.
warning
(
u"Task
%
s: "
+
format_msg
,
task_id
,
course_id
,
email_obj
.
course_id
)
raise
ValueError
(
format_msg
%
(
course_id
,
email_obj
.
course_id
))
raise
ValueError
(
format_msg
%
(
course_id
,
email_obj
.
course_id
))
# Fetch the course object.
# Fetch the course object.
course
=
get_course
(
course_id
)
course
=
get_course
(
course_id
)
...
...
lms/djangoapps/bulk_email/tests/test_email.py
View file @
d01af063
...
@@ -54,10 +54,10 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
...
@@ -54,10 +54,10 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
course_title
=
u"ẗëṡẗ title イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ"
course_title
=
u"ẗëṡẗ title イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ"
self
.
course
=
CourseFactory
.
create
(
display_name
=
course_title
)
self
.
course
=
CourseFactory
.
create
(
display_name
=
course_title
)
self
.
instructor
=
InstructorFactory
(
course
=
self
.
course
.
id
)
self
.
instructor
=
InstructorFactory
(
course
_key
=
self
.
course
.
id
)
# Create staff
# Create staff
self
.
staff
=
[
StaffFactory
(
course
=
self
.
course
.
id
)
self
.
staff
=
[
StaffFactory
(
course
_key
=
self
.
course
.
id
)
for
_
in
xrange
(
STAFF_COUNT
)]
for
_
in
xrange
(
STAFF_COUNT
)]
# Create students
# Create students
...
...
lms/djangoapps/certificates/management/commands/cert_whitelist.py
View file @
d01af063
"""
Management command which sets or gets the certificate whitelist for a given
user/course
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
,
CommandError
from
optparse
import
make_option
from
optparse
import
make_option
from
opaque_keys
import
InvalidKeyError
from
opaque_keys
import
InvalidKeyError
...
@@ -56,7 +60,7 @@ class Command(BaseCommand):
...
@@ -56,7 +60,7 @@ class Command(BaseCommand):
try
:
try
:
course
=
CourseKey
.
from_string
(
course_id
)
course
=
CourseKey
.
from_string
(
course_id
)
except
InvalidKeyError
:
except
InvalidKeyError
:
log
.
warning
(
"Course id
%
s could not be parsed as a CourseKey; falling back to SSCK.from_dep_str"
,
course_id
)
print
(
"Course id {} could not be parsed as a CourseKey; falling back to SSCK.from_dep_str"
.
format
(
course_id
)
)
course
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
course
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
if
options
[
'add'
]
and
options
[
'del'
]:
if
options
[
'add'
]
and
options
[
'del'
]:
...
...
lms/djangoapps/certificates/management/commands/ungenerated_certs.py
View file @
d01af063
"""
Management command to find all students that need certificates for
courses that have finished, and put their cert requests on the queue.
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
,
CommandError
from
certificates.models
import
certificate_status_for_student
from
certificates.models
import
certificate_status_for_student
from
certificates.queue
import
XQueueCertInterface
from
certificates.queue
import
XQueueCertInterface
...
@@ -73,7 +77,7 @@ class Command(BaseCommand):
...
@@ -73,7 +77,7 @@ class Command(BaseCommand):
try
:
try
:
course
=
CourseKey
.
from_string
(
options
[
'course'
])
course
=
CourseKey
.
from_string
(
options
[
'course'
])
except
InvalidKeyError
:
except
InvalidKeyError
:
log
.
warning
(
"Course id
%
s could not be parsed as a CourseKey; falling back to SSCK.from_dep_str"
,
course_id
)
print
(
"Course id {} could not be parsed as a CourseKey; falling back to SSCK.from_dep_str"
.
format
(
options
[
'course'
])
)
course
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
options
[
'course'
])
course
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
options
[
'course'
])
ended_courses
=
[
course
]
ended_courses
=
[
course
]
else
:
else
:
...
...
lms/djangoapps/course_wiki/tests/test_access.py
View file @
d01af063
...
@@ -48,8 +48,8 @@ class TestWikiAccessBase(ModuleStoreTestCase):
...
@@ -48,8 +48,8 @@ class TestWikiAccessBase(ModuleStoreTestCase):
"""Creates and returns users with instructor and staff access to course."""
"""Creates and returns users with instructor and staff access to course."""
return
[
return
[
InstructorFactory
(
course
=
course
.
id
),
# Creates instructor_org/number/run role name
InstructorFactory
(
course
_key
=
course
.
id
),
# Creates instructor_org/number/run role name
StaffFactory
(
course
=
course
.
id
),
# Creates staff_org/number/run role name
StaffFactory
(
course
_key
=
course
.
id
),
# Creates staff_org/number/run role name
]
]
...
...
lms/djangoapps/course_wiki/tests/test_middleware.py
View file @
d01af063
...
@@ -23,7 +23,7 @@ class TestWikiAccessMiddleware(ModuleStoreTestCase):
...
@@ -23,7 +23,7 @@ class TestWikiAccessMiddleware(ModuleStoreTestCase):
self
.
wiki
=
get_or_create_root
()
self
.
wiki
=
get_or_create_root
()
self
.
course_math101
=
CourseFactory
.
create
(
org
=
'edx'
,
number
=
'math101'
,
display_name
=
'2014'
,
metadata
=
{
'use_unique_wiki_id'
:
'false'
})
self
.
course_math101
=
CourseFactory
.
create
(
org
=
'edx'
,
number
=
'math101'
,
display_name
=
'2014'
,
metadata
=
{
'use_unique_wiki_id'
:
'false'
})
self
.
course_math101_instructor
=
InstructorFactory
(
course
=
self
.
course_math101
.
id
,
username
=
'instructor'
,
password
=
'secret'
)
self
.
course_math101_instructor
=
InstructorFactory
(
course
_key
=
self
.
course_math101
.
id
,
username
=
'instructor'
,
password
=
'secret'
)
self
.
wiki_math101
=
URLPath
.
create_article
(
self
.
wiki
,
'math101'
,
title
=
'math101'
)
self
.
wiki_math101
=
URLPath
.
create_article
(
self
.
wiki
,
'math101'
,
title
=
'math101'
)
self
.
client
=
Client
()
self
.
client
=
Client
()
...
...
lms/djangoapps/courseware/features/lti.py
View file @
d01af063
...
@@ -196,9 +196,9 @@ def i_am_registered_for_the_course(coursenum, metadata, user='Instructor'):
...
@@ -196,9 +196,9 @@ def i_am_registered_for_the_course(coursenum, metadata, user='Instructor'):
course_descriptor
=
world
.
scenario_dict
[
'COURSE'
]
course_descriptor
=
world
.
scenario_dict
[
'COURSE'
]
# create beta tester
# create beta tester
user
=
BetaTesterFactory
(
course
=
course_descriptor
.
id
)
user
=
BetaTesterFactory
(
course
_key
=
course_descriptor
.
id
)
normal_student
=
UserFactory
()
normal_student
=
UserFactory
()
instructor
=
InstructorFactory
(
course
=
course_descriptor
.
id
)
instructor
=
InstructorFactory
(
course
_key
=
course_descriptor
.
id
)
assert
not
has_access
(
normal_student
,
'load'
,
course_descriptor
)
assert
not
has_access
(
normal_student
,
'load'
,
course_descriptor
)
assert
has_access
(
user
,
'load'
,
course_descriptor
)
assert
has_access
(
user
,
'load'
,
course_descriptor
)
...
@@ -207,7 +207,7 @@ def i_am_registered_for_the_course(coursenum, metadata, user='Instructor'):
...
@@ -207,7 +207,7 @@ def i_am_registered_for_the_course(coursenum, metadata, user='Instructor'):
metadata
.
update
({
'start'
:
datetime
.
datetime
(
1970
,
1
,
1
,
tzinfo
=
UTC
)})
metadata
.
update
({
'start'
:
datetime
.
datetime
(
1970
,
1
,
1
,
tzinfo
=
UTC
)})
create_course_for_lti
(
coursenum
,
metadata
)
create_course_for_lti
(
coursenum
,
metadata
)
course_descriptor
=
world
.
scenario_dict
[
'COURSE'
]
course_descriptor
=
world
.
scenario_dict
[
'COURSE'
]
user
=
InstructorFactory
(
course
=
course_descriptor
.
id
)
user
=
InstructorFactory
(
course
_key
=
course_descriptor
.
id
)
# Enroll the user in the course and log them in
# Enroll the user in the course and log them in
if
has_access
(
user
,
'load'
,
course_descriptor
):
if
has_access
(
user
,
'load'
,
course_descriptor
):
...
...
lms/djangoapps/courseware/models.py
View file @
d01af063
...
@@ -113,7 +113,12 @@ class StudentModuleHistory(models.Model):
...
@@ -113,7 +113,12 @@ class StudentModuleHistory(models.Model):
max_grade
=
models
.
FloatField
(
null
=
True
,
blank
=
True
)
max_grade
=
models
.
FloatField
(
null
=
True
,
blank
=
True
)
@receiver
(
post_save
,
sender
=
StudentModule
)
@receiver
(
post_save
,
sender
=
StudentModule
)
def
save_history
(
sender
,
instance
,
**
kwargs
):
# pylint: disable=no-self-argument
def
save_history
(
sender
,
instance
,
**
kwargs
):
# pylint: disable=no-self-argument, unused-argument
"""
Checks the instance's module_type, and creates & saves a
StudentModuleHistory entry if the module_type is one that
we save.
"""
if
instance
.
module_type
in
StudentModuleHistory
.
HISTORY_SAVING_TYPES
:
if
instance
.
module_type
in
StudentModuleHistory
.
HISTORY_SAVING_TYPES
:
history_entry
=
StudentModuleHistory
(
student_module
=
instance
,
history_entry
=
StudentModuleHistory
(
student_module
=
instance
,
version
=
None
,
version
=
None
,
...
...
lms/djangoapps/courseware/module_render.py
View file @
d01af063
...
@@ -60,9 +60,9 @@ XQUEUE_INTERFACE = XQueueInterface(
...
@@ -60,9 +60,9 @@ XQUEUE_INTERFACE = XQueueInterface(
REQUESTS_AUTH
,
REQUESTS_AUTH
,
)
)
# TODO
basically all instances of course_id in this file *should* be changed to course_key, but
# TODO
: course_id and course_key are used interchangeably in this file, which is wrong.
#
there's a couple tricky ones I'm too afraid to change before we merge the jellyfish branches.
#
Some brave person should make the variable names consistently someday, but the code's
#
This should be fixed after the jellyfish merge, before merge into master.
#
coupled enough that it's kind of tricky--you've been warned!
class
LmsModuleRenderError
(
Exception
):
class
LmsModuleRenderError
(
Exception
):
...
...
lms/djangoapps/courseware/tests/factories.py
View file @
d01af063
# Factories don't have __init__ methods, and are self documenting
# pylint: disable=W0232, C0111
import
json
import
json
from
functools
import
partial
from
functools
import
partial
import
factory
import
factory
...
@@ -23,6 +25,8 @@ from student.roles import (
...
@@ -23,6 +25,8 @@ from student.roles import (
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
# TODO fix this (course_id and location are invalid names as constants, and course_id should really be COURSE_KEY)
# pylint: disable=invalid-name
course_id
=
SlashSeparatedCourseKey
(
u'edX'
,
u'test_course'
,
u'test'
)
course_id
=
SlashSeparatedCourseKey
(
u'edX'
,
u'test_course'
,
u'test'
)
location
=
partial
(
course_id
.
make_usage_key
,
u'problem'
)
location
=
partial
(
course_id
.
make_usage_key
,
u'problem'
)
...
@@ -31,6 +35,11 @@ class UserProfileFactory(StudentUserProfileFactory):
...
@@ -31,6 +35,11 @@ class UserProfileFactory(StudentUserProfileFactory):
courseware
=
'course.xml'
courseware
=
'course.xml'
# For the following factories, these are disabled because we're ok ignoring the
# unused arguments create and **kwargs in the line:
# course_key(self, create, extracted, **kwargs)
# pylint: disable=unused-argument
class
InstructorFactory
(
UserFactory
):
class
InstructorFactory
(
UserFactory
):
"""
"""
Given a course Location, returns a User object with instructor
Given a course Location, returns a User object with instructor
...
@@ -39,8 +48,7 @@ class InstructorFactory(UserFactory):
...
@@ -39,8 +48,7 @@ class InstructorFactory(UserFactory):
last_name
=
"Instructor"
last_name
=
"Instructor"
@factory.post_generation
@factory.post_generation
# TODO Change this from course to course_key at next opportunity
def
course_key
(
self
,
create
,
extracted
,
**
kwargs
):
def
course
(
self
,
create
,
extracted
,
**
kwargs
):
if
extracted
is
None
:
if
extracted
is
None
:
raise
ValueError
(
"Must specify a CourseKey for a course instructor user"
)
raise
ValueError
(
"Must specify a CourseKey for a course instructor user"
)
CourseInstructorRole
(
extracted
)
.
add_users
(
self
)
CourseInstructorRole
(
extracted
)
.
add_users
(
self
)
...
@@ -54,8 +62,7 @@ class StaffFactory(UserFactory):
...
@@ -54,8 +62,7 @@ class StaffFactory(UserFactory):
last_name
=
"Staff"
last_name
=
"Staff"
@factory.post_generation
@factory.post_generation
# TODO Change this from course to course_key at next opportunity
def
course_key
(
self
,
create
,
extracted
,
**
kwargs
):
def
course
(
self
,
create
,
extracted
,
**
kwargs
):
if
extracted
is
None
:
if
extracted
is
None
:
raise
ValueError
(
"Must specify a CourseKey for a course staff user"
)
raise
ValueError
(
"Must specify a CourseKey for a course staff user"
)
CourseStaffRole
(
extracted
)
.
add_users
(
self
)
CourseStaffRole
(
extracted
)
.
add_users
(
self
)
...
@@ -69,8 +76,7 @@ class BetaTesterFactory(UserFactory):
...
@@ -69,8 +76,7 @@ class BetaTesterFactory(UserFactory):
last_name
=
"Beta-Tester"
last_name
=
"Beta-Tester"
@factory.post_generation
@factory.post_generation
# TODO Change this from course to course_key at next opportunity
def
course_key
(
self
,
create
,
extracted
,
**
kwargs
):
def
course
(
self
,
create
,
extracted
,
**
kwargs
):
if
extracted
is
None
:
if
extracted
is
None
:
raise
ValueError
(
"Must specify a CourseKey for a beta-tester user"
)
raise
ValueError
(
"Must specify a CourseKey for a beta-tester user"
)
CourseBetaTesterRole
(
extracted
)
.
add_users
(
self
)
CourseBetaTesterRole
(
extracted
)
.
add_users
(
self
)
...
@@ -84,8 +90,7 @@ class OrgStaffFactory(UserFactory):
...
@@ -84,8 +90,7 @@ class OrgStaffFactory(UserFactory):
last_name
=
"Org-Staff"
last_name
=
"Org-Staff"
@factory.post_generation
@factory.post_generation
# TODO Change this from course to course_key at next opportunity
def
course_key
(
self
,
create
,
extracted
,
**
kwargs
):
def
course
(
self
,
create
,
extracted
,
**
kwargs
):
if
extracted
is
None
:
if
extracted
is
None
:
raise
ValueError
(
"Must specify a CourseKey for an org-staff user"
)
raise
ValueError
(
"Must specify a CourseKey for an org-staff user"
)
OrgStaffRole
(
extracted
.
org
)
.
add_users
(
self
)
OrgStaffRole
(
extracted
.
org
)
.
add_users
(
self
)
...
@@ -99,8 +104,7 @@ class OrgInstructorFactory(UserFactory):
...
@@ -99,8 +104,7 @@ class OrgInstructorFactory(UserFactory):
last_name
=
"Org-Instructor"
last_name
=
"Org-Instructor"
@factory.post_generation
@factory.post_generation
# TODO Change this from course to course_key at next opportunity
def
course_key
(
self
,
create
,
extracted
,
**
kwargs
):
def
course
(
self
,
create
,
extracted
,
**
kwargs
):
if
extracted
is
None
:
if
extracted
is
None
:
raise
ValueError
(
"Must specify a CourseKey for an org-instructor user"
)
raise
ValueError
(
"Must specify a CourseKey for an org-instructor user"
)
OrgInstructorRole
(
extracted
.
org
)
.
add_users
(
self
)
OrgInstructorRole
(
extracted
.
org
)
.
add_users
(
self
)
...
@@ -115,6 +119,7 @@ class GlobalStaffFactory(UserFactory):
...
@@ -115,6 +119,7 @@ class GlobalStaffFactory(UserFactory):
@factory.post_generation
@factory.post_generation
def
set_staff
(
self
,
create
,
extracted
,
**
kwargs
):
def
set_staff
(
self
,
create
,
extracted
,
**
kwargs
):
GlobalStaff
()
.
add_users
(
self
)
GlobalStaff
()
.
add_users
(
self
)
# pylint: enable=unused-argument
class
StudentModuleFactory
(
DjangoModelFactory
):
class
StudentModuleFactory
(
DjangoModelFactory
):
...
...
lms/djangoapps/courseware/tests/test_access.py
View file @
d01af063
...
@@ -26,9 +26,8 @@ class AccessTestCase(TestCase):
...
@@ -26,9 +26,8 @@ class AccessTestCase(TestCase):
self
.
anonymous_user
=
AnonymousUserFactory
()
self
.
anonymous_user
=
AnonymousUserFactory
()
self
.
student
=
UserFactory
()
self
.
student
=
UserFactory
()
self
.
global_staff
=
UserFactory
(
is_staff
=
True
)
self
.
global_staff
=
UserFactory
(
is_staff
=
True
)
# TODO please change the StaffFactory and InstructorFactory parameters ASAP!
self
.
course_staff
=
StaffFactory
(
course_key
=
self
.
course
.
course_key
)
self
.
course_staff
=
StaffFactory
(
course
=
self
.
course
.
course_key
)
self
.
course_instructor
=
InstructorFactory
(
course_key
=
self
.
course
.
course_key
)
self
.
course_instructor
=
InstructorFactory
(
course
=
self
.
course
.
course_key
)
def
test_has_access_to_course
(
self
):
def
test_has_access_to_course
(
self
):
self
.
assertFalse
(
access
.
_has_access_to_course
(
self
.
assertFalse
(
access
.
_has_access_to_course
(
...
@@ -144,8 +143,8 @@ class UserRoleTestCase(TestCase):
...
@@ -144,8 +143,8 @@ class UserRoleTestCase(TestCase):
self
.
anonymous_user
=
AnonymousUserFactory
()
self
.
anonymous_user
=
AnonymousUserFactory
()
self
.
student
=
UserFactory
()
self
.
student
=
UserFactory
()
self
.
global_staff
=
UserFactory
(
is_staff
=
True
)
self
.
global_staff
=
UserFactory
(
is_staff
=
True
)
self
.
course_staff
=
StaffFactory
(
course
=
self
.
course_key
)
self
.
course_staff
=
StaffFactory
(
course
_key
=
self
.
course_key
)
self
.
course_instructor
=
InstructorFactory
(
course
=
self
.
course_key
)
self
.
course_instructor
=
InstructorFactory
(
course
_key
=
self
.
course_key
)
def
test_user_role_staff
(
self
):
def
test_user_role_staff
(
self
):
"""Ensure that user role is student for staff masqueraded as student."""
"""Ensure that user role is student for staff masqueraded as student."""
...
...
lms/djangoapps/courseware/tests/test_lti_integration.py
View file @
d01af063
...
@@ -39,7 +39,7 @@ class TestLTI(BaseTestXmodule):
...
@@ -39,7 +39,7 @@ class TestLTI(BaseTestXmodule):
mocked_signature_after_sign
=
u'my_signature
%3
D'
mocked_signature_after_sign
=
u'my_signature
%3
D'
mocked_decoded_signature
=
u'my_signature='
mocked_decoded_signature
=
u'my_signature='
#
TODO this course_id is actually a course_key; please change this ASAP!
#
Note: this course_id is actually a course_key
context_id
=
self
.
item_descriptor
.
course_id
.
to_deprecated_string
()
context_id
=
self
.
item_descriptor
.
course_id
.
to_deprecated_string
()
user_id
=
unicode
(
self
.
item_descriptor
.
xmodule_runtime
.
anonymous_student_id
)
user_id
=
unicode
(
self
.
item_descriptor
.
xmodule_runtime
.
anonymous_student_id
)
hostname
=
self
.
item_descriptor
.
xmodule_runtime
.
hostname
hostname
=
self
.
item_descriptor
.
xmodule_runtime
.
hostname
...
...
lms/djangoapps/courseware/tests/test_masquerade.py
View file @
d01af063
...
@@ -36,7 +36,7 @@ class TestStaffMasqueradeAsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
...
@@ -36,7 +36,7 @@ class TestStaffMasqueradeAsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
self
.
graded_course
=
modulestore
()
.
get_course
(
SlashSeparatedCourseKey
(
"edX"
,
"graded"
,
"2012_Fall"
))
self
.
graded_course
=
modulestore
()
.
get_course
(
SlashSeparatedCourseKey
(
"edX"
,
"graded"
,
"2012_Fall"
))
# Create staff account
# Create staff account
self
.
staff
=
StaffFactory
(
course
=
self
.
graded_course
.
id
)
self
.
staff
=
StaffFactory
(
course
_key
=
self
.
graded_course
.
id
)
self
.
logout
()
self
.
logout
()
# self.staff.password is the sha hash but login takes the plain text
# self.staff.password is the sha hash but login takes the plain text
...
...
lms/djangoapps/courseware/tests/test_video_handlers.py
View file @
d01af063
...
@@ -22,7 +22,6 @@ from xmodule.video_module.transcripts_utils import (
...
@@ -22,7 +22,6 @@ from xmodule.video_module.transcripts_utils import (
TranscriptException
,
TranscriptException
,
TranscriptsGenerationException
,
TranscriptsGenerationException
,
)
)
from
xmodule.modulestore.mongo.base
import
MongoModuleStore
from
xmodule.modulestore.locations
import
AssetLocation
from
xmodule.modulestore.locations
import
AssetLocation
SRT_content
=
textwrap
.
dedent
(
"""
SRT_content
=
textwrap
.
dedent
(
"""
...
...
lms/djangoapps/courseware/tests/test_view_authentication.py
View file @
d01af063
...
@@ -138,11 +138,10 @@ class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -138,11 +138,10 @@ class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase):
CourseEnrollmentFactory
(
user
=
self
.
enrolled_user
,
course_id
=
self
.
course
.
id
)
CourseEnrollmentFactory
(
user
=
self
.
enrolled_user
,
course_id
=
self
.
course
.
id
)
CourseEnrollmentFactory
(
user
=
self
.
enrolled_user
,
course_id
=
self
.
test_course
.
id
)
CourseEnrollmentFactory
(
user
=
self
.
enrolled_user
,
course_id
=
self
.
test_course
.
id
)
self
.
staff_user
=
StaffFactory
(
course
=
self
.
course
.
id
)
self
.
staff_user
=
StaffFactory
(
course_key
=
self
.
course
.
id
)
self
.
instructor_user
=
InstructorFactory
(
self
.
instructor_user
=
InstructorFactory
(
course_key
=
self
.
course
.
id
)
course
=
self
.
course
.
id
)
self
.
org_staff_user
=
OrgStaffFactory
(
course_key
=
self
.
course
.
id
)
self
.
org_staff_user
=
OrgStaffFactory
(
course
=
self
.
course
.
id
)
self
.
org_instructor_user
=
OrgInstructorFactory
(
course_key
=
self
.
course
.
id
)
self
.
org_instructor_user
=
OrgInstructorFactory
(
course
=
self
.
course
.
id
)
def
test_redirection_unenrolled
(
self
):
def
test_redirection_unenrolled
(
self
):
"""
"""
...
@@ -374,7 +373,7 @@ class TestBetatesterAccess(ModuleStoreTestCase):
...
@@ -374,7 +373,7 @@ class TestBetatesterAccess(ModuleStoreTestCase):
self
.
content
=
ItemFactory
(
parent
=
self
.
course
)
self
.
content
=
ItemFactory
(
parent
=
self
.
course
)
self
.
normal_student
=
UserFactory
()
self
.
normal_student
=
UserFactory
()
self
.
beta_tester
=
BetaTesterFactory
(
course
=
self
.
course
.
id
)
self
.
beta_tester
=
BetaTesterFactory
(
course
_key
=
self
.
course
.
id
)
@patch.dict
(
'courseware.access.settings.FEATURES'
,
{
'DISABLE_START_DATES'
:
False
})
@patch.dict
(
'courseware.access.settings.FEATURES'
,
{
'DISABLE_START_DATES'
:
False
})
def
test_course_beta_period
(
self
):
def
test_course_beta_period
(
self
):
...
...
lms/djangoapps/courseware/tests/tests.py
View file @
d01af063
...
@@ -48,8 +48,7 @@ class PageLoaderTestCase(LoginEnrollmentTestCase):
...
@@ -48,8 +48,7 @@ class PageLoaderTestCase(LoginEnrollmentTestCase):
Base class that adds a function to load all pages in a modulestore.
Base class that adds a function to load all pages in a modulestore.
"""
"""
# TODO once everything is merged can someone please check whether this function takes a course_id or course_key
def
check_all_pages_load
(
self
,
course_key
):
def
check_all_pages_load
(
self
,
course_id
):
"""
"""
Assert that all pages in the course load correctly.
Assert that all pages in the course load correctly.
`course_id` is the ID of the course to check.
`course_id` is the ID of the course to check.
...
@@ -58,11 +57,11 @@ class PageLoaderTestCase(LoginEnrollmentTestCase):
...
@@ -58,11 +57,11 @@ class PageLoaderTestCase(LoginEnrollmentTestCase):
store
=
modulestore
()
store
=
modulestore
()
# Enroll in the course before trying to access pages
# Enroll in the course before trying to access pages
course
=
store
.
get_course
(
course_
id
)
course
=
store
.
get_course
(
course_
key
)
self
.
enroll
(
course
,
True
)
self
.
enroll
(
course
,
True
)
# Search for items in the course
# Search for items in the course
items
=
store
.
get_items
(
course_
id
)
items
=
store
.
get_items
(
course_
key
)
if
len
(
items
)
<
1
:
if
len
(
items
)
<
1
:
self
.
fail
(
'Could not retrieve any items from course'
)
self
.
fail
(
'Could not retrieve any items from course'
)
...
@@ -72,21 +71,21 @@ class PageLoaderTestCase(LoginEnrollmentTestCase):
...
@@ -72,21 +71,21 @@ class PageLoaderTestCase(LoginEnrollmentTestCase):
if
descriptor
.
location
.
category
==
'about'
:
if
descriptor
.
location
.
category
==
'about'
:
self
.
_assert_loads
(
'about_course'
,
self
.
_assert_loads
(
'about_course'
,
{
'course_id'
:
course_
id
.
to_deprecated_string
()},
{
'course_id'
:
course_
key
.
to_deprecated_string
()},
descriptor
)
descriptor
)
elif
descriptor
.
location
.
category
==
'static_tab'
:
elif
descriptor
.
location
.
category
==
'static_tab'
:
kwargs
=
{
'course_id'
:
course_
id
.
to_deprecated_string
(),
kwargs
=
{
'course_id'
:
course_
key
.
to_deprecated_string
(),
'tab_slug'
:
descriptor
.
location
.
name
}
'tab_slug'
:
descriptor
.
location
.
name
}
self
.
_assert_loads
(
'static_tab'
,
kwargs
,
descriptor
)
self
.
_assert_loads
(
'static_tab'
,
kwargs
,
descriptor
)
elif
descriptor
.
location
.
category
==
'course_info'
:
elif
descriptor
.
location
.
category
==
'course_info'
:
self
.
_assert_loads
(
'info'
,
{
'course_id'
:
course_
id
.
to_deprecated_string
()},
self
.
_assert_loads
(
'info'
,
{
'course_id'
:
course_
key
.
to_deprecated_string
()},
descriptor
)
descriptor
)
else
:
else
:
kwargs
=
{
'course_id'
:
course_
id
.
to_deprecated_string
(),
kwargs
=
{
'course_id'
:
course_
key
.
to_deprecated_string
(),
'location'
:
descriptor
.
location
.
to_deprecated_string
()}
'location'
:
descriptor
.
location
.
to_deprecated_string
()}
self
.
_assert_loads
(
'jump_to'
,
kwargs
,
descriptor
,
self
.
_assert_loads
(
'jump_to'
,
kwargs
,
descriptor
,
...
...
lms/djangoapps/courseware/views.py
View file @
d01af063
...
@@ -47,7 +47,6 @@ from opaque_keys import InvalidKeyError
...
@@ -47,7 +47,6 @@ from opaque_keys import InvalidKeyError
from
microsite_configuration
import
microsite
from
microsite_configuration
import
microsite
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.keys
import
UsageKey
log
=
logging
.
getLogger
(
"edx.courseware"
)
log
=
logging
.
getLogger
(
"edx.courseware"
)
...
...
lms/djangoapps/django_comment_client/management/commands/seed_permissions_roles.py
View file @
d01af063
"""
Management command to seed default permissions and roles.
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django_comment_common.utils
import
seed_permissions_roles
from
django_comment_common.utils
import
seed_permissions_roles
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
...
...
lms/djangoapps/instructor/features/bulk_email.py
View file @
d01af063
...
@@ -29,19 +29,19 @@ def make_populated_course(step): # pylint: disable=unused-argument
...
@@ -29,19 +29,19 @@ def make_populated_course(step): # pylint: disable=unused-argument
number
=
'888'
,
number
=
'888'
,
display_name
=
'Bulk Email Test Course'
display_name
=
'Bulk Email Test Course'
)
)
world
.
bulk_email_course_
id
=
course
.
id
world
.
bulk_email_course_
key
=
course
.
id
try
:
try
:
# See if we've defined the instructor & staff user yet
# See if we've defined the instructor & staff user yet
world
.
bulk_email_instructor
world
.
bulk_email_instructor
except
AttributeError
:
except
AttributeError
:
# Make & register an instructor for the course
# Make & register an instructor for the course
world
.
bulk_email_instructor
=
InstructorFactory
(
course
=
world
.
bulk_email_course_id
)
world
.
bulk_email_instructor
=
InstructorFactory
(
course
_key
=
world
.
bulk_email_course_key
)
world
.
enroll_user
(
world
.
bulk_email_instructor
,
world
.
bulk_email_course_
id
)
world
.
enroll_user
(
world
.
bulk_email_instructor
,
world
.
bulk_email_course_
key
)
# Make & register a staff member
# Make & register a staff member
world
.
bulk_email_staff
=
StaffFactory
(
course
=
course
.
id
)
world
.
bulk_email_staff
=
StaffFactory
(
course
_key
=
course
.
id
)
world
.
enroll_user
(
world
.
bulk_email_staff
,
world
.
bulk_email_course_
id
)
world
.
enroll_user
(
world
.
bulk_email_staff
,
world
.
bulk_email_course_
key
)
# Make & register a student
# Make & register a student
world
.
register_by_course_key
(
world
.
register_by_course_key
(
...
...
lms/djangoapps/instructor/features/common.py
View file @
d01af063
...
@@ -43,13 +43,13 @@ def i_am_staff_or_instructor(step, role): # pylint: disable=unused-argument
...
@@ -43,13 +43,13 @@ def i_am_staff_or_instructor(step, role): # pylint: disable=unused-argument
display_name
=
'Test Course'
display_name
=
'Test Course'
)
)
world
.
course_
id
=
course
.
id
world
.
course_
key
=
course
.
id
world
.
role
=
'instructor'
world
.
role
=
'instructor'
# Log in as the an instructor or staff for the course
# Log in as the an instructor or staff for the course
if
role
==
'instructor'
:
if
role
==
'instructor'
:
# Make & register an instructor for the course
# Make & register an instructor for the course
world
.
instructor
=
InstructorFactory
(
course
=
world
.
course_id
)
world
.
instructor
=
InstructorFactory
(
course
_key
=
world
.
course_key
)
world
.
enroll_user
(
world
.
instructor
,
world
.
course_
id
)
world
.
enroll_user
(
world
.
instructor
,
world
.
course_
key
)
world
.
log_in
(
world
.
log_in
(
username
=
world
.
instructor
.
username
,
username
=
world
.
instructor
.
username
,
...
@@ -61,8 +61,8 @@ def i_am_staff_or_instructor(step, role): # pylint: disable=unused-argument
...
@@ -61,8 +61,8 @@ def i_am_staff_or_instructor(step, role): # pylint: disable=unused-argument
else
:
else
:
world
.
role
=
'staff'
world
.
role
=
'staff'
# Make & register a staff member
# Make & register a staff member
world
.
staff
=
StaffFactory
(
course
=
world
.
course_id
)
world
.
staff
=
StaffFactory
(
course
_key
=
world
.
course_key
)
world
.
enroll_user
(
world
.
staff
,
world
.
course_
id
)
world
.
enroll_user
(
world
.
staff
,
world
.
course_
key
)
world
.
log_in
(
world
.
log_in
(
username
=
world
.
staff
.
username
,
username
=
world
.
staff
.
username
,
...
...
lms/djangoapps/instructor/management/commands/compute_grades.py
View file @
d01af063
#!/usr/bin/python
#!/usr/bin/python
#
"""
#
django management command: dump grades to csv files
django management command: dump grades to csv files
#
for use by batch processes
for use by batch processes
"""
from
instructor.offline_gradecalc
import
offline_grade_calculation
from
instructor.offline_gradecalc
import
offline_grade_calculation
from
courseware.courses
import
get_course_by_id
from
courseware.courses
import
get_course_by_id
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
...
@@ -37,7 +37,7 @@ class Command(BaseCommand):
...
@@ -37,7 +37,7 @@ class Command(BaseCommand):
except
InvalidKeyError
:
except
InvalidKeyError
:
course_key
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
course_key
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
try
:
try
:
course
=
get_course_by_id
(
course_key
)
_
course
=
get_course_by_id
(
course_key
)
except
Exception
as
err
:
except
Exception
as
err
:
print
"-----------------------------------------------------------------------------"
print
"-----------------------------------------------------------------------------"
print
"Sorry, cannot find course with id {}"
.
format
(
course_id
)
print
"Sorry, cannot find course with id {}"
.
format
(
course_id
)
...
...
lms/djangoapps/instructor/management/commands/dump_grades.py
View file @
d01af063
#!/usr/bin/python
#!/usr/bin/python
#
"""
#
django management command: dump grades to csv files
django management command: dump grades to csv files
#
for use by batch processes
for use by batch processes
"""
import
csv
import
csv
from
instructor.views.legacy
import
get_student_grade_summary_data
from
instructor.views.legacy
import
get_student_grade_summary_data
...
@@ -52,7 +52,9 @@ class Command(BaseCommand):
...
@@ -52,7 +52,9 @@ class Command(BaseCommand):
try
:
try
:
course
=
get_course_by_id
(
course_key
)
course
=
get_course_by_id
(
course_key
)
except
Exception
as
err
:
# Ok with catching general exception here because this is run as a management command
# and the exception is exposed right away to the user.
except
Exception
as
err
:
# pylint: disable=broad-except
print
"-----------------------------------------------------------------------------"
print
"-----------------------------------------------------------------------------"
print
"Sorry, cannot find course with id {}"
.
format
(
course_id
)
print
"Sorry, cannot find course with id {}"
.
format
(
course_id
)
print
"Got exception {}"
.
format
(
err
)
print
"Got exception {}"
.
format
(
err
)
...
...
lms/djangoapps/instructor/management/commands/openended_post.py
View file @
d01af063
...
@@ -6,7 +6,6 @@ from django.core.management.base import BaseCommand
...
@@ -6,7 +6,6 @@ from django.core.management.base import BaseCommand
from
optparse
import
make_option
from
optparse
import
make_option
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.keys
import
UsageKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.open_ended_grading_classes.openendedchild
import
OpenEndedChild
from
xmodule.open_ended_grading_classes.openendedchild
import
OpenEndedChild
from
xmodule.open_ended_grading_classes.open_ended_module
import
OpenEndedModule
from
xmodule.open_ended_grading_classes.open_ended_module
import
OpenEndedModule
...
...
lms/djangoapps/instructor/management/commands/openended_stats.py
View file @
d01af063
...
@@ -9,7 +9,6 @@ from optparse import make_option
...
@@ -9,7 +9,6 @@ from optparse import make_option
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.keys
import
UsageKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.open_ended_grading_classes.openendedchild
import
OpenEndedChild
from
xmodule.open_ended_grading_classes.openendedchild
import
OpenEndedChild
...
...
lms/djangoapps/instructor/offline_gradecalc.py
View file @
d01af063
# ======== Offline calculation of grades =============================================================================
"""
#
======== Offline calculation of grades =============================================================
# Computing grades of a large number of students can take a long time. These routines allow grades to
# be computed offline, by a batch process (eg cronjob).
#
# The grades are stored in the OfflineComputedGrade table of the courseware model.
Computing grades of a large number of students can take a long time. These routines allow grades to
be computed offline, by a batch process (eg cronjob).
The grades are stored in the OfflineComputedGrade table of the courseware model.
"""
import
json
import
json
import
time
import
time
...
@@ -49,7 +50,7 @@ def offline_grade_calculation(course_key):
...
@@ -49,7 +50,7 @@ def offline_grade_calculation(course_key):
gradeset
=
grades
.
grade
(
student
,
request
,
course
,
keep_raw_scores
=
True
)
gradeset
=
grades
.
grade
(
student
,
request
,
course
,
keep_raw_scores
=
True
)
gs
=
enc
.
encode
(
gradeset
)
gs
=
enc
.
encode
(
gradeset
)
ocg
,
created
=
models
.
OfflineComputedGrade
.
objects
.
get_or_create
(
user
=
student
,
course_id
=
course_key
)
ocg
,
_
created
=
models
.
OfflineComputedGrade
.
objects
.
get_or_create
(
user
=
student
,
course_id
=
course_key
)
ocg
.
gradeset
=
gs
ocg
.
gradeset
=
gs
ocg
.
save
()
ocg
.
save
()
print
"
%
s done"
%
student
# print statement used because this is run by a management command
print
"
%
s done"
%
student
# print statement used because this is run by a management command
...
...
lms/djangoapps/instructor/tests/test_api.py
View file @
d01af063
...
@@ -13,7 +13,6 @@ from nose.tools import raises
...
@@ -13,7 +13,6 @@ from nose.tools import raises
from
mock
import
Mock
,
patch
from
mock
import
Mock
,
patch
from
django.conf
import
settings
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.http
import
HttpRequest
,
HttpResponse
from
django.http
import
HttpRequest
,
HttpResponse
from
django_comment_common.models
import
FORUM_ROLE_COMMUNITY_TA
,
Role
from
django_comment_common.models
import
FORUM_ROLE_COMMUNITY_TA
,
Role
...
@@ -197,7 +196,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -197,7 +196,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
"""
Ensure that a staff member can't access instructor endpoints.
Ensure that a staff member can't access instructor endpoints.
"""
"""
staff_member
=
StaffFactory
(
course
=
self
.
course
.
id
)
staff_member
=
StaffFactory
(
course
_key
=
self
.
course
.
id
)
CourseEnrollment
.
enroll
(
staff_member
,
self
.
course
.
id
)
CourseEnrollment
.
enroll
(
staff_member
,
self
.
course
.
id
)
self
.
client
.
login
(
username
=
staff_member
.
username
,
password
=
'test'
)
self
.
client
.
login
(
username
=
staff_member
.
username
,
password
=
'test'
)
# Try to promote to forums admin - not working
# Try to promote to forums admin - not working
...
@@ -226,7 +225,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -226,7 +225,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
"""
Ensure that an instructor member can access all endpoints.
Ensure that an instructor member can access all endpoints.
"""
"""
inst
=
InstructorFactory
(
course
=
self
.
course
.
id
)
inst
=
InstructorFactory
(
course
_key
=
self
.
course
.
id
)
CourseEnrollment
.
enroll
(
inst
,
self
.
course
.
id
)
CourseEnrollment
.
enroll
(
inst
,
self
.
course
.
id
)
self
.
client
.
login
(
username
=
inst
.
username
,
password
=
'test'
)
self
.
client
.
login
(
username
=
inst
.
username
,
password
=
'test'
)
...
@@ -264,7 +263,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -264,7 +263,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
request
=
RequestFactory
()
.
request
()
self
.
request
=
RequestFactory
()
.
request
()
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
self
.
instructor
=
InstructorFactory
(
course
=
self
.
course
.
id
)
self
.
instructor
=
InstructorFactory
(
course
_key
=
self
.
course
.
id
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
enrolled_student
=
UserFactory
(
username
=
'EnrolledStudent'
,
first_name
=
'Enrolled'
,
last_name
=
'Student'
)
self
.
enrolled_student
=
UserFactory
(
username
=
'EnrolledStudent'
,
first_name
=
'Enrolled'
,
last_name
=
'Student'
)
...
@@ -752,10 +751,10 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
...
@@ -752,10 +751,10 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
"""
"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
self
.
instructor
=
InstructorFactory
(
course
=
self
.
course
.
id
)
self
.
instructor
=
InstructorFactory
(
course
_key
=
self
.
course
.
id
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
beta_tester
=
BetaTesterFactory
(
course
=
self
.
course
.
id
)
self
.
beta_tester
=
BetaTesterFactory
(
course
_key
=
self
.
course
.
id
)
CourseEnrollment
.
enroll
(
CourseEnrollment
.
enroll
(
self
.
beta_tester
,
self
.
beta_tester
,
self
.
course
.
id
self
.
course
.
id
...
@@ -1057,11 +1056,11 @@ class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase
...
@@ -1057,11 +1056,11 @@ class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase
"""
"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
self
.
instructor
=
InstructorFactory
(
course
=
self
.
course
.
id
)
self
.
instructor
=
InstructorFactory
(
course
_key
=
self
.
course
.
id
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
other_instructor
=
InstructorFactory
(
course
=
self
.
course
.
id
)
self
.
other_instructor
=
InstructorFactory
(
course
_key
=
self
.
course
.
id
)
self
.
other_staff
=
StaffFactory
(
course
=
self
.
course
.
id
)
self
.
other_staff
=
StaffFactory
(
course
_key
=
self
.
course
.
id
)
self
.
other_user
=
UserFactory
()
self
.
other_user
=
UserFactory
()
def
test_modify_access_noparams
(
self
):
def
test_modify_access_noparams
(
self
):
...
@@ -1300,7 +1299,7 @@ class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCa
...
@@ -1300,7 +1299,7 @@ class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCa
"""
"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
self
.
instructor
=
InstructorFactory
(
course
=
self
.
course
.
id
)
self
.
instructor
=
InstructorFactory
(
course
_key
=
self
.
course
.
id
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
students
=
[
UserFactory
()
for
_
in
xrange
(
6
)]
self
.
students
=
[
UserFactory
()
for
_
in
xrange
(
6
)]
...
@@ -1479,7 +1478,7 @@ class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase)
...
@@ -1479,7 +1478,7 @@ class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase)
"""
"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
self
.
instructor
=
InstructorFactory
(
course
=
self
.
course
.
id
)
self
.
instructor
=
InstructorFactory
(
course
_key
=
self
.
course
.
id
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
student
=
UserFactory
()
self
.
student
=
UserFactory
()
...
@@ -1617,7 +1616,7 @@ class TestInstructorSendEmail(ModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -1617,7 +1616,7 @@ class TestInstructorSendEmail(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
self
.
instructor
=
InstructorFactory
(
course
=
self
.
course
.
id
)
self
.
instructor
=
InstructorFactory
(
course
_key
=
self
.
course
.
id
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
test_subject
=
u'
\u1234
test subject'
test_subject
=
u'
\u1234
test subject'
test_message
=
u'
\u6824
test message'
test_message
=
u'
\u6824
test message'
...
@@ -1739,7 +1738,7 @@ class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -1739,7 +1738,7 @@ class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
self
.
instructor
=
InstructorFactory
(
course
=
self
.
course
.
id
)
self
.
instructor
=
InstructorFactory
(
course
_key
=
self
.
course
.
id
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
student
=
UserFactory
()
self
.
student
=
UserFactory
()
...
@@ -1872,7 +1871,7 @@ class TestInstructorAPIAnalyticsProxy(ModuleStoreTestCase, LoginEnrollmentTestCa
...
@@ -1872,7 +1871,7 @@ class TestInstructorAPIAnalyticsProxy(ModuleStoreTestCase, LoginEnrollmentTestCa
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
self
.
instructor
=
InstructorFactory
(
course
=
self
.
course
.
id
)
self
.
instructor
=
InstructorFactory
(
course
_key
=
self
.
course
.
id
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
@patch.object
(
instructor
.
views
.
api
.
requests
,
'get'
)
@patch.object
(
instructor
.
views
.
api
.
requests
,
'get'
)
...
@@ -2042,7 +2041,7 @@ class TestDueDateExtensions(ModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -2042,7 +2041,7 @@ class TestDueDateExtensions(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
user1
=
user1
self
.
user1
=
user1
self
.
user2
=
user2
self
.
user2
=
user2
self
.
instructor
=
InstructorFactory
(
course
=
course
.
id
)
self
.
instructor
=
InstructorFactory
(
course
_key
=
course
.
id
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
def
test_change_due_date
(
self
):
def
test_change_due_date
(
self
):
...
...
lms/djangoapps/instructor/tests/test_enrollment.py
View file @
d01af063
...
@@ -9,7 +9,6 @@ from courseware.models import StudentModule
...
@@ -9,7 +9,6 @@ from courseware.models import StudentModule
from
django.conf
import
settings
from
django.conf
import
settings
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
django.test.client
import
RequestFactory
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
courseware.tests.modulestore_config
import
TEST_DATA_MIXED_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_MIXED_MODULESTORE
...
@@ -27,7 +26,6 @@ from xmodule.modulestore.locations import SlashSeparatedCourseKey
...
@@ -27,7 +26,6 @@ from xmodule.modulestore.locations import SlashSeparatedCourseKey
from
submissions
import
api
as
sub_api
from
submissions
import
api
as
sub_api
from
student.models
import
anonymous_id_for_user
from
student.models
import
anonymous_id_for_user
from
.test_tools
import
msk_from_problem_urlname
class
TestSettableEnrollmentState
(
TestCase
):
class
TestSettableEnrollmentState
(
TestCase
):
...
...
lms/djangoapps/instructor/tests/test_legacy_gradebook.py
View file @
d01af063
...
@@ -11,7 +11,6 @@ from courseware.tests.tests import TEST_DATA_MIXED_MODULESTORE
...
@@ -11,7 +11,6 @@ from courseware.tests.tests import TEST_DATA_MIXED_MODULESTORE
from
capa.tests.response_xml_factory
import
StringResponseXMLFactory
from
capa.tests.response_xml_factory
import
StringResponseXMLFactory
from
courseware.tests.factories
import
StudentModuleFactory
from
courseware.tests.factories
import
StudentModuleFactory
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
...
...
lms/djangoapps/instructor/tests/test_legacy_reset.py
View file @
d01af063
...
@@ -16,7 +16,6 @@ from courseware.models import StudentModule
...
@@ -16,7 +16,6 @@ from courseware.models import StudentModule
from
submissions
import
api
as
sub_api
from
submissions
import
api
as
sub_api
from
student.models
import
anonymous_id_for_user
from
student.models
import
anonymous_id_for_user
from
.test_tools
import
msk_from_problem_urlname
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
...
...
lms/djangoapps/notes/api.py
View file @
d01af063
...
@@ -148,7 +148,7 @@ def create(request, course_key):
...
@@ -148,7 +148,7 @@ def create(request, course_key):
return
ApiResponse
(
http_response
=
response
,
data
=
None
)
return
ApiResponse
(
http_response
=
response
,
data
=
None
)
def
read
(
request
,
course_key
,
note_id
):
def
read
(
request
,
course_key
,
note_id
):
# pylint: disable=unused-argument (course_key)
'''
'''
Returns a single annotation object.
Returns a single annotation object.
'''
'''
...
@@ -163,7 +163,7 @@ def read(request, course_key, note_id):
...
@@ -163,7 +163,7 @@ def read(request, course_key, note_id):
return
ApiResponse
(
http_response
=
HttpResponse
(),
data
=
note
.
as_dict
())
return
ApiResponse
(
http_response
=
HttpResponse
(),
data
=
note
.
as_dict
())
def
update
(
request
,
course_key
,
note_id
):
def
update
(
request
,
course_key
,
note_id
):
# pylint: disable=unused-argument (course_key)
'''
'''
Updates an annotation object and returns a 303 with the read location.
Updates an annotation object and returns a 303 with the read location.
'''
'''
...
@@ -247,7 +247,7 @@ def search(request, course_key):
...
@@ -247,7 +247,7 @@ def search(request, course_key):
return
ApiResponse
(
http_response
=
HttpResponse
(),
data
=
result
)
return
ApiResponse
(
http_response
=
HttpResponse
(),
data
=
result
)
def
root
(
request
,
course_key
):
def
root
(
request
,
course_key
):
# pylint: disable=unused-argument (course_key, request)
'''
'''
Returns version information about the API.
Returns version information about the API.
'''
'''
...
...
lms/djangoapps/psychometrics/management/commands/init_psychometrics.py
View file @
d01af063
...
@@ -7,7 +7,6 @@ import json
...
@@ -7,7 +7,6 @@ import json
from
courseware.models
import
StudentModule
from
courseware.models
import
StudentModule
from
track.models
import
TrackingLog
from
track.models
import
TrackingLog
from
psychometrics.models
import
PsychometricData
from
psychometrics.models
import
PsychometricData
from
xmodule.modulestore.keys
import
UsageKey
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.management.base
import
BaseCommand
from
django.core.management.base
import
BaseCommand
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment