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
f9216656
Commit
f9216656
authored
Jun 23, 2017
by
Brian Mesick
Committed by
GitHub
Jun 23, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15393 from edx/bmedx/django_1.11_upgrade_mock_django_PLAT_1494
Remove mock-django dependency
parents
7b439d02
41def5c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
8 deletions
+22
-8
lms/djangoapps/ccx/tests/test_tasks.py
+22
-7
requirements/edx/base.txt
+0
-1
No files found.
lms/djangoapps/ccx/tests/test_tasks.py
View file @
f9216656
"""
Tests for celery tasks defined in tasks module
"""
import
contextlib
import
mock
from
ccx_keys.locator
import
CCXLocator
from
mock_django
import
mock_signal_receiver
from
lms.djangoapps.ccx.tasks
import
send_ccx_course_published
from
lms.djangoapps.ccx.tests.factories
import
CcxFactory
...
...
@@ -16,8 +17,17 @@ from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE,
from
xmodule.modulestore.tests.factories
import
CourseFactory
@contextlib.contextmanager
def
mock_signal_receiver
(
signal
):
receiver
=
mock
.
Mock
()
signal
.
connect
(
receiver
)
yield
receiver
signal
.
disconnect
(
receiver
)
class
TestSendCCXCoursePublished
(
ModuleStoreTestCase
):
"""unit tests for the send ccx course published task
"""
Unit tests for the send ccx course published task
"""
MODULESTORE
=
TEST_DATA_SPLIT_MODULESTORE
...
...
@@ -39,12 +49,14 @@ class TestSendCCXCoursePublished(ModuleStoreTestCase):
self
.
ccx4
=
CcxFactory
(
course_id
=
course2
.
id
,
coach
=
coach
)
def
call_fut
(
self
,
course_key
):
"""Call the function under test
"""
Call the function under test
"""
send_ccx_course_published
(
unicode
(
course_key
))
def
test_signal_not_sent_for_ccx
(
self
):
"""Check that course published signal is not sent when course key is for a ccx
"""
Check that course published signal is not sent when course key is for a ccx
"""
course_key
=
CCXLocator
.
from_course_locator
(
self
.
course
.
id
,
self
.
ccx
.
id
)
with
mock_signal_receiver
(
SignalHandler
.
course_published
)
as
receiver
:
...
...
@@ -52,7 +64,8 @@ class TestSendCCXCoursePublished(ModuleStoreTestCase):
self
.
assertEqual
(
receiver
.
call_count
,
0
)
def
test_signal_sent_for_ccx
(
self
):
"""Check that course published signal is sent when course key is not for a ccx.
"""
Check that course published signal is sent when course key is not for a ccx.
We have 4 ccx's, but only 3 are derived from the course id used here, so call
count must be 3 to confirm that all derived courses and no more got the signal.
"""
...
...
@@ -61,7 +74,8 @@ class TestSendCCXCoursePublished(ModuleStoreTestCase):
self
.
assertEqual
(
receiver
.
call_count
,
3
)
def
test_course_structure_generated
(
self
):
"""Check that course structure is generated after course published signal is sent
"""
Check that course structure is generated after course published signal is sent
"""
ccx_structure
=
{
u"blocks"
:
{
...
...
@@ -88,7 +102,8 @@ class TestSendCCXCoursePublished(ModuleStoreTestCase):
self
.
assertEqual
(
structure
.
structure
,
ccx_structure
)
def
test_course_overview_cached
(
self
):
"""Check that course overview is cached after course published signal is sent
"""
Check that course overview is cached after course published signal is sent
"""
course_key
=
CCXLocator
.
from_course_locator
(
self
.
course
.
id
,
self
.
ccx
.
id
)
overview
=
CourseOverview
.
objects
.
filter
(
id
=
course_key
)
...
...
requirements/edx/base.txt
View file @
f9216656
...
...
@@ -162,7 +162,6 @@ django_nose==1.4.1
factory_boy==2.8.1
flaky==3.3.0
freezegun==0.3.8
mock-django==0.6.9
mock==1.0.1
moto==0.3.1
needle==0.5.0
...
...
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