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
81a5b363
Commit
81a5b363
authored
Jan 08, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
During testing: drop contentstore when cleaning up modulestore
parent
19eaaaed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
cms/djangoapps/contentstore/tests/test_assets.py
+2
-5
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
+9
-6
No files found.
cms/djangoapps/contentstore/tests/test_assets.py
View file @
81a5b363
...
@@ -6,21 +6,18 @@ Unit tests for the asset upload endpoint.
...
@@ -6,21 +6,18 @@ Unit tests for the asset upload endpoint.
#pylint: disable=W0621
#pylint: disable=W0621
#pylint: disable=W0212
#pylint: disable=W0212
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
from
io
import
BytesIO
from
io
import
BytesIO
from
pytz
import
UTC
from
pytz
import
UTC
import
json
import
json
import
re
from
unittest
import
TestCase
,
skip
from
.utils
import
CourseTestCase
from
.utils
import
CourseTestCase
from
contentstore.views
import
assets
from
contentstore.views
import
assets
from
xmodule.contentstore.content
import
StaticContent
,
XASSET_LOCATION_TAG
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
from
xmodule.contentstore.django
import
contentstore
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
xmodule.modulestore.django
import
loc_mapper
from
xmodule.modulestore.django
import
loc_mapper
from
xmodule.modulestore.mongo.base
import
location_to_query
class
AssetsTestCase
(
CourseTestCase
):
class
AssetsTestCase
(
CourseTestCase
):
...
...
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
View file @
81a5b363
...
@@ -6,6 +6,7 @@ from uuid import uuid4
...
@@ -6,6 +6,7 @@ from uuid import uuid4
from
django.test
import
TestCase
from
django.test
import
TestCase
from
xmodule.modulestore.django
import
editable_modulestore
,
\
from
xmodule.modulestore.django
import
editable_modulestore
,
\
clear_existing_modulestores
clear_existing_modulestores
from
xmodule.contentstore.django
import
contentstore
def
mixed_store_config
(
data_dir
,
mappings
):
def
mixed_store_config
(
data_dir
,
mappings
):
...
@@ -211,17 +212,19 @@ class ModuleStoreTestCase(TestCase):
...
@@ -211,17 +212,19 @@ class ModuleStoreTestCase(TestCase):
return
updated_course
return
updated_course
@staticmethod
@staticmethod
def
drop_mongo_collection
():
def
drop_mongo_collection
s
():
"""
"""
If using a Mongo-backed modulestore
, drop the collection
.
If using a Mongo-backed modulestore
& contentstore, drop the collections
.
"""
"""
# This will return the mongo-backed modulestore
# This will return the mongo-backed modulestore
# even if we're using a mixed modulestore
# even if we're using a mixed modulestore
store
=
editable_modulestore
()
store
=
editable_modulestore
()
if
hasattr
(
store
,
'collection'
):
if
hasattr
(
store
,
'collection'
):
store
.
collection
.
drop
()
store
.
collection
.
drop
()
if
contentstore
()
.
fs_files
:
db
=
contentstore
()
.
fs_files
.
database
db
.
connection
.
drop_database
(
db
)
@classmethod
@classmethod
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
...
@@ -241,7 +244,7 @@ class ModuleStoreTestCase(TestCase):
...
@@ -241,7 +244,7 @@ class ModuleStoreTestCase(TestCase):
Clean up any data stored in Mongo.
Clean up any data stored in Mongo.
"""
"""
# Clean up by flushing the Mongo modulestore
# Clean up by flushing the Mongo modulestore
cls
.
drop_mongo_collection
()
cls
.
drop_mongo_collection
s
()
# Clear out the existing modulestores,
# Clear out the existing modulestores,
# which will cause them to be re-created
# which will cause them to be re-created
...
@@ -257,7 +260,7 @@ class ModuleStoreTestCase(TestCase):
...
@@ -257,7 +260,7 @@ class ModuleStoreTestCase(TestCase):
"""
"""
# Flush the Mongo modulestore
# Flush the Mongo modulestore
ModuleStoreTestCase
.
drop_mongo_collection
()
ModuleStoreTestCase
.
drop_mongo_collection
s
()
# Call superclass implementation
# Call superclass implementation
super
(
ModuleStoreTestCase
,
self
)
.
_pre_setup
()
super
(
ModuleStoreTestCase
,
self
)
.
_pre_setup
()
...
@@ -266,7 +269,7 @@ class ModuleStoreTestCase(TestCase):
...
@@ -266,7 +269,7 @@ class ModuleStoreTestCase(TestCase):
"""
"""
Flush the ModuleStore after each test.
Flush the ModuleStore after each test.
"""
"""
ModuleStoreTestCase
.
drop_mongo_collection
()
ModuleStoreTestCase
.
drop_mongo_collection
s
()
# Call superclass implementation
# Call superclass implementation
super
(
ModuleStoreTestCase
,
self
)
.
_post_teardown
()
super
(
ModuleStoreTestCase
,
self
)
.
_post_teardown
()
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