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
b6614f69
Commit
b6614f69
authored
Feb 04, 2013
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add initial test that only tests the descriptor
parent
e0fb906c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletions
+55
-1
common/lib/xmodule/xmodule/randomize_module.py
+0
-1
common/lib/xmodule/xmodule/tests/test_randomize_module.py
+55
-0
No files found.
common/lib/xmodule/xmodule/randomize_module.py
View file @
b6614f69
...
@@ -61,7 +61,6 @@ class RandomizeModule(XModule):
...
@@ -61,7 +61,6 @@ class RandomizeModule(XModule):
else
:
else
:
self
.
choice
=
random
.
randrange
(
0
,
num_choices
)
self
.
choice
=
random
.
randrange
(
0
,
num_choices
)
log
.
debug
(
"********* self.choice =
%
s"
,
self
.
choice
)
if
self
.
choice
is
not
None
:
if
self
.
choice
is
not
None
:
self
.
child_descriptor
=
self
.
descriptor
.
get_children
()[
self
.
choice
]
self
.
child_descriptor
=
self
.
descriptor
.
get_children
()[
self
.
choice
]
# Now get_children() should return a list with one element
# Now get_children() should return a list with one element
...
...
common/lib/xmodule/xmodule/tests/test_randomize_module.py
0 → 100644
View file @
b6614f69
import
unittest
from
time
import
strptime
from
fs.memoryfs
import
MemoryFS
from
mock
import
Mock
,
patch
from
xmodule.modulestore.xml
import
ImportSystem
,
XMLModuleStore
ORG
=
'test_org'
COURSE
=
'test_course'
START
=
'2013-01-01T01:00:00'
from
test_course_module
import
DummySystem
as
DummyImportSystem
from
.
import
test_system
class
RandomizeModuleTestCase
(
unittest
.
TestCase
):
"""Make sure the randomize module works"""
@staticmethod
def
get_dummy_course
(
start
):
"""Get a dummy course"""
system
=
DummyImportSystem
(
load_error_modules
=
True
)
def
to_attrb
(
n
,
v
):
return
''
if
v
is
None
else
'{0}="{1}"'
.
format
(
n
,
v
)
.
lower
()
start_xml
=
'''
<course org="{org}" course="{course}"
graceperiod="1 day" url_name="test"
start="{start}"
>
<chapter url="hi" url_name="ch" display_name="CH">
<randomize url_name="my_randomize">
<html url_name="a" display_name="A">Two houses, ...</html>
<html url_name="b" display_name="B">Three houses, ...</html>
</randomize>
</chapter>
</course>
'''
.
format
(
org
=
ORG
,
course
=
COURSE
,
start
=
start
)
return
system
.
process_xml
(
start_xml
)
def
test_import
(
self
):
"""
Just make sure descriptor loads without error
"""
descriptor
=
self
.
get_dummy_course
(
START
)
# TODO: add tests that create a module and check. Passing state is a good way to
# check that child access works...
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