Commit 9be120e4 authored by Rafael Monnerat's avatar Rafael Monnerat

erp5_computer_immobilisation: Start to test for CodingStyle

 - Missing init script:
     This script is declared on portal type, so we need a default value,
     even if we always overwrite it on sub projects.
 - Bad identation
 - Fixup proxy fields consistency
 - Prefer use assertIn instead assertTrue(a in b)
parent d3d302b2
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputeNode_init</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -58,12 +58,6 @@ ...@@ -58,12 +58,6 @@
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -93,23 +87,4 @@ ...@@ -93,23 +87,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/portal_categories/activity/getCategoryChildTranslatedLogicalPathItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -58,12 +58,6 @@ ...@@ -58,12 +58,6 @@
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -93,23 +87,4 @@ ...@@ -93,23 +87,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/portal_categories/activity/getCategoryChildTranslatedLogicalPathItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -58,12 +58,6 @@ ...@@ -58,12 +58,6 @@
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -93,23 +87,4 @@ ...@@ -93,23 +87,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/portal_categories/activity/getCategoryChildTranslatedLogicalPathItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -58,12 +58,6 @@ ...@@ -58,12 +58,6 @@
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -93,23 +87,4 @@ ...@@ -93,23 +87,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/portal_categories/activity/getCategoryChildTranslatedLogicalPathItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -25,7 +25,7 @@ class TestComputerWithComputerModel(ERP5TypeTestCase): ...@@ -25,7 +25,7 @@ class TestComputerWithComputerModel(ERP5TypeTestCase):
self.assertEqual(computer.getPropertyList('group'), []) self.assertEqual(computer.getPropertyList('group'), [])
result = computer.Computer_applyComputerModel() result = computer.Computer_applyComputerModel()
self.assertEqual(computer.getPropertyList('group'), category_list) self.assertEqual(computer.getPropertyList('group'), category_list)
self.assertTrue('=Computer%20Model%20applied.' in result, result) self.assertIn('=Computer%20Model%20applied.', result)
def test_apply_model_empty_computer_batch_mode(self): def test_apply_model_empty_computer_batch_mode(self):
category_list = ['mana', 'mahna'] category_list = ['mana', 'mahna']
...@@ -73,7 +73,7 @@ class TestComputerWithComputerModel(ERP5TypeTestCase): ...@@ -73,7 +73,7 @@ class TestComputerWithComputerModel(ERP5TypeTestCase):
result = computer.Computer_applyComputerModel(force=1) result = computer.Computer_applyComputerModel(force=1)
self.assertEqual(computer.getPropertyList('group'), self.assertEqual(computer.getPropertyList('group'),
category_list) category_list)
self.assertTrue('=Computer%20Model%20applied.' in result, result) self.assertIn('=Computer%20Model%20applied.', result)
def test_apply_model_filled_computer_force_batch_mode(self): def test_apply_model_filled_computer_force_batch_mode(self):
computer_category_list = ['oink'] computer_category_list = ['oink']
...@@ -91,7 +91,7 @@ class TestComputerWithComputerModel(ERP5TypeTestCase): ...@@ -91,7 +91,7 @@ class TestComputerWithComputerModel(ERP5TypeTestCase):
def test_apply_no_model(self): def test_apply_no_model(self):
computer = self.newComputer() computer = self.newComputer()
result = computer.Computer_applyComputerModel() result = computer.Computer_applyComputerModel()
self.assertTrue('=No%20Computer%20Model.' in result, result) self.assertIn('=No%20Computer%20Model.', result)
def test_apply_no_model_batch_mode(self): def test_apply_no_model_batch_mode(self):
computer = self.newComputer() computer = self.newComputer()
...@@ -124,7 +124,7 @@ class TestComputerWithComputerModel(ERP5TypeTestCase): ...@@ -124,7 +124,7 @@ class TestComputerWithComputerModel(ERP5TypeTestCase):
computer = self.newComputer(specialise_value=model) computer = self.newComputer(specialise_value=model)
result = computer.Computer_applyComputerModel() result = computer.Computer_applyComputerModel()
self.assertSameSet(category_list, computer.getCategoryList()) self.assertSameSet(category_list, computer.getCategoryList())
self.assertTrue('=Computer%20Model%20applied.', result) self.assertIn('=Computer%20Model%20applied.', result)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
...@@ -10,6 +10,12 @@ ...@@ -10,6 +10,12 @@
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testComputerWithComputerModel</string> </value> <value> <string>testComputerWithComputerModel</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testComputerWithComputerModel</string> </value> <value> <string>test.erp5.testComputerWithComputerModel</string> </value>
......
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