Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
58620643
Commit
58620643
authored
Jan 04, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test Computer.
For now check functionality of variation_property_list property.
parent
4757cebe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
0 deletions
+88
-0
product/ERP5/tests/testComputer.py
product/ERP5/tests/testComputer.py
+88
-0
No files found.
product/ERP5/tests/testComputer.py
0 → 100644
View file @
58620643
##############################################################################
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.Sequence
import
SequenceList
class
TestComputer
(
ERP5TypeTestCase
):
computer_portal_type
=
'Computer'
def
getBusinessTemplateList
(
self
):
return
(
'erp5_base'
,
'erp5_computer_immobilisation'
,
)
def
stepCreateComputer
(
self
,
sequence
=
None
,
**
kw
):
computer_module
=
self
.
portal
.
getDefaultModule
(
self
.
computer_portal_type
)
computer
=
computer_module
.
newContent
(
\
portal_type
=
self
.
computer_portal_type
)
computer
.
edit
(
title
=
"Computer"
)
sequence
.
edit
(
computer
=
computer
,
variation_property_list
=
[])
self
.
category_list
=
[]
# Actually, computer has no individual variation
for
base_category
in
computer
.
getVariationBaseCategoryList
():
sequence
.
edit
(
**
{
base_category
:
None
})
def
stepCheckSetVariationPropertyList
(
self
,
sequence
=
None
,
**
kw
):
"""
Check if SetVariationPropertyList exists on a resource.
And test it.
"""
computer
=
sequence
.
get
(
'computer'
)
vpl
=
[
'prop1'
,
'prop2'
]
sequence
.
edit
(
variation_property_list
=
vpl
)
computer
.
setVariationPropertyList
(
vpl
)
self
.
failIfDifferentSet
(
computer
.
variation_property_list
,
vpl
)
def
stepCheckGetVariationPropertyList
(
self
,
sequence
=
None
,
**
kw
):
computer
=
sequence
.
get
(
'computer'
)
vpl
=
sequence
.
get
(
'variation_property_list'
)
self
.
failIfDifferentSet
(
computer
.
getVariationPropertyList
(),
vpl
)
def
test_variationPropertyList
(
self
):
"""
Simply test if method are well generated by the property sheet.
"""
sequence_list
=
SequenceList
()
sequence_string
=
"""
CreateComputer
CheckGetVariationPropertyList
CheckSetVariationPropertyList
CheckGetVariationPropertyList
"""
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestComputer
))
return
suite
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