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
19f1daca
Commit
19f1daca
authored
Nov 30, 2014
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s/pylint: disable=E1101/pylint: disable=no-member/
parent
134effa8
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
80 additions
and
81 deletions
+80
-81
cms/djangoapps/contentstore/tests/test_contentstore.py
+0
-1
cms/djangoapps/contentstore/tests/test_import.py
+1
-1
cms/djangoapps/contentstore/tests/utils.py
+1
-1
cms/djangoapps/contentstore/utils.py
+1
-1
common/djangoapps/student/management/tests/test_transfer_students.py
+2
-2
common/djangoapps/terrain/browser.py
+1
-1
common/djangoapps/terrain/setup_prereqs.py
+5
-5
common/djangoapps/util/password_policy_validators.py
+1
-1
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
+1
-1
common/lib/xmodule/xmodule/studio_editable.py
+3
-3
common/lib/xmodule/xmodule/video_module/video_handlers.py
+1
-1
lms/djangoapps/bulk_email/tests/test_err_handling.py
+16
-16
lms/djangoapps/bulk_email/tests/test_tasks.py
+2
-2
lms/djangoapps/course_wiki/views.py
+1
-1
lms/djangoapps/courseware/tests/test_model_data.py
+1
-1
lms/djangoapps/instructor/features/bulk_email.py
+4
-4
lms/djangoapps/instructor/tests/test_ecommerce.py
+1
-1
lms/djangoapps/instructor/views/api.py
+1
-1
lms/djangoapps/instructor/views/legacy.py
+1
-1
lms/djangoapps/instructor_task/api_helper.py
+1
-1
lms/djangoapps/instructor_task/subtasks.py
+1
-1
lms/djangoapps/instructor_task/tests/test_api.py
+2
-2
lms/djangoapps/mobile_api/users/tests.py
+2
-2
lms/djangoapps/shoppingcart/models.py
+23
-23
lms/djangoapps/shoppingcart/tests/test_views.py
+7
-7
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
19f1daca
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# pylint: disable=E1101
# pylint: disable=W0212
# pylint: disable=W0212
import
copy
import
copy
...
...
cms/djangoapps/contentstore/tests/test_import.py
View file @
19f1daca
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# pylint: disable=
E1101
# pylint: disable=
no-member
# pylint: disable=protected-access
# pylint: disable=protected-access
"""
"""
Tests for import_from_xml using the mongo modulestore.
Tests for import_from_xml using the mongo modulestore.
...
...
cms/djangoapps/contentstore/tests/utils.py
View file @
19f1daca
# pylint: disable=
E1101
# pylint: disable=
no-member
'''
'''
Utilities for contentstore tests
Utilities for contentstore tests
'''
'''
...
...
cms/djangoapps/contentstore/utils.py
View file @
19f1daca
# pylint: disable=
E1101
# pylint: disable=
no-member
import
copy
import
copy
import
logging
import
logging
...
...
common/djangoapps/student/management/tests/test_transfer_students.py
View file @
19f1daca
...
@@ -45,8 +45,8 @@ class TestTransferStudents(ModuleStoreTestCase):
...
@@ -45,8 +45,8 @@ class TestTransferStudents(ModuleStoreTestCase):
def
test_transfer_students
(
self
):
def
test_transfer_students
(
self
):
""" Verify the transfer student command works as intended. """
""" Verify the transfer student command works as intended. """
student
=
UserFactory
.
create
()
student
=
UserFactory
.
create
()
student
.
set_password
(
self
.
PASSWORD
)
# pylint: disable=
E1101
student
.
set_password
(
self
.
PASSWORD
)
# pylint: disable=
no-member
student
.
save
()
# pylint: disable=
E1101
student
.
save
()
# pylint: disable=
no-member
mode
=
'verified'
mode
=
'verified'
# Original Course
# Original Course
original_course_location
=
locator
.
CourseLocator
(
'Org0'
,
'Course0'
,
'Run0'
)
original_course_location
=
locator
.
CourseLocator
(
'Org0'
,
'Course0'
,
'Run0'
)
...
...
common/djangoapps/terrain/browser.py
View file @
19f1daca
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
Browser set up for acceptance tests.
Browser set up for acceptance tests.
"""
"""
# pylint: disable=
E1101
# pylint: disable=
no-member
# pylint: disable=W0613
# pylint: disable=W0613
from
lettuce
import
before
,
after
,
world
from
lettuce
import
before
,
after
,
world
...
...
common/djangoapps/terrain/setup_prereqs.py
View file @
19f1daca
...
@@ -36,7 +36,7 @@ YOUTUBE_API_URLS = {
...
@@ -36,7 +36,7 @@ YOUTUBE_API_URLS = {
}
}
@before.all
# pylint: disable=
E1101
@before.all
# pylint: disable=
no-member
def
start_video_server
():
def
start_video_server
():
"""
"""
Serve the HTML5 Video Sources from a local port
Serve the HTML5 Video Sources from a local port
...
@@ -47,7 +47,7 @@ def start_video_server():
...
@@ -47,7 +47,7 @@ def start_video_server():
setattr
(
world
,
'video_source'
,
video_server
)
setattr
(
world
,
'video_source'
,
video_server
)
@after.all
# pylint: disable=
E1101
@after.all
# pylint: disable=
no-member
def
stop_video_server
(
_total
):
def
stop_video_server
(
_total
):
"""
"""
Stop the HTML5 Video Source server after all tests have executed
Stop the HTML5 Video Source server after all tests have executed
...
@@ -57,7 +57,7 @@ def stop_video_server(_total):
...
@@ -57,7 +57,7 @@ def stop_video_server(_total):
video_server
.
shutdown
()
video_server
.
shutdown
()
@before.each_scenario
# pylint: disable=
E1101
@before.each_scenario
# pylint: disable=
no-member
def
process_requires_tags
(
scenario
):
def
process_requires_tags
(
scenario
):
"""
"""
Process the scenario tags to make sure that any
Process the scenario tags to make sure that any
...
@@ -125,7 +125,7 @@ def is_youtube_available(urls):
...
@@ -125,7 +125,7 @@ def is_youtube_available(urls):
return
True
return
True
@after.each_scenario
# pylint: disable=
E1101
@after.each_scenario
# pylint: disable=
no-member
def
stop_stubs
(
_scenario
):
def
stop_stubs
(
_scenario
):
"""
"""
Shut down any stub services that were started up for the scenario.
Shut down any stub services that were started up for the scenario.
...
@@ -136,7 +136,7 @@ def stop_stubs(_scenario):
...
@@ -136,7 +136,7 @@ def stop_stubs(_scenario):
stub_server
.
shutdown
()
stub_server
.
shutdown
()
@after.each_scenario
# pylint: disable=
E1101
@after.each_scenario
# pylint: disable=
no-member
def
clear_alerts
(
_scenario
):
def
clear_alerts
(
_scenario
):
"""
"""
Clear any alerts that might still exist, so that
Clear any alerts that might still exist, so that
...
...
common/djangoapps/util/password_policy_validators.py
View file @
19f1daca
# pylint: disable=
E1101
# pylint: disable=
no-member
"""
"""
This file exposes a number of password complexity validators which can be optionally added to
This file exposes a number of password complexity validators which can be optionally added to
account creation
account creation
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
View file @
19f1daca
# pylint: disable=
E1101
# pylint: disable=
no-member
# pylint: disable=W0212
# pylint: disable=W0212
# pylint: disable=no-name-in-module
# pylint: disable=no-name-in-module
from
nose.tools
import
assert_equals
,
assert_raises
,
\
from
nose.tools
import
assert_equals
,
assert_raises
,
\
...
...
common/lib/xmodule/xmodule/studio_editable.py
View file @
19f1daca
...
@@ -19,10 +19,10 @@ class StudioEditableModule(object):
...
@@ -19,10 +19,10 @@ class StudioEditableModule(object):
"""
"""
contents
=
[]
contents
=
[]
for
child
in
self
.
descriptor
.
get_children
():
# pylint: disable=
E1101
for
child
in
self
.
descriptor
.
get_children
():
# pylint: disable=
no-member
if
can_reorder
:
if
can_reorder
:
context
[
'reorderable_items'
]
.
add
(
child
.
location
)
context
[
'reorderable_items'
]
.
add
(
child
.
location
)
child_module
=
self
.
system
.
get_module
(
child
)
# pylint: disable=
E1101
child_module
=
self
.
system
.
get_module
(
child
)
# pylint: disable=
no-member
rendered_child
=
child_module
.
render
(
StudioEditableModule
.
get_preview_view_name
(
child_module
),
context
)
rendered_child
=
child_module
.
render
(
StudioEditableModule
.
get_preview_view_name
(
child_module
),
context
)
fragment
.
add_frag_resources
(
rendered_child
)
fragment
.
add_frag_resources
(
rendered_child
)
...
@@ -31,7 +31,7 @@ class StudioEditableModule(object):
...
@@ -31,7 +31,7 @@ class StudioEditableModule(object):
'content'
:
rendered_child
.
content
'content'
:
rendered_child
.
content
})
})
fragment
.
add_content
(
self
.
system
.
render_template
(
"studio_render_children_view.html"
,
{
# pylint: disable=
E1101
fragment
.
add_content
(
self
.
system
.
render_template
(
"studio_render_children_view.html"
,
{
# pylint: disable=
no-member
'items'
:
contents
,
'items'
:
contents
,
'xblock_context'
:
context
,
'xblock_context'
:
context
,
'can_add'
:
can_add
,
'can_add'
:
can_add
,
...
...
common/lib/xmodule/xmodule/video_module/video_handlers.py
View file @
19f1daca
...
@@ -30,7 +30,7 @@ log = logging.getLogger(__name__)
...
@@ -30,7 +30,7 @@ log = logging.getLogger(__name__)
# Disable no-member warning:
# Disable no-member warning:
# pylint: disable=
E1101
# pylint: disable=
no-member
class
VideoStudentViewHandlers
(
object
):
class
VideoStudentViewHandlers
(
object
):
...
...
lms/djangoapps/bulk_email/tests/test_err_handling.py
View file @
19f1daca
...
@@ -173,7 +173,7 @@ class TestEmailErrors(ModuleStoreTestCase):
...
@@ -173,7 +173,7 @@ class TestEmailErrors(ModuleStoreTestCase):
entry
=
InstructorTask
.
create
(
course_id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
course_id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
task_input
=
{
"email_id"
:
-
1
}
task_input
=
{
"email_id"
:
-
1
}
with
self
.
assertRaises
(
CourseEmail
.
DoesNotExist
):
with
self
.
assertRaises
(
CourseEmail
.
DoesNotExist
):
perform_delegate_email_batches
(
entry
.
id
,
course_id
,
task_input
,
"action_name"
)
# pylint: disable=
E1101
perform_delegate_email_batches
(
entry
.
id
,
course_id
,
task_input
,
"action_name"
)
# pylint: disable=
no-member
((
log_str
,
__
,
email_id
),
__
)
=
mock_log
.
warning
.
call_args
((
log_str
,
__
,
email_id
),
__
)
=
mock_log
.
warning
.
call_args
self
.
assertTrue
(
mock_log
.
warning
.
called
)
self
.
assertTrue
(
mock_log
.
warning
.
called
)
self
.
assertIn
(
'Failed to get CourseEmail with id'
,
log_str
)
self
.
assertIn
(
'Failed to get CourseEmail with id'
,
log_str
)
...
@@ -188,10 +188,10 @@ class TestEmailErrors(ModuleStoreTestCase):
...
@@ -188,10 +188,10 @@ class TestEmailErrors(ModuleStoreTestCase):
email
=
CourseEmail
(
course_id
=
course_id
)
email
=
CourseEmail
(
course_id
=
course_id
)
email
.
save
()
email
.
save
()
entry
=
InstructorTask
.
create
(
course_id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
course_id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
task_input
=
{
"email_id"
:
email
.
id
}
# pylint: disable=
E1101
task_input
=
{
"email_id"
:
email
.
id
}
# pylint: disable=
no-member
# (?i) is a regex for ignore case
# (?i) is a regex for ignore case
with
self
.
assertRaisesRegexp
(
ValueError
,
r"(?i)course not found"
):
with
self
.
assertRaisesRegexp
(
ValueError
,
r"(?i)course not found"
):
perform_delegate_email_batches
(
entry
.
id
,
course_id
,
task_input
,
"action_name"
)
# pylint: disable=
E1101
perform_delegate_email_batches
(
entry
.
id
,
course_id
,
task_input
,
"action_name"
)
# pylint: disable=
no-member
def
test_nonexistent_to_option
(
self
):
def
test_nonexistent_to_option
(
self
):
"""
"""
...
@@ -200,9 +200,9 @@ class TestEmailErrors(ModuleStoreTestCase):
...
@@ -200,9 +200,9 @@ class TestEmailErrors(ModuleStoreTestCase):
email
=
CourseEmail
(
course_id
=
self
.
course
.
id
,
to_option
=
"IDONTEXIST"
)
email
=
CourseEmail
(
course_id
=
self
.
course
.
id
,
to_option
=
"IDONTEXIST"
)
email
.
save
()
email
.
save
()
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
task_input
=
{
"email_id"
:
email
.
id
}
# pylint: disable=
E1101
task_input
=
{
"email_id"
:
email
.
id
}
# pylint: disable=
no-member
with
self
.
assertRaisesRegexp
(
Exception
,
'Unexpected bulk email TO_OPTION found: IDONTEXIST'
):
with
self
.
assertRaisesRegexp
(
Exception
,
'Unexpected bulk email TO_OPTION found: IDONTEXIST'
):
perform_delegate_email_batches
(
entry
.
id
,
self
.
course
.
id
,
task_input
,
"action_name"
)
# pylint: disable=
E1101
perform_delegate_email_batches
(
entry
.
id
,
self
.
course
.
id
,
task_input
,
"action_name"
)
# pylint: disable=
no-member
def
test_wrong_course_id_in_task
(
self
):
def
test_wrong_course_id_in_task
(
self
):
"""
"""
...
@@ -211,9 +211,9 @@ class TestEmailErrors(ModuleStoreTestCase):
...
@@ -211,9 +211,9 @@ class TestEmailErrors(ModuleStoreTestCase):
email
=
CourseEmail
(
course_id
=
self
.
course
.
id
,
to_option
=
SEND_TO_ALL
)
email
=
CourseEmail
(
course_id
=
self
.
course
.
id
,
to_option
=
SEND_TO_ALL
)
email
.
save
()
email
.
save
()
entry
=
InstructorTask
.
create
(
"bogus/task/id"
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
"bogus/task/id"
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
task_input
=
{
"email_id"
:
email
.
id
}
# pylint: disable=
E1101
task_input
=
{
"email_id"
:
email
.
id
}
# pylint: disable=
no-member
with
self
.
assertRaisesRegexp
(
ValueError
,
'does not match task value'
):
with
self
.
assertRaisesRegexp
(
ValueError
,
'does not match task value'
):
perform_delegate_email_batches
(
entry
.
id
,
self
.
course
.
id
,
task_input
,
"action_name"
)
# pylint: disable=
E1101
perform_delegate_email_batches
(
entry
.
id
,
self
.
course
.
id
,
task_input
,
"action_name"
)
# pylint: disable=
no-member
def
test_wrong_course_id_in_email
(
self
):
def
test_wrong_course_id_in_email
(
self
):
"""
"""
...
@@ -222,14 +222,14 @@ class TestEmailErrors(ModuleStoreTestCase):
...
@@ -222,14 +222,14 @@ class TestEmailErrors(ModuleStoreTestCase):
email
=
CourseEmail
(
course_id
=
SlashSeparatedCourseKey
(
"bogus"
,
"course"
,
"id"
),
to_option
=
SEND_TO_ALL
)
email
=
CourseEmail
(
course_id
=
SlashSeparatedCourseKey
(
"bogus"
,
"course"
,
"id"
),
to_option
=
SEND_TO_ALL
)
email
.
save
()
email
.
save
()
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
task_input
=
{
"email_id"
:
email
.
id
}
# pylint: disable=
E1101
task_input
=
{
"email_id"
:
email
.
id
}
# pylint: disable=
no-member
with
self
.
assertRaisesRegexp
(
ValueError
,
'does not match email value'
):
with
self
.
assertRaisesRegexp
(
ValueError
,
'does not match email value'
):
perform_delegate_email_batches
(
entry
.
id
,
self
.
course
.
id
,
task_input
,
"action_name"
)
# pylint: disable=
E1101
perform_delegate_email_batches
(
entry
.
id
,
self
.
course
.
id
,
task_input
,
"action_name"
)
# pylint: disable=
no-member
def
test_send_email_undefined_subtask
(
self
):
def
test_send_email_undefined_subtask
(
self
):
# test at a lower level, to ensure that the course gets checked down below too.
# test at a lower level, to ensure that the course gets checked down below too.
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry_id
=
entry
.
id
# pylint: disable=
E1101
entry_id
=
entry
.
id
# pylint: disable=
no-member
to_list
=
[
'test@test.com'
]
to_list
=
[
'test@test.com'
]
global_email_context
=
{
'course_title'
:
'dummy course'
}
global_email_context
=
{
'course_title'
:
'dummy course'
}
subtask_id
=
"subtask-id-value"
subtask_id
=
"subtask-id-value"
...
@@ -241,7 +241,7 @@ class TestEmailErrors(ModuleStoreTestCase):
...
@@ -241,7 +241,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def
test_send_email_missing_subtask
(
self
):
def
test_send_email_missing_subtask
(
self
):
# test at a lower level, to ensure that the course gets checked down below too.
# test at a lower level, to ensure that the course gets checked down below too.
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry_id
=
entry
.
id
# pylint: disable=
E1101
entry_id
=
entry
.
id
# pylint: disable=
no-member
to_list
=
[
'test@test.com'
]
to_list
=
[
'test@test.com'
]
global_email_context
=
{
'course_title'
:
'dummy course'
}
global_email_context
=
{
'course_title'
:
'dummy course'
}
subtask_id
=
"subtask-id-value"
subtask_id
=
"subtask-id-value"
...
@@ -255,7 +255,7 @@ class TestEmailErrors(ModuleStoreTestCase):
...
@@ -255,7 +255,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def
test_send_email_completed_subtask
(
self
):
def
test_send_email_completed_subtask
(
self
):
# test at a lower level, to ensure that the course gets checked down below too.
# test at a lower level, to ensure that the course gets checked down below too.
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry_id
=
entry
.
id
# pylint: disable=
E1101
entry_id
=
entry
.
id
# pylint: disable=
no-member
subtask_id
=
"subtask-id-value"
subtask_id
=
"subtask-id-value"
initialize_subtask_info
(
entry
,
"emailed"
,
100
,
[
subtask_id
])
initialize_subtask_info
(
entry
,
"emailed"
,
100
,
[
subtask_id
])
subtask_status
=
SubtaskStatus
.
create
(
subtask_id
,
state
=
SUCCESS
)
subtask_status
=
SubtaskStatus
.
create
(
subtask_id
,
state
=
SUCCESS
)
...
@@ -270,7 +270,7 @@ class TestEmailErrors(ModuleStoreTestCase):
...
@@ -270,7 +270,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def
test_send_email_running_subtask
(
self
):
def
test_send_email_running_subtask
(
self
):
# test at a lower level, to ensure that the course gets checked down below too.
# test at a lower level, to ensure that the course gets checked down below too.
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry_id
=
entry
.
id
# pylint: disable=
E1101
entry_id
=
entry
.
id
# pylint: disable=
no-member
subtask_id
=
"subtask-id-value"
subtask_id
=
"subtask-id-value"
initialize_subtask_info
(
entry
,
"emailed"
,
100
,
[
subtask_id
])
initialize_subtask_info
(
entry
,
"emailed"
,
100
,
[
subtask_id
])
subtask_status
=
SubtaskStatus
.
create
(
subtask_id
)
subtask_status
=
SubtaskStatus
.
create
(
subtask_id
)
...
@@ -285,7 +285,7 @@ class TestEmailErrors(ModuleStoreTestCase):
...
@@ -285,7 +285,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def
test_send_email_retried_subtask
(
self
):
def
test_send_email_retried_subtask
(
self
):
# test at a lower level, to ensure that the course gets checked down below too.
# test at a lower level, to ensure that the course gets checked down below too.
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry_id
=
entry
.
id
# pylint: disable=
E1101
entry_id
=
entry
.
id
# pylint: disable=
no-member
subtask_id
=
"subtask-id-value"
subtask_id
=
"subtask-id-value"
initialize_subtask_info
(
entry
,
"emailed"
,
100
,
[
subtask_id
])
initialize_subtask_info
(
entry
,
"emailed"
,
100
,
[
subtask_id
])
subtask_status
=
SubtaskStatus
.
create
(
subtask_id
,
state
=
RETRY
,
retried_nomax
=
2
)
subtask_status
=
SubtaskStatus
.
create
(
subtask_id
,
state
=
RETRY
,
retried_nomax
=
2
)
...
@@ -305,7 +305,7 @@ class TestEmailErrors(ModuleStoreTestCase):
...
@@ -305,7 +305,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def
test_send_email_with_locked_instructor_task
(
self
):
def
test_send_email_with_locked_instructor_task
(
self
):
# test at a lower level, to ensure that the course gets checked down below too.
# test at a lower level, to ensure that the course gets checked down below too.
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry_id
=
entry
.
id
# pylint: disable=
E1101
entry_id
=
entry
.
id
# pylint: disable=
no-member
subtask_id
=
"subtask-id-locked-model"
subtask_id
=
"subtask-id-locked-model"
initialize_subtask_info
(
entry
,
"emailed"
,
100
,
[
subtask_id
])
initialize_subtask_info
(
entry
,
"emailed"
,
100
,
[
subtask_id
])
subtask_status
=
SubtaskStatus
.
create
(
subtask_id
)
subtask_status
=
SubtaskStatus
.
create
(
subtask_id
)
...
@@ -321,7 +321,7 @@ class TestEmailErrors(ModuleStoreTestCase):
...
@@ -321,7 +321,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def
test_send_email_undefined_email
(
self
):
def
test_send_email_undefined_email
(
self
):
# test at a lower level, to ensure that the course gets checked down below too.
# test at a lower level, to ensure that the course gets checked down below too.
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry
=
InstructorTask
.
create
(
self
.
course
.
id
,
"task_type"
,
"task_key"
,
"task_input"
,
self
.
instructor
)
entry_id
=
entry
.
id
# pylint: disable=
E1101
entry_id
=
entry
.
id
# pylint: disable=
no-member
to_list
=
[
'test@test.com'
]
to_list
=
[
'test@test.com'
]
global_email_context
=
{
'course_title'
:
'dummy course'
}
global_email_context
=
{
'course_title'
:
'dummy course'
}
subtask_id
=
"subtask-id-undefined-email"
subtask_id
=
"subtask-id-undefined-email"
...
...
lms/djangoapps/bulk_email/tests/test_tasks.py
View file @
19f1daca
...
@@ -91,7 +91,7 @@ class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase):
...
@@ -91,7 +91,7 @@ class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase):
to_option
=
SEND_TO_ALL
to_option
=
SEND_TO_ALL
course_id
=
course_id
or
self
.
course
.
id
course_id
=
course_id
or
self
.
course
.
id
course_email
=
CourseEmail
.
create
(
course_id
,
self
.
instructor
,
to_option
,
"Test Subject"
,
"<p>This is a test message</p>"
)
course_email
=
CourseEmail
.
create
(
course_id
,
self
.
instructor
,
to_option
,
"Test Subject"
,
"<p>This is a test message</p>"
)
task_input
=
{
'email_id'
:
course_email
.
id
}
# pylint: disable=
E1101
task_input
=
{
'email_id'
:
course_email
.
id
}
# pylint: disable=
no-member
task_id
=
str
(
uuid4
())
task_id
=
str
(
uuid4
())
instructor_task
=
InstructorTaskFactory
.
create
(
instructor_task
=
InstructorTaskFactory
.
create
(
course_id
=
course_id
,
course_id
=
course_id
,
...
@@ -134,7 +134,7 @@ class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase):
...
@@ -134,7 +134,7 @@ class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase):
with
self
.
assertRaises
(
ValueError
):
with
self
.
assertRaises
(
ValueError
):
with
patch
(
'bulk_email.tasks.update_subtask_status'
,
dummy_update_subtask_status
):
with
patch
(
'bulk_email.tasks.update_subtask_status'
,
dummy_update_subtask_status
):
send_bulk_course_email
(
task_entry
.
id
,
{})
# pylint: disable=
E1101
send_bulk_course_email
(
task_entry
.
id
,
{})
# pylint: disable=
no-member
def
_create_students
(
self
,
num_students
):
def
_create_students
(
self
,
num_students
):
"""Create students for testing"""
"""Create students for testing"""
...
...
lms/djangoapps/course_wiki/views.py
View file @
19f1daca
...
@@ -58,7 +58,7 @@ def course_wiki_redirect(request, course_id): # pylint: disable=W0613
...
@@ -58,7 +58,7 @@ def course_wiki_redirect(request, course_id): # pylint: disable=W0613
new_site
.
domain
=
settings
.
SITE_NAME
new_site
.
domain
=
settings
.
SITE_NAME
new_site
.
name
=
"edX"
new_site
.
name
=
"edX"
new_site
.
save
()
new_site
.
save
()
site_id
=
str
(
new_site
.
id
)
# pylint: disable=
E1101
site_id
=
str
(
new_site
.
id
)
# pylint: disable=
no-member
if
site_id
!=
str
(
settings
.
SITE_ID
):
if
site_id
!=
str
(
settings
.
SITE_ID
):
raise
ImproperlyConfigured
(
"No site object was created and the SITE_ID doesn't match the newly created one. {} != {}"
.
format
(
site_id
,
settings
.
SITE_ID
))
raise
ImproperlyConfigured
(
"No site object was created and the SITE_ID doesn't match the newly created one. {} != {}"
.
format
(
site_id
,
settings
.
SITE_ID
))
...
...
lms/djangoapps/courseware/tests/test_model_data.py
View file @
19f1daca
...
@@ -219,7 +219,7 @@ class StorageTestBase(object):
...
@@ -219,7 +219,7 @@ class StorageTestBase(object):
"""
"""
# Disable pylint warnings that arise because of the way the child classes call
# Disable pylint warnings that arise because of the way the child classes call
# this base class -- pylint's static analysis can't keep up with it.
# this base class -- pylint's static analysis can't keep up with it.
# pylint: disable=
E1101
, E1102
# pylint: disable=
no-member
, E1102
factory
=
None
factory
=
None
scope
=
None
scope
=
None
...
...
lms/djangoapps/instructor/features/bulk_email.py
View file @
19f1daca
...
@@ -106,8 +106,8 @@ def when_i_send_an_email(step, recipient): # pylint: disable=unused-argument
...
@@ -106,8 +106,8 @@ def when_i_send_an_email(step, recipient): # pylint: disable=unused-argument
)
)
# Clear the queue of existing emails
# Clear the queue of existing emails
while
not
mail
.
queue
.
empty
():
# pylint: disable=
E1101
while
not
mail
.
queue
.
empty
():
# pylint: disable=
no-member
mail
.
queue
.
get
()
# pylint: disable=
E1101
mail
.
queue
.
get
()
# pylint: disable=
no-member
# Because we flush the database before each run,
# Because we flush the database before each run,
# we need to ensure that the email template fixture
# we need to ensure that the email template fixture
...
@@ -156,8 +156,8 @@ def then_the_email_is_sent(step, recipient): # pylint: disable=unused-argument
...
@@ -156,8 +156,8 @@ def then_the_email_is_sent(step, recipient): # pylint: disable=unused-argument
# Retrieve messages. Because we are using celery in "always eager"
# Retrieve messages. Because we are using celery in "always eager"
# mode, we expect all messages to be sent by this point.
# mode, we expect all messages to be sent by this point.
messages
=
[]
messages
=
[]
while
not
mail
.
queue
.
empty
():
# pylint: disable=
E1101
while
not
mail
.
queue
.
empty
():
# pylint: disable=
no-member
messages
.
append
(
mail
.
queue
.
get
())
# pylint: disable=
E1101
messages
.
append
(
mail
.
queue
.
get
())
# pylint: disable=
no-member
# Check that we got the right number of messages
# Check that we got the right number of messages
assert_equal
(
assert_equal
(
...
...
lms/djangoapps/instructor/tests/test_ecommerce.py
View file @
19f1daca
...
@@ -253,7 +253,7 @@ class TestECommerceDashboardViews(ModuleStoreTestCase):
...
@@ -253,7 +253,7 @@ class TestECommerceDashboardViews(ModuleStoreTestCase):
response
=
self
.
client
.
post
(
self
.
url
)
response
=
self
.
client
.
post
(
self
.
url
)
self
.
assertTrue
(
'<td>AS452</td>'
in
response
.
content
)
self
.
assertTrue
(
'<td>AS452</td>'
in
response
.
content
)
data
=
{
data
=
{
'coupon_id'
:
coupon
.
id
,
'code'
:
'AS452'
,
'discount'
:
'10'
,
'description'
:
'updated_description'
,
# pylint: disable=
E1101
'coupon_id'
:
coupon
.
id
,
'code'
:
'AS452'
,
'discount'
:
'10'
,
'description'
:
'updated_description'
,
# pylint: disable=
no-member
'course_id'
:
coupon
.
course_id
.
to_deprecated_string
()
'course_id'
:
coupon
.
course_id
.
to_deprecated_string
()
}
}
# URL for update_coupon
# URL for update_coupon
...
...
lms/djangoapps/instructor/views/api.py
View file @
19f1daca
...
@@ -1709,7 +1709,7 @@ def send_email(request, course_id):
...
@@ -1709,7 +1709,7 @@ def send_email(request, course_id):
)
)
# Submit the task, so that the correct InstructorTask object gets created (for monitoring purposes)
# 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
instructor_task
.
api
.
submit_bulk_course_email
(
request
,
course_id
,
email
.
id
)
# pylint: disable=
no-member
response_payload
=
{
response_payload
=
{
'course_id'
:
course_id
.
to_deprecated_string
(),
'course_id'
:
course_id
.
to_deprecated_string
(),
...
...
lms/djangoapps/instructor/views/legacy.py
View file @
19f1daca
...
@@ -860,7 +860,7 @@ def instructor_dashboard(request, course_id):
...
@@ -860,7 +860,7 @@ def instructor_dashboard(request, course_id):
)
)
# Submit the task, so that the correct InstructorTask object gets created (for monitoring purposes)
# Submit the task, so that the correct InstructorTask object gets created (for monitoring purposes)
submit_bulk_course_email
(
request
,
course_key
,
email
.
id
)
# pylint: disable=
E1101
submit_bulk_course_email
(
request
,
course_key
,
email
.
id
)
# pylint: disable=
no-member
except
Exception
as
err
:
# pylint: disable=broad-except
except
Exception
as
err
:
# pylint: disable=broad-except
# Catch any errors and deliver a message to the user
# Catch any errors and deliver a message to the user
...
...
lms/djangoapps/instructor_task/api_helper.py
View file @
19f1daca
...
@@ -301,7 +301,7 @@ def submit_task(request, task_type, task_class, course_key, task_input, task_key
...
@@ -301,7 +301,7 @@ def submit_task(request, task_type, task_class, course_key, task_input, task_key
# submit task:
# submit task:
task_id
=
instructor_task
.
task_id
task_id
=
instructor_task
.
task_id
task_args
=
[
instructor_task
.
id
,
_get_xmodule_instance_args
(
request
,
task_id
)]
# pylint: disable=
E1101
task_args
=
[
instructor_task
.
id
,
_get_xmodule_instance_args
(
request
,
task_id
)]
# pylint: disable=
no-member
task_class
.
apply_async
(
task_args
,
task_id
=
task_id
)
task_class
.
apply_async
(
task_args
,
task_id
=
task_id
)
return
instructor_task
return
instructor_task
lms/djangoapps/instructor_task/subtasks.py
View file @
19f1daca
...
@@ -307,7 +307,7 @@ def queue_subtasks_for_query(entry, action_name, create_subtask_fcn, item_querys
...
@@ -307,7 +307,7 @@ def queue_subtasks_for_query(entry, action_name, create_subtask_fcn, item_querys
entry
.
id
,
entry
.
id
,
total_num_subtasks
,
total_num_subtasks
,
total_num_items
,
total_num_items
,
)
# pylint: disable=
E1101
)
# pylint: disable=
no-member
progress
=
initialize_subtask_info
(
entry
,
action_name
,
total_num_items
,
subtask_id_list
)
progress
=
initialize_subtask_info
(
entry
,
action_name
,
total_num_items
,
subtask_id_list
)
# Construct a generator that will return the recipients to use for each subtask.
# Construct a generator that will return the recipients to use for each subtask.
...
...
lms/djangoapps/instructor_task/tests/test_api.py
View file @
19f1daca
...
@@ -170,7 +170,7 @@ class InstructorTaskCourseSubmitTest(TestReportMixin, InstructorTaskCourseTestCa
...
@@ -170,7 +170,7 @@ class InstructorTaskCourseSubmitTest(TestReportMixin, InstructorTaskCourseTestCa
def
_define_course_email
(
self
):
def
_define_course_email
(
self
):
"""Create CourseEmail object for testing."""
"""Create CourseEmail object for testing."""
course_email
=
CourseEmail
.
create
(
self
.
course
.
id
,
self
.
instructor
,
SEND_TO_ALL
,
"Test Subject"
,
"<p>This is a test message</p>"
)
course_email
=
CourseEmail
.
create
(
self
.
course
.
id
,
self
.
instructor
,
SEND_TO_ALL
,
"Test Subject"
,
"<p>This is a test message</p>"
)
return
course_email
.
id
# pylint: disable=
E1101
return
course_email
.
id
# pylint: disable=
no-member
def
_test_resubmission
(
self
,
api_call
):
def
_test_resubmission
(
self
,
api_call
):
"""
"""
...
@@ -181,7 +181,7 @@ class InstructorTaskCourseSubmitTest(TestReportMixin, InstructorTaskCourseTestCa
...
@@ -181,7 +181,7 @@ class InstructorTaskCourseSubmitTest(TestReportMixin, InstructorTaskCourseTestCa
`AlreadyRunningError`.
`AlreadyRunningError`.
"""
"""
instructor_task
=
api_call
()
instructor_task
=
api_call
()
instructor_task
=
InstructorTask
.
objects
.
get
(
id
=
instructor_task
.
id
)
# pylint: disable=
E1101
instructor_task
=
InstructorTask
.
objects
.
get
(
id
=
instructor_task
.
id
)
# pylint: disable=
no-member
instructor_task
.
task_state
=
PROGRESS
instructor_task
.
task_state
=
PROGRESS
instructor_task
.
save
()
instructor_task
.
save
()
with
self
.
assertRaises
(
AlreadyRunningError
):
with
self
.
assertRaises
(
AlreadyRunningError
):
...
...
lms/djangoapps/mobile_api/users/tests.py
View file @
19f1daca
...
@@ -122,7 +122,7 @@ class TestUserApi(ModuleStoreTestCase, APITestCase):
...
@@ -122,7 +122,7 @@ class TestUserApi(ModuleStoreTestCase, APITestCase):
def
test_course_serializer
(
self
):
def
test_course_serializer
(
self
):
self
.
client
.
login
(
username
=
self
.
username
,
password
=
self
.
password
)
self
.
client
.
login
(
username
=
self
.
username
,
password
=
self
.
password
)
self
.
_enroll
(
self
.
course
)
self
.
_enroll
(
self
.
course
)
serialized
=
CourseEnrollmentSerializer
(
CourseEnrollment
.
enrollments_for_user
(
self
.
user
)[
0
])
.
data
# pylint: disable=
E1101
serialized
=
CourseEnrollmentSerializer
(
CourseEnrollment
.
enrollments_for_user
(
self
.
user
)[
0
])
.
data
# pylint: disable=
no-member
self
.
assertEqual
(
serialized
[
'course'
][
'video_outline'
],
None
)
self
.
assertEqual
(
serialized
[
'course'
][
'video_outline'
],
None
)
self
.
assertEqual
(
serialized
[
'course'
][
'name'
],
self
.
course
.
display_name
)
self
.
assertEqual
(
serialized
[
'course'
][
'name'
],
self
.
course
.
display_name
)
self
.
assertEqual
(
serialized
[
'course'
][
'number'
],
self
.
course
.
id
.
course
)
self
.
assertEqual
(
serialized
[
'course'
][
'number'
],
self
.
course
.
id
.
course
)
...
@@ -135,7 +135,7 @@ class TestUserApi(ModuleStoreTestCase, APITestCase):
...
@@ -135,7 +135,7 @@ class TestUserApi(ModuleStoreTestCase, APITestCase):
self
.
client
.
login
(
username
=
self
.
username
,
password
=
self
.
password
)
self
.
client
.
login
(
username
=
self
.
username
,
password
=
self
.
password
)
self
.
_enroll
(
self
.
course
)
self
.
_enroll
(
self
.
course
)
serialized
=
CourseEnrollmentSerializer
(
CourseEnrollment
.
enrollments_for_user
(
self
.
user
)[
0
])
.
data
# pylint: disable=
E1101
serialized
=
CourseEnrollmentSerializer
(
CourseEnrollment
.
enrollments_for_user
(
self
.
user
)[
0
])
.
data
# pylint: disable=
no-member
self
.
assertEqual
(
serialized
[
'course'
][
'number'
],
self
.
course
.
display_coursenumber
)
self
.
assertEqual
(
serialized
[
'course'
][
'number'
],
self
.
course
.
display_coursenumber
)
self
.
assertEqual
(
serialized
[
'course'
][
'org'
],
self
.
course
.
display_organization
)
self
.
assertEqual
(
serialized
[
'course'
][
'org'
],
self
.
course
.
display_organization
)
...
...
lms/djangoapps/shoppingcart/models.py
View file @
19f1daca
...
@@ -158,7 +158,7 @@ class Order(models.Model):
...
@@ -158,7 +158,7 @@ class Order(models.Model):
Return the total cost of the cart. If the order has been purchased, returns total of
Return the total cost of the cart. If the order has been purchased, returns total of
all purchased and not refunded items.
all purchased and not refunded items.
"""
"""
return
sum
(
i
.
line_cost
for
i
in
self
.
orderitem_set
.
filter
(
status
=
self
.
status
))
# pylint: disable=
E1101
return
sum
(
i
.
line_cost
for
i
in
self
.
orderitem_set
.
filter
(
status
=
self
.
status
))
# pylint: disable=
no-member
def
has_items
(
self
,
item_type
=
None
):
def
has_items
(
self
,
item_type
=
None
):
"""
"""
...
@@ -166,9 +166,9 @@ class Order(models.Model):
...
@@ -166,9 +166,9 @@ class Order(models.Model):
If an item_type is passed in then we check to see if there are any items of that class type
If an item_type is passed in then we check to see if there are any items of that class type
"""
"""
if
not
item_type
:
if
not
item_type
:
return
self
.
orderitem_set
.
exists
()
# pylint: disable=
E1101
return
self
.
orderitem_set
.
exists
()
# pylint: disable=
no-member
else
:
else
:
items
=
self
.
orderitem_set
.
all
()
.
select_subclasses
()
# pylint: disable=
E1101
items
=
self
.
orderitem_set
.
all
()
.
select_subclasses
()
# pylint: disable=
no-member
for
item
in
items
:
for
item
in
items
:
if
isinstance
(
item
,
item_type
):
if
isinstance
(
item
,
item_type
):
return
True
return
True
...
@@ -178,7 +178,7 @@ class Order(models.Model):
...
@@ -178,7 +178,7 @@ class Order(models.Model):
"""
"""
Reset the items price state in the user cart
Reset the items price state in the user cart
"""
"""
for
item
in
self
.
orderitem_set
.
all
():
# pylint: disable=
E1101
for
item
in
self
.
orderitem_set
.
all
():
# pylint: disable=
no-member
if
item
.
list_price
:
if
item
.
list_price
:
item
.
unit_cost
=
item
.
list_price
item
.
unit_cost
=
item
.
list_price
item
.
list_price
=
None
item
.
list_price
=
None
...
@@ -188,7 +188,7 @@ class Order(models.Model):
...
@@ -188,7 +188,7 @@ class Order(models.Model):
"""
"""
Clear out all the items in the cart
Clear out all the items in the cart
"""
"""
self
.
orderitem_set
.
all
()
.
delete
()
# pylint: disable=
E1101
self
.
orderitem_set
.
all
()
.
delete
()
# pylint: disable=
no-member
@transaction.commit_on_success
@transaction.commit_on_success
def
start_purchase
(
self
):
def
start_purchase
(
self
):
...
@@ -216,7 +216,7 @@ class Order(models.Model):
...
@@ -216,7 +216,7 @@ class Order(models.Model):
The UI/UX may change in the future to make the switching between PaidCourseRegistration
The UI/UX may change in the future to make the switching between PaidCourseRegistration
and CourseRegCodeItems a more explicit UI gesture from the purchaser
and CourseRegCodeItems a more explicit UI gesture from the purchaser
"""
"""
cart_items
=
self
.
orderitem_set
.
all
()
# pylint: disable=
E1101
cart_items
=
self
.
orderitem_set
.
all
()
# pylint: disable=
no-member
is_order_type_business
=
False
is_order_type_business
=
False
for
cart_item
in
cart_items
:
for
cart_item
in
cart_items
:
if
cart_item
.
qty
>
1
:
if
cart_item
.
qty
>
1
:
...
@@ -272,7 +272,7 @@ class Order(models.Model):
...
@@ -272,7 +272,7 @@ class Order(models.Model):
"""
"""
send confirmation e-mail
send confirmation e-mail
"""
"""
recipient_list
=
[(
self
.
user
.
username
,
getattr
(
self
.
user
,
'email'
),
'user'
)]
# pylint: disable=
E1101
recipient_list
=
[(
self
.
user
.
username
,
getattr
(
self
.
user
,
'email'
),
'user'
)]
# pylint: disable=
no-member
if
self
.
company_contact_email
:
if
self
.
company_contact_email
:
recipient_list
.
append
((
self
.
company_contact_name
,
self
.
company_contact_email
,
'company_contact'
))
recipient_list
.
append
((
self
.
company_contact_name
,
self
.
company_contact_email
,
'company_contact'
))
joined_course_names
=
""
joined_course_names
=
""
...
@@ -310,7 +310,7 @@ class Order(models.Model):
...
@@ -310,7 +310,7 @@ class Order(models.Model):
'course_names'
:
", "
.
join
([
course_info
[
0
]
for
course_info
in
courses_info
]),
'course_names'
:
", "
.
join
([
course_info
[
0
]
for
course_info
in
courses_info
]),
'dashboard_url'
:
dashboard_url
,
'dashboard_url'
:
dashboard_url
,
'currency_symbol'
:
settings
.
PAID_COURSE_REGISTRATION_CURRENCY
[
1
],
'currency_symbol'
:
settings
.
PAID_COURSE_REGISTRATION_CURRENCY
[
1
],
'order_placed_by'
:
'{username} ({email})'
.
format
(
username
=
self
.
user
.
username
,
email
=
getattr
(
self
.
user
,
'email'
)),
# pylint: disable=
E1101
'order_placed_by'
:
'{username} ({email})'
.
format
(
username
=
self
.
user
.
username
,
email
=
getattr
(
self
.
user
,
'email'
)),
# pylint: disable=
no-member
'has_billing_info'
:
settings
.
FEATURES
[
'STORE_BILLING_INFO'
],
'has_billing_info'
:
settings
.
FEATURES
[
'STORE_BILLING_INFO'
],
'platform_name'
:
microsite
.
get_value
(
'platform_name'
,
settings
.
PLATFORM_NAME
),
'platform_name'
:
microsite
.
get_value
(
'platform_name'
,
settings
.
PLATFORM_NAME
),
'payment_support_email'
:
microsite
.
get_value
(
'payment_support_email'
,
settings
.
PAYMENT_SUPPORT_EMAIL
),
'payment_support_email'
:
microsite
.
get_value
(
'payment_support_email'
,
settings
.
PAYMENT_SUPPORT_EMAIL
),
...
@@ -333,7 +333,7 @@ class Order(models.Model):
...
@@ -333,7 +333,7 @@ class Order(models.Model):
email
.
attach
(
u'RegistrationCodesRedemptionUrls.csv'
,
csv_file
.
getvalue
(),
'text/csv'
)
email
.
attach
(
u'RegistrationCodesRedemptionUrls.csv'
,
csv_file
.
getvalue
(),
'text/csv'
)
email
.
send
()
email
.
send
()
except
(
smtplib
.
SMTPException
,
BotoServerError
):
# sadly need to handle diff. mail backends individually
except
(
smtplib
.
SMTPException
,
BotoServerError
):
# sadly need to handle diff. mail backends individually
log
.
error
(
'Failed sending confirmation e-mail for order
%
d'
,
self
.
id
)
# pylint: disable=
E1101
log
.
error
(
'Failed sending confirmation e-mail for order
%
d'
,
self
.
id
)
# pylint: disable=
no-member
def
purchase
(
self
,
first
=
''
,
last
=
''
,
street1
=
''
,
street2
=
''
,
city
=
''
,
state
=
''
,
postalcode
=
''
,
def
purchase
(
self
,
first
=
''
,
last
=
''
,
street1
=
''
,
street2
=
''
,
city
=
''
,
state
=
''
,
postalcode
=
''
,
country
=
''
,
ccnum
=
''
,
cardtype
=
''
,
processor_reply_dump
=
''
):
country
=
''
,
ccnum
=
''
,
cardtype
=
''
,
processor_reply_dump
=
''
):
...
@@ -356,7 +356,7 @@ class Order(models.Model):
...
@@ -356,7 +356,7 @@ class Order(models.Model):
"""
"""
if
self
.
status
==
'purchased'
:
if
self
.
status
==
'purchased'
:
log
.
error
(
log
.
error
(
u"`purchase` method called on order {}, but order is already purchased."
.
format
(
self
.
id
)
# pylint: disable=
E1101
u"`purchase` method called on order {}, but order is already purchased."
.
format
(
self
.
id
)
# pylint: disable=
no-member
)
)
return
return
self
.
status
=
'purchased'
self
.
status
=
'purchased'
...
@@ -410,8 +410,8 @@ class Order(models.Model):
...
@@ -410,8 +410,8 @@ class Order(models.Model):
try
:
try
:
if
settings
.
FEATURES
.
get
(
'SEGMENT_IO_LMS'
)
and
settings
.
SEGMENT_IO_LMS_KEY
:
if
settings
.
FEATURES
.
get
(
'SEGMENT_IO_LMS'
)
and
settings
.
SEGMENT_IO_LMS_KEY
:
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
analytics
.
track
(
self
.
user
.
id
,
event_name
,
{
# pylint: disable=
E1101
analytics
.
track
(
self
.
user
.
id
,
event_name
,
{
# pylint: disable=
no-member
'orderId'
:
self
.
id
,
# pylint: disable=
E1101
'orderId'
:
self
.
id
,
# pylint: disable=
no-member
'total'
:
str
(
self
.
total_cost
),
'total'
:
str
(
self
.
total_cost
),
'currency'
:
self
.
currency
,
'currency'
:
self
.
currency
,
'products'
:
[
item
.
analytics_data
()
for
item
in
orderitems
]
'products'
:
[
item
.
analytics_data
()
for
item
in
orderitems
]
...
@@ -427,7 +427,7 @@ class Order(models.Model):
...
@@ -427,7 +427,7 @@ class Order(models.Model):
# errors in the logs.
# errors in the logs.
log
.
exception
(
log
.
exception
(
u'Unable to emit {event} event for user {user} and order {order}'
.
format
(
u'Unable to emit {event} event for user {user} and order {order}'
.
format
(
event
=
event_name
,
user
=
self
.
user
.
id
,
order
=
self
.
id
)
# pylint: disable=
E1101
event
=
event_name
,
user
=
self
.
user
.
id
,
order
=
self
.
id
)
# pylint: disable=
no-member
)
)
def
add_billing_details
(
self
,
company_name
=
''
,
company_contact_name
=
''
,
company_contact_email
=
''
,
recipient_name
=
''
,
def
add_billing_details
(
self
,
company_name
=
''
,
company_contact_name
=
''
,
company_contact_email
=
''
,
recipient_name
=
''
,
...
@@ -595,7 +595,7 @@ class OrderItem(TimeStampedModel):
...
@@ -595,7 +595,7 @@ class OrderItem(TimeStampedModel):
"""
"""
return
{
return
{
'id'
:
self
.
id
,
# pylint: disable=
E1101
'id'
:
self
.
id
,
# pylint: disable=
no-member
'sku'
:
type
(
self
)
.
__name__
,
'sku'
:
type
(
self
)
.
__name__
,
'name'
:
'N/A'
,
'name'
:
'N/A'
,
'price'
:
str
(
self
.
unit_cost
),
'price'
:
str
(
self
.
unit_cost
),
...
@@ -652,7 +652,7 @@ class CourseRegistrationCode(models.Model):
...
@@ -652,7 +652,7 @@ class CourseRegistrationCode(models.Model):
for
item
in
cart_items
:
for
item
in
cart_items
:
CourseEnrollment
.
enroll
(
cart
.
user
,
item
.
course_id
)
CourseEnrollment
.
enroll
(
cart
.
user
,
item
.
course_id
)
log
.
info
(
"Enrolled '{0}' in free course '{1}'"
log
.
info
(
"Enrolled '{0}' in free course '{1}'"
.
format
(
cart
.
user
.
email
,
item
.
course_id
))
# pylint: disable=
E1101
.
format
(
cart
.
user
.
email
,
item
.
course_id
))
# pylint: disable=
no-member
item
.
status
=
'purchased'
item
.
status
=
'purchased'
item
.
save
()
item
.
save
()
...
@@ -834,7 +834,7 @@ class PaidCourseRegistration(OrderItem):
...
@@ -834,7 +834,7 @@ class PaidCourseRegistration(OrderItem):
This will return the total amount of money that a purchased course generated
This will return the total amount of money that a purchased course generated
"""
"""
total_cost
=
0
total_cost
=
0
result
=
cls
.
objects
.
filter
(
course_id
=
course_key
,
status
=
'purchased'
)
.
aggregate
(
total
=
Sum
(
'unit_cost'
,
field
=
'qty * unit_cost'
))
# pylint: disable=
E1101
result
=
cls
.
objects
.
filter
(
course_id
=
course_key
,
status
=
'purchased'
)
.
aggregate
(
total
=
Sum
(
'unit_cost'
,
field
=
'qty * unit_cost'
))
# pylint: disable=
no-member
if
result
[
'total'
]
is
not
None
:
if
result
[
'total'
]
is
not
None
:
total_cost
=
result
[
'total'
]
total_cost
=
result
[
'total'
]
...
@@ -911,7 +911,7 @@ class PaidCourseRegistration(OrderItem):
...
@@ -911,7 +911,7 @@ class PaidCourseRegistration(OrderItem):
CourseEnrollment
.
enroll
(
user
=
self
.
user
,
course_key
=
self
.
course_id
,
mode
=
self
.
mode
)
CourseEnrollment
.
enroll
(
user
=
self
.
user
,
course_key
=
self
.
course_id
,
mode
=
self
.
mode
)
log
.
info
(
"Enrolled {0} in paid course {1}, paid ${2}"
log
.
info
(
"Enrolled {0} in paid course {1}, paid ${2}"
.
format
(
self
.
user
.
email
,
self
.
course_id
,
self
.
line_cost
))
# pylint: disable=
E1101
.
format
(
self
.
user
.
email
,
self
.
course_id
,
self
.
line_cost
))
# pylint: disable=
no-member
def
generate_receipt_instructions
(
self
):
def
generate_receipt_instructions
(
self
):
"""
"""
...
@@ -948,7 +948,7 @@ class PaidCourseRegistration(OrderItem):
...
@@ -948,7 +948,7 @@ class PaidCourseRegistration(OrderItem):
sku
=
data
[
'sku'
]
sku
=
data
[
'sku'
]
if
self
.
course_id
!=
CourseKeyField
.
Empty
:
if
self
.
course_id
!=
CourseKeyField
.
Empty
:
data
[
'name'
]
=
unicode
(
self
.
course_id
)
data
[
'name'
]
=
unicode
(
self
.
course_id
)
data
[
'category'
]
=
unicode
(
self
.
course_id
.
org
)
# pylint: disable=
E1101
data
[
'category'
]
=
unicode
(
self
.
course_id
.
org
)
# pylint: disable=
no-member
if
self
.
mode
:
if
self
.
mode
:
data
[
'sku'
]
=
sku
+
u'.'
+
unicode
(
self
.
mode
)
data
[
'sku'
]
=
sku
+
u'.'
+
unicode
(
self
.
mode
)
return
data
return
data
...
@@ -979,7 +979,7 @@ class CourseRegCodeItem(OrderItem):
...
@@ -979,7 +979,7 @@ class CourseRegCodeItem(OrderItem):
This will return the total amount of money that a purchased course generated
This will return the total amount of money that a purchased course generated
"""
"""
total_cost
=
0
total_cost
=
0
result
=
cls
.
objects
.
filter
(
course_id
=
course_key
,
status
=
'purchased'
)
.
aggregate
(
total
=
Sum
(
'unit_cost'
,
field
=
'qty * unit_cost'
))
# pylint: disable=
E1101
result
=
cls
.
objects
.
filter
(
course_id
=
course_key
,
status
=
'purchased'
)
.
aggregate
(
total
=
Sum
(
'unit_cost'
,
field
=
'qty * unit_cost'
))
# pylint: disable=
no-member
if
result
[
'total'
]
is
not
None
:
if
result
[
'total'
]
is
not
None
:
total_cost
=
result
[
'total'
]
total_cost
=
result
[
'total'
]
...
@@ -1061,7 +1061,7 @@ class CourseRegCodeItem(OrderItem):
...
@@ -1061,7 +1061,7 @@ class CourseRegCodeItem(OrderItem):
save_registration_code
(
self
.
user
,
self
.
course_id
,
invoice
=
None
,
order
=
self
.
order
)
save_registration_code
(
self
.
user
,
self
.
course_id
,
invoice
=
None
,
order
=
self
.
order
)
log
.
info
(
"Enrolled {0} in paid course {1}, paid ${2}"
log
.
info
(
"Enrolled {0} in paid course {1}, paid ${2}"
.
format
(
self
.
user
.
email
,
self
.
course_id
,
self
.
line_cost
))
# pylint: disable=
E1101
.
format
(
self
.
user
.
email
,
self
.
course_id
,
self
.
line_cost
))
# pylint: disable=
no-member
@property
@property
def
csv_report_comments
(
self
):
def
csv_report_comments
(
self
):
...
@@ -1088,7 +1088,7 @@ class CourseRegCodeItem(OrderItem):
...
@@ -1088,7 +1088,7 @@ class CourseRegCodeItem(OrderItem):
sku
=
data
[
'sku'
]
sku
=
data
[
'sku'
]
if
self
.
course_id
!=
CourseKeyField
.
Empty
:
if
self
.
course_id
!=
CourseKeyField
.
Empty
:
data
[
'name'
]
=
unicode
(
self
.
course_id
)
data
[
'name'
]
=
unicode
(
self
.
course_id
)
data
[
'category'
]
=
unicode
(
self
.
course_id
.
org
)
# pylint: disable=
E1101
data
[
'category'
]
=
unicode
(
self
.
course_id
.
org
)
# pylint: disable=
no-member
if
self
.
mode
:
if
self
.
mode
:
data
[
'sku'
]
=
sku
+
u'.'
+
unicode
(
self
.
mode
)
data
[
'sku'
]
=
sku
+
u'.'
+
unicode
(
self
.
mode
)
return
data
return
data
...
@@ -1328,7 +1328,7 @@ class CertificateItem(OrderItem):
...
@@ -1328,7 +1328,7 @@ class CertificateItem(OrderItem):
sku
=
data
[
'sku'
]
sku
=
data
[
'sku'
]
if
self
.
course_id
!=
CourseKeyField
.
Empty
:
if
self
.
course_id
!=
CourseKeyField
.
Empty
:
data
[
'name'
]
=
unicode
(
self
.
course_id
)
data
[
'name'
]
=
unicode
(
self
.
course_id
)
data
[
'category'
]
=
unicode
(
self
.
course_id
.
org
)
# pylint: disable=
E1101
data
[
'category'
]
=
unicode
(
self
.
course_id
.
org
)
# pylint: disable=
no-member
if
self
.
mode
:
if
self
.
mode
:
data
[
'sku'
]
=
sku
+
u'.'
+
unicode
(
self
.
mode
)
data
[
'sku'
]
=
sku
+
u'.'
+
unicode
(
self
.
mode
)
return
data
return
data
...
@@ -1496,7 +1496,7 @@ class Donation(OrderItem):
...
@@ -1496,7 +1496,7 @@ class Donation(OrderItem):
data
=
super
(
Donation
,
self
)
.
analytics_data
()
data
=
super
(
Donation
,
self
)
.
analytics_data
()
if
self
.
course_id
!=
CourseKeyField
.
Empty
:
if
self
.
course_id
!=
CourseKeyField
.
Empty
:
data
[
'name'
]
=
unicode
(
self
.
course_id
)
data
[
'name'
]
=
unicode
(
self
.
course_id
)
data
[
'category'
]
=
unicode
(
self
.
course_id
.
org
)
# pylint: disable=
E1101
data
[
'category'
]
=
unicode
(
self
.
course_id
.
org
)
# pylint: disable=
no-member
else
:
else
:
data
[
'name'
]
=
settings
.
PLATFORM_NAME
data
[
'name'
]
=
settings
.
PLATFORM_NAME
data
[
'category'
]
=
settings
.
PLATFORM_NAME
data
[
'category'
]
=
settings
.
PLATFORM_NAME
...
...
lms/djangoapps/shoppingcart/tests/test_views.py
View file @
19f1daca
...
@@ -405,7 +405,7 @@ class ShoppingCartViewsTests(ModuleStoreTestCase):
...
@@ -405,7 +405,7 @@ class ShoppingCartViewsTests(ModuleStoreTestCase):
item
=
self
.
cart
.
orderitem_set
.
all
()
.
select_subclasses
()[
1
]
item
=
self
.
cart
.
orderitem_set
.
all
()
.
select_subclasses
()[
1
]
self
.
assertEquals
(
item
.
unit_cost
,
self
.
get_discount
(
self
.
testing_cost
))
self
.
assertEquals
(
item
.
unit_cost
,
self
.
get_discount
(
self
.
testing_cost
))
def
test_soft_delete_coupon
(
self
):
# pylint: disable=
E1101
def
test_soft_delete_coupon
(
self
):
# pylint: disable=
no-member
self
.
add_coupon
(
self
.
course_key
,
True
,
self
.
coupon_code
)
self
.
add_coupon
(
self
.
course_key
,
True
,
self
.
coupon_code
)
coupon
=
Coupon
(
code
=
'TestCode'
,
description
=
'testing'
,
course_id
=
self
.
course_key
,
coupon
=
Coupon
(
code
=
'TestCode'
,
description
=
'testing'
,
course_id
=
self
.
course_key
,
percentage_discount
=
12
,
created_by
=
self
.
user
,
is_active
=
True
)
percentage_discount
=
12
,
created_by
=
self
.
user
,
is_active
=
True
)
...
@@ -416,25 +416,25 @@ class ShoppingCartViewsTests(ModuleStoreTestCase):
...
@@ -416,25 +416,25 @@ class ShoppingCartViewsTests(ModuleStoreTestCase):
get_coupon
=
Coupon
.
objects
.
get
(
id
=
1
)
get_coupon
=
Coupon
.
objects
.
get
(
id
=
1
)
request
=
HttpRequest
()
request
=
HttpRequest
()
request
.
user
=
admin
request
.
user
=
admin
setattr
(
request
,
'session'
,
'session'
)
# pylint: disable=
E1101
setattr
(
request
,
'session'
,
'session'
)
# pylint: disable=
no-member
messages
=
FallbackStorage
(
request
)
# pylint: disable=
E1101
messages
=
FallbackStorage
(
request
)
# pylint: disable=
no-member
setattr
(
request
,
'_messages'
,
messages
)
# pylint: disable=
E1101
setattr
(
request
,
'_messages'
,
messages
)
# pylint: disable=
no-member
coupon_admin
=
SoftDeleteCouponAdmin
(
Coupon
,
AdminSite
())
coupon_admin
=
SoftDeleteCouponAdmin
(
Coupon
,
AdminSite
())
test_query_set
=
coupon_admin
.
queryset
(
request
)
test_query_set
=
coupon_admin
.
queryset
(
request
)
test_actions
=
coupon_admin
.
get_actions
(
request
)
test_actions
=
coupon_admin
.
get_actions
(
request
)
self
.
assertTrue
(
'really_delete_selected'
in
test_actions
[
'really_delete_selected'
])
self
.
assertTrue
(
'really_delete_selected'
in
test_actions
[
'really_delete_selected'
])
self
.
assertEqual
(
get_coupon
.
is_active
,
True
)
self
.
assertEqual
(
get_coupon
.
is_active
,
True
)
coupon_admin
.
really_delete_selected
(
request
,
test_query_set
)
# pylint: disable=
E1101
coupon_admin
.
really_delete_selected
(
request
,
test_query_set
)
# pylint: disable=
no-member
for
coupon
in
test_query_set
:
for
coupon
in
test_query_set
:
self
.
assertEqual
(
coupon
.
is_active
,
False
)
self
.
assertEqual
(
coupon
.
is_active
,
False
)
coupon_admin
.
delete_model
(
request
,
get_coupon
)
# pylint: disable=
E1101
coupon_admin
.
delete_model
(
request
,
get_coupon
)
# pylint: disable=
no-member
self
.
assertEqual
(
get_coupon
.
is_active
,
False
)
self
.
assertEqual
(
get_coupon
.
is_active
,
False
)
coupon
=
Coupon
(
code
=
'TestCode123'
,
description
=
'testing123'
,
course_id
=
self
.
course_key
,
coupon
=
Coupon
(
code
=
'TestCode123'
,
description
=
'testing123'
,
course_id
=
self
.
course_key
,
percentage_discount
=
22
,
created_by
=
self
.
user
,
is_active
=
True
)
percentage_discount
=
22
,
created_by
=
self
.
user
,
is_active
=
True
)
coupon
.
save
()
coupon
.
save
()
test_query_set
=
coupon_admin
.
queryset
(
request
)
test_query_set
=
coupon_admin
.
queryset
(
request
)
coupon_admin
.
really_delete_selected
(
request
,
test_query_set
)
# pylint: disable=
E1101
coupon_admin
.
really_delete_selected
(
request
,
test_query_set
)
# pylint: disable=
no-member
for
coupon
in
test_query_set
:
for
coupon
in
test_query_set
:
self
.
assertEqual
(
coupon
.
is_active
,
False
)
self
.
assertEqual
(
coupon
.
is_active
,
False
)
...
...
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