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
2ed1e3d8
Commit
2ed1e3d8
authored
Jun 05, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for survey question format.
parent
1617c71e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
+24
-7
djangoapps/student/tests.py
+24
-7
No files found.
djangoapps/student/tests.py
View file @
2ed1e3d8
...
...
@@ -6,11 +6,28 @@ Replace this with more appropriate tests for your application.
"""
from
django.test
import
TestCase
from
survey_questions
import
exit_survey_questions
class
SimpleTest
(
TestCase
):
def
test_basic_addition
(
self
):
"""
Tests that 1 + 1 always equals 2.
"""
self
.
assertEqual
(
1
+
1
,
2
)
class
ExitSurveyTest
(
TestCase
):
def
test_unique_names
(
self
):
question_names
=
set
()
for
question
in
exit_survey_questions
[
'common_questions'
]
+
exit_survey_questions
[
'random_questions'
]:
name
=
question
[
'question_name'
]
self
.
assertFalse
(
name
in
question_names
,
"There is a duplicate of name "
+
name
)
question_names
.
add
(
name
)
def
test_question_format
(
self
):
for
question
in
exit_survey_questions
[
'common_questions'
]
+
exit_survey_questions
[
'random_questions'
]:
self
.
assertTrue
(
'question_name'
in
question
,
"All questions need a question_name. Failed on: "
+
str
(
question
)
)
self
.
assertTrue
(
'label'
in
question
,
"All questions need a label. Failed on: "
+
str
(
question
)
)
question_type
=
question
[
'type'
]
if
question_type
==
'checkbox'
or
question_type
==
'short_field'
:
# No other required fields
pass
elif
question_type
==
'radio'
or
question_type
==
'select_many'
:
self
.
assertTrue
(
'choices'
in
question
,
"All radio/select_many questions need choices. Failed on: "
+
str
(
question
)
)
else
:
self
.
assertTrue
(
False
,
"Found illegal question type. Failed on: "
+
str
(
question
)
)
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