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
e96e65a3
Commit
e96e65a3
authored
Dec 14, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generate_course_overview management command error handling
parent
029e1397
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
10 deletions
+5
-10
openedx/core/djangoapps/content/course_overviews/management/commands/generate_course_overview.py
+1
-5
openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_generate_course_overview.py
+4
-5
No files found.
openedx/core/djangoapps/content/course_overviews/management/commands/generate_course_overview.py
View file @
e96e65a3
...
...
@@ -33,7 +33,6 @@ class Command(BaseCommand):
def
handle
(
self
,
*
args
,
**
options
):
course_keys
=
[]
if
options
[
'all'
]:
course_keys
=
[
course
.
id
for
course
in
modulestore
()
.
get_courses
()]
else
:
...
...
@@ -42,9 +41,6 @@ class Command(BaseCommand):
try
:
course_keys
=
[
CourseKey
.
from_string
(
arg
)
for
arg
in
args
]
except
InvalidKeyError
:
log
.
fatal
(
'Invalid key specified.'
)
if
not
course_keys
:
log
.
fatal
(
'No courses specified.'
)
raise
CommandError
(
'Invalid key specified.'
)
CourseOverview
.
get_select_courses
(
course_keys
)
openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_generate_course_overview.py
View file @
e96e65a3
...
...
@@ -56,13 +56,12 @@ class TestGenerateCourseOverview(ModuleStoreTestCase):
self
.
_assert_courses_in_overview
(
self
.
course_key_1
)
self
.
_assert_courses_not_in_overview
(
self
.
course_key_2
)
@patch
(
'openedx.core.djangoapps.content.course_overviews.management.commands.generate_course_overview.log'
)
def
test_invalid_key
(
self
,
mock_log
):
def
test_invalid_key
(
self
):
"""
Test that
invalid key errors are logged
.
Test that
CommandError is raised for invalid key
.
"""
self
.
command
.
handle
(
'not/found'
,
all
=
False
)
self
.
assertTrue
(
mock_log
.
fatal
.
called
)
with
self
.
assertRaises
(
CommandError
):
self
.
command
.
handle
(
'not/found'
,
all
=
False
)
@patch
(
'openedx.core.djangoapps.content.course_overviews.models.log'
)
def
test_not_found_key
(
self
,
mock_log
):
...
...
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