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
d1392855
Commit
d1392855
authored
Aug 29, 2017
by
Noraiz Anwar
Committed by
GitHub
Aug 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "remove try/catch block and associated test for EDUCATOR-1134 followin…"
parent
19dec17e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletions
+21
-1
common/lib/xmodule/xmodule/course_module.py
+10
-1
common/lib/xmodule/xmodule/tests/test_course_module.py
+11
-0
No files found.
common/lib/xmodule/xmodule/course_module.py
View file @
d1392855
...
@@ -1454,4 +1454,13 @@ class CourseSummary(object):
...
@@ -1454,4 +1454,13 @@ class CourseSummary(object):
"""
"""
Returns whether the course has ended.
Returns whether the course has ended.
"""
"""
return
course_metadata_utils
.
has_course_ended
(
self
.
end
)
try
:
return
course_metadata_utils
.
has_course_ended
(
self
.
end
)
except
TypeError
as
e
:
log
.
warning
(
"Course '{course_id}' has an improperly formatted end date '{end_date}'. Error: '{err}'."
.
format
(
course_id
=
unicode
(
self
.
id
),
end_date
=
self
.
end
,
err
=
e
)
)
modified_end
=
self
.
end
.
replace
(
tzinfo
=
utc
)
return
course_metadata_utils
.
has_course_ended
(
modified_end
)
common/lib/xmodule/xmodule/tests/test_course_module.py
View file @
d1392855
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
ddt
import
ddt
import
unittest
import
unittest
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
from
dateutil
import
parser
import
itertools
import
itertools
from
fs.memoryfs
import
MemoryFS
from
fs.memoryfs
import
MemoryFS
...
@@ -142,6 +143,16 @@ class HasEndedMayCertifyTestCase(unittest.TestCase):
...
@@ -142,6 +143,16 @@ class HasEndedMayCertifyTestCase(unittest.TestCase):
self
.
assertFalse
(
self
.
future_noshow_certs
.
may_certify
())
self
.
assertFalse
(
self
.
future_noshow_certs
.
may_certify
())
class
CourseSummaryHasEnded
(
unittest
.
TestCase
):
""" Test for has_ended method when end date is missing timezone information. """
def
test_course_end
(
self
):
test_course
=
get_dummy_course
(
"2012-01-01T12:00"
)
bad_end_date
=
parser
.
parse
(
"2012-02-21 10:28:45"
)
summary
=
xmodule
.
course_module
.
CourseSummary
(
test_course
.
id
,
end
=
bad_end_date
)
self
.
assertTrue
(
summary
.
has_ended
())
@ddt.ddt
@ddt.ddt
class
IsNewCourseTestCase
(
unittest
.
TestCase
):
class
IsNewCourseTestCase
(
unittest
.
TestCase
):
"""Make sure the property is_new works on courses"""
"""Make sure the property is_new works on courses"""
...
...
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