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
e9378881
Commit
e9378881
authored
Aug 27, 2015
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use SharedModuleStoreTestCase in Discussion API serializer tests.
parent
406c9bc5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
lms/djangoapps/discussion_api/tests/test_serializers.py
+22
-8
No files found.
lms/djangoapps/discussion_api/tests/test_serializers.py
View file @
e9378881
...
...
@@ -27,13 +27,19 @@ from lms.lib.comment_client.comment import Comment
from
lms.lib.comment_client.thread
import
Thread
from
student.tests.factories
import
UserFactory
from
util.testing
import
UrlResetMixin
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
Shared
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
openedx.core.djangoapps.course_groups.tests.helpers
import
CohortFactory
@ddt.ddt
class
SerializerTestMixin
(
CommentsServiceMockMixin
,
UrlResetMixin
):
@classmethod
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
def
setUpClass
(
cls
):
super
(
SerializerTestMixin
,
cls
)
.
setUpClass
()
cls
.
course
=
CourseFactory
.
create
()
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
def
setUp
(
self
):
super
(
SerializerTestMixin
,
self
)
.
setUp
()
...
...
@@ -45,7 +51,6 @@ class SerializerTestMixin(CommentsServiceMockMixin, UrlResetMixin):
self
.
register_get_user_response
(
self
.
user
)
self
.
request
=
RequestFactory
()
.
get
(
"/dummy"
)
self
.
request
.
user
=
self
.
user
self
.
course
=
CourseFactory
.
create
()
self
.
author
=
UserFactory
.
create
()
def
create_role
(
self
,
role_name
,
users
,
course
=
None
):
...
...
@@ -128,7 +133,7 @@ class SerializerTestMixin(CommentsServiceMockMixin, UrlResetMixin):
@ddt.ddt
class
ThreadSerializerSerializationTest
(
SerializerTestMixin
,
ModuleStoreTestCase
):
class
ThreadSerializerSerializationTest
(
SerializerTestMixin
,
Shared
ModuleStoreTestCase
):
"""Tests for ThreadSerializer serialization."""
def
make_cs_content
(
self
,
overrides
):
"""
...
...
@@ -245,7 +250,7 @@ class ThreadSerializerSerializationTest(SerializerTestMixin, ModuleStoreTestCase
@ddt.ddt
class
CommentSerializerTest
(
SerializerTestMixin
,
ModuleStoreTestCase
):
class
CommentSerializerTest
(
SerializerTestMixin
,
Shared
ModuleStoreTestCase
):
"""Tests for CommentSerializer."""
def
setUp
(
self
):
super
(
CommentSerializerTest
,
self
)
.
setUp
()
...
...
@@ -402,15 +407,20 @@ class CommentSerializerTest(SerializerTestMixin, ModuleStoreTestCase):
@ddt.ddt
class
ThreadSerializerDeserializationTest
(
CommentsServiceMockMixin
,
UrlResetMixin
,
ModuleStoreTestCase
):
class
ThreadSerializerDeserializationTest
(
CommentsServiceMockMixin
,
UrlResetMixin
,
Shared
ModuleStoreTestCase
):
"""Tests for ThreadSerializer deserialization."""
@classmethod
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
def
setUpClass
(
cls
):
super
(
ThreadSerializerDeserializationTest
,
cls
)
.
setUpClass
()
cls
.
course
=
CourseFactory
.
create
()
@mock.patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
def
setUp
(
self
):
super
(
ThreadSerializerDeserializationTest
,
self
)
.
setUp
()
httpretty
.
reset
()
httpretty
.
enable
()
self
.
addCleanup
(
httpretty
.
disable
)
self
.
course
=
CourseFactory
.
create
()
self
.
user
=
UserFactory
.
create
()
self
.
register_get_user_response
(
self
.
user
)
self
.
request
=
RequestFactory
()
.
get
(
"/dummy"
)
...
...
@@ -592,14 +602,18 @@ class ThreadSerializerDeserializationTest(CommentsServiceMockMixin, UrlResetMixi
@ddt.ddt
class
CommentSerializerDeserializationTest
(
CommentsServiceMockMixin
,
ModuleStoreTestCase
):
class
CommentSerializerDeserializationTest
(
CommentsServiceMockMixin
,
Shared
ModuleStoreTestCase
):
"""Tests for ThreadSerializer deserialization."""
@classmethod
def
setUpClass
(
cls
):
super
(
CommentSerializerDeserializationTest
,
cls
)
.
setUpClass
()
cls
.
course
=
CourseFactory
.
create
()
def
setUp
(
self
):
super
(
CommentSerializerDeserializationTest
,
self
)
.
setUp
()
httpretty
.
reset
()
httpretty
.
enable
()
self
.
addCleanup
(
httpretty
.
disable
)
self
.
course
=
CourseFactory
.
create
()
self
.
user
=
UserFactory
.
create
()
self
.
register_get_user_response
(
self
.
user
)
self
.
request
=
RequestFactory
()
.
get
(
"/dummy"
)
...
...
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