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
d6f3cd86
Commit
d6f3cd86
authored
Aug 25, 2015
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert class dashboard tests to use SharedModuleStoreTestCase.
parent
28bca8e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
38 deletions
+43
-38
lms/djangoapps/class_dashboard/tests/test_dashboard_data.py
+43
-38
No files found.
lms/djangoapps/class_dashboard/tests/test_dashboard_data.py
View file @
d6f3cd86
...
...
@@ -13,7 +13,7 @@ from capa.tests.response_xml_factory import StringResponseXMLFactory
from
courseware.tests.factories
import
StudentModuleFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
,
AdminFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
Shared
ModuleStoreTestCase
from
class_dashboard.dashboard_data
import
(
get_problem_grade_distribution
,
get_sequential_open_distrib
,
...
...
@@ -28,10 +28,44 @@ USER_COUNT = 11
@attr
(
'shard_1'
)
class
TestGetProblemGradeDistribution
(
ModuleStoreTestCase
):
class
TestGetProblemGradeDistribution
(
Shared
ModuleStoreTestCase
):
"""
Tests related to class_dashboard/dashboard_data.py
"""
@classmethod
def
setUpClass
(
cls
):
super
(
TestGetProblemGradeDistribution
,
cls
)
.
setUpClass
()
cls
.
course
=
CourseFactory
.
create
(
display_name
=
u"test course omega
\u03a9
"
,
)
with
cls
.
store
.
bulk_operations
(
cls
.
course
.
id
,
emit_signals
=
False
):
section
=
ItemFactory
.
create
(
parent_location
=
cls
.
course
.
location
,
category
=
"chapter"
,
display_name
=
u"test factory section omega
\u03a9
"
,
)
cls
.
sub_section
=
ItemFactory
.
create
(
parent_location
=
section
.
location
,
category
=
"sequential"
,
display_name
=
u"test subsection omega
\u03a9
"
,
)
cls
.
unit
=
ItemFactory
.
create
(
parent_location
=
cls
.
sub_section
.
location
,
category
=
"vertical"
,
metadata
=
{
'graded'
:
True
,
'format'
:
'Homework'
},
display_name
=
u"test unit omega
\u03a9
"
,
)
cls
.
items
=
[]
for
i
in
xrange
(
USER_COUNT
-
1
):
item
=
ItemFactory
.
create
(
parent_location
=
cls
.
unit
.
location
,
category
=
"problem"
,
data
=
StringResponseXMLFactory
()
.
build_xml
(
answer
=
'foo'
),
metadata
=
{
'rerandomize'
:
'always'
},
display_name
=
u"test problem omega
\u03a9
"
+
str
(
i
)
)
cls
.
items
.
append
(
item
)
cls
.
item
=
item
def
setUp
(
self
):
super
(
TestGetProblemGradeDistribution
,
self
)
.
setUp
()
...
...
@@ -40,58 +74,29 @@ class TestGetProblemGradeDistribution(ModuleStoreTestCase):
self
.
instructor
=
AdminFactory
.
create
()
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
'test'
)
self
.
attempts
=
3
self
.
course
=
CourseFactory
.
create
(
display_name
=
u"test course omega
\u03a9
"
,
)
section
=
ItemFactory
.
create
(
parent_location
=
self
.
course
.
location
,
category
=
"chapter"
,
display_name
=
u"test factory section omega
\u03a9
"
,
)
self
.
sub_section
=
ItemFactory
.
create
(
parent_location
=
section
.
location
,
category
=
"sequential"
,
display_name
=
u"test subsection omega
\u03a9
"
,
)
unit
=
ItemFactory
.
create
(
parent_location
=
self
.
sub_section
.
location
,
category
=
"vertical"
,
metadata
=
{
'graded'
:
True
,
'format'
:
'Homework'
},
display_name
=
u"test unit omega
\u03a9
"
,
)
self
.
users
=
[
UserFactory
.
create
(
username
=
"metric"
+
str
(
__
))
for
__
in
xrange
(
USER_COUNT
)]
self
.
users
=
[
UserFactory
.
create
(
username
=
"metric"
+
str
(
__
))
for
__
in
xrange
(
USER_COUNT
)
]
for
user
in
self
.
users
:
CourseEnrollmentFactory
.
create
(
user
=
user
,
course_id
=
self
.
course
.
id
)
for
i
in
xrange
(
USER_COUNT
-
1
):
category
=
"problem"
self
.
item
=
ItemFactory
.
create
(
parent_location
=
unit
.
location
,
category
=
category
,
data
=
StringResponseXMLFactory
()
.
build_xml
(
answer
=
'foo'
),
metadata
=
{
'rerandomize'
:
'always'
},
display_name
=
u"test problem omega
\u03a9
"
+
str
(
i
)
)
for
i
,
item
in
enumerate
(
self
.
items
):
for
j
,
user
in
enumerate
(
self
.
users
):
StudentModuleFactory
.
create
(
grade
=
1
if
i
<
j
else
0
,
max_grade
=
1
if
i
<
j
else
0.5
,
student
=
user
,
course_id
=
self
.
course
.
id
,
module_state_key
=
self
.
item
.
location
,
module_state_key
=
item
.
location
,
state
=
json
.
dumps
({
'attempts'
:
self
.
attempts
}),
)
for
j
,
user
in
enumerate
(
self
.
users
):
StudentModuleFactory
.
create
(
course_id
=
self
.
course
.
id
,
module_type
=
'sequential'
,
module_state_key
=
self
.
item
.
location
,
module_state_key
=
item
.
location
,
)
def
test_get_problem_grade_distribution
(
self
):
...
...
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