Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
582e21b9
Commit
582e21b9
authored
11 years ago
by
Sarina Canelake
Browse files
Options
Downloads
Patches
Plain Diff
Course Auth tests for legacy dash
parent
d0fe1d69
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/instructor/tests/test_email.py
+1
-1
1 addition, 1 deletion
lms/djangoapps/instructor/tests/test_email.py
lms/djangoapps/instructor/tests/test_legacy_email.py
+28
-0
28 additions, 0 deletions
lms/djangoapps/instructor/tests/test_legacy_email.py
with
29 additions
and
1 deletion
lms/djangoapps/instructor/tests/test_email.py
+
1
−
1
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
)
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/instructor/tests/test_legacy_email.py
+
28
−
0
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment