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
7cb5c4d7
Commit
7cb5c4d7
authored
Jul 10, 2014
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates based on merge with master.
parent
d40ef5e0
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
21 deletions
+74
-21
cms/djangoapps/contentstore/tests/utils.py
+1
-1
cms/djangoapps/contentstore/views/item.py
+18
-1
cms/djangoapps/contentstore/views/tests/test_container_page.py
+21
-8
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+3
-1
common/test/acceptance/pages/studio/container.py
+27
-0
common/test/acceptance/tests/video/test_studio_video_module.py
+4
-10
No files found.
cms/djangoapps/contentstore/tests/utils.py
View file @
7cb5c4d7
...
...
@@ -308,7 +308,7 @@ class CourseTestCase(ModuleStoreTestCase):
# assert is here to make sure that the course being tested actually has verticals (units) to check.
self
.
assertGreater
(
len
(
items
),
0
,
"Course has no verticals (units) to check"
)
for
descriptor
in
items
:
resp
=
self
.
client
.
get_html
(
get_url
(
'
unit
_handler'
,
descriptor
.
location
))
resp
=
self
.
client
.
get_html
(
get_url
(
'
container
_handler'
,
descriptor
.
location
))
self
.
assertEqual
(
resp
.
status_code
,
200
)
def
assertAssetsEqual
(
self
,
asset_son
,
course1_id
,
course2_id
):
...
...
cms/djangoapps/contentstore/views/item.py
View file @
7cb5c4d7
...
...
@@ -543,6 +543,23 @@ def create_xblock_info(usage_key, xblock, data=None, metadata=None):
"""
publish_state
=
compute_publish_state
(
xblock
)
if
xblock
else
None
def
safe_get_username
(
user_id
):
"""
Guard against bad user_ids, like the infamous "**replace_user**".
Note that this will ignore our special known IDs (ModuleStoreEnum.UserID).
We should consider adding special handling for those values.
:param user_id: the user id to get the username of
:return: username, or None if the user does not exist or user_id is None
"""
if
user_id
:
try
:
return
User
.
objects
.
get
(
id
=
user_id
)
.
username
except
:
# pylint: disable=bare-except
pass
return
None
xblock_info
=
{
"id"
:
unicode
(
xblock
.
location
),
"display_name"
:
xblock
.
display_name_with_default
,
...
...
@@ -550,7 +567,7 @@ def create_xblock_info(usage_key, xblock, data=None, metadata=None):
"has_changes"
:
modulestore
()
.
has_changes
(
usage_key
),
"published"
:
publish_state
in
(
PublishState
.
public
,
PublishState
.
draft
),
"edited_on"
:
get_default_time_display
(
xblock
.
edited_on
)
if
xblock
.
edited_on
else
None
,
"edited_by"
:
User
.
objects
.
get
(
id
=
xblock
.
edited_by
)
.
username
if
xblock
.
edited_by
else
None
"edited_by"
:
safe_get_username
(
xblock
.
edited_by
)
}
if
data
is
not
None
:
xblock_info
[
"data"
]
=
data
...
...
cms/djangoapps/contentstore/views/tests/test_container_page.py
View file @
7cb5c4d7
...
...
@@ -29,18 +29,18 @@ class ContainerPageTestCase(StudioPageTestCase):
past
=
datetime
.
datetime
(
1970
,
1
,
1
,
tzinfo
=
UTC
)
future
=
datetime
.
datetime
.
now
(
UTC
)
+
datetime
.
timedelta
(
days
=
1
)
self
.
released_private_vertical
=
ItemFactory
.
create
(
self
.
released_private_vertical
=
self
.
_create_item
(
parent_location
=
self
.
sequential
.
location
,
category
=
'vertical'
,
display_name
=
'Released Private Unit'
,
user_id
=
self
.
user
.
id
,
start
=
past
)
self
.
unreleased_private_vertical
=
ItemFactory
.
create
(
start
=
past
)
self
.
unreleased_private_vertical
=
self
.
_create_item
(
parent_location
=
self
.
sequential
.
location
,
category
=
'vertical'
,
display_name
=
'Unreleased Private Unit'
,
user_id
=
self
.
user
.
id
,
start
=
future
)
self
.
released_public_vertical
=
ItemFactory
.
create
(
start
=
future
)
self
.
released_public_vertical
=
self
.
_create_item
(
parent_location
=
self
.
sequential
.
location
,
category
=
'vertical'
,
display_name
=
'Released Public Unit'
,
user_id
=
self
.
user
.
id
,
start
=
past
)
self
.
unreleased_public_vertical
=
ItemFactory
.
create
(
start
=
past
)
self
.
unreleased_public_vertical
=
self
.
_create_item
(
parent_location
=
self
.
sequential
.
location
,
category
=
'vertical'
,
display_name
=
'Unreleased Public Unit'
,
user_id
=
self
.
user
.
id
,
start
=
future
)
start
=
future
)
self
.
store
.
publish
(
self
.
unreleased_public_vertical
.
location
,
self
.
user
.
id
)
self
.
store
.
publish
(
self
.
released_public_vertical
.
location
,
self
.
user
.
id
)
...
...
@@ -124,6 +124,19 @@ class ContainerPageTestCase(StudioPageTestCase):
self
.
validate_preview_html
(
self
.
child_container
,
self
.
container_view
)
self
.
validate_preview_html
(
self
.
child_vertical
,
self
.
reorderable_child_view
)
def
_create_item
(
self
,
parent_location
,
category
,
display_name
,
**
kwargs
):
"""
creates an item in the module store, without publishing it.
"""
return
ItemFactory
.
create
(
parent_location
=
parent_location
,
category
=
category
,
display_name
=
display_name
,
publish_item
=
False
,
user_id
=
self
.
user
.
id
,
**
kwargs
)
def
test_public_child_container_preview_html
(
self
):
"""
Verify that a public container rendered as a child of the container page returns the expected HTML.
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
7cb5c4d7
...
...
@@ -538,7 +538,9 @@ class TestMixedModuleStore(unittest.TestCase):
Tests already exist for both split and draft in their own test files.
"""
self
.
initdb
(
default_ms
)
item
=
self
.
store
.
create_item
(
self
.
course_locations
[
self
.
MONGO_COURSEID
],
'problem'
,
block_id
=
'orphan'
)
item
=
self
.
store
.
create_item
(
self
.
course_locations
[
self
.
MONGO_COURSEID
],
'problem'
,
self
.
user_id
,
block_id
=
'orphan'
)
self
.
assertTrue
(
self
.
store
.
has_changes
(
item
.
location
))
self
.
store
.
publish
(
item
.
location
,
self
.
user_id
)
self
.
assertFalse
(
self
.
store
.
has_changes
(
item
.
location
))
...
...
common/test/acceptance/pages/studio/container.py
View file @
7cb5c4d7
...
...
@@ -215,6 +215,10 @@ class XBlockWrapper(PageObject):
url
=
None
BODY_SELECTOR
=
'.studio-xblock-wrapper'
NAME_SELECTOR
=
'.xblock-display-name'
COMPONENT_BUTTONS
=
{
'advanced_tab'
:
'.editor-tabs li.inner_tab_wrap:nth-child(2) > a'
,
'save_settings'
:
'.action-save'
,
}
def
__init__
(
self
,
browser
,
locator
):
super
(
XBlockWrapper
,
self
)
.
__init__
(
browser
)
...
...
@@ -274,10 +278,33 @@ class XBlockWrapper(PageObject):
"""
return
_click_edit
(
self
,
self
.
_bounded_selector
)
def
open_advanced_tab
(
self
):
"""
Click on Advanced Tab.
"""
self
.
_click_button
(
'advanced_tab'
)
def
save_settings
(
self
):
"""
Click on settings Save button.
"""
self
.
_click_button
(
'save_settings'
)
@property
def
editor_selector
(
self
):
return
'.xblock-studio_view'
def
_click_button
(
self
,
button_name
):
"""
Click on a button as specified by `button_name`
Arguments:
button_name (str): button name
"""
self
.
q
(
css
=
self
.
COMPONENT_BUTTONS
[
button_name
])
.
first
.
click
()
self
.
wait_for_ajax
()
def
_click_edit
(
page_object
,
bounded_selector
=
lambda
(
x
):
x
):
"""
...
...
common/test/acceptance/tests/video/test_studio_video_module.py
View file @
7cb5c4d7
...
...
@@ -93,25 +93,19 @@ class CMSVideoBaseTest(UniqueCourseTest):
def
edit_component
(
self
):
"""
Make component editable and open components Edit Dialog.
Arguments:
handout_filename (str): handout file name to be uploaded
save_settings (bool): save settings or not
Open component Edit Dialog for first component on page.
"""
self
.
unit_page
.
set_unit_visibility
(
'private'
)
self
.
unit_page
.
components
[
0
]
.
edit
()
self
.
unit_page
.
xblocks
[
0
]
.
edit
()
def
open_advanced_tab
(
self
):
"""
Open components advanced tab.
"""
self
.
unit_page
.
component
s
[
0
]
.
open_advanced_tab
()
self
.
unit_page
.
xblock
s
[
0
]
.
open_advanced_tab
()
def
save_unit_settings
(
self
):
"""
Save component settings.
"""
self
.
unit_page
.
component
s
[
0
]
.
save_settings
()
self
.
unit_page
.
xblock
s
[
0
]
.
save_settings
()
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