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
...
@@ -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
):
def
register_by_course_id
(
course_id
,
username
=
'robot'
,
password
=
'test'
,
is_staff
=
False
):
create_user
(
username
,
password
)
create_user
(
username
,
password
)
user
=
User
.
objects
.
get
(
username
=
username
)
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
:
if
is_staff
:
user
.
is_staff
=
True
user
.
is_staff
=
True
user
.
save
()
user
.
save
()
...
@@ -51,18 +53,8 @@ def register_by_course_id(course_id, username='robot', password='test', is_staff
...
@@ -51,18 +53,8 @@ def register_by_course_id(course_id, username='robot', password='test', is_staff
@world.absorb
@world.absorb
def
add_to_course_staff
(
username
,
course_num
):
def
enroll_user
(
user
,
course_id
):
"""
CourseEnrollment
.
enroll
(
user
,
course_id
)
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
)
@world.absorb
@world.absorb
...
...
lms/djangoapps/instructor/features/bulk_email.feature
View file @
c547ac72
@shard_2
@shard_2
Feature
:
LMS.Bulk Email
Feature
:
LMS.
Instructor Dash
Bulk Email
As an instructor or course staff,
As an instructor or course staff,
In order to communicate with students and staff
In order to communicate with students and staff
I want to send email to staff and students in a course.
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
...
@@ -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.core.management
import
call_command
from
django.conf
import
settings
from
django.conf
import
settings
from
courseware.tests.factories
import
StaffFactory
,
InstructorFactory
@step
(
u'Given I am "([^"]*)" for a course'
)
@step
(
u'Given I am "([^"]*)" for a course'
)
def
i_am_an_instructor
(
step
,
role
):
# pylint: disable=W0613
def
i_am_an_instructor
(
step
,
role
):
# pylint: disable=W0613
...
@@ -27,47 +29,53 @@ 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'
,
number
=
'999'
,
display_name
=
'Test Course'
display_name
=
'Test Course'
)
)
world
.
course_id
=
'edx/999/Test_Course'
# Register the instructor as staff for the course
try
:
world
.
register_by_course_id
(
# See if we've defined the instructor & staff user yet
'edx/999/Test_Course'
,
world
.
instructor
username
=
'instructor'
,
except
AttributeError
:
password
=
'password'
,
# Make & register an instructor for the course
is_staff
=
True
world
.
instructor
=
InstructorFactory
(
course
=
course
.
location
)
)
world
.
enroll_user
(
world
.
instructor
,
world
.
course_id
)
world
.
add_to_course_staff
(
'instructor'
,
'999'
)
# Register another staff member
# Make & register a staff member
world
.
register_by_course_id
(
world
.
staff
=
StaffFactory
(
course
=
course
.
location
)
'edx/999/Test_Course'
,
world
.
enroll_user
(
world
.
staff
,
world
.
course_id
)
username
=
'staff'
,
password
=
'password'
,
is_staff
=
True
)
world
.
add_to_course_staff
(
'staff'
,
'999'
)
#
R
egister a student
#
Make & r
egister a student
world
.
register_by_course_id
(
world
.
register_by_course_id
(
'edx/999/Test_Course'
,
'edx/999/Test_Course'
,
username
=
'student'
,
username
=
'student'
,
password
=
'
password
'
,
password
=
'
test
'
,
is_staff
=
False
is_staff
=
False
)
)
# Log in as the an instructor or staff for the course
# Log in as the an instructor or staff for the course
world
.
log_in
(
my_email
=
None
username
=
role
,
if
role
==
'instructor'
:
password
=
'password'
,
my_email
=
world
.
instructor
.
email
email
=
"instructor@edx.org"
,
world
.
log_in
(
name
=
"Instructor"
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
# Store the expected recipients
# given each "send to" option
# given each "send to" option
world
.
expected_addresses
=
{
world
.
expected_addresses
=
{
'myself'
:
[
role
+
'@edx.org'
],
'myself'
:
[
my_email
],
'course staff'
:
[
'instructor@edx.org'
,
'staff@edx.org'
],
'course staff'
:
[
world
.
staff
.
email
,
world
.
instructor
.
email
],
'students, staff, and instructors'
:
[
'instructor@edx.org'
,
'staff@edx.org'
,
'student@edx.org'
]
'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'
...
@@ -131,7 +139,6 @@ UNSUBSCRIBE_MSG = 'To stop receiving email like this'
@step
(
u'Email is sent to "([^"]*)"'
)
@step
(
u'Email is sent to "([^"]*)"'
)
def
then_the_email_is_sent
(
step
,
recipient
):
def
then_the_email_is_sent
(
step
,
recipient
):
# Check that the recipient is valid
# Check that the recipient is valid
assert_in
(
assert_in
(
recipient
,
SEND_TO_OPTIONS
,
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