Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cloud-consulting
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
cloud-consulting
Commits
05589731
Commit
05589731
authored
Oct 30, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try adding Category Sheet Question to the tests
parent
1fa358f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
2 deletions
+56
-2
product/ERP5Survey/tests/testQuestionnaire.py
product/ERP5Survey/tests/testQuestionnaire.py
+56
-2
No files found.
product/ERP5Survey/tests/testQuestionnaire.py
View file @
05589731
...
...
@@ -225,6 +225,15 @@ class TestQuestionnaire(ERP5TypeTestCase):
max_grade
=
10
,
batch_mode
=
True
)
elif
portal_type
==
'Category Sheet Question'
:
question
=
self
.
question_module
.
newContent
(
portal_type
=
portal_type
,
title
=
'Some '
+
portal_type
+
' Title'
+
title_suffix
,
comment
=
'Some Comment'
,
description
=
'Some Description'
,
category_dict
=
{},
max_grade
=
10
,
batch_mode
=
True
)
elif
portal_type
in
(
'Selection Question'
,
'Multi Selection Question'
):
question
=
self
.
question_module
.
newContent
(
portal_type
=
portal_type
,
title
=
'Some '
+
portal_type
+
' Title'
+
title_suffix
,
...
...
@@ -247,12 +256,14 @@ class TestQuestionnaire(ERP5TypeTestCase):
def
_getQuestionPortalTypeList
(
self
,
include_statement
=
True
,
everything
=
True
,
multiple_choice
=
False
):
l
=
[]
if
everything
:
l
=
[
'Boolean Question'
,
'Float Question'
,
'Integer Question'
,
'String Question'
,
'Text Question'
,
'Multi Selection Question'
,
'Selection Question'
,
'Document Question'
]
l
=
[
'Boolean Question'
,
'Float Question'
,
'Integer Question'
,
'String Question'
,
'Text Question'
,
'Multi Selection Question'
,
'Selection Question'
,
'Document Question'
,
'Category Sheet Question'
]
else
:
if
multiple_choice
:
l
=
[
'Multi Selection Question'
,
'Selection Question'
]
else
:
l
=
[
'Boolean Question'
,
'Float Question'
,
'Integer Question'
,
'String Question'
,
'Text Question'
,
'Document Question'
]
l
=
[
'Boolean Question'
,
'Float Question'
,
'Integer Question'
,
'String Question'
,
'Text Question'
,
'Document Question'
,
'Category Sheet Question'
]
if
include_statement
:
l
.
append
(
'Statement'
)
return
l
...
...
@@ -279,6 +290,8 @@ class TestQuestionnaire(ERP5TypeTestCase):
self
.
assertEquals
(
question
.
getFalseText
(),
'Absolutely not'
)
elif
portal_type
==
'Document Question'
:
self
.
assertEquals
(
question
.
getAnswerPortalType
(),
'Spreadsheet'
)
elif
portal_type
==
'Category Sheet Question'
:
self
.
assertEquals
(
question
.
getAnswerPortalType
(),
None
)
self
.
assertEquals
(
len
(
self
.
question_module
.
objectValues
()),
question_number
+
1
)
self
.
assertEquals
(
len
(
question
.
objectValues
()),
0
)
...
...
@@ -1053,6 +1066,11 @@ class TestQuestionnaire(ERP5TypeTestCase):
filename
=
'sample_attachment.ods'
file_object
=
makeFileUpload
(
filename
)
return
answer_set
.
DocumentQuestion_answerQuestion
(
file
=
file_object
,
no_answer_reason
=
no_answer_reason
,
comment
=
comment
,
start_date
=
start_date
,
int_index
=
int_index
,
batch_mode
=
True
,
simulation_mode
=
True
)
elif
portal_type
==
'Category Sheet Question'
:
if
no_answer_given
:
return
answer_set
.
CategorySheetQuestion_answerQuestion
(
no_answer_reason
=
no_answer_reason
,
comment
=
comment
,
start_date
=
start_date
,
int_index
=
int_index
,
batch_mode
=
True
)
else
:
return
answer_set
.
CategorySheetQuestion_answerQuestion
(
no_answer_reason
=
no_answer_reason
,
comment
=
comment
,
start_date
=
start_date
,
int_index
=
int_index
,
batch_mode
=
True
,
simulation_mode
=
True
)
elif
portal_type
==
'Float Question'
:
if
no_answer_given
:
return
answer_set
.
FloatQuestion_answerQuestion
(
no_answer_reason
=
no_answer_reason
,
comment
=
comment
,
start_date
=
start_date
,
int_index
=
int_index
,
batch_mode
=
True
)
...
...
@@ -1143,6 +1161,11 @@ class TestQuestionnaire(ERP5TypeTestCase):
self
.
assertEquals
(
len
(
base_category
),
2
)
self
.
_checkCategory
(
base_category
[
'base_category/category'
],
'base_category'
)
self
.
_checkCategory
(
base_category
[
'base_category/category/child_category'
],
'base_category/category'
,
id
=
'child_category'
,
title
=
'Child Category'
,
reference
=
'CHILD'
,
codification
=
'CHILD'
,
description
=
'Child Category Description'
)
elif
portal_type
==
'Category Sheet Question'
:
if
no_answer_given
:
self
.
assertEquals
(
11
,
len
(
answer
.
getCategoryDict
()))
else
:
self
.
assertEquals
({},
answer
.
getCategoryDict
())
elif
portal_type
==
'Float Question'
:
if
no_answer_given
:
self
.
assertEquals
(
answer
.
getFloatValue
(),
0
)
...
...
@@ -1219,6 +1242,7 @@ class TestQuestionnaire(ERP5TypeTestCase):
self
.
assertEquals
(
question
.
objectValues
()[
i
].
getStringValue
(),
answer
.
getListValueList
()[
i
])
i
+=
1
;
def
_fillOut
(
self
,
question_list
,
answer_set
,
no_answer_given
,
url
,
answer_number
=
0
):
for
question
in
question_list
:
if
question
.
getPortalType
()
!=
'Statement'
or
len
(
answer_set
.
getAnswerHistoryList
())
==
0
:
...
...
@@ -2190,3 +2214,33 @@ class TestQuestionnaire(ERP5TypeTestCase):
else
:
self
.
fail
(
"We expect a value error when Uploading the bad spreadsheet"
)
self
.
assertTrue
(
answer
.
documentExists
())
def
test_85_CategorySheetQuestionCreation
(
self
):
self
.
_CreateQuestion
(
portal_type
=
'Category Sheet Question'
)
def
test_86_CategorySheetQuestionStateCreation
(
self
):
self
.
_CreateQuestionState
(
question_type
=
'Category Sheet Question'
)
def
test_87_FillOutCategorySheetQuestion
(
self
):
questionnaire
=
self
.
_newQuestionnaire
()
question_remove_list
=
[]
answer_set_remove_list
=
[]
self
.
userLogin
(
name
=
'assignor'
)
question
=
self
.
_newQuestion
(
portal_type
=
'Category Sheet Question'
)
question_remove_list
.
append
(
question
.
getId
())
author
=
self
.
createUserAndLogin
(
role_list
=
[
'Author'
],
name
=
'author'
)
answer_set
=
self
.
_newAnswerSet
(
person
=
author
)
answer_set_remove_list
.
append
(
answer_set
.
getId
())
answer
=
self
.
_newAnswer
(
answer_set
=
answer_set
,
question
=
question
)
self
.
assertNotEquals
(
None
,
questionnaire
)
self
.
assertEquals
(
None
,
answer
.
getCategoryDict
())
self
.
_newQuestionState
(
questionnaire
=
questionnaire
,
question
=
question
)
self
.
_answerQuestion
(
question
=
question
,
answer_set
=
answer_set
)
self
.
assertEquals
(
None
,
answer
.
getCategoryDict
())
self
.
clear_module_list
=
[
self
.
question_module
,
question_remove_list
,
self
.
answer_set_module
,
answer_set_remove_list
]
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