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
b852025a
Commit
b852025a
authored
Oct 26, 2017
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move test_course_end into the schedules management command base test class
parent
1bb23a13
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
24 deletions
+27
-24
openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py
+0
-24
openedx/core/djangoapps/schedules/management/commands/tests/tools.py
+27
-0
No files found.
openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py
View file @
b852025a
...
...
@@ -57,30 +57,6 @@ class TestSendRecurringNudge(ScheduleBaseEmailTestBase):
enqueue_config
=
'enqueue_recurring_nudge'
expected_offsets
=
(
-
3
,
-
10
)
@patch.object
(
tested_task
,
'async_send_task'
)
def
test_send_after_course_end
(
self
,
mock_schedule_send
):
user1
=
UserFactory
.
create
(
id
=
resolvers
.
RECURRING_NUDGE_NUM_BINS
)
schedule_start
=
datetime
.
datetime
(
2017
,
8
,
3
,
20
,
34
,
30
,
tzinfo
=
pytz
.
UTC
)
day_command_is_run
=
schedule_start
+
datetime
.
timedelta
(
days
=
3
)
schedule
=
ScheduleFactory
.
create
(
start
=
schedule_start
,
enrollment__user
=
user1
,
)
schedule
.
enrollment
.
course
.
start
=
schedule_start
-
datetime
.
timedelta
(
days
=
30
)
schedule
.
enrollment
.
course
.
end
=
day_command_is_run
-
datetime
.
timedelta
(
days
=
1
)
schedule
.
enrollment
.
course
.
save
()
test_datetime
=
datetime
.
datetime
(
2017
,
8
,
3
,
20
,
tzinfo
=
pytz
.
UTC
)
test_datetime_str
=
serialize
(
test_datetime
)
self
.
tested_task
.
apply
(
kwargs
=
dict
(
site_id
=
self
.
site_config
.
site
.
id
,
target_day_str
=
test_datetime_str
,
day_offset
=-
3
,
bin_num
=
0
,
))
self
.
assertFalse
(
mock_schedule_send
.
apply_async
.
called
)
@patch.object
(
tasks
,
'ace'
)
@patch.object
(
tested_task
,
'async_send_task'
)
def
test_multiple_enrollments
(
self
,
mock_schedule_send
,
mock_ace
):
...
...
openedx/core/djangoapps/schedules/management/commands/tests/tools.py
View file @
b852025a
...
...
@@ -264,3 +264,30 @@ class ScheduleBaseEmailTestBase(SharedModuleStoreTestCase):
self
.
assertEqual
(
mock_schedule_send
.
apply_async
.
call_count
,
expected_message_count
)
self
.
assertFalse
(
mock_ace
.
send
.
called
)
@ddt.data
(
True
,
False
)
def
test_course_end
(
self
,
has_course_ended
):
user1
=
UserFactory
.
create
(
id
=
self
.
tested_task
.
num_bins
)
current_day
,
offset
,
target_day
=
self
.
_get_dates
()
schedule
=
ScheduleFactory
.
create
(
start
=
target_day
,
upgrade_deadline
=
target_day
,
enrollment__course__self_paced
=
True
,
enrollment__user
=
user1
,
)
schedule
.
enrollment
.
course
.
start
=
current_day
-
datetime
.
timedelta
(
days
=
30
)
end_date_offset
=
-
2
if
has_course_ended
else
2
schedule
.
enrollment
.
course
.
end
=
current_day
+
datetime
.
timedelta
(
days
=
end_date_offset
)
schedule
.
enrollment
.
course
.
save
()
with
patch
.
object
(
self
.
tested_task
,
'async_send_task'
)
as
mock_schedule_send
:
self
.
tested_task
.
apply
(
kwargs
=
dict
(
site_id
=
self
.
site_config
.
site
.
id
,
target_day_str
=
serialize
(
target_day
),
day_offset
=
offset
,
bin_num
=
0
,
))
if
has_course_ended
:
self
.
assertFalse
(
mock_schedule_send
.
apply_async
.
called
)
else
:
self
.
assertTrue
(
mock_schedule_send
.
apply_async
.
called
)
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