Commit 58620643 authored by Łukasz Nowak's avatar Łukasz Nowak

Test Computer.

For now check functionality of variation_property_list property.
parent 4757cebe
##############################################################################
#
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment