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
88b28ae0
Commit
88b28ae0
authored
Aug 27, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #808 from edx/will/randomize-cms-mongo-collections
Use randomized mongo collection names in Studio tests
parents
b5e1d57e
e50a2414
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
4 deletions
+59
-4
cms/djangoapps/contentstore/tests/modulestore_config.py
+8
-0
cms/djangoapps/contentstore/tests/test_contentstore.py
+4
-2
cms/djangoapps/contentstore/tests/test_i18n.py
+3
-0
cms/djangoapps/contentstore/tests/test_import_nostatic.py
+2
-1
cms/djangoapps/contentstore/tests/tests.py
+4
-1
cms/djangoapps/contentstore/tests/utils.py
+3
-0
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
+35
-0
No files found.
cms/djangoapps/contentstore/tests/modulestore_config.py
0 → 100644
View file @
88b28ae0
"""
Define test configuration for modulestores.
"""
from
xmodule.modulestore.tests.django_utils
import
studio_store_config
from
django.conf
import
settings
TEST_MODULESTORE
=
studio_store_config
(
settings
.
TEST_ROOT
/
"data"
)
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
88b28ae0
...
...
@@ -25,6 +25,7 @@ from contentstore.tests.utils import parse_json
from
auth.authz
import
add_user_to_creator_group
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
contentstore.tests.modulestore_config
import
TEST_MODULESTORE
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore
import
Location
,
mongo
...
...
@@ -68,7 +69,7 @@ class MongoCollectionFindWrapper(object):
return
self
.
original
(
query
,
*
args
,
**
kwargs
)
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
,
MODULESTORE
=
TEST_MODULESTORE
)
class
ContentStoreToyCourseTest
(
ModuleStoreTestCase
):
"""
Tests that rely on the toy courses.
...
...
@@ -1180,7 +1181,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
export_to_xml
(
module_store
,
content_store
,
location
,
root_dir
,
'test_export'
)
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
,
MODULESTORE
=
TEST_MODULESTORE
)
class
ContentStoreTest
(
ModuleStoreTestCase
):
"""
Tests for the CMS ContentStore application.
...
...
@@ -1707,6 +1708,7 @@ class ContentStoreTest(ModuleStoreTestCase):
content_store
.
find
(
location
)
@override_settings
(
MODULESTORE
=
TEST_MODULESTORE
)
class
MetadataSaveTestCase
(
ModuleStoreTestCase
):
"""Test that metadata is correctly cached and decached."""
...
...
cms/djangoapps/contentstore/tests/test_i18n.py
View file @
88b28ae0
...
...
@@ -3,10 +3,13 @@ from unittest import skip
from
django.core.urlresolvers
import
reverse
from
django.contrib.auth.models
import
User
from
django.test.client
import
Client
from
django.test.utils
import
override_settings
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
contentstore.tests.modulestore_config
import
TEST_MODULESTORE
@override_settings
(
MODULESTORE
=
TEST_MODULESTORE
)
class
InternationalizationTest
(
ModuleStoreTestCase
):
"""
Tests to validate Internationalization.
...
...
cms/djangoapps/contentstore/tests/test_import_nostatic.py
View file @
88b28ae0
...
...
@@ -12,6 +12,7 @@ import copy
from
django.contrib.auth.models
import
User
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
contentstore.tests.modulestore_config
import
TEST_MODULESTORE
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
...
...
@@ -30,7 +31,7 @@ TEST_DATA_CONTENTSTORE = copy.deepcopy(settings.CONTENTSTORE)
TEST_DATA_CONTENTSTORE
[
'OPTIONS'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
,
MODULESTORE
=
TEST_MODULESTORE
)
class
ContentStoreImportNoStaticTest
(
ModuleStoreTestCase
):
"""
Tests that rely on the toy and test_import_course courses.
...
...
cms/djangoapps/contentstore/tests/tests.py
View file @
88b28ae0
from
django.test.client
import
Client
from
django.test.utils
import
override_settings
from
django.core.cache
import
cache
from
django.core.urlresolvers
import
reverse
from
.utils
import
parse_json
,
user
,
registration
from
contentstore.tests
.utils
import
parse_json
,
user
,
registration
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
contentstore.tests.test_course_settings
import
CourseTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
contentstore.tests.modulestore_config
import
TEST_MODULESTORE
import
datetime
from
pytz
import
UTC
@override_settings
(
MODULESTORE
=
TEST_MODULESTORE
)
class
ContentStoreTestCase
(
ModuleStoreTestCase
):
def
_login
(
self
,
email
,
password
):
"""
...
...
cms/djangoapps/contentstore/tests/utils.py
View file @
88b28ae0
...
...
@@ -7,9 +7,11 @@ import json
from
student.models
import
Registration
from
django.contrib.auth.models
import
User
from
django.test.client
import
Client
from
django.test.utils
import
override_settings
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
contentstore.tests.modulestore_config
import
TEST_MODULESTORE
def
parse_json
(
response
):
...
...
@@ -27,6 +29,7 @@ def registration(email):
return
Registration
.
objects
.
get
(
user__email
=
email
)
@override_settings
(
MODULESTORE
=
TEST_MODULESTORE
)
class
CourseTestCase
(
ModuleStoreTestCase
):
def
setUp
(
self
):
"""
...
...
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
View file @
88b28ae0
...
...
@@ -110,6 +110,41 @@ def xml_store_config(data_dir):
return
store
def
studio_store_config
(
data_dir
):
"""
Defines modulestore structure used by Studio tests.
"""
options
=
{
'default_class'
:
'xmodule.raw_module.RawDescriptor'
,
'host'
:
'localhost'
,
'db'
:
'test_xmodule'
,
'collection'
:
'modulestore_
%
s'
%
uuid4
()
.
hex
,
'fs_root'
:
data_dir
,
'render_template'
:
'mitxmako.shortcuts.render_to_string'
,
}
store
=
{
'default'
:
{
'ENGINE'
:
'xmodule.modulestore.draft.DraftModuleStore'
,
'OPTIONS'
:
options
},
'direct'
:
{
'ENGINE'
:
'xmodule.modulestore.mongo.MongoModuleStore'
,
'OPTIONS'
:
options
},
'draft'
:
{
'ENGINE'
:
'xmodule.modulestore.draft.DraftModuleStore'
,
'OPTIONS'
:
options
},
'split'
:
{
'ENGINE'
:
'xmodule.modulestore.split_mongo.SplitMongoModuleStore'
,
'OPTIONS'
:
options
}
}
return
store
class
ModuleStoreTestCase
(
TestCase
):
"""
Subclass for any test case that uses a ModuleStore.
...
...
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