Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-drag-and-drop-v2
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
OpenEdx
xblock-drag-and-drop-v2
Commits
07328f1b
Commit
07328f1b
authored
Sep 16, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add integration test.
parent
21ee62c0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
6 deletions
+37
-6
tests/integration/test_base.py
+7
-3
tests/integration/test_title_and_question.py
+30
-3
No files found.
tests/integration/test_base.py
View file @
07328f1b
...
...
@@ -19,12 +19,16 @@ class BaseIntegrationTest(SeleniumBaseTest):
"'"
:
"'"
}
def
_make_scenario_xml
(
self
,
display_name
,
question_text
,
completed
):
def
_make_scenario_xml
(
self
,
display_name
,
show_title
,
question_text
,
completed
):
return
"""
<vertical_demo>
<drag-and-drop-v2 display_name='{display_name}' question_text='{question_text}' weight='1' completed='{completed}'/>
<drag-and-drop-v2 display_name='{display_name}' show_title='{show_title}' question_text='{question_text}'
weight='1' completed='{completed}'/>
</vertical_demo>
"""
.
format
(
display_name
=
escape
(
display_name
),
question_text
=
escape
(
question_text
),
completed
=
completed
)
"""
.
format
(
display_name
=
escape
(
display_name
),
show_title
=
show_title
,
question_text
=
escape
(
question_text
),
completed
=
completed
)
def
_get_custom_scenario_xml
(
self
,
filename
):
data
=
load_resource
(
filename
)
...
...
tests/integration/test_title_and_question.py
View file @
07328f1b
from
ddt
import
ddt
,
unpack
,
data
from
selenium.common.exceptions
import
NoSuchElementException
from
tests.integration.test_base
import
BaseIntegrationTest
from
workbench
import
scenarios
...
...
@@ -13,9 +14,11 @@ class TestDragAndDropTitleAndQuestion(BaseIntegrationTest):
(
'html2'
,
'<span style="color:red">Title: HTML?</span>'
,
'<span style="color:red">Span question</span>'
),
)
def
test_title_and_question_parameters
(
self
,
_
,
display_name
,
question_text
):
const_page_name
=
'Test block parameters'
const_page_id
=
'test_block_title'
scenario_xml
=
self
.
_make_scenario_xml
(
display_name
,
question_text
,
False
)
const_page_name
=
'Test title and question parameters'
const_page_id
=
'test_block_title_and_question'
scenario_xml
=
self
.
_make_scenario_xml
(
display_name
=
display_name
,
show_title
=
True
,
question_text
=
question_text
,
completed
=
False
)
scenarios
.
add_xml_scenario
(
const_page_id
,
const_page_name
,
scenario_xml
)
self
.
addCleanup
(
scenarios
.
remove_scenario
,
const_page_id
)
...
...
@@ -25,3 +28,27 @@ class TestDragAndDropTitleAndQuestion(BaseIntegrationTest):
question
=
page
.
find_element_by_css_selector
(
'section.problem > p'
)
self
.
assertEqual
(
self
.
get_element_html
(
question
),
question_text
)
@unpack
@data
(
(
'plain shown'
,
'title1'
,
True
),
(
'plain hidden'
,
'title2'
,
False
),
(
'html shown'
,
'title with <i>HTML</i>'
,
True
),
(
'html hidden'
,
'<span style="color:red">Title: HTML?</span>'
,
False
)
)
def
test_show_title_parameter
(
self
,
_
,
display_name
,
show_title
):
const_page_name
=
'Test show title parameter'
const_page_id
=
'test_block_show_title'
scenario_xml
=
self
.
_make_scenario_xml
(
display_name
=
display_name
,
show_title
=
show_title
,
question_text
=
'Generic question'
,
completed
=
False
)
scenarios
.
add_xml_scenario
(
const_page_id
,
const_page_name
,
scenario_xml
)
self
.
addCleanup
(
scenarios
.
remove_scenario
,
const_page_id
)
page
=
self
.
go_to_page
(
const_page_name
)
if
show_title
:
problem_header
=
page
.
find_element_by_css_selector
(
'h2.problem-header'
)
self
.
assertEqual
(
self
.
get_element_html
(
problem_header
),
display_name
)
else
:
with
self
.
assertRaises
(
NoSuchElementException
):
page
.
find_element_by_css_selector
(
'h2.problem-header'
)
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