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
582e21b9
Commit
582e21b9
authored
Oct 17, 2013
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Course Auth tests for legacy dash
parent
d0fe1d69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletions
+29
-1
lms/djangoapps/instructor/tests/test_email.py
+1
-1
lms/djangoapps/instructor/tests/test_legacy_email.py
+28
-0
No files found.
lms/djangoapps/instructor/tests/test_email.py
View file @
582e21b9
...
...
@@ -90,7 +90,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase):
# Assert that instructor email is enabled for this course
self
.
assertTrue
(
CourseAuthorization
.
instructor_email_enabled
(
self
.
course
.
id
))
# Assert that the URL for the email view is
not
in the response
# Assert that the URL for the email view is in the response
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertTrue
(
self
.
email_link
in
response
.
content
)
...
...
lms/djangoapps/instructor/tests/test_legacy_email.py
View file @
582e21b9
...
...
@@ -15,6 +15,8 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore
import
XML_MODULESTORE_TYPE
from
bulk_email.models
import
CourseAuthorization
from
mock
import
patch
...
...
@@ -59,6 +61,32 @@ class TestInstructorDashboardEmailView(ModuleStoreTestCase):
send_to_label
=
'<label for="id_to">Send to:</label>'
self
.
assertTrue
(
send_to_label
in
response
.
content
)
@patch.dict
(
settings
.
MITX_FEATURES
,
{
'ENABLE_INSTRUCTOR_EMAIL'
:
True
,
'REQUIRE_COURSE_EMAIL_AUTH'
:
True
})
def
test_email_flag_unauthorized
(
self
):
# Assert that the URL for the email view is not in the response
# email is enabled, but this course is not authorized to send email
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertFalse
(
self
.
email_link
in
response
.
content
)
@patch.dict
(
settings
.
MITX_FEATURES
,
{
'ENABLE_INSTRUCTOR_EMAIL'
:
True
,
'REQUIRE_COURSE_EMAIL_AUTH'
:
True
})
def
test_email_flag_authorized
(
self
):
# Assert that the URL for the email view is in the response
# email is enabled, and this course is authorized to send email
# Assert that instructor email is not enabled for this course
self
.
assertFalse
(
CourseAuthorization
.
instructor_email_enabled
(
self
.
course
.
id
))
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertFalse
(
self
.
email_link
in
response
.
content
)
# Authorize the course to use email
cauth
=
CourseAuthorization
(
course_id
=
self
.
course
.
id
,
email_enabled
=
True
)
cauth
.
save
()
# Assert that instructor email is enabled for this course
self
.
assertTrue
(
CourseAuthorization
.
instructor_email_enabled
(
self
.
course
.
id
))
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertTrue
(
self
.
email_link
in
response
.
content
)
@patch.dict
(
settings
.
MITX_FEATURES
,
{
'ENABLE_INSTRUCTOR_EMAIL'
:
False
})
def
test_email_flag_false
(
self
):
# Assert that the URL for the email view is not in the response
...
...
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