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
c547ac72
Commit
c547ac72
authored
Nov 25, 2013
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bulk email acceptance test
parent
1ee6d151
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
41 deletions
+40
-41
common/djangoapps/terrain/course_helpers.py
+4
-12
lms/djangoapps/instructor/features/bulk_email.feature
+1
-1
lms/djangoapps/instructor/features/bulk_email.py
+35
-28
No files found.
common/djangoapps/terrain/course_helpers.py
View file @
c547ac72
...
...
@@ -44,6 +44,8 @@ def log_in(username='robot', password='test', email='robot@edx.org', name='Robot
def
register_by_course_id
(
course_id
,
username
=
'robot'
,
password
=
'test'
,
is_staff
=
False
):
create_user
(
username
,
password
)
user
=
User
.
objects
.
get
(
username
=
username
)
# Note: this flag makes the user global staff - that is, an edX employee - not a course staff.
# See courseware.tests.factories for StaffFactory and InstructorFactory.
if
is_staff
:
user
.
is_staff
=
True
user
.
save
()
...
...
@@ -51,18 +53,8 @@ def register_by_course_id(course_id, username='robot', password='test', is_staff
@world.absorb
def
add_to_course_staff
(
username
,
course_num
):
"""
Add the user with `username` to the course staff group
for `course_num`.
"""
# Based on code in lms/djangoapps/courseware/access.py
group_name
=
"instructor_{}"
.
format
(
course_num
)
group
,
_
=
Group
.
objects
.
get_or_create
(
name
=
group_name
)
group
.
save
()
user
=
User
.
objects
.
get
(
username
=
username
)
user
.
groups
.
add
(
group
)
def
enroll_user
(
user
,
course_id
):
CourseEnrollment
.
enroll
(
user
,
course_id
)
@world.absorb
...
...
lms/djangoapps/instructor/features/bulk_email.feature
View file @
c547ac72
@shard_2
Feature
:
LMS.Bulk Email
Feature
:
LMS.
Instructor Dash
Bulk Email
As an instructor or course staff,
In order to communicate with students and staff
I want to send email to staff and students in a course.
...
...
lms/djangoapps/instructor/features/bulk_email.py
View file @
c547ac72
...
...
@@ -11,6 +11,8 @@ from nose.tools import assert_in, assert_true, assert_equal # pylint: disable=E
from
django.core.management
import
call_command
from
django.conf
import
settings
from
courseware.tests.factories
import
StaffFactory
,
InstructorFactory
@step
(
u'Given I am "([^"]*)" for a course'
)
def
i_am_an_instructor
(
step
,
role
):
# pylint: disable=W0613
...
...
@@ -27,47 +29,53 @@ def i_am_an_instructor(step, role): # pylint: disable=W0613
number
=
'999'
,
display_name
=
'Test Course'
)
world
.
course_id
=
'edx/999/Test_Course'
# Register the instructor as staff for the course
world
.
register_by_course_id
(
'edx/999/Test_Course'
,
username
=
'instructor'
,
password
=
'password'
,
is_staff
=
True
)
world
.
add_to_course_staff
(
'instructor'
,
'999'
)
try
:
# See if we've defined the instructor & staff user yet
world
.
instructor
except
AttributeError
:
# Make & register an instructor for the course
world
.
instructor
=
InstructorFactory
(
course
=
course
.
location
)
world
.
enroll_user
(
world
.
instructor
,
world
.
course_id
)
# Register another staff member
world
.
register_by_course_id
(
'edx/999/Test_Course'
,
username
=
'staff'
,
password
=
'password'
,
is_staff
=
True
)
world
.
add_to_course_staff
(
'staff'
,
'999'
)
# Make & register a staff member
world
.
staff
=
StaffFactory
(
course
=
course
.
location
)
world
.
enroll_user
(
world
.
staff
,
world
.
course_id
)
#
R
egister a student
#
Make & r
egister a student
world
.
register_by_course_id
(
'edx/999/Test_Course'
,
username
=
'student'
,
password
=
'
password
'
,
password
=
'
test
'
,
is_staff
=
False
)
# Log in as the an instructor or staff for the course
world
.
log_in
(
username
=
role
,
password
=
'password'
,
email
=
"instructor@edx.org"
,
name
=
"Instructor"
)
my_email
=
None
if
role
==
'instructor'
:
my_email
=
world
.
instructor
.
email
world
.
log_in
(
username
=
world
.
instructor
.
username
,
password
=
'test'
,
email
=
my_email
,
name
=
world
.
instructor
.
profile
.
name
)
else
:
my_email
=
world
.
staff
.
email
world
.
log_in
(
username
=
world
.
staff
.
username
,
password
=
'test'
,
email
=
world
.
staff
.
email
,
name
=
world
.
staff
.
profile
.
name
)
# Store the expected recipients
# given each "send to" option
world
.
expected_addresses
=
{
'myself'
:
[
role
+
'@edx.org'
],
'course staff'
:
[
'instructor@edx.org'
,
'staff@edx.org'
],
'students, staff, and instructors'
:
[
'instructor@edx.org'
,
'staff@edx.org'
,
'student@edx.org'
]
'myself'
:
[
my_email
],
'course staff'
:
[
world
.
staff
.
email
,
world
.
instructor
.
email
],
'students, staff, and instructors'
:
[
world
.
staff
.
email
,
world
.
instructor
.
email
,
'student@edx.org'
]
}
...
...
@@ -131,7 +139,6 @@ UNSUBSCRIBE_MSG = 'To stop receiving email like this'
@step
(
u'Email is sent to "([^"]*)"'
)
def
then_the_email_is_sent
(
step
,
recipient
):
# Check that the recipient is valid
assert_in
(
recipient
,
SEND_TO_OPTIONS
,
...
...
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