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
f2ea6f66
Commit
f2ea6f66
authored
Oct 25, 2017
by
Calen Pennington
Committed by
Nimisha Asthagiri
Oct 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the tested_command up to a class attribute, and make sure that it matches with the tested_task
parent
c4249c6b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py
+3
-2
openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py
+4
-2
openedx/core/djangoapps/schedules/management/commands/tests/tools.py
+5
-0
No files found.
openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py
View file @
f2ea6f66
...
...
@@ -49,11 +49,12 @@ NUM_COURSE_MODES_QUERIES = 1
class
TestSendRecurringNudge
(
ScheduleBaseEmailTestBase
):
# pylint: disable=protected-access
tested_task
=
tasks
.
ScheduleRecurringNudge
tested_command
=
nudge
.
Command
@patch.object
(
nudge
.
C
ommand
,
'async_send_task'
)
@patch.object
(
tested_c
ommand
,
'async_send_task'
)
def
test_handle
(
self
,
mock_send
):
test_day
=
datetime
.
datetime
(
2017
,
8
,
1
,
tzinfo
=
pytz
.
UTC
)
nudge
.
C
ommand
()
.
handle
(
date
=
'2017-08-01'
,
site_domain_name
=
self
.
site_config
.
site
.
domain
)
self
.
tested_c
ommand
()
.
handle
(
date
=
'2017-08-01'
,
site_domain_name
=
self
.
site_config
.
site
.
domain
)
for
day
in
(
-
3
,
-
10
):
mock_send
.
enqueue
.
assert_any_call
(
self
.
site_config
.
site
,
...
...
openedx/core/djangoapps/schedules/management/commands/tests/test_send_upgrade_reminder.py
View file @
f2ea6f66
...
...
@@ -60,8 +60,10 @@ LOG = logging.getLogger(__name__)
"Can't test schedules if the app isn't installed"
)
@freeze_time
(
'2017-08-01 00:00:00'
,
tz_offset
=
0
,
tick
=
True
)
class
TestUpgradeReminder
(
ScheduleBaseEmailTestBase
,
SharedModuleStoreTestCase
):
__test__
=
True
tested_task
=
tasks
.
ScheduleUpgradeReminder
tested_command
=
reminder
.
Command
@classmethod
def
setUpClass
(
cls
):
...
...
@@ -85,10 +87,10 @@ class TestUpgradeReminder(ScheduleBaseEmailTestBase, SharedModuleStoreTestCase):
expiration_datetime
=
datetime
.
datetime
.
now
(
pytz
.
UTC
)
+
datetime
.
timedelta
(
days
=
30
),
)
@patch.object
(
reminder
.
C
ommand
,
'async_send_task'
)
@patch.object
(
tested_c
ommand
,
'async_send_task'
)
def
test_handle
(
self
,
mock_send
):
test_day
=
datetime
.
datetime
(
2017
,
8
,
1
,
tzinfo
=
pytz
.
UTC
)
reminder
.
C
ommand
()
.
handle
(
date
=
'2017-08-01'
,
site_domain_name
=
self
.
site_config
.
site
.
domain
)
self
.
tested_c
ommand
()
.
handle
(
date
=
'2017-08-01'
,
site_domain_name
=
self
.
site_config
.
site
.
domain
)
mock_send
.
enqueue
.
assert_called_with
(
self
.
site_config
.
site
,
test_day
,
...
...
openedx/core/djangoapps/schedules/management/commands/tests/tools.py
View file @
f2ea6f66
...
...
@@ -6,6 +6,8 @@ from openedx.core.djangoapps.schedules.tests.factories import ScheduleConfigFact
class
ScheduleBaseEmailTestBase
(
FilteredQueryCountMixin
,
CacheIsolationTestCase
):
__test__
=
False
ENABLED_CACHES
=
[
'default'
]
def
setUp
(
self
):
...
...
@@ -16,3 +18,6 @@ class ScheduleBaseEmailTestBase(FilteredQueryCountMixin, CacheIsolationTestCase)
ScheduleConfigFactory
.
create
(
site
=
self
.
site_config
.
site
)
DynamicUpgradeDeadlineConfiguration
.
objects
.
create
(
enabled
=
True
)
def
test_command_task_binding
(
self
):
self
.
assertEqual
(
self
.
tested_command
.
async_send_task
,
self
.
tested_task
)
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