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
ce4b1301
Commit
ce4b1301
authored
Jan 06, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set default section start date to Jan 1, 2030
STUD-1072
parent
024c3f65
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
21 deletions
+43
-21
CHANGELOG.rst
+2
-0
cms/djangoapps/contentstore/tests/test_item.py
+15
-8
common/lib/xmodule/xmodule/course_module.py
+1
-3
common/lib/xmodule/xmodule/modulestore/inheritance.py
+1
-1
common/lib/xmodule/xmodule/modulestore/tests/factories.py
+0
-2
common/lib/xmodule/xmodule/tests/test_course_module.py
+11
-3
common/lib/xmodule/xmodule/tests/test_import.py
+4
-2
lms/djangoapps/django_comment_client/tests/test_utils.py
+9
-2
No files found.
CHANGELOG.rst
View file @
ce4b1301
...
...
@@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes,
in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected.
Studio: Newly-created courses default to being published on Jan 1, 2030
Studio: Added pagination to the Files & Uploads page.
Blades: Video player improvements:
...
...
cms/djangoapps/contentstore/tests/test_item.py
View file @
ce4b1301
"""Tests for items views."""
import
json
import
datetime
from
datetime
import
datetime
import
ddt
from
mock
import
Mock
,
patch
...
...
@@ -149,6 +149,13 @@ class TestCreateItem(ItemTest):
resp
=
self
.
create_xblock
(
category
=
'problem'
,
boilerplate
=
'nosuchboilerplate.yaml'
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
def
test_create_with_future_date
(
self
):
self
.
assertEqual
(
self
.
course
.
start
,
datetime
(
2030
,
1
,
1
,
tzinfo
=
UTC
))
resp
=
self
.
create_xblock
(
category
=
'chapter'
)
locator
=
self
.
response_locator
(
resp
)
obj
=
self
.
get_item_from_modulestore
(
locator
)
self
.
assertEqual
(
obj
.
start
,
datetime
(
2030
,
1
,
1
,
tzinfo
=
UTC
))
class
TestEditItem
(
ItemTest
):
"""
...
...
@@ -214,14 +221,14 @@ class TestEditItem(ItemTest):
data
=
{
'metadata'
:
{
'due'
:
'2010-11-22T04:00Z'
}}
)
sequential
=
self
.
get_item_from_modulestore
(
self
.
seq_locator
)
self
.
assertEqual
(
sequential
.
due
,
datetime
.
datetime
(
2010
,
11
,
22
,
4
,
0
,
tzinfo
=
UTC
))
self
.
assertEqual
(
sequential
.
due
,
datetime
(
2010
,
11
,
22
,
4
,
0
,
tzinfo
=
UTC
))
self
.
client
.
ajax_post
(
self
.
seq_update_url
,
data
=
{
'metadata'
:
{
'start'
:
'2010-09-12T14:00Z'
}}
)
sequential
=
self
.
get_item_from_modulestore
(
self
.
seq_locator
)
self
.
assertEqual
(
sequential
.
due
,
datetime
.
datetime
(
2010
,
11
,
22
,
4
,
0
,
tzinfo
=
UTC
))
self
.
assertEqual
(
sequential
.
start
,
datetime
.
datetime
(
2010
,
9
,
12
,
14
,
0
,
tzinfo
=
UTC
))
self
.
assertEqual
(
sequential
.
due
,
datetime
(
2010
,
11
,
22
,
4
,
0
,
tzinfo
=
UTC
))
self
.
assertEqual
(
sequential
.
start
,
datetime
(
2010
,
9
,
12
,
14
,
0
,
tzinfo
=
UTC
))
def
test_delete_child
(
self
):
"""
...
...
@@ -326,7 +333,7 @@ class TestEditItem(ItemTest):
published
=
self
.
get_item_from_modulestore
(
self
.
problem_locator
,
False
)
self
.
assertIsNone
(
published
.
due
)
draft
=
self
.
get_item_from_modulestore
(
self
.
problem_locator
,
True
)
self
.
assertEqual
(
draft
.
due
,
datetime
.
datetime
(
2077
,
10
,
10
,
4
,
0
,
tzinfo
=
UTC
))
self
.
assertEqual
(
draft
.
due
,
datetime
(
2077
,
10
,
10
,
4
,
0
,
tzinfo
=
UTC
))
def
test_make_public_with_update
(
self
):
""" Update a problem and make it public at the same time. """
...
...
@@ -338,7 +345,7 @@ class TestEditItem(ItemTest):
}
)
published
=
self
.
get_item_from_modulestore
(
self
.
problem_locator
,
False
)
self
.
assertEqual
(
published
.
due
,
datetime
.
datetime
(
2077
,
10
,
10
,
4
,
0
,
tzinfo
=
UTC
))
self
.
assertEqual
(
published
.
due
,
datetime
(
2077
,
10
,
10
,
4
,
0
,
tzinfo
=
UTC
))
def
test_make_private_with_update
(
self
):
""" Make a problem private and update it at the same time. """
...
...
@@ -357,7 +364,7 @@ class TestEditItem(ItemTest):
with
self
.
assertRaises
(
ItemNotFoundError
):
self
.
get_item_from_modulestore
(
self
.
problem_locator
,
False
)
draft
=
self
.
get_item_from_modulestore
(
self
.
problem_locator
,
True
)
self
.
assertEqual
(
draft
.
due
,
datetime
.
datetime
(
2077
,
10
,
10
,
4
,
0
,
tzinfo
=
UTC
))
self
.
assertEqual
(
draft
.
due
,
datetime
(
2077
,
10
,
10
,
4
,
0
,
tzinfo
=
UTC
))
def
test_create_draft_with_update
(
self
):
""" Create a draft and update it at the same time. """
...
...
@@ -378,7 +385,7 @@ class TestEditItem(ItemTest):
published
=
self
.
get_item_from_modulestore
(
self
.
problem_locator
,
False
)
self
.
assertIsNone
(
published
.
due
)
draft
=
self
.
get_item_from_modulestore
(
self
.
problem_locator
,
True
)
self
.
assertEqual
(
draft
.
due
,
datetime
.
datetime
(
2077
,
10
,
10
,
4
,
0
,
tzinfo
=
UTC
))
self
.
assertEqual
(
draft
.
due
,
datetime
(
2077
,
10
,
10
,
4
,
0
,
tzinfo
=
UTC
))
@ddt.ddt
...
...
common/lib/xmodule/xmodule/course_module.py
View file @
ce4b1301
...
...
@@ -164,9 +164,7 @@ class CourseFields(object):
enrollment_start
=
Date
(
help
=
"Date that enrollment for this class is opened"
,
scope
=
Scope
.
settings
)
enrollment_end
=
Date
(
help
=
"Date that enrollment for this class is closed"
,
scope
=
Scope
.
settings
)
start
=
Date
(
help
=
"Start time when this module is visible"
,
# using now(UTC()) resulted in fractional seconds which screwed up comparisons and anyway w/b the
# time of first invocation of this stmt on the server
default
=
datetime
.
fromtimestamp
(
0
,
UTC
()),
default
=
datetime
(
2030
,
1
,
1
,
tzinfo
=
UTC
()),
scope
=
Scope
.
settings
)
end
=
Date
(
help
=
"Date that this class ends"
,
scope
=
Scope
.
settings
)
advertised_start
=
String
(
help
=
"Date that this course is advertised to start"
,
scope
=
Scope
.
settings
)
...
...
common/lib/xmodule/xmodule/modulestore/inheritance.py
View file @
ce4b1301
...
...
@@ -17,7 +17,7 @@ class InheritanceMixin(XBlockMixin):
start
=
Date
(
help
=
"Start time when this module is visible"
,
default
=
datetime
.
fromtimestamp
(
0
,
UTC
),
default
=
datetime
(
2030
,
1
,
1
,
tzinfo
=
UTC
),
scope
=
Scope
.
settings
)
due
=
Date
(
help
=
"Date that this problem is due by"
,
scope
=
Scope
.
settings
)
...
...
common/lib/xmodule/xmodule/modulestore/tests/factories.py
View file @
ce4b1301
...
...
@@ -55,8 +55,6 @@ class CourseFactory(XModuleFactory):
# Write the data to the mongo datastore
new_course
=
store
.
create_xmodule
(
location
,
metadata
=
kwargs
.
get
(
'metadata'
,
None
))
new_course
.
start
=
datetime
.
datetime
.
now
(
UTC
)
.
replace
(
microsecond
=
0
)
# The rest of kwargs become attributes on the course:
for
k
,
v
in
kwargs
.
iteritems
():
setattr
(
new_course
,
k
,
v
)
...
...
common/lib/xmodule/xmodule/tests/test_course_module.py
View file @
ce4b1301
import
unittest
import
datetime
from
datetime
import
datetime
from
fs.memoryfs
import
MemoryFS
...
...
@@ -13,7 +13,15 @@ from django.utils.timezone import UTC
ORG
=
'test_org'
COURSE
=
'test_course'
NOW
=
datetime
.
datetime
.
strptime
(
'2013-01-01T01:00:00'
,
'
%
Y-
%
m-
%
dT
%
H:
%
M:00'
)
.
replace
(
tzinfo
=
UTC
())
NOW
=
datetime
.
strptime
(
'2013-01-01T01:00:00'
,
'
%
Y-
%
m-
%
dT
%
H:
%
M:00'
)
.
replace
(
tzinfo
=
UTC
())
class
CourseFieldsTestCase
(
unittest
.
TestCase
):
def
test_default_start_date
(
self
):
self
.
assertEqual
(
xmodule
.
course_module
.
CourseFields
.
start
.
default
,
datetime
(
2030
,
1
,
1
,
tzinfo
=
UTC
())
)
class
DummySystem
(
ImportSystem
):
...
...
@@ -77,7 +85,7 @@ class IsNewCourseTestCase(unittest.TestCase):
# Needed for test_is_newish
datetime_patcher
=
patch
.
object
(
xmodule
.
course_module
,
'datetime'
,
Mock
(
wraps
=
datetime
.
datetime
)
Mock
(
wraps
=
datetime
)
)
mocked_datetime
=
datetime_patcher
.
start
()
mocked_datetime
.
now
.
return_value
=
NOW
...
...
common/lib/xmodule/xmodule/tests/test_import.py
View file @
ce4b1301
...
...
@@ -228,9 +228,11 @@ class ImportTestCase(BaseCourseTestCase):
# Check that the child does not inherit a value for due
child
=
descriptor
.
get_children
()[
0
]
self
.
assertEqual
(
child
.
due
,
None
)
# Check that the child hasn't started yet
self
.
assertLessEqual
(
child
.
start
,
datetime
.
datetime
.
now
(
UTC
())
datetime
.
datetime
.
now
(
UTC
())
,
child
.
start
)
def
test_metadata_override_default
(
self
):
...
...
lms/djangoapps/django_comment_client/tests/test_utils.py
View file @
ce4b1301
from
datetime
import
datetime
from
pytz
import
UTC
from
django.core.urlresolvers
import
reverse
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
from
django_comment_common.models
import
Role
,
Permission
from
django_comment_client.tests.factories
import
RoleFactory
import
django_comment_client.utils
as
utils
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
courseware.tests.tests
import
TEST_DATA_MONGO_MODULESTORE
class
DictionaryTestCase
(
TestCase
):
def
test_extract
(
self
):
d
=
{
'cats'
:
'meow'
,
'dogs'
:
'woof'
}
...
...
@@ -128,7 +129,13 @@ class CoursewareContextTestCase(ModuleStoreTestCase):
@override_settings
(
MODULESTORE
=
TEST_DATA_MONGO_MODULESTORE
)
class
CategoryMapTestCase
(
ModuleStoreTestCase
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
(
org
=
"TestX"
,
number
=
"101"
,
display_name
=
"Test Course"
)
self
.
course
=
CourseFactory
.
create
(
org
=
"TestX"
,
number
=
"101"
,
display_name
=
"Test Course"
,
# This test needs to use a course that has already started --
# discussion topics only show up if the course has already started,
# and the default start date for courses is Jan 1, 2030.
start
=
datetime
(
2012
,
2
,
3
,
tzinfo
=
UTC
)
)
# Courses get a default discussion topic on creation, so remove it
self
.
course
.
discussion_topics
=
{}
self
.
course
.
save
()
...
...
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