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
2d5c4dae
Commit
2d5c4dae
authored
Dec 12, 2013
by
Chris Rossi
Committed by
Diana Huang
Jan 16, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test coverage.
parent
e34d131f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
lms/djangoapps/linkedin/management/commands/mailusers.py
+4
-0
lms/djangoapps/linkedin/management/commands/tests/test_mailusers.py
+39
-0
No files found.
lms/djangoapps/linkedin/management/commands/mailusers.py
View file @
2d5c4dae
...
...
@@ -13,6 +13,10 @@ from ...models import LinkedIn
class
Command
(
BaseCommand
):
"""
Django command for inviting users to add their course certificates to their
LinkedIn profiles.
"""
args
=
''
help
=
(
'Sends emails to edX users that are on LinkedIn who have completed '
'course certificates, inviting them to add their certificates to '
...
...
lms/djangoapps/linkedin/management/commands/tests/test_mailusers.py
0 → 100644
View file @
2d5c4dae
"""
Test email scripts.
"""
import
mock
import
unittest
from
linkedin.management.commands
import
mailusers
class
MailusersTests
(
unittest
.
TestCase
):
"""
Test mail users command.
"""
@mock.patch
(
'linkedin.management.commands.mailusers.send_email'
)
@mock.patch
(
'linkedin.management.commands.mailusers.GeneratedCertificate'
)
@mock.patch
(
'linkedin.management.commands.mailusers.LinkedIn'
)
def
test_mail_users
(
self
,
linkedin
,
certificates
,
send_email
):
"""
Test "happy path" for emailing users.
"""
fut
=
mailusers
.
Command
()
.
handle
fred
=
mock
.
Mock
(
user
=
mock
.
Mock
(
certificates
=
[
1
,
2
]))
barney
=
mock
.
Mock
(
user
=
mock
.
Mock
(
certificates
=
[
3
]))
linkedin
.
objects
.
filter
.
return_value
=
[
fred
,
barney
]
def
filter_user
(
user
):
"Mock querying the database."
queryset
=
mock
.
Mock
()
queryset
.
filter
.
return_value
=
user
.
certificates
return
queryset
certificates
.
objects
.
filter
=
filter_user
fut
()
self
.
assertEqual
(
send_email
.
call_args_list
,
[((
fred
.
user
,
1
),),
((
fred
.
user
,
2
),),
((
barney
.
user
,
3
),)])
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