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
d89279f6
Commit
d89279f6
authored
Aug 23, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #773 from edx/lapentab/fix_network_tests
Remove network calls in tests
parents
bda814fb
42ac76ce
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
cms/djangoapps/contentstore/tests/test_contentstore.py
+19
-2
lms/djangoapps/courseware/tests/tests.py
+10
-3
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
d89279f6
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
import
json
import
json
import
shutil
import
shutil
import
mock
import
mock
from
textwrap
import
dedent
from
django.test.client
import
Client
from
django.test.client
import
Client
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -312,7 +315,14 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
...
@@ -312,7 +315,14 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
handouts
=
module_store
.
get_item
(
Location
([
'i4x'
,
'edX'
,
'toy'
,
'html'
,
'toyhtml'
,
None
]))
handouts
=
module_store
.
get_item
(
Location
([
'i4x'
,
'edX'
,
'toy'
,
'html'
,
'toyhtml'
,
None
]))
self
.
assertIn
(
'/static/'
,
handouts
.
data
)
self
.
assertIn
(
'/static/'
,
handouts
.
data
)
def
test_import_textbook_as_content_element
(
self
):
@mock.patch
(
'xmodule.course_module.requests.get'
)
def
test_import_textbook_as_content_element
(
self
,
mock_get
):
mock_get
.
return_value
.
text
=
dedent
(
"""
<?xml version="1.0"?><table_of_contents>
<entry page="5" page_label="ii" name="Table of Contents"/>
</table_of_contents>
"""
)
.
strip
()
module_store
=
modulestore
(
'direct'
)
module_store
=
modulestore
(
'direct'
)
import_from_xml
(
module_store
,
'common/test/data/'
,
[
'toy'
])
import_from_xml
(
module_store
,
'common/test/data/'
,
[
'toy'
])
...
@@ -845,7 +855,14 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
...
@@ -845,7 +855,14 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
filesystem
=
OSFS
(
root_dir
/
(
'test_export/'
+
dirname
))
filesystem
=
OSFS
(
root_dir
/
(
'test_export/'
+
dirname
))
self
.
assertTrue
(
filesystem
.
exists
(
item
.
location
.
name
+
filename_suffix
))
self
.
assertTrue
(
filesystem
.
exists
(
item
.
location
.
name
+
filename_suffix
))
def
test_export_course
(
self
):
@mock.patch
(
'xmodule.course_module.requests.get'
)
def
test_export_course
(
self
,
mock_get
):
mock_get
.
return_value
.
text
=
dedent
(
"""
<?xml version="1.0"?><table_of_contents>
<entry page="5" page_label="ii" name="Table of Contents"/>
</table_of_contents>
"""
)
.
strip
()
module_store
=
modulestore
(
'direct'
)
module_store
=
modulestore
(
'direct'
)
draft_store
=
modulestore
(
'draft'
)
draft_store
=
modulestore
(
'draft'
)
content_store
=
contentstore
()
content_store
=
contentstore
()
...
...
lms/djangoapps/courseware/tests/tests.py
View file @
d89279f6
"""
"""
Test for LMS courseware app.
Test for LMS courseware app.
"""
"""
import
mock
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
textwrap
import
dedent
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
...
@@ -156,10 +159,14 @@ class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
...
@@ -156,10 +159,14 @@ class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
self
.
store
=
modulestore
()
self
.
store
=
modulestore
()
import_from_xml
(
self
.
store
,
TEST_DATA_DIR
,
[
'toy'
])
import_from_xml
(
self
.
store
,
TEST_DATA_DIR
,
[
'toy'
])
def
test_toy_course_loads
(
self
):
@mock.patch
(
'xmodule.course_module.requests.get'
)
self
.
check_all_pages_load
(
'edX/toy/2012_Fall'
)
def
test_toy_textbooks_loads
(
self
,
mock_get
):
mock_get
.
return_value
.
text
=
dedent
(
"""
<?xml version="1.0"?><table_of_contents>
<entry page="5" page_label="ii" name="Table of Contents"/>
</table_of_contents>
"""
)
.
strip
()
def
test_toy_textbooks_loads
(
self
):
location
=
Location
([
'i4x'
,
'edX'
,
'toy'
,
'course'
,
'2012_Fall'
,
None
])
location
=
Location
([
'i4x'
,
'edX'
,
'toy'
,
'course'
,
'2012_Fall'
,
None
])
course
=
self
.
store
.
get_item
(
location
)
course
=
self
.
store
.
get_item
(
location
)
self
.
assertGreater
(
len
(
course
.
textbooks
),
0
)
self
.
assertGreater
(
len
(
course
.
textbooks
),
0
)
...
...
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