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
c5cf6db9
Commit
c5cf6db9
authored
Aug 04, 2014
by
njdup
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned pylint quality issues in instructor email content history code.
parent
035e495c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
11 deletions
+9
-11
lms/djangoapps/instructor/tests/test_api.py
+7
-8
lms/djangoapps/instructor/tests/utils.py
+1
-1
lms/djangoapps/instructor/views/api.py
+1
-2
No files found.
lms/djangoapps/instructor/tests/test_api.py
View file @
c5cf6db9
...
...
@@ -32,7 +32,6 @@ from student.tests.factories import UserFactory
from
courseware.tests.factories
import
StaffFactory
,
InstructorFactory
,
BetaTesterFactory
from
student.roles
import
CourseBetaTesterRole
from
microsite_configuration
import
microsite
from
util.date_utils
import
get_default_time_display
from
instructor.tests.utils
import
FakeContentTask
,
FakeEmail
,
FakeEmailInfo
from
student.models
import
CourseEnrollment
,
CourseEnrollmentAllowed
...
...
@@ -1891,6 +1890,9 @@ class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCas
self
.
course
=
CourseFactory
.
create
()
self
.
instructor
=
InstructorFactory
(
course_key
=
self
.
course
.
id
)
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
tasks
=
{}
self
.
emails
=
{}
self
.
emails_info
=
{}
def
tearDown
(
self
):
"""
...
...
@@ -1900,16 +1902,13 @@ class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCas
def
setup_fake_email_info
(
self
,
num_emails
):
""" Initialize the specified number of fake emails """
self
.
tasks
=
{}
self
.
emails
=
{}
self
.
emails_info
=
{}
for
email_id
in
range
(
num_emails
):
num_sent
=
random
.
randint
(
1
,
15401
)
self
.
tasks
[
email_id
]
=
FakeContentTask
(
email_id
,
num_sent
,
'expected'
)
self
.
emails
[
email_id
]
=
FakeEmail
(
email_id
)
self
.
emails_info
[
email_id
]
=
FakeEmailInfo
(
self
.
emails
[
email_id
],
num_sent
)
def
get_matching_mock_email
(
self
,
*
args
,
*
*
kwargs
):
def
get_matching_mock_email
(
self
,
**
kwargs
):
""" Returns the matching mock emails for the given id """
email_id
=
kwargs
.
get
(
'id'
,
0
)
return
self
.
emails
[
email_id
]
...
...
@@ -1964,9 +1963,9 @@ class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCas
def
test_list_email_content_error
(
self
,
task_history_request
):
""" Test handling of error retrieving email """
self
.
invalid_task
=
FakeContentTask
(
0
,
0
,
'test'
)
self
.
invalid_task
.
make_invalid_input
()
task_history_request
.
return_value
=
[
self
.
invalid_task
]
invalid_task
=
FakeContentTask
(
0
,
0
,
'test'
)
invalid_task
.
make_invalid_input
()
task_history_request
.
return_value
=
[
invalid_task
]
url
=
reverse
(
'list_email_content'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
get
(
url
,
{})
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
lms/djangoapps/instructor/tests/utils.py
View file @
c5cf6db9
...
...
@@ -51,7 +51,7 @@ class FakeEmail(FakeInfo):
def
__init__
(
self
,
email_id
):
super
(
FakeEmail
,
self
)
.
__init__
()
self
.
id
=
unicode
(
email_id
)
self
.
id
=
unicode
(
email_id
)
# pylint: disable=invalid-name
# Select a random data for create field
year
=
random
.
choice
(
range
(
1950
,
2000
))
month
=
random
.
choice
(
range
(
1
,
12
))
...
...
lms/djangoapps/instructor/views/api.py
View file @
c5cf6db9
...
...
@@ -20,7 +20,6 @@ from django.utils.translation import ugettext as _
from
django.http
import
HttpResponse
,
HttpResponseBadRequest
,
HttpResponseForbidden
from
django.utils.html
import
strip_tags
from
util.json_request
import
JsonResponse
from
util.date_utils
import
get_default_time_display
from
instructor.views.instructor_task_helpers
import
extract_email_features
,
extract_task_features
from
courseware.access
import
has_access
...
...
@@ -873,7 +872,7 @@ def list_background_email_tasks(request, course_id): # pylint: disable=unused-a
@ensure_csrf_cookie
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
@require_level
(
'staff'
)
def
list_email_content
(
request
s
,
course_id
):
def
list_email_content
(
request
,
course_id
):
# pylint: disable=unused-argument
"""
List the content of bulk emails sent
"""
...
...
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