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
4dbb935c
Commit
4dbb935c
authored
Nov 30, 2017
by
sandroroux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed references to CREATE_SCHEDULE_WAFFLE_FLAG.
parent
fab7f31a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
44 deletions
+16
-44
lms/djangoapps/courseware/tests/test_course_tools.py
+6
-2
lms/djangoapps/courseware/tests/test_date_summary.py
+6
-6
openedx/core/djangoapps/schedules/README.rst
+0
-8
openedx/core/djangoapps/schedules/config.py
+0
-6
openedx/core/djangoapps/schedules/signals.py
+1
-5
openedx/core/djangoapps/schedules/tests/test_signals.py
+3
-17
No files found.
lms/djangoapps/courseware/tests/test_course_tools.py
View file @
4dbb935c
...
...
@@ -15,12 +15,12 @@ from course_modes.tests.factories import CourseModeFactory
from
courseware.course_tools
import
VerifiedUpgradeTool
from
courseware.models
import
DynamicUpgradeDeadlineConfiguration
from
openedx.core.djangoapps.content.course_overviews.models
import
CourseOverview
from
openedx.core.djangoapps.schedules.config
import
CREATE_SCHEDULE_WAFFLE_FLAG
from
openedx.core.djangoapps.site_configuration.tests.factories
import
SiteFactory
from
openedx.core.djangoapps.waffle_utils.testutils
import
override_waffle_flag
from
student.tests.factories
import
CourseEnrollmentFactory
,
UserFactory
from
xmodule.modulestore.tests.django_utils
import
SharedModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
openedx.core.djangoapps.schedules.tests.factories
import
ScheduleConfigFactory
@attr
(
shard
=
3
)
...
...
@@ -40,7 +40,6 @@ class VerifiedUpgradeToolTest(SharedModuleStoreTestCase):
)
cls
.
course_overview
=
CourseOverview
.
get_from_id
(
cls
.
course
.
id
)
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
def
setUp
(
self
):
super
(
VerifiedUpgradeToolTest
,
self
)
.
setUp
()
...
...
@@ -57,6 +56,11 @@ class VerifiedUpgradeToolTest(SharedModuleStoreTestCase):
DynamicUpgradeDeadlineConfiguration
.
objects
.
create
(
enabled
=
True
)
ScheduleConfigFactory
.
create
(
site
=
mock_get_current_site
.
return_value
,
create_schedules
=
True
)
self
.
enrollment
=
CourseEnrollmentFactory
(
course_id
=
self
.
course
.
id
,
mode
=
CourseMode
.
AUDIT
,
...
...
lms/djangoapps/courseware/tests/test_date_summary.py
View file @
4dbb935c
...
...
@@ -33,12 +33,12 @@ from lms.djangoapps.commerce.models import CommerceConfiguration
from
lms.djangoapps.verify_student.models
import
VerificationDeadline
from
lms.djangoapps.verify_student.tests.factories
import
SoftwareSecurePhotoVerificationFactory
from
openedx.core.djangoapps.content.course_overviews.models
import
CourseOverview
from
openedx.core.djangoapps.schedules.signals
import
CREATE_SCHEDULE_WAFFLE_FLAG
from
openedx.core.djangoapps.self_paced.models
import
SelfPacedConfiguration
from
openedx.core.djangoapps.site_configuration.tests.factories
import
SiteFactory
from
openedx.core.djangoapps.user_api.preferences.api
import
set_user_preference
from
openedx.core.djangoapps.waffle_utils.testutils
import
override_waffle_flag
from
openedx.features.course_experience
import
UNIFIED_COURSE_TAB_FLAG
,
UPGRADE_DEADLINE_MESSAGE
,
CourseHomeMessages
from
openedx.core.djangoapps.schedules.tests.factories
import
ScheduleConfigFactory
from
student.tests.factories
import
TEST_PASSWORD
,
CourseEnrollmentFactory
,
UserFactory
from
xmodule.modulestore.tests.django_utils
import
SharedModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
...
...
@@ -580,8 +580,8 @@ class TestScheduleOverrides(SharedModuleStoreTestCase):
self
.
addCleanup
(
patcher
.
stop
)
mock_get_current_site
.
return_value
=
SiteFactory
.
create
()
self
.
site
=
mock_get_current_site
.
return_value
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
def
test_date_with_self_paced_with_enrollment_before_course_start
(
self
):
""" Enrolling before a course begins should result in the upgrade deadline being set relative to the
course start date. """
...
...
@@ -589,6 +589,7 @@ class TestScheduleOverrides(SharedModuleStoreTestCase):
course
=
create_self_paced_course_run
(
days_till_start
=
3
)
overview
=
CourseOverview
.
get_from_id
(
course
.
id
)
expected
=
overview
.
start
+
timedelta
(
days
=
global_config
.
deadline_days
)
ScheduleConfigFactory
.
create
(
site
=
self
.
site
,
enabled
=
True
,
create_schedules
=
True
)
enrollment
=
CourseEnrollmentFactory
(
course_id
=
course
.
id
,
mode
=
CourseMode
.
AUDIT
)
block
=
VerifiedUpgradeDeadlineDate
(
course
,
enrollment
.
user
)
self
.
assertEqual
(
block
.
date
,
expected
)
...
...
@@ -603,7 +604,6 @@ class TestScheduleOverrides(SharedModuleStoreTestCase):
)
self
.
assertEqual
(
upgrade_date_summary
.
relative_datestring
,
'by {date}'
)
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
def
test_date_with_self_paced_with_enrollment_after_course_start
(
self
):
""" Enrolling after a course begins should result in the upgrade deadline being set relative to the
enrollment date.
...
...
@@ -613,6 +613,7 @@ class TestScheduleOverrides(SharedModuleStoreTestCase):
"""
global_config
=
DynamicUpgradeDeadlineConfiguration
.
objects
.
create
(
enabled
=
True
)
course
=
create_self_paced_course_run
(
days_till_start
=-
1
,
org_id
=
'TestOrg'
)
ScheduleConfigFactory
.
create
(
site
=
self
.
site
,
enabled
=
True
,
create_schedules
=
True
)
enrollment
=
CourseEnrollmentFactory
(
course_id
=
course
.
id
,
mode
=
CourseMode
.
AUDIT
)
block
=
VerifiedUpgradeDeadlineDate
(
course
,
enrollment
.
user
)
expected
=
enrollment
.
created
+
timedelta
(
days
=
global_config
.
deadline_days
)
...
...
@@ -636,7 +637,6 @@ class TestScheduleOverrides(SharedModuleStoreTestCase):
expected
=
enrollment
.
created
+
timedelta
(
days
=
course_config
.
deadline_days
)
self
.
assertEqual
(
block
.
date
,
expected
)
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
def
test_date_with_self_paced_without_dynamic_upgrade_deadline
(
self
):
""" Disabling the dynamic upgrade deadline functionality should result in the verified mode's
expiration date being returned. """
...
...
@@ -647,13 +647,13 @@ class TestScheduleOverrides(SharedModuleStoreTestCase):
block
=
VerifiedUpgradeDeadlineDate
(
course
,
enrollment
.
user
)
self
.
assertEqual
(
block
.
date
,
expected
)
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
def
test_date_with_existing_schedule
(
self
):
""" If a schedule is created while deadlines are disabled, they shouldn't magically appear once the feature is
turned on. """
course
=
create_self_paced_course_run
(
days_till_start
=-
1
)
DynamicUpgradeDeadlineConfiguration
.
objects
.
create
(
enabled
=
False
)
course_config
=
CourseDynamicUpgradeDeadlineConfiguration
.
objects
.
create
(
enabled
=
False
,
course_id
=
course
.
id
)
ScheduleConfigFactory
.
create
(
site
=
self
.
site
,
enabled
=
True
,
create_schedules
=
True
)
enrollment
=
CourseEnrollmentFactory
(
course_id
=
course
.
id
,
mode
=
CourseMode
.
AUDIT
)
# The enrollment has a schedule, but the upgrade deadline should be None
...
...
@@ -707,7 +707,6 @@ class TestScheduleOverrides(SharedModuleStoreTestCase):
(
True
,
True
,
True
,
True
,
True
,
False
),
)
@ddt.unpack
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
def
test_date_with_org_and_course_config_overrides
(
self
,
enroll_first
,
org_config_enabled
,
org_config_opt_out
,
course_config_enabled
,
course_config_opt_out
,
expected_dynamic_deadline
):
...
...
@@ -715,6 +714,7 @@ class TestScheduleOverrides(SharedModuleStoreTestCase):
and opt-out states to verify that course-level overrides the org-level config. """
course
=
create_self_paced_course_run
(
days_till_start
=-
1
,
org_id
=
'TestOrg'
)
DynamicUpgradeDeadlineConfiguration
.
objects
.
create
(
enabled
=
True
)
ScheduleConfigFactory
.
create
(
site
=
self
.
site
,
enabled
=
True
,
create_schedules
=
True
)
if
enroll_first
:
enrollment
=
CourseEnrollmentFactory
(
course_id
=
course
.
id
,
mode
=
CourseMode
.
AUDIT
,
course__self_paced
=
True
)
OrgDynamicUpgradeDeadlineConfiguration
.
objects
.
create
(
...
...
openedx/core/djangoapps/schedules/README.rst
View file @
4dbb935c
...
...
@@ -250,14 +250,6 @@ and link it to the Site. Make sure to enable all of the settings:
- ``hold_back_ratio``: ratio of all new Course Enrollments that should
NOT have a Schedule created.
Roll-out Waffle Flag
^^^^^^^^^^^^^^^^^^^^
There is one roll-out related course waffle flag that we plan to delete
called ``schedules.create_schedules_for_course``, which, if the
``ScheduleConfig.create_schedules`` is disabled, will enable schedule
creation on a per-course basis.
Self-paced Configuration
^^^^^^^^^^^^^^^^^^^^^^^^
...
...
openedx/core/djangoapps/schedules/config.py
View file @
4dbb935c
...
...
@@ -3,12 +3,6 @@ from openedx.core.djangoapps.waffle_utils import WaffleFlagNamespace, CourseWaff
WAFFLE_FLAG_NAMESPACE
=
WaffleFlagNamespace
(
name
=
u'schedules'
)
CREATE_SCHEDULE_WAFFLE_FLAG
=
CourseWaffleFlag
(
waffle_namespace
=
WAFFLE_FLAG_NAMESPACE
,
flag_name
=
u'create_schedules_for_course'
,
flag_undefined_default
=
False
)
COURSE_UPDATE_WAFFLE_FLAG
=
CourseWaffleFlag
(
waffle_namespace
=
WAFFLE_FLAG_NAMESPACE
,
flag_name
=
u'send_updates_for_course'
,
...
...
openedx/core/djangoapps/schedules/signals.py
View file @
4dbb935c
...
...
@@ -18,7 +18,6 @@ from openedx.core.djangoapps.schedules.content_highlights import course_has_high
from
openedx.core.djangoapps.signals.signals
import
COURSE_START_DATE_CHANGED
from
openedx.core.djangoapps.theming.helpers
import
get_current_site
from
student.models
import
CourseEnrollment
from
.config
import
CREATE_SCHEDULE_WAFFLE_FLAG
from
.models
import
Schedule
,
ScheduleConfig
from
.tasks
import
update_course_schedules
...
...
@@ -39,10 +38,7 @@ def create_schedule(sender, **kwargs):
enrollment
=
kwargs
[
'instance'
]
schedule_config
=
ScheduleConfig
.
current
(
current_site
)
if
(
not
schedule_config
.
create_schedules
and
not
CREATE_SCHEDULE_WAFFLE_FLAG
.
is_enabled
(
enrollment
.
course_id
)
):
if
not
schedule_config
.
create_schedules
:
log
.
debug
(
'Schedules: Creation not enabled for this course or for this site'
)
return
...
...
openedx/core/djangoapps/schedules/tests/test_signals.py
View file @
4dbb935c
...
...
@@ -7,7 +7,6 @@ from course_modes.models import CourseMode
from
course_modes.tests.factories
import
CourseModeFactory
from
courseware.models
import
DynamicUpgradeDeadlineConfiguration
from
openedx.core.djangoapps.schedules.models
import
ScheduleExperience
from
openedx.core.djangoapps.schedules.signals
import
CREATE_SCHEDULE_WAFFLE_FLAG
from
openedx.core.djangoapps.site_configuration.tests.factories
import
SiteFactory
from
openedx.core.djangoapps.waffle_utils.testutils
import
override_waffle_flag
from
openedx.core.djangolib.testing.utils
import
skip_unless_lms
...
...
@@ -44,40 +43,28 @@ class CreateScheduleTests(SharedModuleStoreTestCase):
with
self
.
assertRaises
(
Schedule
.
DoesNotExist
):
enrollment
.
schedule
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
def
test_create_schedule
(
self
,
mock_get_current_site
):
site
=
SiteFactory
.
create
()
mock_get_current_site
.
return_value
=
site
ScheduleConfigFactory
.
create
(
site
=
site
)
self
.
assert_schedule_created
()
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
def
test_no_current_site
(
self
,
mock_get_current_site
):
mock_get_current_site
.
return_value
=
None
self
.
assert_schedule_not_created
()
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
def
test_schedule_config_disabled_waffle_enabled
(
self
,
mock_get_current_site
):
site
=
SiteFactory
.
create
()
mock_get_current_site
.
return_value
=
site
ScheduleConfigFactory
.
create
(
site
=
site
,
create_schedules
=
False
)
self
.
assert_schedule_created
()
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
False
)
def
test_schedule_config_enabled_waffle_disabled
(
self
,
mock_get_current_site
):
def
test_schedule_config_enabled
(
self
,
mock_get_current_site
):
site
=
SiteFactory
.
create
()
mock_get_current_site
.
return_value
=
site
ScheduleConfigFactory
.
create
(
site
=
site
,
create_schedules
=
True
)
self
.
assert_schedule_created
()
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
False
)
def
test_schedule_config_disabled_waffle_disabled
(
self
,
mock_get_current_site
):
def
test_schedule_config_disabled
(
self
,
mock_get_current_site
):
site
=
SiteFactory
.
create
()
mock_get_current_site
.
return_value
=
site
ScheduleConfigFactory
.
create
(
site
=
site
,
create_schedules
=
False
)
self
.
assert_schedule_not_created
()
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
def
test_schedule_config_creation_enabled_instructor_paced
(
self
,
mock_get_current_site
):
site
=
SiteFactory
.
create
()
mock_get_current_site
.
return_value
=
site
...
...
@@ -87,15 +74,14 @@ class CreateScheduleTests(SharedModuleStoreTestCase):
with
self
.
assertRaises
(
Schedule
.
DoesNotExist
):
enrollment
.
schedule
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
@patch
(
'openedx.core.djangoapps.schedules.signals.course_has_highlights'
)
def
test_create_schedule_course_updates_experience
(
self
,
mock_course_has_highlights
,
mock_get_current_site
):
site
=
SiteFactory
.
create
()
ScheduleConfigFactory
.
create
(
site
=
site
,
enabled
=
True
,
create_schedules
=
True
)
mock_course_has_highlights
.
return_value
=
True
mock_get_current_site
.
return_value
=
site
self
.
assert_schedule_created
(
experience_type
=
ScheduleExperience
.
EXPERIENCES
.
course_updates
)
@override_waffle_flag
(
CREATE_SCHEDULE_WAFFLE_FLAG
,
True
)
@patch
(
'analytics.track'
)
@patch
(
'random.random'
)
@ddt.data
(
...
...
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