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
de80f892
Commit
de80f892
authored
May 02, 2014
by
Andy Armstrong
Committed by
cahrens
May 02, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up coverage and code quality issues
parent
e20a7fc5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
14 deletions
+35
-14
cms/djangoapps/contentstore/views/tests/test_container.py
+6
-1
cms/djangoapps/contentstore/views/tests/test_tabs.py
+21
-1
cms/static/js/spec/views/container_spec.js
+1
-6
common/test/acceptance/pages/studio/container.py
+1
-1
common/test/acceptance/tests/test_studio_acid_xblock.py
+1
-0
common/test/acceptance/tests/test_studio_general.py
+5
-5
No files found.
cms/djangoapps/contentstore/views/tests/test_container.py
View file @
de80f892
...
@@ -124,14 +124,19 @@ class ContainerViewTestCase(CourseTestCase):
...
@@ -124,14 +124,19 @@ class ContainerViewTestCase(CourseTestCase):
Verify that an xblock returns the expected HTML for a container preview
Verify that an xblock returns the expected HTML for a container preview
"""
"""
# First verify that the behavior is correct with a published container
# First verify that the behavior is correct with a published container
self
.
_test_preview_html
(
self
.
vertical
)
self
.
_test_preview_html
(
self
.
child_vertical
)
self
.
_test_preview_html
(
self
.
child_vertical
)
# Now make the unit and its children into a draft and validate the preview again
# Now make the unit and its children into a draft and validate the preview again
modulestore
(
'draft'
)
.
convert_to_draft
(
self
.
vertical
.
location
)
draft_unit
=
modulestore
(
'draft'
)
.
convert_to_draft
(
self
.
vertical
.
location
)
draft_container
=
modulestore
(
'draft'
)
.
convert_to_draft
(
self
.
child_vertical
.
location
)
draft_container
=
modulestore
(
'draft'
)
.
convert_to_draft
(
self
.
child_vertical
.
location
)
self
.
_test_preview_html
(
draft_unit
)
self
.
_test_preview_html
(
draft_container
)
self
.
_test_preview_html
(
draft_container
)
def
_test_preview_html
(
self
,
xblock
):
def
_test_preview_html
(
self
,
xblock
):
"""
Verify that the specified xblock has the expected HTML elements for container preview
"""
locator
=
loc_mapper
()
.
translate_location
(
self
.
course
.
id
,
xblock
.
location
,
published
=
False
)
locator
=
loc_mapper
()
.
translate_location
(
self
.
course
.
id
,
xblock
.
location
,
published
=
False
)
publish_state
=
compute_publish_state
(
xblock
)
publish_state
=
compute_publish_state
(
xblock
)
preview_url
=
'/xblock/{locator}/container_preview'
.
format
(
locator
=
locator
)
preview_url
=
'/xblock/{locator}/container_preview'
.
format
(
locator
=
locator
)
...
...
cms/djangoapps/contentstore/views/tests/test_tabs.py
View file @
de80f892
...
@@ -4,6 +4,7 @@ import json
...
@@ -4,6 +4,7 @@ import json
from
contentstore.views
import
tabs
from
contentstore.views
import
tabs
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.tests.utils
import
CourseTestCase
from
django.test
import
TestCase
from
django.test
import
TestCase
from
xmodule.modulestore.django
import
loc_mapper
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
courseware.courses
import
get_course_by_id
from
courseware.courses
import
get_course_by_id
from
xmodule.tabs
import
CourseTabList
,
WikiTab
from
xmodule.tabs
import
CourseTabList
,
WikiTab
...
@@ -22,7 +23,7 @@ class TabsPageTests(CourseTestCase):
...
@@ -22,7 +23,7 @@ class TabsPageTests(CourseTestCase):
self
.
url
=
self
.
course_locator
.
url_reverse
(
'tabs'
)
self
.
url
=
self
.
course_locator
.
url_reverse
(
'tabs'
)
# add a static tab to the course, for code coverage
# add a static tab to the course, for code coverage
ItemFactory
.
create
(
self
.
test_tab
=
ItemFactory
.
create
(
parent_location
=
self
.
course_location
,
parent_location
=
self
.
course_location
,
category
=
"static_tab"
,
category
=
"static_tab"
,
display_name
=
"Static_1"
display_name
=
"Static_1"
...
@@ -172,6 +173,25 @@ class TabsPageTests(CourseTestCase):
...
@@ -172,6 +173,25 @@ class TabsPageTests(CourseTestCase):
)
)
self
.
check_invalid_tab_id_response
(
resp
)
self
.
check_invalid_tab_id_response
(
resp
)
def
test_tab_preview_html
(
self
):
"""
Verify that the static tab renders itself with the correct HTML
"""
locator
=
loc_mapper
()
.
translate_location
(
self
.
course
.
id
,
self
.
test_tab
.
location
)
preview_url
=
'/xblock/{locator}/student_view'
.
format
(
locator
=
locator
)
resp
=
self
.
client
.
get
(
preview_url
,
HTTP_ACCEPT
=
'application/json'
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
resp_content
=
json
.
loads
(
resp
.
content
)
html
=
resp_content
[
'html'
]
# Verify that the HTML contains the expected elements
self
.
assertIn
(
'<span class="action-button-text">Edit</span>'
,
html
)
self
.
assertIn
(
'<span class="sr">Duplicate this component</span>'
,
html
)
self
.
assertIn
(
'<span class="sr">Delete this component</span>'
,
html
)
self
.
assertIn
(
'<span data-tooltip="Drag to reorder" class="drag-handle"></span>'
,
html
)
class
PrimitiveTabEdit
(
TestCase
):
class
PrimitiveTabEdit
(
TestCase
):
"""Tests for the primitive tab edit data manipulations"""
"""Tests for the primitive tab edit data manipulations"""
...
...
cms/static/js/spec/views/container_spec.js
View file @
de80f892
...
@@ -8,7 +8,7 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/view_helpers
...
@@ -8,7 +8,7 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/view_helpers
describe
(
"Supports reordering components"
,
function
()
{
describe
(
"Supports reordering components"
,
function
()
{
var
model
,
containerView
,
mockContainerHTML
,
respondWithMockXBlockFragment
,
init
,
getComponent
,
var
model
,
containerView
,
mockContainerHTML
,
respondWithMockXBlockFragment
,
init
,
getComponent
,
getDragHandle
,
dragComponentVertically
,
dragComponentToY
,
dragComponentAbove
,
dragComponentBelow
,
getDragHandle
,
dragComponentVertically
,
dragComponentToY
,
dragComponentAbove
,
verifyRequest
,
verifyNumReorderCalls
,
respondToRequest
,
verifyRequest
,
verifyNumReorderCalls
,
respondToRequest
,
rootLocator
=
'testCourse/branch/draft/split_test/splitFFF'
,
rootLocator
=
'testCourse/branch/draft/split_test/splitFFF'
,
...
@@ -93,11 +93,6 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/view_helpers
...
@@ -93,11 +93,6 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/view_helpers
dragComponentToY
(
sourceLocator
,
targetElement
.
offset
().
top
+
1
);
dragComponentToY
(
sourceLocator
,
targetElement
.
offset
().
top
+
1
);
};
};
dragComponentBelow
=
function
(
sourceLocator
,
targetLocator
)
{
var
targetElement
=
containerView
.
$
(
'[data-locator="'
+
targetLocator
+
'"]'
);
dragComponentToY
(
sourceLocator
,
targetElement
.
offset
().
top
+
targetElement
.
height
()
-
1
);
};
verifyRequest
=
function
(
requests
,
reorderCallIndex
,
expectedURL
,
expectedChildren
)
{
verifyRequest
=
function
(
requests
,
reorderCallIndex
,
expectedURL
,
expectedChildren
)
{
var
actualIndex
,
request
,
children
,
i
;
var
actualIndex
,
request
,
children
,
i
;
// 0th call is the response to the initial render call to get HTML.
// 0th call is the response to the initial render call to get HTML.
...
...
common/test/acceptance/pages/studio/container.py
View file @
de80f892
...
@@ -59,7 +59,7 @@ class ContainerPage(PageObject):
...
@@ -59,7 +59,7 @@ class ContainerPage(PageObject):
action
=
ActionChains
(
self
.
browser
)
action
=
ActionChains
(
self
.
browser
)
action
.
click_and_hold
(
source
)
.
perform
()
# pylint: disable=protected-access
action
.
click_and_hold
(
source
)
.
perform
()
# pylint: disable=protected-access
action
.
move_to_element_with_offset
(
action
.
move_to_element_with_offset
(
target
,
0
,
target
.
size
[
'height'
]
/
2
if
after
else
0
target
,
0
,
target
.
size
[
'height'
]
/
2
if
after
else
0
)
.
perform
()
# pylint: disable=protected-access
)
.
perform
()
# pylint: disable=protected-access
action
.
release
()
.
perform
()
action
.
release
()
.
perform
()
# TODO: should wait for "Saving" to go away so we know the operation is complete?
# TODO: should wait for "Saving" to go away so we know the operation is complete?
...
...
common/test/acceptance/tests/test_studio_acid_xblock.py
View file @
de80f892
...
@@ -10,6 +10,7 @@ from ..pages.studio.overview import CourseOutlinePage
...
@@ -10,6 +10,7 @@ from ..pages.studio.overview import CourseOutlinePage
from
..pages.xblock.acid
import
AcidView
from
..pages.xblock.acid
import
AcidView
from
..fixtures.course
import
CourseFixture
,
XBlockFixtureDesc
from
..fixtures.course
import
CourseFixture
,
XBlockFixtureDesc
class
XBlockAcidBase
(
WebAppTest
):
class
XBlockAcidBase
(
WebAppTest
):
"""
"""
Base class for tests that verify that XBlock integration is working correctly
Base class for tests that verify that XBlock integration is working correctly
...
...
common/test/acceptance/tests/test_studio_general.py
View file @
de80f892
...
@@ -131,11 +131,11 @@ class DiscussionPreviewTest(UniqueCourseTest):
...
@@ -131,11 +131,11 @@ class DiscussionPreviewTest(UniqueCourseTest):
AutoAuthPage
(
self
.
browser
,
staff
=
True
)
.
visit
()
AutoAuthPage
(
self
.
browser
,
staff
=
True
)
.
visit
()
cop
=
CourseOutlinePage
(
cop
=
CourseOutlinePage
(
self
.
browser
,
self
.
browser
,
self
.
course_info
[
'org'
],
self
.
course_info
[
'org'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'run'
]
self
.
course_info
[
'run'
]
)
)
cop
.
visit
()
cop
.
visit
()
self
.
unit
=
cop
.
section
(
'Test Section'
)
.
subsection
(
'Test Subsection'
)
.
toggle_expand
()
.
unit
(
'Test Unit'
)
self
.
unit
=
cop
.
section
(
'Test Section'
)
.
subsection
(
'Test Subsection'
)
.
toggle_expand
()
.
unit
(
'Test Unit'
)
self
.
unit
.
go_to
()
self
.
unit
.
go_to
()
...
...
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