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
65e26e3e
Commit
65e26e3e
authored
Feb 29, 2016
by
John Eskew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move user/admin model creation to class level.
Wrap whole test with several publish/unpublish in same bulk_op.
parent
14ad8cd7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
23 deletions
+24
-23
lms/djangoapps/ccx/tests/test_ccx_modulestore.py
+24
-23
No files found.
lms/djangoapps/ccx/tests/test_ccx_modulestore.py
View file @
65e26e3e
...
...
@@ -25,16 +25,12 @@ class TestCCXModulestoreWrapper(SharedModuleStoreTestCase):
@classmethod
def
setUpClass
(
cls
):
super
(
TestCCXModulestoreWrapper
,
cls
)
.
setUpClass
()
cls
.
course
=
course
=
CourseFactory
.
create
()
cls
.
mooc_start
=
start
=
datetime
.
datetime
(
2010
,
5
,
12
,
2
,
42
,
tzinfo
=
pytz
.
UTC
)
cls
.
mooc_due
=
due
=
datetime
.
datetime
(
2010
,
7
,
7
,
0
,
0
,
tzinfo
=
pytz
.
UTC
)
cls
.
course
=
CourseFactory
.
create
()
start
=
datetime
.
datetime
(
2010
,
5
,
12
,
2
,
42
,
tzinfo
=
pytz
.
UTC
)
due
=
datetime
.
datetime
(
2010
,
7
,
7
,
0
,
0
,
tzinfo
=
pytz
.
UTC
)
# Create a course outline
cls
.
chapters
=
chapters
=
[
ItemFactory
.
create
(
start
=
start
,
parent
=
course
)
for
_
in
xrange
(
2
)
ItemFactory
.
create
(
start
=
start
,
parent
=
c
ls
.
c
ourse
)
for
_
in
xrange
(
2
)
]
cls
.
sequentials
=
sequentials
=
[
ItemFactory
.
create
(
parent
=
c
)
for
_
in
xrange
(
2
)
for
c
in
chapters
...
...
@@ -48,20 +44,24 @@ class TestCCXModulestoreWrapper(SharedModuleStoreTestCase):
ItemFactory
.
create
(
parent
=
v
,
category
=
'html'
)
for
_
in
xrange
(
2
)
for
v
in
verticals
]
@classmethod
def
setUpTestData
(
cls
):
"""
Set up models for the whole TestCase.
"""
cls
.
user
=
UserFactory
.
create
()
# Create instructor account
cls
.
coach
=
AdminFactory
.
create
()
def
setUp
(
self
):
"""
Set up tests
"""
super
(
TestCCXModulestoreWrapper
,
self
)
.
setUp
()
self
.
user
=
UserFactory
.
create
()
# Create instructor account
coach
=
AdminFactory
.
create
()
self
.
ccx
=
ccx
=
CustomCourseForEdX
(
course_id
=
self
.
course
.
id
,
display_name
=
'Test CCX'
,
coach
=
coach
coach
=
self
.
coach
)
ccx
.
save
()
...
...
@@ -132,12 +132,13 @@ class TestCCXModulestoreWrapper(SharedModuleStoreTestCase):
def
test_publication_api
(
self
):
"""verify that we can correctly discern a published item by ccx key"""
for
expected
in
self
.
blocks
:
block_key
=
self
.
ccx_locator
.
make_usage_key
(
expected
.
location
.
block_type
,
expected
.
location
.
block_id
)
self
.
assertTrue
(
self
.
store
.
has_published_version
(
expected
))
self
.
store
.
unpublish
(
block_key
,
self
.
user
.
id
)
self
.
assertFalse
(
self
.
store
.
has_published_version
(
expected
))
self
.
store
.
publish
(
block_key
,
self
.
user
.
id
)
self
.
assertTrue
(
self
.
store
.
has_published_version
(
expected
))
with
self
.
store
.
bulk_operations
(
self
.
ccx_locator
):
for
expected
in
self
.
blocks
:
block_key
=
self
.
ccx_locator
.
make_usage_key
(
expected
.
location
.
block_type
,
expected
.
location
.
block_id
)
self
.
assertTrue
(
self
.
store
.
has_published_version
(
expected
))
self
.
store
.
unpublish
(
block_key
,
self
.
user
.
id
)
self
.
assertFalse
(
self
.
store
.
has_published_version
(
expected
))
self
.
store
.
publish
(
block_key
,
self
.
user
.
id
)
self
.
assertTrue
(
self
.
store
.
has_published_version
(
expected
))
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