Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
86865d5d
Commit
86865d5d
authored
May 18, 2017
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove CT from reviewed email when PC approves course-run.
ECOM-7767
parent
917a3152
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
17 deletions
+46
-17
course_discovery/apps/publisher/api/tests/test_views.py
+30
-1
course_discovery/apps/publisher/emails.py
+13
-13
course_discovery/apps/publisher/tests/test_emails.py
+3
-3
No files found.
course_discovery/apps/publisher/api/tests/test_views.py
View file @
86865d5d
...
...
@@ -671,7 +671,7 @@ class ChangeCourseRunStateViewTests(TestCase):
def
test_mark_as_reviewed
(
self
):
"""
Verify that
user can change course-run workflow state
and owner role will be changed to `Publisher`.
Verify that
course team can approve the changes
and owner role will be changed to `Publisher`.
"""
self
.
run_state
.
name
=
CourseRunStateChoices
.
Review
self
.
run_state
.
owner_role
=
PublisherUserRole
.
CourseTeam
...
...
@@ -697,6 +697,35 @@ class ChangeCourseRunStateViewTests(TestCase):
self
.
assertEqual
(
len
(
mail
.
outbox
),
2
)
def
test_mark_as_reviewed_by_pc
(
self
):
"""
Verify that project coordinator can approve the changes and email not sent to course team.
"""
self
.
run_state
.
name
=
CourseRunStateChoices
.
Review
self
.
run_state
.
owner_role
=
PublisherUserRole
.
ProjectCoordinator
self
.
run_state
.
save
()
self
.
_assign_role
(
self
.
course_run
.
course
,
PublisherUserRole
.
ProjectCoordinator
,
self
.
user
)
self
.
_assign_role
(
self
.
course_run
.
course
,
PublisherUserRole
.
CourseTeam
,
UserFactory
())
self
.
_assign_role
(
self
.
course_run
.
course
,
PublisherUserRole
.
Publisher
,
UserFactory
())
response
=
self
.
client
.
patch
(
self
.
change_state_url
,
data
=
json
.
dumps
({
'name'
:
CourseStateChoices
.
Approved
}),
content_type
=
JSON_CONTENT_TYPE
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
run_state
=
CourseRunState
.
objects
.
get
(
course_run
=
self
.
course_run
)
self
.
assertEqual
(
self
.
run_state
.
name
,
CourseRunStateChoices
.
Approved
)
self
.
assertEqual
(
self
.
run_state
.
owner_role
,
PublisherUserRole
.
Publisher
)
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
self
.
assertNotIn
(
self
.
course_run
.
course
.
course_team_admin
.
email
,
mail
.
outbox
[
0
]
.
to
)
def
test_preview_accepted
(
self
):
"""
Verify that user can accept preview for course run and owner role will be changed to `Publisher`.
...
...
course_discovery/apps/publisher/emails.py
View file @
86865d5d
...
...
@@ -271,22 +271,22 @@ def send_email_for_mark_as_reviewed_course_run(course_run, user):
)
try
:
page_path
=
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
course_run
.
id
})
recipient_user
=
course
.
project_coordinator
user_role
=
course
.
course_user_roles
.
get
(
user
=
user
)
if
user_role
.
role
==
PublisherUserRole
.
ProjectCoordinator
:
recipient_user
=
course
.
course_team_admin
# Send this email only to PC if approving person is course team member
if
user_role
.
role
==
PublisherUserRole
.
CourseTeam
:
page_path
=
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
course_run
.
id
})
recipient_user
=
course
.
project_coordinator
context
=
{
'course_name'
:
course
.
title
,
'run_number'
:
course_key
.
run
,
'sender_team'
:
'course team'
if
user_role
.
role
==
PublisherUserRole
.
CourseTeam
else
'project coordinators
'
,
'page_url'
:
'https://{host}{path}'
.
format
(
host
=
Site
.
objects
.
get_current
()
.
domain
.
strip
(
'/'
),
path
=
page_path
)
}
context
=
{
'course_name'
:
course
.
title
,
'run_number'
:
course_key
.
run
,
'sender_team'
:
'course team
'
,
'page_url'
:
'https://{host}{path}'
.
format
(
host
=
Site
.
objects
.
get_current
()
.
domain
.
strip
(
'/'
),
path
=
page_path
)
}
send_course_workflow_email
(
course
,
user
,
subject
,
txt_template
,
html_template
,
context
,
recipient_user
)
send_course_workflow_email
(
course
,
user
,
subject
,
txt_template
,
html_template
,
context
,
recipient_user
)
except
Exception
:
# pylint: disable=broad-except
logger
.
exception
(
'Failed to send email notifications for mark as reviewed of course-run
%
s'
,
course_run
.
id
)
...
...
course_discovery/apps/publisher/tests/test_emails.py
View file @
86865d5d
...
...
@@ -303,13 +303,13 @@ class CourseRunMarkAsReviewedEmailTests(TestCase):
toggle_switch
(
'enable_publisher_email_notifications'
,
True
)
def
test_email_
sent_by_marketing_reviewe
r
(
self
):
""" Verify that
email works successfully for marketing user.
"""
def
test_email_
not_sent_by_project_coordinato
r
(
self
):
""" Verify that
no email is sent if approving person is project coordinator.
"""
factories
.
CourseUserRoleFactory
(
course
=
self
.
course
,
role
=
PublisherUserRole
.
ProjectCoordinator
,
user
=
self
.
user
)
emails
.
send_email_for_mark_as_reviewed_course_run
(
self
.
course_run_state
.
course_run
,
self
.
user
)
self
.
assert
_email_sent
(
self
.
user_2
)
self
.
assert
Equal
(
len
(
mail
.
outbox
),
0
)
def
test_email_sent_by_course_team
(
self
):
""" Verify that email works successfully for course team user."""
...
...
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