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
4660055e
Commit
4660055e
authored
Mar 17, 2016
by
Ben Patterson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11411 from edx/benp/shard2-lms
Create a third shard for lms unit tests.
parents
8aff51bf
c504029b
Hide whitespace changes
Inline
Side-by-side
Showing
66 changed files
with
221 additions
and
2 deletions
+221
-2
lms/djangoapps/discussion_api/tests/test_api.py
+12
-0
lms/djangoapps/django_comment_client/base/tests.py
+14
-0
lms/djangoapps/mobile_api/users/tests.py
+8
-0
lms/djangoapps/mobile_api/video_outlines/tests.py
+4
-0
lms/djangoapps/verify_student/tests/test_views.py
+17
-0
openedx/core/djangoapps/bookmarks/tests/test_api.py
+2
-0
openedx/core/djangoapps/bookmarks/tests/test_models.py
+3
-0
openedx/core/djangoapps/bookmarks/tests/test_services.py
+2
-0
openedx/core/djangoapps/bookmarks/tests/test_tasks.py
+2
-0
openedx/core/djangoapps/bookmarks/tests/test_views.py
+3
-0
openedx/core/djangoapps/ccxcon/tests/test_signals.py
+2
-0
openedx/core/djangoapps/ccxcon/tests/test_tasks.py
+2
-0
openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_generate_course_overview.py
+2
-0
openedx/core/djangoapps/content/course_structures/tests.py
+2
-0
openedx/core/djangoapps/course_groups/management/commands/tests/test_post_cohort_membership_fix.py
+2
-0
openedx/core/djangoapps/course_groups/tests/test_cohorts.py
+4
-0
openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py
+5
-0
openedx/core/djangoapps/course_groups/tests/test_views.py
+8
-0
openedx/core/djangoapps/credentials/tests/test_models.py
+2
-1
openedx/core/djangoapps/credentials/tests/test_utils.py
+2
-0
openedx/core/djangoapps/credit/tests/test_api.py
+3
-0
openedx/core/djangoapps/credit/tests/test_models.py
+2
-0
openedx/core/djangoapps/credit/tests/test_partition.py
+2
-0
openedx/core/djangoapps/credit/tests/test_serializers.py
+3
-0
openedx/core/djangoapps/credit/tests/test_services.py
+3
-0
openedx/core/djangoapps/credit/tests/test_signals.py
+2
-0
openedx/core/djangoapps/credit/tests/test_signature.py
+3
-0
openedx/core/djangoapps/credit/tests/test_tasks.py
+2
-0
openedx/core/djangoapps/credit/tests/test_verification_access.py
+3
-0
openedx/core/djangoapps/credit/tests/test_views.py
+6
-0
openedx/core/djangoapps/models/tests/test_course_details.py
+2
-0
openedx/core/djangoapps/profile_images/tests/test_images.py
+4
-0
openedx/core/djangoapps/profile_images/tests/test_views.py
+6
-0
openedx/core/djangoapps/programs/tests/test_models.py
+2
-0
openedx/core/djangoapps/programs/tests/test_signals.py
+2
-0
openedx/core/djangoapps/programs/tests/test_utils.py
+2
-0
openedx/core/djangoapps/safe_sessions/tests/test_middleware.py
+4
-0
openedx/core/djangoapps/safe_sessions/tests/test_safe_cookie_data.py
+2
-0
openedx/core/djangoapps/user_api/accounts/tests/test_api.py
+4
-0
openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py
+2
-0
openedx/core/djangoapps/user_api/accounts/tests/test_views.py
+3
-0
openedx/core/djangoapps/user_api/course_tag/tests/test_api.py
+2
-0
openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py
+2
-0
openedx/core/djangoapps/user_api/preferences/tests/test_api.py
+3
-0
openedx/core/djangolib/tests/test_js_utils.py
+2
-0
openedx/core/djangolib/tests/test_markup.py
+2
-0
openedx/core/lib/api/tests/test_authentication.py
+3
-0
openedx/core/lib/api/tests/test_exceptions.py
+3
-0
openedx/core/lib/api/tests/test_paginators.py
+3
-0
openedx/core/lib/api/tests/test_parsers.py
+2
-0
openedx/core/lib/api/tests/test_permissions.py
+4
-0
openedx/core/lib/block_structure/tests/test_block_structure.py
+3
-0
openedx/core/lib/block_structure/tests/test_cache.py
+2
-0
openedx/core/lib/block_structure/tests/test_factory.py
+2
-0
openedx/core/lib/block_structure/tests/test_manager.py
+2
-0
openedx/core/lib/block_structure/tests/test_transformer_registry.py
+2
-0
openedx/core/lib/block_structure/tests/test_transformers.py
+2
-0
openedx/core/lib/gating/tests/test_api.py
+2
-0
openedx/core/lib/tests/test_course_tab_api.py
+2
-0
openedx/core/lib/tests/test_course_tabs.py
+4
-0
openedx/core/lib/tests/test_courses.py
+2
-0
openedx/core/lib/tests/test_edx_api_utils.py
+2
-0
openedx/core/lib/tests/test_graph_traversals.py
+2
-0
openedx/core/lib/tests/test_token_utils.py
+2
-0
openedx/core/lib/tests/test_xblock_utils.py
+2
-0
scripts/generic-ci-tests.sh
+4
-1
No files found.
lms/djangoapps/discussion_api/tests/test_api.py
View file @
4660055e
...
@@ -9,6 +9,7 @@ from urllib import urlencode
...
@@ -9,6 +9,7 @@ from urllib import urlencode
import
ddt
import
ddt
import
httpretty
import
httpretty
import
mock
import
mock
from
nose.plugins.attrib
import
attr
from
pytz
import
UTC
from
pytz
import
UTC
from
django.core.exceptions
import
ValidationError
from
django.core.exceptions
import
ValidationError
...
@@ -82,6 +83,7 @@ def _discussion_disabled_course_for(user):
...
@@ -82,6 +83,7 @@ def _discussion_disabled_course_for(user):
return
course_with_disabled_forums
return
course_with_disabled_forums
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
class
GetCourseTest
(
UrlResetMixin
,
SharedModuleStoreTestCase
):
class
GetCourseTest
(
UrlResetMixin
,
SharedModuleStoreTestCase
):
...
@@ -155,6 +157,7 @@ class GetCourseTest(UrlResetMixin, SharedModuleStoreTestCase):
...
@@ -155,6 +157,7 @@ class GetCourseTest(UrlResetMixin, SharedModuleStoreTestCase):
self
.
assertEqual
(
result
[
"blackouts"
],
[])
self
.
assertEqual
(
result
[
"blackouts"
],
[])
@attr
(
'shard_2'
)
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"DISABLE_START_DATES"
:
False
})
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"DISABLE_START_DATES"
:
False
})
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
class
GetCourseTopicsTest
(
UrlResetMixin
,
ModuleStoreTestCase
):
class
GetCourseTopicsTest
(
UrlResetMixin
,
ModuleStoreTestCase
):
...
@@ -481,6 +484,7 @@ class GetCourseTopicsTest(UrlResetMixin, ModuleStoreTestCase):
...
@@ -481,6 +484,7 @@ class GetCourseTopicsTest(UrlResetMixin, ModuleStoreTestCase):
self
.
assertEqual
(
staff_actual
,
staff_expected
)
self
.
assertEqual
(
staff_actual
,
staff_expected
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
class
GetThreadListTest
(
CommentsServiceMockMixin
,
UrlResetMixin
,
SharedModuleStoreTestCase
):
class
GetThreadListTest
(
CommentsServiceMockMixin
,
UrlResetMixin
,
SharedModuleStoreTestCase
):
...
@@ -930,6 +934,7 @@ class GetThreadListTest(CommentsServiceMockMixin, UrlResetMixin, SharedModuleSto
...
@@ -930,6 +934,7 @@ class GetThreadListTest(CommentsServiceMockMixin, UrlResetMixin, SharedModuleSto
})
})
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
class
GetCommentListTest
(
CommentsServiceMockMixin
,
SharedModuleStoreTestCase
):
class
GetCommentListTest
(
CommentsServiceMockMixin
,
SharedModuleStoreTestCase
):
...
@@ -1353,6 +1358,7 @@ class GetCommentListTest(CommentsServiceMockMixin, SharedModuleStoreTestCase):
...
@@ -1353,6 +1358,7 @@ class GetCommentListTest(CommentsServiceMockMixin, SharedModuleStoreTestCase):
self
.
get_comment_list
(
thread
,
endorsed
=
True
,
page
=
2
,
page_size
=
10
)
self
.
get_comment_list
(
thread
,
endorsed
=
True
,
page
=
2
,
page_size
=
10
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@disable_signal
(
api
,
'thread_created'
)
@disable_signal
(
api
,
'thread_created'
)
@disable_signal
(
api
,
'thread_voted'
)
@disable_signal
(
api
,
'thread_voted'
)
...
@@ -1604,6 +1610,7 @@ class CreateThreadTest(
...
@@ -1604,6 +1610,7 @@ class CreateThreadTest(
create_thread
(
self
.
request
,
data
)
create_thread
(
self
.
request
,
data
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@disable_signal
(
api
,
'comment_created'
)
@disable_signal
(
api
,
'comment_created'
)
@disable_signal
(
api
,
'comment_voted'
)
@disable_signal
(
api
,
'comment_voted'
)
...
@@ -1870,6 +1877,7 @@ class CreateCommentTest(
...
@@ -1870,6 +1877,7 @@ class CreateCommentTest(
create_comment
(
self
.
request
,
data
)
create_comment
(
self
.
request
,
data
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@disable_signal
(
api
,
'thread_edited'
)
@disable_signal
(
api
,
'thread_edited'
)
@disable_signal
(
api
,
'thread_voted'
)
@disable_signal
(
api
,
'thread_voted'
)
...
@@ -2278,6 +2286,7 @@ class UpdateThreadTest(
...
@@ -2278,6 +2286,7 @@ class UpdateThreadTest(
)
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@disable_signal
(
api
,
'comment_edited'
)
@disable_signal
(
api
,
'comment_edited'
)
@disable_signal
(
api
,
'comment_voted'
)
@disable_signal
(
api
,
'comment_voted'
)
...
@@ -2681,6 +2690,7 @@ class UpdateCommentTest(
...
@@ -2681,6 +2690,7 @@ class UpdateCommentTest(
)
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@disable_signal
(
api
,
'thread_deleted'
)
@disable_signal
(
api
,
'thread_deleted'
)
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
...
@@ -2820,6 +2830,7 @@ class DeleteThreadTest(
...
@@ -2820,6 +2830,7 @@ class DeleteThreadTest(
self
.
assertTrue
(
expected_error
)
self
.
assertTrue
(
expected_error
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@disable_signal
(
api
,
'comment_deleted'
)
@disable_signal
(
api
,
'comment_deleted'
)
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
...
@@ -2978,6 +2989,7 @@ class DeleteCommentTest(
...
@@ -2978,6 +2989,7 @@ class DeleteCommentTest(
self
.
assertTrue
(
expected_error
)
self
.
assertTrue
(
expected_error
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
class
RetrieveThreadTest
(
class
RetrieveThreadTest
(
...
...
lms/djangoapps/django_comment_client/base/tests.py
View file @
4660055e
...
@@ -13,6 +13,7 @@ from django.core.urlresolvers import reverse
...
@@ -13,6 +13,7 @@ from django.core.urlresolvers import reverse
from
request_cache.middleware
import
RequestCache
from
request_cache.middleware
import
RequestCache
from
mock
import
patch
,
ANY
,
Mock
from
mock
import
patch
,
ANY
,
Mock
from
nose.tools
import
assert_true
,
assert_equal
from
nose.tools
import
assert_true
,
assert_equal
from
nose.plugins.attrib
import
attr
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.keys
import
CourseKey
from
lms.lib.comment_client
import
Thread
from
lms.lib.comment_client
import
Thread
...
@@ -48,6 +49,7 @@ class MockRequestSetupMixin(object):
...
@@ -48,6 +49,7 @@ class MockRequestSetupMixin(object):
mock_request
.
return_value
=
self
.
_create_response_mock
(
data
)
mock_request
.
return_value
=
self
.
_create_response_mock
(
data
)
@attr
(
'shard_2'
)
@patch
(
'lms.lib.comment_client.utils.requests.request'
,
autospec
=
True
)
@patch
(
'lms.lib.comment_client.utils.requests.request'
,
autospec
=
True
)
class
CreateThreadGroupIdTestCase
(
class
CreateThreadGroupIdTestCase
(
MockRequestSetupMixin
,
MockRequestSetupMixin
,
...
@@ -83,6 +85,7 @@ class CreateThreadGroupIdTestCase(
...
@@ -83,6 +85,7 @@ class CreateThreadGroupIdTestCase(
self
.
_assert_json_response_contains_group_info
(
response
)
self
.
_assert_json_response_contains_group_info
(
response
)
@attr
(
'shard_2'
)
@patch
(
'lms.lib.comment_client.utils.requests.request'
,
autospec
=
True
)
@patch
(
'lms.lib.comment_client.utils.requests.request'
,
autospec
=
True
)
@disable_signal
(
views
,
'thread_edited'
)
@disable_signal
(
views
,
'thread_edited'
)
@disable_signal
(
views
,
'thread_voted'
)
@disable_signal
(
views
,
'thread_voted'
)
...
@@ -340,6 +343,7 @@ class ViewsTestCaseMixin(object):
...
@@ -340,6 +343,7 @@ class ViewsTestCaseMixin(object):
self
.
assertEqual
(
data
[
'commentable_id'
],
'some_topic'
)
self
.
assertEqual
(
data
[
'commentable_id'
],
'some_topic'
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@patch
(
'lms.lib.comment_client.utils.requests.request'
,
autospec
=
True
)
@patch
(
'lms.lib.comment_client.utils.requests.request'
,
autospec
=
True
)
@disable_signal
(
views
,
'thread_created'
)
@disable_signal
(
views
,
'thread_created'
)
...
@@ -389,6 +393,7 @@ class ViewsQueryCountTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSet
...
@@ -389,6 +393,7 @@ class ViewsQueryCountTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSet
self
.
update_thread_helper
(
mock_request
)
self
.
update_thread_helper
(
mock_request
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@patch
(
'lms.lib.comment_client.utils.requests.request'
,
autospec
=
True
)
@patch
(
'lms.lib.comment_client.utils.requests.request'
,
autospec
=
True
)
class
ViewsTestCase
(
class
ViewsTestCase
(
...
@@ -1016,6 +1021,7 @@ class ViewsTestCase(
...
@@ -1016,6 +1021,7 @@ class ViewsTestCase(
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
@attr
(
'shard_2'
)
@patch
(
"lms.lib.comment_client.utils.requests.request"
,
autospec
=
True
)
@patch
(
"lms.lib.comment_client.utils.requests.request"
,
autospec
=
True
)
@disable_signal
(
views
,
'comment_endorsed'
)
@disable_signal
(
views
,
'comment_endorsed'
)
class
ViewPermissionsTestCase
(
UrlResetMixin
,
SharedModuleStoreTestCase
,
MockRequestSetupMixin
):
class
ViewPermissionsTestCase
(
UrlResetMixin
,
SharedModuleStoreTestCase
,
MockRequestSetupMixin
):
...
@@ -1125,6 +1131,7 @@ class ViewPermissionsTestCase(UrlResetMixin, SharedModuleStoreTestCase, MockRequ
...
@@ -1125,6 +1131,7 @@ class ViewPermissionsTestCase(UrlResetMixin, SharedModuleStoreTestCase, MockRequ
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
@attr
(
'shard_2'
)
class
CreateThreadUnicodeTestCase
(
SharedModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
class
CreateThreadUnicodeTestCase
(
SharedModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
@classmethod
@classmethod
...
@@ -1160,6 +1167,7 @@ class CreateThreadUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, M
...
@@ -1160,6 +1167,7 @@ class CreateThreadUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, M
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"title"
],
text
)
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"title"
],
text
)
@attr
(
'shard_2'
)
@disable_signal
(
views
,
'thread_edited'
)
@disable_signal
(
views
,
'thread_edited'
)
class
UpdateThreadUnicodeTestCase
(
SharedModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
class
UpdateThreadUnicodeTestCase
(
SharedModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
...
@@ -1197,6 +1205,7 @@ class UpdateThreadUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, M
...
@@ -1197,6 +1205,7 @@ class UpdateThreadUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, M
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"commentable_id"
],
"test_commentable"
)
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"commentable_id"
],
"test_commentable"
)
@attr
(
'shard_2'
)
@disable_signal
(
views
,
'comment_created'
)
@disable_signal
(
views
,
'comment_created'
)
class
CreateCommentUnicodeTestCase
(
SharedModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
class
CreateCommentUnicodeTestCase
(
SharedModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
...
@@ -1239,6 +1248,7 @@ class CreateCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin,
...
@@ -1239,6 +1248,7 @@ class CreateCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin,
del
Thread
.
commentable_id
del
Thread
.
commentable_id
@attr
(
'shard_2'
)
@disable_signal
(
views
,
'comment_edited'
)
@disable_signal
(
views
,
'comment_edited'
)
class
UpdateCommentUnicodeTestCase
(
SharedModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
class
UpdateCommentUnicodeTestCase
(
SharedModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
...
@@ -1272,6 +1282,7 @@ class UpdateCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin,
...
@@ -1272,6 +1282,7 @@ class UpdateCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin,
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"body"
],
text
)
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"body"
],
text
)
@attr
(
'shard_2'
)
@disable_signal
(
views
,
'comment_created'
)
@disable_signal
(
views
,
'comment_created'
)
class
CreateSubCommentUnicodeTestCase
(
SharedModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
class
CreateSubCommentUnicodeTestCase
(
SharedModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
"""
"""
...
@@ -1318,6 +1329,7 @@ class CreateSubCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixi
...
@@ -1318,6 +1329,7 @@ class CreateSubCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixi
del
Thread
.
commentable_id
del
Thread
.
commentable_id
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@patch
(
"lms.lib.comment_client.utils.requests.request"
,
autospec
=
True
)
@patch
(
"lms.lib.comment_client.utils.requests.request"
,
autospec
=
True
)
@disable_signal
(
views
,
'thread_voted'
)
@disable_signal
(
views
,
'thread_voted'
)
...
@@ -1589,6 +1601,7 @@ class TeamsPermissionsTestCase(UrlResetMixin, SharedModuleStoreTestCase, MockReq
...
@@ -1589,6 +1601,7 @@ class TeamsPermissionsTestCase(UrlResetMixin, SharedModuleStoreTestCase, MockReq
TEAM_COMMENTABLE_ID
=
'test-team-discussion'
TEAM_COMMENTABLE_ID
=
'test-team-discussion'
@attr
(
'shard_2'
)
@disable_signal
(
views
,
'comment_created'
)
@disable_signal
(
views
,
'comment_created'
)
@ddt.ddt
@ddt.ddt
class
ForumEventTestCase
(
SharedModuleStoreTestCase
,
MockRequestSetupMixin
):
class
ForumEventTestCase
(
SharedModuleStoreTestCase
,
MockRequestSetupMixin
):
...
@@ -1774,6 +1787,7 @@ class ForumEventTestCase(SharedModuleStoreTestCase, MockRequestSetupMixin):
...
@@ -1774,6 +1787,7 @@ class ForumEventTestCase(SharedModuleStoreTestCase, MockRequestSetupMixin):
self
.
assertEqual
(
event
[
'vote_value'
],
'up'
)
self
.
assertEqual
(
event
[
'vote_value'
],
'up'
)
@attr
(
'shard_2'
)
class
UsersEndpointTestCase
(
SharedModuleStoreTestCase
,
MockRequestSetupMixin
):
class
UsersEndpointTestCase
(
SharedModuleStoreTestCase
,
MockRequestSetupMixin
):
@classmethod
@classmethod
...
...
lms/djangoapps/mobile_api/users/tests.py
View file @
4660055e
...
@@ -5,6 +5,7 @@ Tests for users API
...
@@ -5,6 +5,7 @@ Tests for users API
import
datetime
import
datetime
import
ddt
import
ddt
from
mock
import
patch
from
mock
import
patch
from
nose.plugins.attrib
import
attr
import
pytz
import
pytz
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -34,6 +35,7 @@ from ..testutils import MobileAPITestCase, MobileAuthTestMixin, MobileAuthUserTe
...
@@ -34,6 +35,7 @@ from ..testutils import MobileAPITestCase, MobileAuthTestMixin, MobileAuthUserTe
from
.serializers
import
CourseEnrollmentSerializer
from
.serializers
import
CourseEnrollmentSerializer
@attr
(
'shard_2'
)
class
TestUserDetailApi
(
MobileAPITestCase
,
MobileAuthUserTestMixin
):
class
TestUserDetailApi
(
MobileAPITestCase
,
MobileAuthUserTestMixin
):
"""
"""
Tests for /api/mobile/v0.5/users/<user_name>...
Tests for /api/mobile/v0.5/users/<user_name>...
...
@@ -48,6 +50,7 @@ class TestUserDetailApi(MobileAPITestCase, MobileAuthUserTestMixin):
...
@@ -48,6 +50,7 @@ class TestUserDetailApi(MobileAPITestCase, MobileAuthUserTestMixin):
self
.
assertEqual
(
response
.
data
[
'email'
],
self
.
user
.
email
)
self
.
assertEqual
(
response
.
data
[
'email'
],
self
.
user
.
email
)
@attr
(
'shard_2'
)
class
TestUserInfoApi
(
MobileAPITestCase
,
MobileAuthTestMixin
):
class
TestUserInfoApi
(
MobileAPITestCase
,
MobileAuthTestMixin
):
"""
"""
Tests for /api/mobile/v0.5/my_user_info
Tests for /api/mobile/v0.5/my_user_info
...
@@ -63,6 +66,7 @@ class TestUserInfoApi(MobileAPITestCase, MobileAuthTestMixin):
...
@@ -63,6 +66,7 @@ class TestUserInfoApi(MobileAPITestCase, MobileAuthTestMixin):
self
.
assertTrue
(
self
.
username
in
response
[
'location'
])
self
.
assertTrue
(
self
.
username
in
response
[
'location'
])
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestUserEnrollmentApi
(
UrlResetMixin
,
MobileAPITestCase
,
MobileAuthUserTestMixin
,
class
TestUserEnrollmentApi
(
UrlResetMixin
,
MobileAPITestCase
,
MobileAuthUserTestMixin
,
MobileCourseAccessTestMixin
,
MilestonesTestCaseMixin
):
MobileCourseAccessTestMixin
,
MilestonesTestCaseMixin
):
...
@@ -262,6 +266,7 @@ class TestUserEnrollmentApi(UrlResetMixin, MobileAPITestCase, MobileAuthUserTest
...
@@ -262,6 +266,7 @@ class TestUserEnrollmentApi(UrlResetMixin, MobileAPITestCase, MobileAuthUserTest
self
.
assertIn
(
'/api/discussion/v1/courses/{}'
.
format
(
self
.
course
.
id
),
response_discussion_url
)
self
.
assertIn
(
'/api/discussion/v1/courses/{}'
.
format
(
self
.
course
.
id
),
response_discussion_url
)
@attr
(
'shard_2'
)
class
CourseStatusAPITestCase
(
MobileAPITestCase
):
class
CourseStatusAPITestCase
(
MobileAPITestCase
):
"""
"""
Base test class for /api/mobile/v0.5/users/<user_name>/course_status_info/{course_id}
Base test class for /api/mobile/v0.5/users/<user_name>/course_status_info/{course_id}
...
@@ -296,6 +301,7 @@ class CourseStatusAPITestCase(MobileAPITestCase):
...
@@ -296,6 +301,7 @@ class CourseStatusAPITestCase(MobileAPITestCase):
)
)
@attr
(
'shard_2'
)
class
TestCourseStatusGET
(
CourseStatusAPITestCase
,
MobileAuthUserTestMixin
,
class
TestCourseStatusGET
(
CourseStatusAPITestCase
,
MobileAuthUserTestMixin
,
MobileCourseAccessTestMixin
,
MilestonesTestCaseMixin
):
MobileCourseAccessTestMixin
,
MilestonesTestCaseMixin
):
"""
"""
...
@@ -315,6 +321,7 @@ class TestCourseStatusGET(CourseStatusAPITestCase, MobileAuthUserTestMixin,
...
@@ -315,6 +321,7 @@ class TestCourseStatusGET(CourseStatusAPITestCase, MobileAuthUserTestMixin,
)
)
@attr
(
'shard_2'
)
class
TestCourseStatusPATCH
(
CourseStatusAPITestCase
,
MobileAuthUserTestMixin
,
class
TestCourseStatusPATCH
(
CourseStatusAPITestCase
,
MobileAuthUserTestMixin
,
MobileCourseAccessTestMixin
,
MilestonesTestCaseMixin
):
MobileCourseAccessTestMixin
,
MilestonesTestCaseMixin
):
"""
"""
...
@@ -418,6 +425,7 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin,
...
@@ -418,6 +425,7 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin,
)
)
@attr
(
'shard_2'
)
class
TestCourseEnrollmentSerializer
(
MobileAPITestCase
):
class
TestCourseEnrollmentSerializer
(
MobileAPITestCase
):
"""
"""
Test the course enrollment serializer
Test the course enrollment serializer
...
...
lms/djangoapps/mobile_api/video_outlines/tests.py
View file @
4660055e
...
@@ -5,6 +5,7 @@ Tests for video outline API
...
@@ -5,6 +5,7 @@ Tests for video outline API
import
ddt
import
ddt
import
itertools
import
itertools
from
nose.plugins.attrib
import
attr
from
uuid
import
uuid4
from
uuid
import
uuid4
from
collections
import
namedtuple
from
collections
import
namedtuple
...
@@ -199,6 +200,7 @@ class TestVideoAPIMixin(object):
...
@@ -199,6 +200,7 @@ class TestVideoAPIMixin(object):
return
sub_block_a
,
sub_block_b
return
sub_block_a
,
sub_block_b
@attr
(
'shard_2'
)
class
TestNonStandardCourseStructure
(
MobileAPITestCase
,
TestVideoAPIMixin
):
class
TestNonStandardCourseStructure
(
MobileAPITestCase
,
TestVideoAPIMixin
):
"""
"""
Tests /api/mobile/v0.5/video_outlines/courses/{course_id} with no course set
Tests /api/mobile/v0.5/video_outlines/courses/{course_id} with no course set
...
@@ -408,6 +410,7 @@ class TestNonStandardCourseStructure(MobileAPITestCase, TestVideoAPIMixin):
...
@@ -408,6 +410,7 @@ class TestNonStandardCourseStructure(MobileAPITestCase, TestVideoAPIMixin):
)
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestVideoSummaryList
(
TestVideoAPITestCase
,
MobileAuthTestMixin
,
MobileCourseAccessTestMixin
,
class
TestVideoSummaryList
(
TestVideoAPITestCase
,
MobileAuthTestMixin
,
MobileCourseAccessTestMixin
,
TestVideoAPIMixin
,
MilestonesTestCaseMixin
):
TestVideoAPIMixin
,
MilestonesTestCaseMixin
):
...
@@ -864,6 +867,7 @@ class TestVideoSummaryList(TestVideoAPITestCase, MobileAuthTestMixin, MobileCour
...
@@ -864,6 +867,7 @@ class TestVideoSummaryList(TestVideoAPITestCase, MobileAuthTestMixin, MobileCour
)
)
@attr
(
'shard_2'
)
class
TestTranscriptsDetail
(
TestVideoAPITestCase
,
MobileAuthTestMixin
,
MobileCourseAccessTestMixin
,
class
TestTranscriptsDetail
(
TestVideoAPITestCase
,
MobileAuthTestMixin
,
MobileCourseAccessTestMixin
,
TestVideoAPIMixin
,
MilestonesTestCaseMixin
):
TestVideoAPIMixin
,
MilestonesTestCaseMixin
):
"""
"""
...
...
lms/djangoapps/verify_student/tests/test_views.py
View file @
4660055e
...
@@ -11,6 +11,7 @@ from uuid import uuid4
...
@@ -11,6 +11,7 @@ from uuid import uuid4
import
ddt
import
ddt
import
httpretty
import
httpretty
import
mock
import
mock
from
nose.plugins.attrib
import
attr
import
boto
import
boto
import
moto
import
moto
import
pytz
import
pytz
...
@@ -67,7 +68,12 @@ render_mock = Mock(side_effect=mock_render_to_response)
...
@@ -67,7 +68,12 @@ render_mock = Mock(side_effect=mock_render_to_response)
PAYMENT_DATA_KEYS
=
{
'payment_processor_name'
,
'payment_page_url'
,
'payment_form_data'
}
PAYMENT_DATA_KEYS
=
{
'payment_processor_name'
,
'payment_page_url'
,
'payment_form_data'
}
@attr
(
'shard_2'
)
class
StartView
(
TestCase
):
class
StartView
(
TestCase
):
"""
This view is for the first time student is
attempting a Photo Verification.
"""
def
start_url
(
self
,
course_id
=
""
):
def
start_url
(
self
,
course_id
=
""
):
return
"/verify_student/{0}"
.
format
(
urllib
.
quote
(
course_id
))
return
"/verify_student/{0}"
.
format
(
urllib
.
quote
(
course_id
))
...
@@ -83,6 +89,7 @@ class StartView(TestCase):
...
@@ -83,6 +89,7 @@ class StartView(TestCase):
self
.
assertHttpForbidden
(
self
.
client
.
get
(
self
.
start_url
()))
self
.
assertHttpForbidden
(
self
.
client
.
get
(
self
.
start_url
()))
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestPayAndVerifyView
(
UrlResetMixin
,
ModuleStoreTestCase
,
XssTestMixin
):
class
TestPayAndVerifyView
(
UrlResetMixin
,
ModuleStoreTestCase
,
XssTestMixin
):
"""
"""
...
@@ -1173,6 +1180,7 @@ class CheckoutTestMixin(object):
...
@@ -1173,6 +1180,7 @@ class CheckoutTestMixin(object):
self
.
assertEqual
(
data
,
{
'foo'
:
'bar'
})
self
.
assertEqual
(
data
,
{
'foo'
:
'bar'
})
@attr
(
'shard_2'
)
@patch
(
'lms.djangoapps.verify_student.views.checkout_with_shoppingcart'
,
return_value
=
TEST_PAYMENT_DATA
,
autospec
=
True
)
@patch
(
'lms.djangoapps.verify_student.views.checkout_with_shoppingcart'
,
return_value
=
TEST_PAYMENT_DATA
,
autospec
=
True
)
class
TestCreateOrderShoppingCart
(
CheckoutTestMixin
,
ModuleStoreTestCase
):
class
TestCreateOrderShoppingCart
(
CheckoutTestMixin
,
ModuleStoreTestCase
):
""" Test view behavior when the shoppingcart is used. """
""" Test view behavior when the shoppingcart is used. """
...
@@ -1186,6 +1194,7 @@ class TestCreateOrderShoppingCart(CheckoutTestMixin, ModuleStoreTestCase):
...
@@ -1186,6 +1194,7 @@ class TestCreateOrderShoppingCart(CheckoutTestMixin, ModuleStoreTestCase):
return
dict
(
zip
((
'request'
,
'user'
,
'course_key'
,
'course_mode'
,
'amount'
),
patched_create_order
.
call_args
[
0
]))
return
dict
(
zip
((
'request'
,
'user'
,
'course_key'
,
'course_mode'
,
'amount'
),
patched_create_order
.
call_args
[
0
]))
@attr
(
'shard_2'
)
@override_settings
(
ECOMMERCE_API_URL
=
TEST_API_URL
,
ECOMMERCE_API_SIGNING_KEY
=
TEST_API_SIGNING_KEY
)
@override_settings
(
ECOMMERCE_API_URL
=
TEST_API_URL
,
ECOMMERCE_API_SIGNING_KEY
=
TEST_API_SIGNING_KEY
)
@patch
(
@patch
(
'lms.djangoapps.verify_student.views.checkout_with_ecommerce_service'
,
'lms.djangoapps.verify_student.views.checkout_with_ecommerce_service'
,
...
@@ -1204,6 +1213,7 @@ class TestCreateOrderEcommerceService(CheckoutTestMixin, ModuleStoreTestCase):
...
@@ -1204,6 +1213,7 @@ class TestCreateOrderEcommerceService(CheckoutTestMixin, ModuleStoreTestCase):
return
dict
(
zip
((
'user'
,
'course_key'
,
'course_mode'
,
'processor'
),
patched_create_order
.
call_args
[
0
]))
return
dict
(
zip
((
'user'
,
'course_key'
,
'course_mode'
,
'processor'
),
patched_create_order
.
call_args
[
0
]))
@attr
(
'shard_2'
)
class
TestCheckoutWithEcommerceService
(
ModuleStoreTestCase
):
class
TestCheckoutWithEcommerceService
(
ModuleStoreTestCase
):
"""
"""
Ensures correct behavior in the function `checkout_with_ecommerce_service`.
Ensures correct behavior in the function `checkout_with_ecommerce_service`.
...
@@ -1249,6 +1259,7 @@ class TestCheckoutWithEcommerceService(ModuleStoreTestCase):
...
@@ -1249,6 +1259,7 @@ class TestCheckoutWithEcommerceService(ModuleStoreTestCase):
self
.
assertEqual
(
actual_payment_data
,
expected_payment_data
)
self
.
assertEqual
(
actual_payment_data
,
expected_payment_data
)
@attr
(
'shard_2'
)
class
TestCreateOrderView
(
ModuleStoreTestCase
):
class
TestCreateOrderView
(
ModuleStoreTestCase
):
"""
"""
Tests for the create_order view of verified course enrollment process.
Tests for the create_order view of verified course enrollment process.
...
@@ -1352,6 +1363,7 @@ class TestCreateOrderView(ModuleStoreTestCase):
...
@@ -1352,6 +1363,7 @@ class TestCreateOrderView(ModuleStoreTestCase):
return
response
return
response
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
class
TestSubmitPhotosForVerification
(
TestCase
):
class
TestSubmitPhotosForVerification
(
TestCase
):
...
@@ -1593,6 +1605,7 @@ class TestSubmitPhotosForVerification(TestCase):
...
@@ -1593,6 +1605,7 @@ class TestSubmitPhotosForVerification(TestCase):
return
json
.
loads
(
last_request
.
body
)
return
json
.
loads
(
last_request
.
body
)
@attr
(
'shard_2'
)
class
TestPhotoVerificationResultsCallback
(
ModuleStoreTestCase
):
class
TestPhotoVerificationResultsCallback
(
ModuleStoreTestCase
):
"""
"""
Tests for the results_callback view.
Tests for the results_callback view.
...
@@ -1954,6 +1967,7 @@ class TestPhotoVerificationResultsCallback(ModuleStoreTestCase):
...
@@ -1954,6 +1967,7 @@ class TestPhotoVerificationResultsCallback(ModuleStoreTestCase):
VerificationStatus
.
add_verification_status
(
checkpoint
,
self
.
user
,
"submitted"
)
VerificationStatus
.
add_verification_status
(
checkpoint
,
self
.
user
,
"submitted"
)
@attr
(
'shard_2'
)
class
TestReverifyView
(
TestCase
):
class
TestReverifyView
(
TestCase
):
"""
"""
Tests for the reverification view.
Tests for the reverification view.
...
@@ -2048,6 +2062,7 @@ class TestReverifyView(TestCase):
...
@@ -2048,6 +2062,7 @@ class TestReverifyView(TestCase):
self
.
assertContains
(
response
,
"reverify-blocked"
)
self
.
assertContains
(
response
,
"reverify-blocked"
)
@attr
(
'shard_2'
)
class
TestInCourseReverifyView
(
ModuleStoreTestCase
):
class
TestInCourseReverifyView
(
ModuleStoreTestCase
):
"""
"""
Tests for the incourse reverification views.
Tests for the incourse reverification views.
...
@@ -2247,6 +2262,7 @@ class TestInCourseReverifyView(ModuleStoreTestCase):
...
@@ -2247,6 +2262,7 @@ class TestInCourseReverifyView(ModuleStoreTestCase):
return
self
.
client
.
post
(
url
,
data
)
return
self
.
client
.
post
(
url
,
data
)
@attr
(
'shard_2'
)
class
TestEmailMessageWithCustomICRVBlock
(
ModuleStoreTestCase
):
class
TestEmailMessageWithCustomICRVBlock
(
ModuleStoreTestCase
):
"""
"""
Test email sending on re-verification
Test email sending on re-verification
...
@@ -2451,6 +2467,7 @@ class TestEmailMessageWithCustomICRVBlock(ModuleStoreTestCase):
...
@@ -2451,6 +2467,7 @@ class TestEmailMessageWithCustomICRVBlock(ModuleStoreTestCase):
)
)
@attr
(
'shard_2'
)
class
TestEmailMessageWithDefaultICRVBlock
(
ModuleStoreTestCase
):
class
TestEmailMessageWithDefaultICRVBlock
(
ModuleStoreTestCase
):
"""
"""
Test for In-course Re-verification
Test for In-course Re-verification
...
...
openedx/core/djangoapps/bookmarks/tests/test_api.py
View file @
4660055e
...
@@ -3,6 +3,7 @@ Tests for bookmarks api.
...
@@ -3,6 +3,7 @@ Tests for bookmarks api.
"""
"""
import
ddt
import
ddt
from
mock
import
patch
from
mock
import
patch
from
nose.plugins.attrib
import
attr
from
unittest
import
skipUnless
from
unittest
import
skipUnless
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -35,6 +36,7 @@ class BookmarkApiEventTestMixin(object):
...
@@ -35,6 +36,7 @@ class BookmarkApiEventTestMixin(object):
self
.
assertFalse
(
mock_tracker
.
called
)
# pylint: disable=maybe-no-member
self
.
assertFalse
(
mock_tracker
.
called
)
# pylint: disable=maybe-no-member
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
class
BookmarksAPITests
(
BookmarkApiEventTestMixin
,
BookmarksTestsBase
):
class
BookmarksAPITests
(
BookmarkApiEventTestMixin
,
BookmarksTestsBase
):
...
...
openedx/core/djangoapps/bookmarks/tests/test_models.py
View file @
4660055e
...
@@ -6,6 +6,7 @@ import datetime
...
@@ -6,6 +6,7 @@ import datetime
import
ddt
import
ddt
from
freezegun
import
freeze_time
from
freezegun
import
freeze_time
import
mock
import
mock
from
nose.plugins.attrib
import
attr
import
pytz
import
pytz
from
unittest
import
skipUnless
from
unittest
import
skipUnless
...
@@ -223,6 +224,7 @@ class BookmarksTestsBase(ModuleStoreTestCase):
...
@@ -223,6 +224,7 @@ class BookmarksTestsBase(ModuleStoreTestCase):
self
.
assertEqual
(
bookmark_data
[
'path'
],
bookmark
.
path
)
self
.
assertEqual
(
bookmark_data
[
'path'
],
bookmark
.
path
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
class
BookmarkModelTests
(
BookmarksTestsBase
):
class
BookmarkModelTests
(
BookmarksTestsBase
):
...
@@ -407,6 +409,7 @@ class BookmarkModelTests(BookmarksTestsBase):
...
@@ -407,6 +409,7 @@ class BookmarkModelTests(BookmarksTestsBase):
self
.
assertEqual
(
bookmark
.
path
,
[])
self
.
assertEqual
(
bookmark
.
path
,
[])
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
XBlockCacheModelTest
(
ModuleStoreTestCase
):
class
XBlockCacheModelTest
(
ModuleStoreTestCase
):
"""
"""
...
...
openedx/core/djangoapps/bookmarks/tests/test_services.py
View file @
4660055e
"""
"""
Tests for bookmark services.
Tests for bookmark services.
"""
"""
from
nose.plugins.attrib
import
attr
from
unittest
import
skipUnless
from
unittest
import
skipUnless
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -11,6 +12,7 @@ from ..services import BookmarksService
...
@@ -11,6 +12,7 @@ from ..services import BookmarksService
from
.test_models
import
BookmarksTestsBase
from
.test_models
import
BookmarksTestsBase
@attr
(
'shard_2'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
class
BookmarksServiceTests
(
BookmarksTestsBase
):
class
BookmarksServiceTests
(
BookmarksTestsBase
):
"""
"""
...
...
openedx/core/djangoapps/bookmarks/tests/test_tasks.py
View file @
4660055e
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
Tests for tasks.
Tests for tasks.
"""
"""
import
ddt
import
ddt
from
nose.plugins.attrib
import
attr
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.tests.factories
import
check_mongo_calls
,
ItemFactory
from
xmodule.modulestore.tests.factories
import
check_mongo_calls
,
ItemFactory
...
@@ -11,6 +12,7 @@ from ..tasks import _calculate_course_xblocks_data, _update_xblocks_cache
...
@@ -11,6 +12,7 @@ from ..tasks import _calculate_course_xblocks_data, _update_xblocks_cache
from
.test_models
import
BookmarksTestsBase
from
.test_models
import
BookmarksTestsBase
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
XBlockCacheTaskTests
(
BookmarksTestsBase
):
class
XBlockCacheTaskTests
(
BookmarksTestsBase
):
"""
"""
...
...
openedx/core/djangoapps/bookmarks/tests/test_views.py
View file @
4660055e
...
@@ -4,6 +4,7 @@ Tests for bookmark views.
...
@@ -4,6 +4,7 @@ Tests for bookmark views.
import
ddt
import
ddt
import
json
import
json
from
nose.plugins.attrib
import
attr
from
unittest
import
skipUnless
from
unittest
import
skipUnless
import
urllib
import
urllib
...
@@ -63,6 +64,7 @@ class BookmarksViewsTestsBase(BookmarksTestsBase, BookmarkApiEventTestMixin):
...
@@ -63,6 +64,7 @@ class BookmarksViewsTestsBase(BookmarksTestsBase, BookmarkApiEventTestMixin):
return
response
return
response
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
class
BookmarksListViewTests
(
BookmarksViewsTestsBase
):
class
BookmarksListViewTests
(
BookmarksViewsTestsBase
):
...
@@ -367,6 +369,7 @@ class BookmarksListViewTests(BookmarksViewsTestsBase):
...
@@ -367,6 +369,7 @@ class BookmarksListViewTests(BookmarksViewsTestsBase):
)
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
class
BookmarksDetailViewTests
(
BookmarksViewsTestsBase
):
class
BookmarksDetailViewTests
(
BookmarksViewsTestsBase
):
...
...
openedx/core/djangoapps/ccxcon/tests/test_signals.py
View file @
4660055e
...
@@ -3,12 +3,14 @@ Test for contentstore signals receiver
...
@@ -3,12 +3,14 @@ Test for contentstore signals receiver
"""
"""
import
mock
import
mock
from
nose.plugins.attrib
import
attr
from
django.test
import
TestCase
from
django.test
import
TestCase
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.keys
import
CourseKey
from
xmodule.modulestore.django
import
modulestore
,
SignalHandler
from
xmodule.modulestore.django
import
modulestore
,
SignalHandler
@attr
(
'shard_2'
)
class
CCXConSignalTestCase
(
TestCase
):
class
CCXConSignalTestCase
(
TestCase
):
"""
"""
The only tests currently implemented are for verifying that
The only tests currently implemented are for verifying that
...
...
openedx/core/djangoapps/ccxcon/tests/test_tasks.py
View file @
4660055e
...
@@ -3,6 +3,7 @@ Tests for the CCXCon celery tasks
...
@@ -3,6 +3,7 @@ Tests for the CCXCon celery tasks
"""
"""
import
mock
import
mock
from
nose.plugins.attrib
import
attr
from
django.test
import
TestCase
from
django.test
import
TestCase
...
@@ -10,6 +11,7 @@ from opaque_keys.edx.keys import CourseKey
...
@@ -10,6 +11,7 @@ from opaque_keys.edx.keys import CourseKey
from
openedx.core.djangoapps.ccxcon
import
api
,
tasks
from
openedx.core.djangoapps.ccxcon
import
api
,
tasks
@attr
(
'shard_2'
)
class
CCXConTaskTestCase
(
TestCase
):
class
CCXConTaskTestCase
(
TestCase
):
"""
"""
Tests for CCXCon tasks.
Tests for CCXCon tasks.
...
...
openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_generate_course_overview.py
View file @
4660055e
# pylint: disable=missing-docstring
# pylint: disable=missing-docstring
from
django.core.management.base
import
CommandError
from
django.core.management.base
import
CommandError
from
mock
import
patch
from
mock
import
patch
from
nose.plugins.attrib
import
attr
from
openedx.core.djangoapps.content.course_overviews.management.commands
import
generate_course_overview
from
openedx.core.djangoapps.content.course_overviews.management.commands
import
generate_course_overview
from
openedx.core.djangoapps.content.course_overviews.models
import
CourseOverview
from
openedx.core.djangoapps.content.course_overviews.models
import
CourseOverview
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
@attr
(
'shard_2'
)
class
TestGenerateCourseOverview
(
ModuleStoreTestCase
):
class
TestGenerateCourseOverview
(
ModuleStoreTestCase
):
"""
"""
Tests course overview management command.
Tests course overview management command.
...
...
openedx/core/djangoapps/content/course_structures/tests.py
View file @
4660055e
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
Course Structure Content sub-application test cases
Course Structure Content sub-application test cases
"""
"""
import
json
import
json
from
nose.plugins.attrib
import
attr
from
xmodule_django.models
import
UsageKey
from
xmodule_django.models
import
UsageKey
from
xmodule.modulestore.django
import
SignalHandler
from
xmodule.modulestore.django
import
SignalHandler
...
@@ -22,6 +23,7 @@ class SignalDisconnectTestMixin(object):
...
@@ -22,6 +23,7 @@ class SignalDisconnectTestMixin(object):
SignalHandler
.
course_published
.
disconnect
(
listen_for_course_publish
)
SignalHandler
.
course_published
.
disconnect
(
listen_for_course_publish
)
@attr
(
'shard_2'
)
class
CourseStructureTaskTests
(
ModuleStoreTestCase
):
class
CourseStructureTaskTests
(
ModuleStoreTestCase
):
"""
"""
Test cases covering Course Structure task-related workflows
Test cases covering Course Structure task-related workflows
...
...
openedx/core/djangoapps/course_groups/management/commands/tests/test_post_cohort_membership_fix.py
View file @
4660055e
...
@@ -3,6 +3,7 @@ Test for the post-migration fix commands that are included with this djangoapp
...
@@ -3,6 +3,7 @@ Test for the post-migration fix commands that are included with this djangoapp
"""
"""
from
django.core.management
import
call_command
from
django.core.management
import
call_command
from
django.test.client
import
RequestFactory
from
django.test.client
import
RequestFactory
from
nose.plugins.attrib
import
attr
from
openedx.core.djangoapps.course_groups.views
import
cohort_handler
from
openedx.core.djangoapps.course_groups.views
import
cohort_handler
from
openedx.core.djangoapps.course_groups.cohorts
import
get_cohort_by_name
from
openedx.core.djangoapps.course_groups.cohorts
import
get_cohort_by_name
...
@@ -13,6 +14,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
...
@@ -13,6 +14,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
@attr
(
'shard_2'
)
class
TestPostMigrationFix
(
ModuleStoreTestCase
):
class
TestPostMigrationFix
(
ModuleStoreTestCase
):
"""
"""
Base class for testing post-migration fix commands
Base class for testing post-migration fix commands
...
...
openedx/core/djangoapps/course_groups/tests/test_cohorts.py
View file @
4660055e
...
@@ -4,6 +4,7 @@ Tests for cohorts
...
@@ -4,6 +4,7 @@ Tests for cohorts
# pylint: disable=no-member
# pylint: disable=no-member
import
ddt
import
ddt
from
mock
import
call
,
patch
from
mock
import
call
,
patch
from
nose.plugins.attrib
import
attr
import
before_after
import
before_after
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
...
@@ -25,6 +26,7 @@ from ..tests.helpers import (
...
@@ -25,6 +26,7 @@ from ..tests.helpers import (
)
)
@attr
(
'shard_2'
)
@patch
(
"openedx.core.djangoapps.course_groups.cohorts.tracker"
,
autospec
=
True
)
@patch
(
"openedx.core.djangoapps.course_groups.cohorts.tracker"
,
autospec
=
True
)
class
TestCohortSignals
(
TestCase
):
class
TestCohortSignals
(
TestCase
):
"""
"""
...
@@ -130,6 +132,7 @@ class TestCohortSignals(TestCase):
...
@@ -130,6 +132,7 @@ class TestCohortSignals(TestCase):
self
.
assertFalse
(
mock_tracker
.
emit
.
called
)
self
.
assertFalse
(
mock_tracker
.
emit
.
called
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestCohorts
(
ModuleStoreTestCase
):
class
TestCohorts
(
ModuleStoreTestCase
):
"""
"""
...
@@ -723,6 +726,7 @@ class TestCohorts(ModuleStoreTestCase):
...
@@ -723,6 +726,7 @@ class TestCohorts(ModuleStoreTestCase):
)
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestCohortsAndPartitionGroups
(
ModuleStoreTestCase
):
class
TestCohortsAndPartitionGroups
(
ModuleStoreTestCase
):
"""
"""
...
...
openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py
View file @
4660055e
...
@@ -7,6 +7,7 @@ import json
...
@@ -7,6 +7,7 @@ import json
from
django.conf
import
settings
from
django.conf
import
settings
import
django.test
import
django.test
from
mock
import
patch
from
mock
import
patch
from
nose.plugins.attrib
import
attr
from
unittest
import
skipUnless
from
unittest
import
skipUnless
from
courseware.masquerade
import
handle_ajax
,
setup_masquerade
from
courseware.masquerade
import
handle_ajax
,
setup_masquerade
...
@@ -25,6 +26,7 @@ from ..cohorts import add_user_to_cohort, remove_user_from_cohort, get_course_co
...
@@ -25,6 +26,7 @@ from ..cohorts import add_user_to_cohort, remove_user_from_cohort, get_course_co
from
.helpers
import
CohortFactory
,
config_course_cohorts
from
.helpers
import
CohortFactory
,
config_course_cohorts
@attr
(
'shard_2'
)
class
TestCohortPartitionScheme
(
ModuleStoreTestCase
):
class
TestCohortPartitionScheme
(
ModuleStoreTestCase
):
"""
"""
Test the logic for linking a user to a partition group based on their cohort.
Test the logic for linking a user to a partition group based on their cohort.
...
@@ -258,6 +260,7 @@ class TestCohortPartitionScheme(ModuleStoreTestCase):
...
@@ -258,6 +260,7 @@ class TestCohortPartitionScheme(ModuleStoreTestCase):
self
.
assertRegexpMatches
(
mock_log
.
warn
.
call_args
[
0
][
0
],
'partition mismatch'
)
self
.
assertRegexpMatches
(
mock_log
.
warn
.
call_args
[
0
][
0
],
'partition mismatch'
)
@attr
(
'shard_2'
)
class
TestExtension
(
django
.
test
.
TestCase
):
class
TestExtension
(
django
.
test
.
TestCase
):
"""
"""
Ensure that the scheme extension is correctly plugged in (via entry point
Ensure that the scheme extension is correctly plugged in (via entry point
...
@@ -270,6 +273,7 @@ class TestExtension(django.test.TestCase):
...
@@ -270,6 +273,7 @@ class TestExtension(django.test.TestCase):
UserPartition
.
get_scheme
(
'other'
)
UserPartition
.
get_scheme
(
'other'
)
@attr
(
'shard_2'
)
class
TestGetCohortedUserPartition
(
ModuleStoreTestCase
):
class
TestGetCohortedUserPartition
(
ModuleStoreTestCase
):
"""
"""
Test that `get_cohorted_user_partition` returns the first user_partition with scheme `CohortPartitionScheme`.
Test that `get_cohorted_user_partition` returns the first user_partition with scheme `CohortPartitionScheme`.
...
@@ -327,6 +331,7 @@ class TestGetCohortedUserPartition(ModuleStoreTestCase):
...
@@ -327,6 +331,7 @@ class TestGetCohortedUserPartition(ModuleStoreTestCase):
self
.
assertIsNone
(
get_cohorted_user_partition
(
self
.
course
))
self
.
assertIsNone
(
get_cohorted_user_partition
(
self
.
course
))
@attr
(
'shard_2'
)
class
TestMasqueradedGroup
(
StaffMasqueradeTestCase
):
class
TestMasqueradedGroup
(
StaffMasqueradeTestCase
):
"""
"""
Check for staff being able to masquerade as belonging to a group.
Check for staff being able to masquerade as belonging to a group.
...
...
openedx/core/djangoapps/course_groups/tests/test_views.py
View file @
4660055e
...
@@ -7,6 +7,7 @@ import json
...
@@ -7,6 +7,7 @@ import json
from
collections
import
namedtuple
from
collections
import
namedtuple
from
datetime
import
datetime
from
datetime
import
datetime
from
nose.plugins.attrib
import
attr
from
unittest
import
skipUnless
from
unittest
import
skipUnless
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -35,6 +36,7 @@ from .helpers import (
...
@@ -35,6 +36,7 @@ from .helpers import (
)
)
@attr
(
'shard_2'
)
class
CohortViewsTestCase
(
ModuleStoreTestCase
):
class
CohortViewsTestCase
(
ModuleStoreTestCase
):
"""
"""
Base class which sets up a course and staff/non-staff users.
Base class which sets up a course and staff/non-staff users.
...
@@ -174,6 +176,7 @@ class CohortViewsTestCase(ModuleStoreTestCase):
...
@@ -174,6 +176,7 @@ class CohortViewsTestCase(ModuleStoreTestCase):
return
json
.
loads
(
response
.
content
)
return
json
.
loads
(
response
.
content
)
@attr
(
'shard_2'
)
class
CourseCohortSettingsHandlerTestCase
(
CohortViewsTestCase
):
class
CourseCohortSettingsHandlerTestCase
(
CohortViewsTestCase
):
"""
"""
Tests the `course_cohort_settings_handler` view.
Tests the `course_cohort_settings_handler` view.
...
@@ -323,6 +326,7 @@ class CourseCohortSettingsHandlerTestCase(CohortViewsTestCase):
...
@@ -323,6 +326,7 @@ class CourseCohortSettingsHandlerTestCase(CohortViewsTestCase):
)
)
@attr
(
'shard_2'
)
class
CohortHandlerTestCase
(
CohortViewsTestCase
):
class
CohortHandlerTestCase
(
CohortViewsTestCase
):
"""
"""
Tests the `cohort_handler` view.
Tests the `cohort_handler` view.
...
@@ -675,6 +679,7 @@ class CohortHandlerTestCase(CohortViewsTestCase):
...
@@ -675,6 +679,7 @@ class CohortHandlerTestCase(CohortViewsTestCase):
)
)
@attr
(
'shard_2'
)
class
UsersInCohortTestCase
(
CohortViewsTestCase
):
class
UsersInCohortTestCase
(
CohortViewsTestCase
):
"""
"""
Tests the `users_in_cohort` view.
Tests the `users_in_cohort` view.
...
@@ -807,6 +812,7 @@ class UsersInCohortTestCase(CohortViewsTestCase):
...
@@ -807,6 +812,7 @@ class UsersInCohortTestCase(CohortViewsTestCase):
self
.
request_users_in_cohort
(
cohort
,
self
.
course
,
-
1
,
should_return_bad_request
=
True
)
self
.
request_users_in_cohort
(
cohort
,
self
.
course
,
-
1
,
should_return_bad_request
=
True
)
@attr
(
'shard_2'
)
class
AddUsersToCohortTestCase
(
CohortViewsTestCase
):
class
AddUsersToCohortTestCase
(
CohortViewsTestCase
):
"""
"""
Tests the `add_users_to_cohort` view.
Tests the `add_users_to_cohort` view.
...
@@ -1105,6 +1111,7 @@ class AddUsersToCohortTestCase(CohortViewsTestCase):
...
@@ -1105,6 +1111,7 @@ class AddUsersToCohortTestCase(CohortViewsTestCase):
)
)
@attr
(
'shard_2'
)
class
RemoveUserFromCohortTestCase
(
CohortViewsTestCase
):
class
RemoveUserFromCohortTestCase
(
CohortViewsTestCase
):
"""
"""
Tests the `remove_user_from_cohort` view.
Tests the `remove_user_from_cohort` view.
...
@@ -1198,6 +1205,7 @@ class RemoveUserFromCohortTestCase(CohortViewsTestCase):
...
@@ -1198,6 +1205,7 @@ class RemoveUserFromCohortTestCase(CohortViewsTestCase):
self
.
verify_removed_user_from_cohort
(
user
.
username
,
response_dict
,
cohort
)
self
.
verify_removed_user_from_cohort
(
user
.
username
,
response_dict
,
cohort
)
@attr
(
'shard_2'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
class
CourseCohortDiscussionTopicsTestCase
(
CohortViewsTestCase
):
class
CourseCohortDiscussionTopicsTestCase
(
CohortViewsTestCase
):
"""
"""
...
...
openedx/core/djangoapps/credentials/tests/test_models.py
View file @
4660055e
...
@@ -4,11 +4,12 @@ import unittest
...
@@ -4,11 +4,12 @@ import unittest
from
django.conf
import
settings
from
django.conf
import
settings
from
django.test
import
TestCase
from
django.test
import
TestCase
from
nose.plugins.attrib
import
attr
from
openedx.core.djangoapps.credentials.tests.mixins
import
CredentialsApiConfigMixin
from
openedx.core.djangoapps.credentials.tests.mixins
import
CredentialsApiConfigMixin
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@attr
(
'shard_2'
)
class
TestCredentialsApiConfig
(
CredentialsApiConfigMixin
,
TestCase
):
class
TestCredentialsApiConfig
(
CredentialsApiConfigMixin
,
TestCase
):
"""Tests covering the CredentialsApiConfig model."""
"""Tests covering the CredentialsApiConfig model."""
def
test_url_construction
(
self
):
def
test_url_construction
(
self
):
...
...
openedx/core/djangoapps/credentials/tests/test_utils.py
View file @
4660055e
...
@@ -4,6 +4,7 @@ import unittest
...
@@ -4,6 +4,7 @@ import unittest
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.test
import
TestCase
from
django.test
import
TestCase
from
nose.plugins.attrib
import
attr
import
httpretty
import
httpretty
from
oauth2_provider.tests.factories
import
ClientFactory
from
oauth2_provider.tests.factories
import
ClientFactory
from
provider.constants
import
CONFIDENTIAL
from
provider.constants
import
CONFIDENTIAL
...
@@ -19,6 +20,7 @@ from student.tests.factories import UserFactory
...
@@ -19,6 +20,7 @@ from student.tests.factories import UserFactory
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@attr
(
'shard_2'
)
class
TestCredentialsRetrieval
(
ProgramsApiConfigMixin
,
CredentialsApiConfigMixin
,
CredentialsDataMixin
,
class
TestCredentialsRetrieval
(
ProgramsApiConfigMixin
,
CredentialsApiConfigMixin
,
CredentialsDataMixin
,
ProgramsDataMixin
,
TestCase
):
ProgramsDataMixin
,
TestCase
):
""" Tests covering the retrieval of user credentials from the Credentials
""" Tests covering the retrieval of user credentials from the Credentials
...
...
openedx/core/djangoapps/credit/tests/test_api.py
View file @
4660055e
...
@@ -9,6 +9,7 @@ from django.conf import settings
...
@@ -9,6 +9,7 @@ from django.conf import settings
from
django.core
import
mail
from
django.core
import
mail
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
django.db
import
connection
,
transaction
from
django.db
import
connection
,
transaction
from
nose.plugins.attrib
import
attr
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.keys
import
CourseKey
import
pytz
import
pytz
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
@@ -86,6 +87,7 @@ class CreditApiTestBase(ModuleStoreTestCase):
...
@@ -86,6 +87,7 @@ class CreditApiTestBase(ModuleStoreTestCase):
return
credit_course
return
credit_course
@attr
(
'shard_2'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in LMS'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in LMS'
)
@ddt.ddt
@ddt.ddt
class
CreditRequirementApiTests
(
CreditApiTestBase
):
class
CreditRequirementApiTests
(
CreditApiTestBase
):
...
@@ -550,6 +552,7 @@ class CreditRequirementApiTests(CreditApiTestBase):
...
@@ -550,6 +552,7 @@ class CreditRequirementApiTests(CreditApiTestBase):
self
.
assertEqual
(
req_status
[
0
][
"status"
],
None
)
self
.
assertEqual
(
req_status
[
0
][
"status"
],
None
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
CreditProviderIntegrationApiTests
(
CreditApiTestBase
):
class
CreditProviderIntegrationApiTests
(
CreditApiTestBase
):
"""
"""
...
...
openedx/core/djangoapps/credit/tests/test_models.py
View file @
4660055e
...
@@ -5,11 +5,13 @@ Tests for credit course models.
...
@@ -5,11 +5,13 @@ Tests for credit course models.
import
ddt
import
ddt
from
django.test
import
TestCase
from
django.test
import
TestCase
from
nose.plugins.attrib
import
attr
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.keys
import
CourseKey
from
openedx.core.djangoapps.credit.models
import
CreditCourse
,
CreditRequirement
from
openedx.core.djangoapps.credit.models
import
CreditCourse
,
CreditRequirement
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
CreditEligibilityModelTests
(
TestCase
):
class
CreditEligibilityModelTests
(
TestCase
):
"""
"""
...
...
openedx/core/djangoapps/credit/tests/test_partition.py
View file @
4660055e
...
@@ -4,6 +4,7 @@ Tests for In-Course Reverification Access Control Partition scheme
...
@@ -4,6 +4,7 @@ Tests for In-Course Reverification Access Control Partition scheme
"""
"""
import
ddt
import
ddt
from
nose.plugins.attrib
import
attr
import
unittest
import
unittest
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -21,6 +22,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
...
@@ -21,6 +22,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
ReverificationPartitionTest
(
ModuleStoreTestCase
):
class
ReverificationPartitionTest
(
ModuleStoreTestCase
):
...
...
openedx/core/djangoapps/credit/tests/test_serializers.py
View file @
4660055e
...
@@ -5,11 +5,13 @@ from __future__ import unicode_literals
...
@@ -5,11 +5,13 @@ from __future__ import unicode_literals
from
django.test
import
TestCase
from
django.test
import
TestCase
from
nose.plugins.attrib
import
attr
from
openedx.core.djangoapps.credit
import
serializers
from
openedx.core.djangoapps.credit
import
serializers
from
openedx.core.djangoapps.credit.tests.factories
import
CreditProviderFactory
,
CreditEligibilityFactory
from
openedx.core.djangoapps.credit.tests.factories
import
CreditProviderFactory
,
CreditEligibilityFactory
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
@attr
(
'shard_2'
)
class
CreditProviderSerializerTests
(
TestCase
):
class
CreditProviderSerializerTests
(
TestCase
):
""" CreditProviderSerializer tests. """
""" CreditProviderSerializer tests. """
...
@@ -30,6 +32,7 @@ class CreditProviderSerializerTests(TestCase):
...
@@ -30,6 +32,7 @@ class CreditProviderSerializerTests(TestCase):
self
.
assertDictEqual
(
serializer
.
data
,
expected
)
self
.
assertDictEqual
(
serializer
.
data
,
expected
)
@attr
(
'shard_2'
)
class
CreditEligibilitySerializerTests
(
TestCase
):
class
CreditEligibilitySerializerTests
(
TestCase
):
""" CreditEligibilitySerializer tests. """
""" CreditEligibilitySerializer tests. """
...
...
openedx/core/djangoapps/credit/tests/test_services.py
View file @
4660055e
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
Tests for the Credit xBlock service
Tests for the Credit xBlock service
"""
"""
from
nose.plugins.attrib
import
attr
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
...
@@ -12,6 +14,7 @@ from openedx.core.djangoapps.credit.api.eligibility import set_credit_requiremen
...
@@ -12,6 +14,7 @@ from openedx.core.djangoapps.credit.api.eligibility import set_credit_requiremen
from
student.models
import
CourseEnrollment
,
UserProfile
from
student.models
import
CourseEnrollment
,
UserProfile
@attr
(
'shard_2'
)
class
CreditServiceTests
(
ModuleStoreTestCase
):
class
CreditServiceTests
(
ModuleStoreTestCase
):
"""
"""
Tests for the Credit xBlock service
Tests for the Credit xBlock service
...
...
openedx/core/djangoapps/credit/tests/test_signals.py
View file @
4660055e
...
@@ -5,6 +5,7 @@ Tests for minimum grade requirement status
...
@@ -5,6 +5,7 @@ Tests for minimum grade requirement status
import
pytz
import
pytz
import
ddt
import
ddt
from
datetime
import
timedelta
,
datetime
from
datetime
import
timedelta
,
datetime
from
nose.plugins.attrib
import
attr
from
django.conf
import
settings
from
django.conf
import
settings
from
django.test.client
import
RequestFactory
from
django.test.client
import
RequestFactory
...
@@ -21,6 +22,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
...
@@ -21,6 +22,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
@attr
(
'shard_2'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in LMS'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in LMS'
)
@ddt.ddt
@ddt.ddt
class
TestMinGradedRequirementStatus
(
ModuleStoreTestCase
):
class
TestMinGradedRequirementStatus
(
ModuleStoreTestCase
):
...
...
openedx/core/djangoapps/credit/tests/test_signature.py
View file @
4660055e
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
Tests for digital signatures used to validate messages to/from credit providers.
Tests for digital signatures used to validate messages to/from credit providers.
"""
"""
from
nose.plugins.attrib
import
attr
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
...
@@ -10,6 +12,7 @@ from django.test.utils import override_settings
...
@@ -10,6 +12,7 @@ from django.test.utils import override_settings
from
openedx.core.djangoapps.credit
import
signature
from
openedx.core.djangoapps.credit
import
signature
@attr
(
'shard_2'
)
@override_settings
(
CREDIT_PROVIDER_SECRET_KEYS
=
{
@override_settings
(
CREDIT_PROVIDER_SECRET_KEYS
=
{
"asu"
:
u'abcd1234'
"asu"
:
u'abcd1234'
})
})
...
...
openedx/core/djangoapps/credit/tests/test_tasks.py
View file @
4660055e
...
@@ -3,6 +3,7 @@ Tests for credit course tasks.
...
@@ -3,6 +3,7 @@ Tests for credit course tasks.
"""
"""
import
mock
import
mock
from
nose.plugins.attrib
import
attr
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
from
pytz
import
UTC
from
pytz
import
UTC
...
@@ -17,6 +18,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, chec
...
@@ -17,6 +18,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, chec
from
edx_proctoring.api
import
create_exam
from
edx_proctoring.api
import
create_exam
@attr
(
'shard_2'
)
class
TestTaskExecution
(
ModuleStoreTestCase
):
class
TestTaskExecution
(
ModuleStoreTestCase
):
"""Set of tests to ensure that the task code will do the right thing when
"""Set of tests to ensure that the task code will do the right thing when
executed directly.
executed directly.
...
...
openedx/core/djangoapps/credit/tests/test_verification_access.py
View file @
4660055e
...
@@ -12,6 +12,7 @@ into verify_student.
...
@@ -12,6 +12,7 @@ into verify_student.
"""
"""
from
mock
import
patch
from
mock
import
patch
from
nose.plugins.attrib
import
attr
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -27,6 +28,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, chec
...
@@ -27,6 +28,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, chec
from
xmodule.partitions.partitions
import
Group
,
UserPartition
from
xmodule.partitions.partitions
import
Group
,
UserPartition
@attr
(
'shard_2'
)
class
CreateVerificationPartitionTest
(
ModuleStoreTestCase
):
class
CreateVerificationPartitionTest
(
ModuleStoreTestCase
):
"""
"""
Tests for applying verification access rules.
Tests for applying verification access rules.
...
@@ -230,6 +232,7 @@ class CreateVerificationPartitionTest(ModuleStoreTestCase):
...
@@ -230,6 +232,7 @@ class CreateVerificationPartitionTest(ModuleStoreTestCase):
return
None
return
None
@attr
(
'shard_2'
)
class
WriteOnPublishTest
(
ModuleStoreTestCase
):
class
WriteOnPublishTest
(
ModuleStoreTestCase
):
"""
"""
Verify that updates to the course descriptor's
Verify that updates to the course descriptor's
...
...
openedx/core/djangoapps/credit/tests/test_views.py
View file @
4660055e
...
@@ -7,6 +7,7 @@ Tests for credit app views.
...
@@ -7,6 +7,7 @@ Tests for credit app views.
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
datetime
import
datetime
import
json
import
json
from
nose.plugins.attrib
import
attr
import
unittest
import
unittest
import
ddt
import
ddt
...
@@ -98,6 +99,7 @@ class ReadOnlyMixin(object):
...
@@ -98,6 +99,7 @@ class ReadOnlyMixin(object):
self
.
assertEqual
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
405
)
@attr
(
'shard_2'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
CreditCourseViewSetTests
(
UserMixin
,
TestCase
):
class
CreditCourseViewSetTests
(
UserMixin
,
TestCase
):
""" Tests for the CreditCourse endpoints.
""" Tests for the CreditCourse endpoints.
...
@@ -259,6 +261,7 @@ class CreditCourseViewSetTests(UserMixin, TestCase):
...
@@ -259,6 +261,7 @@ class CreditCourseViewSetTests(UserMixin, TestCase):
self
.
assertTrue
(
credit_course
.
enabled
)
self
.
assertTrue
(
credit_course
.
enabled
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
CreditProviderViewSetTests
(
ApiTestCaseMixin
,
ReadOnlyMixin
,
AuthMixin
,
UserMixin
,
TestCase
):
class
CreditProviderViewSetTests
(
ApiTestCaseMixin
,
ReadOnlyMixin
,
AuthMixin
,
UserMixin
,
TestCase
):
...
@@ -303,6 +306,7 @@ class CreditProviderViewSetTests(ApiTestCaseMixin, ReadOnlyMixin, AuthMixin, Use
...
@@ -303,6 +306,7 @@ class CreditProviderViewSetTests(ApiTestCaseMixin, ReadOnlyMixin, AuthMixin, Use
self
.
assertEqual
(
response
.
data
,
CreditProviderSerializer
(
self
.
bayside
)
.
data
)
self
.
assertEqual
(
response
.
data
,
CreditProviderSerializer
(
self
.
bayside
)
.
data
)
@attr
(
'shard_2'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
CreditProviderRequestCreateViewTests
(
ApiTestCaseMixin
,
UserMixin
,
TestCase
):
class
CreditProviderRequestCreateViewTests
(
ApiTestCaseMixin
,
UserMixin
,
TestCase
):
""" Tests for CreditProviderRequestCreateView. """
""" Tests for CreditProviderRequestCreateView. """
...
@@ -451,6 +455,7 @@ class CreditProviderRequestCreateViewTests(ApiTestCaseMixin, UserMixin, TestCase
...
@@ -451,6 +455,7 @@ class CreditProviderRequestCreateViewTests(ApiTestCaseMixin, UserMixin, TestCase
self
.
assertEqual
(
response
.
status_code
,
400
)
self
.
assertEqual
(
response
.
status_code
,
400
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
CreditProviderCallbackViewTests
(
UserMixin
,
TestCase
):
class
CreditProviderCallbackViewTests
(
UserMixin
,
TestCase
):
...
@@ -604,6 +609,7 @@ class CreditProviderCallbackViewTests(UserMixin, TestCase):
...
@@ -604,6 +609,7 @@ class CreditProviderCallbackViewTests(UserMixin, TestCase):
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
response
.
status_code
,
403
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
CreditEligibilityViewTests
(
AuthMixin
,
UserMixin
,
ReadOnlyMixin
,
TestCase
):
class
CreditEligibilityViewTests
(
AuthMixin
,
UserMixin
,
ReadOnlyMixin
,
TestCase
):
...
...
openedx/core/djangoapps/models/tests/test_course_details.py
View file @
4660055e
...
@@ -5,6 +5,7 @@ Tests for CourseDetails
...
@@ -5,6 +5,7 @@ Tests for CourseDetails
import
datetime
import
datetime
import
ddt
import
ddt
from
django.utils.timezone
import
UTC
from
django.utils.timezone
import
UTC
from
nose.plugins.attrib
import
attr
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
@@ -14,6 +15,7 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
...
@@ -14,6 +15,7 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
from
openedx.core.djangoapps.models.course_details
import
CourseDetails
,
ABOUT_ATTRIBUTES
from
openedx.core.djangoapps.models.course_details
import
CourseDetails
,
ABOUT_ATTRIBUTES
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
CourseDetailsTestCase
(
ModuleStoreTestCase
):
class
CourseDetailsTestCase
(
ModuleStoreTestCase
):
"""
"""
...
...
openedx/core/djangoapps/profile_images/tests/test_images.py
View file @
4660055e
...
@@ -13,6 +13,7 @@ from django.test import TestCase
...
@@ -13,6 +13,7 @@ from django.test import TestCase
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
import
ddt
import
ddt
import
mock
import
mock
from
nose.plugins.attrib
import
attr
import
piexif
import
piexif
from
PIL
import
Image
from
PIL
import
Image
...
@@ -27,6 +28,7 @@ from ..images import (
...
@@ -27,6 +28,7 @@ from ..images import (
from
.helpers
import
make_image_file
,
make_uploaded_file
from
.helpers
import
make_image_file
,
make_uploaded_file
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
class
TestValidateUploadedImage
(
TestCase
):
class
TestValidateUploadedImage
(
TestCase
):
...
@@ -122,6 +124,7 @@ class TestValidateUploadedImage(TestCase):
...
@@ -122,6 +124,7 @@ class TestValidateUploadedImage(TestCase):
self
.
assertEqual
(
ctx
.
exception
.
message
,
file_upload_bad_mimetype
)
self
.
assertEqual
(
ctx
.
exception
.
message
,
file_upload_bad_mimetype
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
class
TestGenerateProfileImages
(
TestCase
):
class
TestGenerateProfileImages
(
TestCase
):
...
@@ -205,6 +208,7 @@ class TestGenerateProfileImages(TestCase):
...
@@ -205,6 +208,7 @@ class TestGenerateProfileImages(TestCase):
yield
name
,
image
yield
name
,
image
@attr
(
'shard_2'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
class
TestRemoveProfileImages
(
TestCase
):
class
TestRemoveProfileImages
(
TestCase
):
"""
"""
...
...
openedx/core/djangoapps/profile_images/tests/test_views.py
View file @
4660055e
...
@@ -3,6 +3,7 @@ Test cases for the HTTP endpoints of the profile image api.
...
@@ -3,6 +3,7 @@ Test cases for the HTTP endpoints of the profile image api.
"""
"""
from
contextlib
import
closing
from
contextlib
import
closing
import
datetime
import
datetime
from
nose.plugins.attrib
import
attr
from
pytz
import
UTC
from
pytz
import
UTC
import
unittest
import
unittest
...
@@ -151,6 +152,7 @@ class ProfileImageEndpointMixin(UserSettingsEventTestMixin):
...
@@ -151,6 +152,7 @@ class ProfileImageEndpointMixin(UserSettingsEventTestMixin):
self
.
assert_no_events_were_emitted
()
self
.
assert_no_events_were_emitted
()
@attr
(
'shard_2'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@mock.patch
(
'openedx.core.djangoapps.profile_images.views.log'
)
@mock.patch
(
'openedx.core.djangoapps.profile_images.views.log'
)
class
ProfileImageViewGeneralTestCase
(
ProfileImageEndpointMixin
,
APITestCase
):
class
ProfileImageViewGeneralTestCase
(
ProfileImageEndpointMixin
,
APITestCase
):
...
@@ -170,6 +172,7 @@ class ProfileImageViewGeneralTestCase(ProfileImageEndpointMixin, APITestCase):
...
@@ -170,6 +172,7 @@ class ProfileImageViewGeneralTestCase(ProfileImageEndpointMixin, APITestCase):
self
.
assert_no_events_were_emitted
()
self
.
assert_no_events_were_emitted
()
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@mock.patch
(
'openedx.core.djangoapps.profile_images.views.log'
)
@mock.patch
(
'openedx.core.djangoapps.profile_images.views.log'
)
...
@@ -380,6 +383,7 @@ class ProfileImageViewPostTestCase(ProfileImageEndpointMixin, APITestCase):
...
@@ -380,6 +383,7 @@ class ProfileImageViewPostTestCase(ProfileImageEndpointMixin, APITestCase):
self
.
assert_no_events_were_emitted
()
self
.
assert_no_events_were_emitted
()
@attr
(
'shard_2'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@mock.patch
(
'openedx.core.djangoapps.profile_images.views.log'
)
@mock.patch
(
'openedx.core.djangoapps.profile_images.views.log'
)
class
ProfileImageViewDeleteTestCase
(
ProfileImageEndpointMixin
,
APITestCase
):
class
ProfileImageViewDeleteTestCase
(
ProfileImageEndpointMixin
,
APITestCase
):
...
@@ -510,6 +514,7 @@ class DeprecatedProfileImageTestMixin(ProfileImageEndpointMixin):
...
@@ -510,6 +514,7 @@ class DeprecatedProfileImageTestMixin(ProfileImageEndpointMixin):
self
.
assert_no_events_were_emitted
()
self
.
assert_no_events_were_emitted
()
@attr
(
'shard_2'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@mock.patch
(
'openedx.core.djangoapps.profile_images.views.log'
)
@mock.patch
(
'openedx.core.djangoapps.profile_images.views.log'
)
class
DeprecatedProfileImageUploadTestCase
(
DeprecatedProfileImageTestMixin
,
APITestCase
):
class
DeprecatedProfileImageUploadTestCase
(
DeprecatedProfileImageTestMixin
,
APITestCase
):
...
@@ -522,6 +527,7 @@ class DeprecatedProfileImageUploadTestCase(DeprecatedProfileImageTestMixin, APIT
...
@@ -522,6 +527,7 @@ class DeprecatedProfileImageUploadTestCase(DeprecatedProfileImageTestMixin, APIT
_replacement_method
=
'openedx.core.djangoapps.profile_images.views.ProfileImageView.post'
_replacement_method
=
'openedx.core.djangoapps.profile_images.views.ProfileImageView.post'
@attr
(
'shard_2'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Profile Image API is only supported in LMS'
)
@mock.patch
(
'openedx.core.djangoapps.profile_images.views.log'
)
@mock.patch
(
'openedx.core.djangoapps.profile_images.views.log'
)
class
DeprecatedProfileImageRemoveTestCase
(
DeprecatedProfileImageTestMixin
,
APITestCase
):
class
DeprecatedProfileImageRemoveTestCase
(
DeprecatedProfileImageTestMixin
,
APITestCase
):
...
...
openedx/core/djangoapps/programs/tests/test_models.py
View file @
4660055e
...
@@ -2,11 +2,13 @@
...
@@ -2,11 +2,13 @@
import
ddt
import
ddt
from
django.test
import
TestCase
from
django.test
import
TestCase
import
mock
import
mock
from
nose.plugins.attrib
import
attr
from
openedx.core.djangoapps.programs.models
import
ProgramsApiConfig
from
openedx.core.djangoapps.programs.models
import
ProgramsApiConfig
from
openedx.core.djangoapps.programs.tests.mixins
import
ProgramsApiConfigMixin
from
openedx.core.djangoapps.programs.tests.mixins
import
ProgramsApiConfigMixin
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
# ConfigurationModels use the cache. Make every cache get a miss.
# ConfigurationModels use the cache. Make every cache get a miss.
@mock.patch
(
'config_models.models.cache.get'
,
return_value
=
None
)
@mock.patch
(
'config_models.models.cache.get'
,
return_value
=
None
)
...
...
openedx/core/djangoapps/programs/tests/test_signals.py
View file @
4660055e
...
@@ -3,6 +3,7 @@ This module contains tests for programs-related signals and signal handlers.
...
@@ -3,6 +3,7 @@ This module contains tests for programs-related signals and signal handlers.
"""
"""
from
django.test
import
TestCase
from
django.test
import
TestCase
from
nose.plugins.attrib
import
attr
import
mock
import
mock
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
...
@@ -14,6 +15,7 @@ from openedx.core.djangoapps.programs.signals import handle_course_cert_awarded
...
@@ -14,6 +15,7 @@ from openedx.core.djangoapps.programs.signals import handle_course_cert_awarded
TEST_USERNAME
=
'test-user'
TEST_USERNAME
=
'test-user'
@attr
(
'shard_2'
)
@mock.patch
(
'openedx.core.djangoapps.programs.tasks.v1.tasks.award_program_certificates.delay'
)
@mock.patch
(
'openedx.core.djangoapps.programs.tasks.v1.tasks.award_program_certificates.delay'
)
@mock.patch
(
@mock.patch
(
'openedx.core.djangoapps.programs.models.ProgramsApiConfig.is_certification_enabled'
,
'openedx.core.djangoapps.programs.models.ProgramsApiConfig.is_certification_enabled'
,
...
...
openedx/core/djangoapps/programs/tests/test_utils.py
View file @
4660055e
...
@@ -6,6 +6,7 @@ from django.core.cache import cache
...
@@ -6,6 +6,7 @@ from django.core.cache import cache
from
django.test
import
TestCase
from
django.test
import
TestCase
import
httpretty
import
httpretty
import
mock
import
mock
from
nose.plugins.attrib
import
attr
from
oauth2_provider.tests.factories
import
ClientFactory
from
oauth2_provider.tests.factories
import
ClientFactory
from
provider.constants
import
CONFIDENTIAL
from
provider.constants
import
CONFIDENTIAL
...
@@ -19,6 +20,7 @@ from student.tests.factories import UserFactory
...
@@ -19,6 +20,7 @@ from student.tests.factories import UserFactory
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@attr
(
'shard_2'
)
class
TestProgramRetrieval
(
ProgramsApiConfigMixin
,
ProgramsDataMixin
,
class
TestProgramRetrieval
(
ProgramsApiConfigMixin
,
ProgramsDataMixin
,
CredentialsApiConfigMixin
,
TestCase
):
CredentialsApiConfigMixin
,
TestCase
):
"""Tests covering the retrieval of programs from the Programs service."""
"""Tests covering the retrieval of programs from the Programs service."""
...
...
openedx/core/djangoapps/safe_sessions/tests/test_middleware.py
View file @
4660055e
...
@@ -12,6 +12,7 @@ from django.test import TestCase
...
@@ -12,6 +12,7 @@ from django.test import TestCase
from
django.test.client
import
RequestFactory
from
django.test.client
import
RequestFactory
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
mock
import
patch
from
mock
import
patch
from
nose.plugins.attrib
import
attr
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
...
@@ -30,6 +31,7 @@ def create_mock_request():
...
@@ -30,6 +31,7 @@ def create_mock_request():
return
request
return
request
@attr
(
'shard_2'
)
class
TestSafeSessionProcessRequest
(
TestSafeSessionsLogMixin
,
TestCase
):
class
TestSafeSessionProcessRequest
(
TestSafeSessionsLogMixin
,
TestCase
):
"""
"""
Test class for SafeSessionMiddleware.process_request
Test class for SafeSessionMiddleware.process_request
...
@@ -130,6 +132,7 @@ class TestSafeSessionProcessRequest(TestSafeSessionsLogMixin, TestCase):
...
@@ -130,6 +132,7 @@ class TestSafeSessionProcessRequest(TestSafeSessionsLogMixin, TestCase):
self
.
assert_user_in_session
()
self
.
assert_user_in_session
()
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestSafeSessionProcessResponse
(
TestSafeSessionsLogMixin
,
TestCase
):
class
TestSafeSessionProcessResponse
(
TestSafeSessionsLogMixin
,
TestCase
):
"""
"""
...
@@ -232,6 +235,7 @@ class TestSafeSessionProcessResponse(TestSafeSessionsLogMixin, TestCase):
...
@@ -232,6 +235,7 @@ class TestSafeSessionProcessResponse(TestSafeSessionsLogMixin, TestCase):
self
.
assert_response_with_delete_cookie
()
self
.
assert_response_with_delete_cookie
()
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestSafeSessionMiddleware
(
TestSafeSessionsLogMixin
,
TestCase
):
class
TestSafeSessionMiddleware
(
TestSafeSessionsLogMixin
,
TestCase
):
"""
"""
...
...
openedx/core/djangoapps/safe_sessions/tests/test_safe_cookie_data.py
View file @
4660055e
...
@@ -7,12 +7,14 @@ import ddt
...
@@ -7,12 +7,14 @@ import ddt
from
django.test
import
TestCase
from
django.test
import
TestCase
import
itertools
import
itertools
from
mock
import
patch
from
mock
import
patch
from
nose.plugins.attrib
import
attr
from
time
import
time
from
time
import
time
from
..middleware
import
SafeCookieData
,
SafeCookieError
from
..middleware
import
SafeCookieData
,
SafeCookieError
from
.test_utils
import
TestSafeSessionsLogMixin
from
.test_utils
import
TestSafeSessionsLogMixin
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestSafeCookieData
(
TestSafeSessionsLogMixin
,
TestCase
):
class
TestSafeCookieData
(
TestSafeSessionsLogMixin
,
TestCase
):
"""
"""
...
...
openedx/core/djangoapps/user_api/accounts/tests/test_api.py
View file @
4660055e
...
@@ -9,6 +9,7 @@ from dateutil.parser import parse as parse_datetime
...
@@ -9,6 +9,7 @@ from dateutil.parser import parse as parse_datetime
from
mock
import
Mock
,
patch
from
mock
import
Mock
,
patch
from
django.test
import
TestCase
from
django.test
import
TestCase
from
nose.plugins.attrib
import
attr
from
nose.tools
import
raises
from
nose.tools
import
raises
import
unittest
import
unittest
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
...
@@ -33,6 +34,7 @@ def mock_render_to_string(template_name, context):
...
@@ -33,6 +34,7 @@ def mock_render_to_string(template_name, context):
return
str
((
template_name
,
sorted
(
context
.
iteritems
())))
return
str
((
template_name
,
sorted
(
context
.
iteritems
())))
@attr
(
'shard_2'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Account APIs are only supported in LMS'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Account APIs are only supported in LMS'
)
class
TestAccountApi
(
UserSettingsEventTestMixin
,
TestCase
):
class
TestAccountApi
(
UserSettingsEventTestMixin
,
TestCase
):
"""
"""
...
@@ -230,6 +232,7 @@ class TestAccountApi(UserSettingsEventTestMixin, TestCase):
...
@@ -230,6 +232,7 @@ class TestAccountApi(UserSettingsEventTestMixin, TestCase):
verify_event_emitted
([],
[{
"code"
:
"en"
},
{
"code"
:
"fr"
}])
verify_event_emitted
([],
[{
"code"
:
"en"
},
{
"code"
:
"fr"
}])
@attr
(
'shard_2'
)
@patch
(
'openedx.core.djangoapps.user_api.accounts.image_helpers._PROFILE_IMAGE_SIZES'
,
[
50
,
10
])
@patch
(
'openedx.core.djangoapps.user_api.accounts.image_helpers._PROFILE_IMAGE_SIZES'
,
[
50
,
10
])
@patch.dict
(
@patch.dict
(
'openedx.core.djangoapps.user_api.accounts.image_helpers.PROFILE_IMAGE_SIZES_MAP'
,
'openedx.core.djangoapps.user_api.accounts.image_helpers.PROFILE_IMAGE_SIZES_MAP'
,
...
@@ -282,6 +285,7 @@ class AccountSettingsOnCreationTest(TestCase):
...
@@ -282,6 +285,7 @@ class AccountSettingsOnCreationTest(TestCase):
})
})
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
AccountCreationActivationAndPasswordChangeTest
(
TestCase
):
class
AccountCreationActivationAndPasswordChangeTest
(
TestCase
):
"""
"""
...
...
openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py
View file @
4660055e
...
@@ -4,6 +4,7 @@ Tests for helpers.py
...
@@ -4,6 +4,7 @@ Tests for helpers.py
import
datetime
import
datetime
import
hashlib
import
hashlib
from
mock
import
patch
from
mock
import
patch
from
nose.plugins.attrib
import
attr
from
pytz
import
UTC
from
pytz
import
UTC
from
unittest
import
skipUnless
from
unittest
import
skipUnless
...
@@ -17,6 +18,7 @@ TEST_SIZES = {'full': 50, 'small': 10}
...
@@ -17,6 +18,7 @@ TEST_SIZES = {'full': 50, 'small': 10}
TEST_PROFILE_IMAGE_UPLOAD_DT
=
datetime
.
datetime
(
2002
,
1
,
9
,
15
,
43
,
01
,
tzinfo
=
UTC
)
TEST_PROFILE_IMAGE_UPLOAD_DT
=
datetime
.
datetime
(
2002
,
1
,
9
,
15
,
43
,
01
,
tzinfo
=
UTC
)
@attr
(
'shard_2'
)
@patch.dict
(
'openedx.core.djangoapps.user_api.accounts.image_helpers.PROFILE_IMAGE_SIZES_MAP'
,
TEST_SIZES
,
clear
=
True
)
@patch.dict
(
'openedx.core.djangoapps.user_api.accounts.image_helpers.PROFILE_IMAGE_SIZES_MAP'
,
TEST_SIZES
,
clear
=
True
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
ProfileImageUrlTestCase
(
TestCase
):
class
ProfileImageUrlTestCase
(
TestCase
):
...
...
openedx/core/djangoapps/user_api/accounts/tests/test_views.py
View file @
4660055e
...
@@ -9,6 +9,7 @@ import ddt
...
@@ -9,6 +9,7 @@ import ddt
import
hashlib
import
hashlib
import
json
import
json
from
mock
import
patch
from
mock
import
patch
from
nose.plugins.attrib
import
attr
from
pytz
import
UTC
from
pytz
import
UTC
import
unittest
import
unittest
...
@@ -118,6 +119,7 @@ class UserAPITestCase(APITestCase):
...
@@ -118,6 +119,7 @@ class UserAPITestCase(APITestCase):
{
'full'
:
50
,
'small'
:
10
},
{
'full'
:
50
,
'small'
:
10
},
clear
=
True
clear
=
True
)
)
@attr
(
'shard_2'
)
class
TestAccountAPI
(
UserAPITestCase
):
class
TestAccountAPI
(
UserAPITestCase
):
"""
"""
Unit tests for the Account API.
Unit tests for the Account API.
...
@@ -717,6 +719,7 @@ class TestAccountAPI(UserAPITestCase):
...
@@ -717,6 +719,7 @@ class TestAccountAPI(UserAPITestCase):
)
)
@attr
(
'shard_2'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
TestAccountAPITransactions
(
TransactionTestCase
):
class
TestAccountAPITransactions
(
TransactionTestCase
):
"""
"""
...
...
openedx/core/djangoapps/user_api/course_tag/tests/test_api.py
View file @
4660055e
...
@@ -4,10 +4,12 @@ Test the user course tag API.
...
@@ -4,10 +4,12 @@ Test the user course tag API.
from
django.test
import
TestCase
from
django.test
import
TestCase
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
from
nose.plugins.attrib
import
attr
from
openedx.core.djangoapps.user_api.course_tag
import
api
as
course_tag_api
from
openedx.core.djangoapps.user_api.course_tag
import
api
as
course_tag_api
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
@attr
(
'shard_2'
)
class
TestCourseTagAPI
(
TestCase
):
class
TestCourseTagAPI
(
TestCase
):
"""
"""
Test the user service
Test the user service
...
...
openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py
View file @
4660055e
...
@@ -5,6 +5,7 @@ import tempfile
...
@@ -5,6 +5,7 @@ import tempfile
import
shutil
import
shutil
import
csv
import
csv
from
collections
import
defaultdict
from
collections
import
defaultdict
from
nose.plugins.attrib
import
attr
from
unittest
import
skipUnless
from
unittest
import
skipUnless
import
ddt
import
ddt
...
@@ -21,6 +22,7 @@ from openedx.core.djangoapps.user_api.models import UserOrgTag
...
@@ -21,6 +22,7 @@ from openedx.core.djangoapps.user_api.models import UserOrgTag
from
openedx.core.djangoapps.user_api.management.commands
import
email_opt_in_list
from
openedx.core.djangoapps.user_api.management.commands
import
email_opt_in_list
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
EmailOptInListTest
(
ModuleStoreTestCase
):
class
EmailOptInListTest
(
ModuleStoreTestCase
):
...
...
openedx/core/djangoapps/user_api/preferences/tests/test_api.py
View file @
4660055e
...
@@ -6,6 +6,7 @@ import datetime
...
@@ -6,6 +6,7 @@ import datetime
import
ddt
import
ddt
import
unittest
import
unittest
from
mock
import
patch
from
mock
import
patch
from
nose.plugins.attrib
import
attr
from
pytz
import
UTC
from
pytz
import
UTC
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -28,6 +29,7 @@ from ...preferences.api import (
...
@@ -28,6 +29,7 @@ from ...preferences.api import (
)
)
@attr
(
'shard_2'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Account APIs are only supported in LMS'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Account APIs are only supported in LMS'
)
class
TestPreferenceAPI
(
TestCase
):
class
TestPreferenceAPI
(
TestCase
):
"""
"""
...
@@ -319,6 +321,7 @@ class TestPreferenceAPI(TestCase):
...
@@ -319,6 +321,7 @@ class TestPreferenceAPI(TestCase):
)
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
UpdateEmailOptInTests
(
ModuleStoreTestCase
):
class
UpdateEmailOptInTests
(
ModuleStoreTestCase
):
"""
"""
...
...
openedx/core/djangolib/tests/test_js_utils.py
View file @
4660055e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
Tests for js_utils.py
Tests for js_utils.py
"""
"""
import
json
import
json
from
nose.plugins.attrib
import
attr
from
unittest
import
TestCase
from
unittest
import
TestCase
import
HTMLParser
import
HTMLParser
...
@@ -13,6 +14,7 @@ from openedx.core.djangolib.js_utils import (
...
@@ -13,6 +14,7 @@ from openedx.core.djangolib.js_utils import (
)
)
@attr
(
'shard_2'
)
class
TestJSUtils
(
TestCase
):
class
TestJSUtils
(
TestCase
):
"""
"""
Test JS utils
Test JS utils
...
...
openedx/core/djangolib/tests/test_markup.py
View file @
4660055e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
Tests for openedx.core.djangolib.markup
Tests for openedx.core.djangolib.markup
"""
"""
from
nose.plugins.attrib
import
attr
import
unittest
import
unittest
import
ddt
import
ddt
...
@@ -12,6 +13,7 @@ from mako.template import Template
...
@@ -12,6 +13,7 @@ from mako.template import Template
from
openedx.core.djangolib.markup
import
Text
,
HTML
from
openedx.core.djangolib.markup
import
Text
,
HTML
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
FormatHtmlTest
(
unittest
.
TestCase
):
class
FormatHtmlTest
(
unittest
.
TestCase
):
"""Test that we can format plain strings and HTML into them properly."""
"""Test that we can format plain strings and HTML into them properly."""
...
...
openedx/core/lib/api/tests/test_authentication.py
View file @
4660055e
...
@@ -18,6 +18,7 @@ from django.test import TestCase
...
@@ -18,6 +18,7 @@ from django.test import TestCase
from
django.utils
import
unittest
from
django.utils
import
unittest
from
django.utils.http
import
urlencode
from
django.utils.http
import
urlencode
from
mock
import
patch
from
mock
import
patch
from
nose.plugins.attrib
import
attr
from
rest_framework
import
exceptions
from
rest_framework
import
exceptions
from
rest_framework
import
status
from
rest_framework
import
status
from
rest_framework.permissions
import
IsAuthenticated
from
rest_framework.permissions
import
IsAuthenticated
...
@@ -75,6 +76,7 @@ urlpatterns = patterns(
...
@@ -75,6 +76,7 @@ urlpatterns = patterns(
)
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
OAuth2Tests
(
TestCase
):
class
OAuth2Tests
(
TestCase
):
"""OAuth 2.0 authentication"""
"""OAuth 2.0 authentication"""
...
@@ -292,6 +294,7 @@ class OAuth2Tests(TestCase):
...
@@ -292,6 +294,7 @@ class OAuth2Tests(TestCase):
self
.
assertEqual
(
response
.
status_code
,
scope_statuses
.
write_status
)
self
.
assertEqual
(
response
.
status_code
,
scope_statuses
.
write_status
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
TestJWTAuthToggle
(
JwtMixin
,
TestCase
):
class
TestJWTAuthToggle
(
JwtMixin
,
TestCase
):
...
...
openedx/core/lib/api/tests/test_exceptions.py
View file @
4660055e
...
@@ -3,11 +3,13 @@ Test Custom Exceptions
...
@@ -3,11 +3,13 @@ Test Custom Exceptions
"""
"""
import
ddt
import
ddt
from
django.test
import
TestCase
from
django.test
import
TestCase
from
nose.plugins.attrib
import
attr
from
rest_framework
import
exceptions
as
drf_exceptions
from
rest_framework
import
exceptions
as
drf_exceptions
from
..
import
exceptions
from
..
import
exceptions
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestDictExceptionsAllowDictDetails
(
TestCase
):
class
TestDictExceptionsAllowDictDetails
(
TestCase
):
"""
"""
...
@@ -44,6 +46,7 @@ class TestDictExceptionsAllowDictDetails(TestCase):
...
@@ -44,6 +46,7 @@ class TestDictExceptionsAllowDictDetails(TestCase):
self
.
assertEqual
(
exc
.
available_renderers
,
[
'application/json'
])
self
.
assertEqual
(
exc
.
available_renderers
,
[
'application/json'
])
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestDictExceptionSubclassing
(
TestCase
):
class
TestDictExceptionSubclassing
(
TestCase
):
"""
"""
...
...
openedx/core/lib/api/tests/test_paginators.py
View file @
4660055e
...
@@ -4,6 +4,7 @@ from collections import namedtuple
...
@@ -4,6 +4,7 @@ from collections import namedtuple
import
ddt
import
ddt
from
mock
import
Mock
,
MagicMock
from
mock
import
Mock
,
MagicMock
from
nose.plugins.attrib
import
attr
from
unittest
import
TestCase
from
unittest
import
TestCase
from
django.http
import
Http404
from
django.http
import
Http404
from
django.test
import
RequestFactory
from
django.test
import
RequestFactory
...
@@ -12,6 +13,7 @@ from rest_framework import serializers
...
@@ -12,6 +13,7 @@ from rest_framework import serializers
from
openedx.core.lib.api.paginators
import
NamespacedPageNumberPagination
,
paginate_search_results
from
openedx.core.lib.api.paginators
import
NamespacedPageNumberPagination
,
paginate_search_results
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
PaginateSearchResultsTestCase
(
TestCase
):
class
PaginateSearchResultsTestCase
(
TestCase
):
"""Test cases for paginate_search_results method"""
"""Test cases for paginate_search_results method"""
...
@@ -122,6 +124,7 @@ class PaginateSearchResultsTestCase(TestCase):
...
@@ -122,6 +124,7 @@ class PaginateSearchResultsTestCase(TestCase):
paginate_search_results
(
self
.
mock_model
,
self
.
search_results
,
self
.
default_size
,
page_num
)
paginate_search_results
(
self
.
mock_model
,
self
.
search_results
,
self
.
default_size
,
page_num
)
@attr
(
'shard_2'
)
class
NamespacedPaginationTestCase
(
TestCase
):
class
NamespacedPaginationTestCase
(
TestCase
):
"""
"""
Test behavior of `NamespacedPageNumberPagination`
Test behavior of `NamespacedPageNumberPagination`
...
...
openedx/core/lib/api/tests/test_parsers.py
View file @
4660055e
...
@@ -3,6 +3,7 @@ TestCases verifying proper behavior of custom DRF request parsers.
...
@@ -3,6 +3,7 @@ TestCases verifying proper behavior of custom DRF request parsers.
"""
"""
from
collections
import
namedtuple
from
collections
import
namedtuple
from
nose.plugins.attrib
import
attr
from
io
import
BytesIO
from
io
import
BytesIO
from
rest_framework
import
exceptions
from
rest_framework
import
exceptions
...
@@ -11,6 +12,7 @@ from rest_framework.test import APITestCase, APIRequestFactory
...
@@ -11,6 +12,7 @@ from rest_framework.test import APITestCase, APIRequestFactory
from
openedx.core.lib.api
import
parsers
from
openedx.core.lib.api
import
parsers
@attr
(
'shard_2'
)
class
TestTypedFileUploadParser
(
APITestCase
):
class
TestTypedFileUploadParser
(
APITestCase
):
"""
"""
Tests that verify the behavior of TypedFileUploadParser
Tests that verify the behavior of TypedFileUploadParser
...
...
openedx/core/lib/api/tests/test_permissions.py
View file @
4660055e
...
@@ -4,6 +4,7 @@ import ddt
...
@@ -4,6 +4,7 @@ import ddt
from
django.contrib.auth.models
import
AnonymousUser
from
django.contrib.auth.models
import
AnonymousUser
from
django.http
import
Http404
from
django.http
import
Http404
from
django.test
import
TestCase
,
RequestFactory
from
django.test
import
TestCase
,
RequestFactory
from
nose.plugins.attrib
import
attr
from
student.roles
import
CourseStaffRole
,
CourseInstructorRole
from
student.roles
import
CourseStaffRole
,
CourseInstructorRole
from
openedx.core.lib.api.permissions
import
(
from
openedx.core.lib.api.permissions
import
(
...
@@ -29,6 +30,7 @@ class TestCcxObject(TestObject):
...
@@ -29,6 +30,7 @@ class TestCcxObject(TestObject):
self
.
coach
=
user
self
.
coach
=
user
@attr
(
'shard_2'
)
class
IsCourseStaffInstructorTests
(
TestCase
):
class
IsCourseStaffInstructorTests
(
TestCase
):
""" Test for IsCourseStaffInstructor permission class. """
""" Test for IsCourseStaffInstructor permission class. """
...
@@ -62,6 +64,7 @@ class IsCourseStaffInstructorTests(TestCase):
...
@@ -62,6 +64,7 @@ class IsCourseStaffInstructorTests(TestCase):
self
.
assertFalse
(
self
.
permission
.
has_object_permission
(
self
.
request
,
None
,
self
.
obj
))
self
.
assertFalse
(
self
.
permission
.
has_object_permission
(
self
.
request
,
None
,
self
.
obj
))
@attr
(
'shard_2'
)
class
IsMasterCourseStaffInstructorTests
(
TestCase
):
class
IsMasterCourseStaffInstructorTests
(
TestCase
):
""" Test for IsMasterCourseStaffInstructorTests permission class. """
""" Test for IsMasterCourseStaffInstructorTests permission class. """
...
@@ -106,6 +109,7 @@ class IsMasterCourseStaffInstructorTests(TestCase):
...
@@ -106,6 +109,7 @@ class IsMasterCourseStaffInstructorTests(TestCase):
self
.
permission
.
has_permission
(
post_request
,
None
)
self
.
permission
.
has_permission
(
post_request
,
None
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
IsStaffOrOwnerTests
(
TestCase
):
class
IsStaffOrOwnerTests
(
TestCase
):
""" Tests for IsStaffOrOwner permission class. """
""" Tests for IsStaffOrOwner permission class. """
...
...
openedx/core/lib/block_structure/tests/test_block_structure.py
View file @
4660055e
...
@@ -6,6 +6,7 @@ from collections import namedtuple
...
@@ -6,6 +6,7 @@ from collections import namedtuple
from
copy
import
deepcopy
from
copy
import
deepcopy
import
ddt
import
ddt
import
itertools
import
itertools
from
nose.plugins.attrib
import
attr
from
unittest
import
TestCase
from
unittest
import
TestCase
from
openedx.core.lib.graph_traversals
import
traverse_post_order
from
openedx.core.lib.graph_traversals
import
traverse_post_order
...
@@ -15,6 +16,7 @@ from ..exceptions import TransformerException
...
@@ -15,6 +16,7 @@ from ..exceptions import TransformerException
from
.helpers
import
MockXBlock
,
MockTransformer
,
ChildrenMapTestMixin
from
.helpers
import
MockXBlock
,
MockTransformer
,
ChildrenMapTestMixin
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestBlockStructure
(
TestCase
,
ChildrenMapTestMixin
):
class
TestBlockStructure
(
TestCase
,
ChildrenMapTestMixin
):
"""
"""
...
@@ -43,6 +45,7 @@ class TestBlockStructure(TestCase, ChildrenMapTestMixin):
...
@@ -43,6 +45,7 @@ class TestBlockStructure(TestCase, ChildrenMapTestMixin):
self
.
assertNotIn
(
len
(
children_map
)
+
1
,
block_structure
)
self
.
assertNotIn
(
len
(
children_map
)
+
1
,
block_structure
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestBlockStructureData
(
TestCase
,
ChildrenMapTestMixin
):
class
TestBlockStructureData
(
TestCase
,
ChildrenMapTestMixin
):
"""
"""
...
...
openedx/core/lib/block_structure/tests/test_cache.py
View file @
4660055e
"""
"""
Tests for block_structure/cache.py
Tests for block_structure/cache.py
"""
"""
from
nose.plugins.attrib
import
attr
from
unittest
import
TestCase
from
unittest
import
TestCase
from
..cache
import
BlockStructureCache
from
..cache
import
BlockStructureCache
from
.helpers
import
ChildrenMapTestMixin
,
MockCache
,
MockTransformer
from
.helpers
import
ChildrenMapTestMixin
,
MockCache
,
MockTransformer
@attr
(
'shard_2'
)
class
TestBlockStructureCache
(
ChildrenMapTestMixin
,
TestCase
):
class
TestBlockStructureCache
(
ChildrenMapTestMixin
,
TestCase
):
"""
"""
Tests for BlockStructureFactory
Tests for BlockStructureFactory
...
...
openedx/core/lib/block_structure/tests/test_factory.py
View file @
4660055e
"""
"""
Tests for block_structure_factory.py
Tests for block_structure_factory.py
"""
"""
from
nose.plugins.attrib
import
attr
from
unittest
import
TestCase
from
unittest
import
TestCase
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
...
@@ -11,6 +12,7 @@ from .helpers import (
...
@@ -11,6 +12,7 @@ from .helpers import (
)
)
@attr
(
'shard_2'
)
class
TestBlockStructureFactory
(
TestCase
,
ChildrenMapTestMixin
):
class
TestBlockStructureFactory
(
TestCase
,
ChildrenMapTestMixin
):
"""
"""
Tests for BlockStructureFactory
Tests for BlockStructureFactory
...
...
openedx/core/lib/block_structure/tests/test_manager.py
View file @
4660055e
"""
"""
Tests for manager.py
Tests for manager.py
"""
"""
from
nose.plugins.attrib
import
attr
from
unittest
import
TestCase
from
unittest
import
TestCase
from
..exceptions
import
UsageKeyNotInBlockStructure
from
..exceptions
import
UsageKeyNotInBlockStructure
...
@@ -83,6 +84,7 @@ class TestTransformer1(MockTransformer):
...
@@ -83,6 +84,7 @@ class TestTransformer1(MockTransformer):
return
data_key
+
't1.val1.'
+
unicode
(
block_key
)
return
data_key
+
't1.val1.'
+
unicode
(
block_key
)
@attr
(
'shard_2'
)
class
TestBlockStructureManager
(
TestCase
,
ChildrenMapTestMixin
):
class
TestBlockStructureManager
(
TestCase
,
ChildrenMapTestMixin
):
"""
"""
Test class for BlockStructureManager.
Test class for BlockStructureManager.
...
...
openedx/core/lib/block_structure/tests/test_transformer_registry.py
View file @
4660055e
...
@@ -3,6 +3,7 @@ Tests for transformer_registry.py
...
@@ -3,6 +3,7 @@ Tests for transformer_registry.py
"""
"""
import
ddt
import
ddt
from
nose.plugins.attrib
import
attr
from
unittest
import
TestCase
from
unittest
import
TestCase
from
..transformer_registry
import
TransformerRegistry
from
..transformer_registry
import
TransformerRegistry
...
@@ -30,6 +31,7 @@ class UnregisteredTestTransformer3(MockTransformer):
...
@@ -30,6 +31,7 @@ class UnregisteredTestTransformer3(MockTransformer):
pass
pass
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TransformerRegistryTestCase
(
TestCase
):
class
TransformerRegistryTestCase
(
TestCase
):
"""
"""
...
...
openedx/core/lib/block_structure/tests/test_transformers.py
View file @
4660055e
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
Tests for transformers.py
Tests for transformers.py
"""
"""
from
mock
import
MagicMock
,
patch
from
mock
import
MagicMock
,
patch
from
nose.plugins.attrib
import
attr
from
unittest
import
TestCase
from
unittest
import
TestCase
from
..block_structure
import
BlockStructureModulestoreData
from
..block_structure
import
BlockStructureModulestoreData
...
@@ -12,6 +13,7 @@ from .helpers import (
...
@@ -12,6 +13,7 @@ from .helpers import (
)
)
@attr
(
'shard_2'
)
class
TestBlockStructureTransformers
(
ChildrenMapTestMixin
,
TestCase
):
class
TestBlockStructureTransformers
(
ChildrenMapTestMixin
,
TestCase
):
"""
"""
Test class for testing BlockStructureTransformers
Test class for testing BlockStructureTransformers
...
...
openedx/core/lib/gating/tests/test_api.py
View file @
4660055e
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
Tests for the gating API
Tests for the gating API
"""
"""
from
mock
import
patch
,
MagicMock
from
mock
import
patch
,
MagicMock
from
nose.plugins.attrib
import
attr
from
ddt
import
ddt
,
data
from
ddt
import
ddt
,
data
from
milestones.tests.utils
import
MilestonesTestCaseMixin
from
milestones.tests.utils
import
MilestonesTestCaseMixin
from
milestones
import
api
as
milestones_api
from
milestones
import
api
as
milestones_api
...
@@ -11,6 +12,7 @@ from openedx.core.lib.gating import api as gating_api
...
@@ -11,6 +12,7 @@ from openedx.core.lib.gating import api as gating_api
from
openedx.core.lib.gating.exceptions
import
GatingValidationError
from
openedx.core.lib.gating.exceptions
import
GatingValidationError
@attr
(
'shard_2'
)
@ddt
@ddt
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'MILESTONES_APP'
:
True
})
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'MILESTONES_APP'
:
True
})
class
TestGatingApi
(
ModuleStoreTestCase
,
MilestonesTestCaseMixin
):
class
TestGatingApi
(
ModuleStoreTestCase
,
MilestonesTestCaseMixin
):
...
...
openedx/core/lib/tests/test_course_tab_api.py
View file @
4660055e
...
@@ -3,11 +3,13 @@ Tests for the plugin API
...
@@ -3,11 +3,13 @@ Tests for the plugin API
"""
"""
from
django.test
import
TestCase
from
django.test
import
TestCase
from
nose.plugins.attrib
import
attr
from
openedx.core.lib.api.plugins
import
PluginError
from
openedx.core.lib.api.plugins
import
PluginError
from
openedx.core.lib.course_tabs
import
CourseTabPluginManager
from
openedx.core.lib.course_tabs
import
CourseTabPluginManager
@attr
(
'shard_2'
)
class
TestPluginApi
(
TestCase
):
class
TestPluginApi
(
TestCase
):
"""
"""
Unit tests for the plugin API
Unit tests for the plugin API
...
...
openedx/core/lib/tests/test_course_tabs.py
View file @
4660055e
""" Tests of specific tabs. """
""" Tests of specific tabs. """
from
mock
import
patch
,
Mock
from
mock
import
patch
,
Mock
from
nose.plugins.attrib
import
attr
from
unittest
import
TestCase
from
unittest
import
TestCase
import
xmodule.tabs
as
xmodule_tabs
import
xmodule.tabs
as
xmodule_tabs
...
@@ -8,6 +9,7 @@ import xmodule.tabs as xmodule_tabs
...
@@ -8,6 +9,7 @@ import xmodule.tabs as xmodule_tabs
from
openedx.core.lib.course_tabs
import
CourseTabPluginManager
from
openedx.core.lib.course_tabs
import
CourseTabPluginManager
@attr
(
'shard_2'
)
class
CourseTabPluginManagerTestCase
(
TestCase
):
class
CourseTabPluginManagerTestCase
(
TestCase
):
"""Test cases for CourseTabPluginManager class"""
"""Test cases for CourseTabPluginManager class"""
...
@@ -37,6 +39,7 @@ class CourseTabPluginManagerTestCase(TestCase):
...
@@ -37,6 +39,7 @@ class CourseTabPluginManagerTestCase(TestCase):
)
)
@attr
(
'shard_2'
)
class
KeyCheckerTestCase
(
TestCase
):
class
KeyCheckerTestCase
(
TestCase
):
"""Test cases for KeyChecker class"""
"""Test cases for KeyChecker class"""
...
@@ -55,6 +58,7 @@ class KeyCheckerTestCase(TestCase):
...
@@ -55,6 +58,7 @@ class KeyCheckerTestCase(TestCase):
xmodule_tabs
.
key_checker
(
self
.
invalid_keys
)(
self
.
dict_value
)
xmodule_tabs
.
key_checker
(
self
.
invalid_keys
)(
self
.
dict_value
)
@attr
(
'shard_2'
)
class
NeedNameTestCase
(
TestCase
):
class
NeedNameTestCase
(
TestCase
):
"""Test cases for NeedName validator"""
"""Test cases for NeedName validator"""
...
...
openedx/core/lib/tests/test_courses.py
View file @
4660055e
...
@@ -4,6 +4,7 @@ Tests for functionality in openedx/core/lib/courses.py.
...
@@ -4,6 +4,7 @@ Tests for functionality in openedx/core/lib/courses.py.
import
ddt
import
ddt
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
nose.plugins.attrib
import
attr
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
...
@@ -12,6 +13,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
...
@@ -12,6 +13,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
..courses
import
course_image_url
from
..courses
import
course_image_url
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
CourseImageTestCase
(
ModuleStoreTestCase
):
class
CourseImageTestCase
(
ModuleStoreTestCase
):
"""Tests for course image URLs."""
"""Tests for course image URLs."""
...
...
openedx/core/lib/tests/test_edx_api_utils.py
View file @
4660055e
...
@@ -6,6 +6,7 @@ from django.core.cache import cache
...
@@ -6,6 +6,7 @@ from django.core.cache import cache
from
django.test
import
TestCase
from
django.test
import
TestCase
import
httpretty
import
httpretty
import
mock
import
mock
from
nose.plugins.attrib
import
attr
from
oauth2_provider.tests.factories
import
ClientFactory
from
oauth2_provider.tests.factories
import
ClientFactory
from
provider.constants
import
CONFIDENTIAL
from
provider.constants
import
CONFIDENTIAL
from
testfixtures
import
LogCapture
from
testfixtures
import
LogCapture
...
@@ -21,6 +22,7 @@ from student.tests.factories import UserFactory
...
@@ -21,6 +22,7 @@ from student.tests.factories import UserFactory
LOGGER_NAME
=
'openedx.core.lib.edx_api_utils'
LOGGER_NAME
=
'openedx.core.lib.edx_api_utils'
@attr
(
'shard_2'
)
class
TestApiDataRetrieval
(
CredentialsApiConfigMixin
,
CredentialsDataMixin
,
ProgramsApiConfigMixin
,
ProgramsDataMixin
,
class
TestApiDataRetrieval
(
CredentialsApiConfigMixin
,
CredentialsDataMixin
,
ProgramsApiConfigMixin
,
ProgramsDataMixin
,
TestCase
):
TestCase
):
"""Test utility for API data retrieval."""
"""Test utility for API data retrieval."""
...
...
openedx/core/lib/tests/test_graph_traversals.py
View file @
4660055e
...
@@ -3,6 +3,7 @@ Tests for graph traversal generator functions.
...
@@ -3,6 +3,7 @@ Tests for graph traversal generator functions.
"""
"""
from
collections
import
defaultdict
from
collections
import
defaultdict
from
nose.plugins.attrib
import
attr
from
unittest
import
TestCase
from
unittest
import
TestCase
from
..graph_traversals
import
(
from
..graph_traversals
import
(
...
@@ -10,6 +11,7 @@ from ..graph_traversals import (
...
@@ -10,6 +11,7 @@ from ..graph_traversals import (
)
)
@attr
(
'shard_2'
)
class
TestGraphTraversals
(
TestCase
):
class
TestGraphTraversals
(
TestCase
):
"""
"""
Test Class for graph traversal generator functions.
Test Class for graph traversal generator functions.
...
...
openedx/core/lib/tests/test_token_utils.py
View file @
4660055e
...
@@ -9,6 +9,7 @@ from django.test import TestCase
...
@@ -9,6 +9,7 @@ from django.test import TestCase
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
import
freezegun
import
freezegun
import
jwt
import
jwt
from
nose.plugins.attrib
import
attr
from
oauth2_provider.tests.factories
import
ClientFactory
from
oauth2_provider.tests.factories
import
ClientFactory
from
provider.constants
import
CONFIDENTIAL
from
provider.constants
import
CONFIDENTIAL
...
@@ -17,6 +18,7 @@ from student.models import anonymous_id_for_user
...
@@ -17,6 +18,7 @@ from student.models import anonymous_id_for_user
from
student.tests.factories
import
UserFactory
,
UserProfileFactory
from
student.tests.factories
import
UserFactory
,
UserProfileFactory
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestIdTokenGeneration
(
TestCase
):
class
TestIdTokenGeneration
(
TestCase
):
"""Tests covering ID token generation."""
"""Tests covering ID token generation."""
...
...
openedx/core/lib/tests/test_xblock_utils.py
View file @
4660055e
...
@@ -4,6 +4,7 @@ Tests for xblock_utils.py
...
@@ -4,6 +4,7 @@ Tests for xblock_utils.py
from
__future__
import
unicode_literals
,
absolute_import
from
__future__
import
unicode_literals
,
absolute_import
import
ddt
import
ddt
from
nose.plugins.attrib
import
attr
import
uuid
import
uuid
from
django.test.client
import
RequestFactory
from
django.test.client
import
RequestFactory
...
@@ -27,6 +28,7 @@ from openedx.core.lib.xblock_utils import (
...
@@ -27,6 +28,7 @@ from openedx.core.lib.xblock_utils import (
)
)
@attr
(
'shard_2'
)
@ddt.ddt
@ddt.ddt
class
TestXblockUtils
(
SharedModuleStoreTestCase
):
class
TestXblockUtils
(
SharedModuleStoreTestCase
):
"""
"""
...
...
scripts/generic-ci-tests.sh
View file @
4660055e
...
@@ -94,7 +94,10 @@ END
...
@@ -94,7 +94,10 @@ END
paver test_system
-s
lms
--extra_args
=
"--attr='shard_1' --with-flaky"
--cov_args
=
"-p"
paver test_system
-s
lms
--extra_args
=
"--attr='shard_1' --with-flaky"
--cov_args
=
"-p"
;;
;;
"2"
)
"2"
)
paver test_system
-s
lms
--extra_args
=
"--attr='shard_1=False' --with-flaky"
--cov_args
=
"-p"
paver test_system
-s
lms
--extra_args
=
"--attr='shard_2' --with-flaky"
--cov_args
=
"-p"
;;
"3"
)
paver test_system
-s
lms
--extra_args
=
"--attr='shard_1=False,shard_2=False' --with-flaky"
--cov_args
=
"-p"
;;
;;
*
)
*
)
paver test_system
-s
lms
--extra_args
=
"--with-flaky"
--cov_args
=
"-p"
paver test_system
-s
lms
--extra_args
=
"--with-flaky"
--cov_args
=
"-p"
...
...
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