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
66874aca
Commit
66874aca
authored
Dec 23, 2014
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed typo + combined problem type tests into single test
parent
2b45e10f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
48 deletions
+43
-48
common/test/acceptance/pages/lms/library.py
+1
-1
common/test/acceptance/tests/lms/test_library.py
+42
-47
No files found.
common/test/acceptance/pages/lms/library.py
View file @
66874aca
...
@@ -42,7 +42,7 @@ class LibraryContentXBlockWrapper(PageObject):
...
@@ -42,7 +42,7 @@ class LibraryContentXBlockWrapper(PageObject):
@property
@property
def
children_headers
(
self
):
def
children_headers
(
self
):
"""
"""
Gets headers
i
f all child XBlocks as list of strings
Gets headers
o
f all child XBlocks as list of strings
"""
"""
child_blocks_headers
=
self
.
q
(
css
=
self
.
_bounded_selector
(
"div[data-id] h2.problem-header"
))
child_blocks_headers
=
self
.
q
(
css
=
self
.
_bounded_selector
(
"div[data-id] h2.problem-header"
))
return
frozenset
(
child
.
text
for
child
in
child_blocks_headers
)
return
frozenset
(
child
.
text
for
child
in
child_blocks_headers
)
common/test/acceptance/tests/lms/test_library.py
View file @
66874aca
...
@@ -119,6 +119,9 @@ class LibraryContentTestBase(UniqueCourseTest):
...
@@ -119,6 +119,9 @@ class LibraryContentTestBase(UniqueCourseTest):
Open library page in LMS
Open library page in LMS
"""
"""
self
.
courseware_page
.
visit
()
self
.
courseware_page
.
visit
()
paragraphs
=
self
.
courseware_page
.
q
(
css
=
'.course-content p'
)
if
paragraphs
and
"You were most recently in"
in
paragraphs
.
text
[
0
]:
paragraphs
[
0
]
.
find_element_by_tag_name
(
'a'
)
.
click
()
block_id
=
block_id
if
block_id
is
not
None
else
self
.
lib_block
.
locator
block_id
=
block_id
if
block_id
is
not
None
else
self
.
lib_block
.
locator
#pylint: disable=attribute-defined-outside-init
#pylint: disable=attribute-defined-outside-init
self
.
library_content_page
=
LibraryContentXBlockWrapper
(
self
.
browser
,
block_id
)
self
.
library_content_page
=
LibraryContentXBlockWrapper
(
self
.
browser
,
block_id
)
...
@@ -241,62 +244,54 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase):
...
@@ -241,62 +244,54 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase):
""" Expected XBLock headers according to populate_library_fixture """
""" Expected XBLock headers according to populate_library_fixture """
return
frozenset
(
child
.
display_name
.
upper
()
for
child
in
self
.
library_fixture
.
children
)
return
frozenset
(
child
.
display_name
.
upper
()
for
child
in
self
.
library_fixture
.
children
)
@ddt.data
(
1
,
3
)
def
_set_library_content_settings
(
self
,
count
=
1
,
capa_type
=
"Any Type"
):
def
test_any_capa_type_shows_all
(
self
,
count
):
"""
"""
Scenario: Ensure setting "Any Type" for Problem Type does not filter out Problems
Sets library content XBlock parameters, saves, publishes unit, goes to LMS unit page and
Given I have a library with two "Select Option" and two "Choice Group" problems, and a course containing
gets children XBlock headers to assert against them
LibraryContent XBlock configured to draw XBlocks from that library
When I go to studio unit page for library content xblock as staff
And I set library content xblock Problem Type to "Any Type" and Count to {count}
And I refresh library content xblock and pulbish unit
When I go to LMS courseware page for library content xblock as student
Then I can see {count} xblocks from the library of any type
"""
"""
self
.
_change_library_content_settings
(
count
=
count
,
capa_type
=
"Any Type"
)
self
.
_change_library_content_settings
(
count
=
count
,
capa_type
=
capa_type
)
self
.
_auto_auth
(
self
.
USERNAME
,
self
.
EMAIL
,
False
)
self
.
_auto_auth
(
self
.
USERNAME
,
self
.
EMAIL
,
False
)
self
.
_goto_library_block_page
()
self
.
_goto_library_block_page
()
children_headers
=
self
.
library_content_page
.
children_headers
return
self
.
library_content_page
.
children_headers
self
.
assertEqual
(
len
(
children_headers
),
count
)
self
.
assertLessEqual
(
children_headers
,
self
.
_problem_headers
)
@ddt.data
(
def
test_problem_type_selector
(
self
):
(
'Choice Group'
,
1
,
[
"Problem Choice Group 1"
,
"Problem Choice Group 2"
]),
(
'Select Option'
,
2
,
[
"Problem Select 1"
,
"Problem Select 2"
]),
)
@ddt.unpack
def
test_capa_type_shows_only_chosen_type
(
self
,
capa_type
,
count
,
expected_headers
):
"""
"""
Scenario: Ensure setting "
{capa_type}" for Problem Type draws aonly problem of {capa_type} from library
Scenario: Ensure setting "
Any Type" for Problem Type does not filter out Problems
Given I have a library with two "Select Option" and two "Choice Group" problems, and a course containing
Given I have a library with two "Select Option" and two "Choice Group" problems, and a course containing
LibraryContent XBlock configured to draw XBlocks from that library
LibraryContent XBlock configured to draw XBlocks from that library
When I go to studio unit page for library content xblock as staff
When I set library content xblock Problem Type to "Any Type" and Count to 3 and publish unit
And I set library content xblock Problem Type to "{capa_type}" and Count to {count}
When I go to LMS courseware page for library content xblock as student
And I refresh library content xblock and pulbish unit
Then I can see 3 xblocks from the library of any type
When I set library content xblock Problem Type to "Choice Group" and Count to 1 and publish unit
When I go to LMS courseware page for library content xblock as student
When I go to LMS courseware page for library content xblock as student
Then I can see {count} xblocks from the library of {capa_type}
Then I can see 1 xblock from the library of "Choice Group" type
When I set library content xblock Problem Type to "Select Option" and Count to 2 and publish unit
When I go to LMS courseware page for library content xblock as student
Then I can see 2 xblock from the library of "Select Option" type
When I set library content xblock Problem Type to "Matlab" and Count to 2 and publish unit
When I go to LMS courseware page for library content xblock as student
Then I can see 0 xblocks from the library
"""
"""
self
.
_change_library_content_settings
(
count
=
count
,
capa_type
=
capa_type
)
children_headers
=
self
.
_set_library_content_settings
(
count
=
3
,
capa_type
=
"Any Type"
)
self
.
_auto_auth
(
self
.
USERNAME
,
self
.
EMAIL
,
False
)
self
.
assertEqual
(
len
(
children_headers
),
3
)
self
.
_goto_library_block_page
()
children_headers
=
self
.
library_content_page
.
children_headers
self
.
assertEqual
(
len
(
children_headers
),
count
)
self
.
assertLessEqual
(
children_headers
,
self
.
_problem_headers
)
self
.
assertLessEqual
(
children_headers
,
self
.
_problem_headers
)
self
.
assertLessEqual
(
children_headers
,
set
(
map
(
lambda
header
:
header
.
upper
(),
expected_headers
)))
def
test_missing_capa_type_shows_none
(
self
):
# Choice group test
"""
children_headers
=
self
.
_set_library_content_settings
(
count
=
1
,
capa_type
=
"Choice Group"
)
Scenario: Ensure setting "{capa_type}" for Problem Type that is not present in library results in empty XBlock
self
.
assertEqual
(
len
(
children_headers
),
1
)
Given I have a library with two "Select Option" and two "Choice Group" problems, and a course containing
self
.
assertLessEqual
(
LibraryContent XBlock configured to draw XBlocks from that library
children_headers
,
When I go to studio unit page for library content xblock as staff
set
(
map
(
lambda
header
:
header
.
upper
(),
[
"Problem Choice Group 1"
,
"Problem Choice Group 2"
]))
And I set library content xblock Problem Type to type not present in library
)
And I refresh library content xblock and pulbish unit
When I go to LMS courseware page for library content xblock as student
# Choice group test
Then I can see no xblocks
children_headers
=
self
.
_set_library_content_settings
(
count
=
2
,
capa_type
=
"Select Option"
)
"""
self
.
assertEqual
(
len
(
children_headers
),
2
)
self
.
_change_library_content_settings
(
count
=
1
,
capa_type
=
"Matlab"
)
self
.
assertLessEqual
(
self
.
_auto_auth
(
self
.
USERNAME
,
self
.
EMAIL
,
False
)
children_headers
,
self
.
_goto_library_block_page
()
set
(
map
(
lambda
header
:
header
.
upper
(),
[
"Problem Select 1"
,
"Problem Select 2"
]))
children_headers
=
self
.
library_content_page
.
children_headers
)
self
.
assertEqual
(
len
(
children_headers
),
0
)
# Missing problem type test
children_headers
=
self
.
_set_library_content_settings
(
count
=
2
,
capa_type
=
"Matlab"
)
self
.
assertEqual
(
children_headers
,
set
())
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