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
ca66d982
Commit
ca66d982
authored
May 28, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3900 from edx/dhm/test_has_course
Add tests for has_course
parents
eeac479c
c5368462
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
+28
-2
No files found.
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
View file @
ca66d982
# pylint: disable=E0611
from
nose.tools
import
assert_equals
,
assert_raises
,
\
assert_not_equals
,
assert_false
,
assert_true
,
assert_greater
,
assert_is_instance
from
itertools
import
ifilter
assert_not_equals
,
assert_false
,
assert_true
,
assert_greater
,
assert_is_instance
,
assert_is_none
# pylint: enable=E0611
from
path
import
path
import
pymongo
...
...
@@ -157,6 +156,33 @@ class TestMongoModuleStore(unittest.TestCase):
assert_in
(
course_key
,
course_ids
)
course
=
self
.
store
.
get_course
(
course_key
)
assert_not_none
(
course
)
assert_true
(
self
.
store
.
has_course
(
course_key
))
mix_cased
=
SlashSeparatedCourseKey
(
course_key
.
org
.
upper
(),
course_key
.
course
.
upper
(),
course_key
.
run
.
lower
()
)
assert_false
(
self
.
store
.
has_course
(
mix_cased
))
assert_true
(
self
.
store
.
has_course
(
mix_cased
,
ignore_case
=
True
))
def
test_no_such_course
(
self
):
"""
Test get_course and has_course with ids which don't exist
"""
for
course_key
in
[
SlashSeparatedCourseKey
(
*
fields
)
for
fields
in
[
[
'edX'
,
'simple'
,
'no_such_course'
],
[
'edX'
,
'no_such_course'
,
'2012_Fall'
],
[
'NO_SUCH_COURSE'
,
'Test_iMport_courSe'
,
'2012_Fall'
],
]
]:
course
=
self
.
store
.
get_course
(
course_key
)
assert_is_none
(
course
)
assert_false
(
self
.
store
.
has_course
(
course_key
))
mix_cased
=
SlashSeparatedCourseKey
(
course_key
.
org
.
lower
(),
course_key
.
course
.
upper
(),
course_key
.
run
.
upper
()
)
assert_false
(
self
.
store
.
has_course
(
mix_cased
))
assert_false
(
self
.
store
.
has_course
(
mix_cased
,
ignore_case
=
True
))
def
test_loads
(
self
):
assert_not_none
(
...
...
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