Commit 2785a5cc authored by Jérome Perrin's avatar Jérome Perrin

testBusinessTemplate: use better assert methods (assertIn)

parent 382ab989
...@@ -399,17 +399,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -399,17 +399,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
skins_tool = self.getSkinsTool() skins_tool = self.getSkinsTool()
for skin_name, selection in skins_tool.getSkinPaths(): for skin_name, selection in skins_tool.getSkinPaths():
if skin_name == 'View': if skin_name == 'View':
self.assertFalse('erp5_csv_style' in selection) self.assertNotIn('erp5_csv_style', selection)
self.assertFalse('erp5_core' not in selection) self.assertIn('erp5_core', selection)
self.assertFalse('erp5_xhtml_style' not in selection) self.assertIn('erp5_xhtml_style', selection)
if skin_name == 'Print': if skin_name == 'Print':
self.assertFalse('erp5_xhtml_style' in selection) self.assertIn('erp5_xhtml_style', selection)
self.assertFalse('erp5_csv_style' in selection) self.assertIn('erp5_csv_style', selection)
self.assertFalse('erp5_core' not in selection) self.assertNotIn('erp5_core', selection)
if skin_name == 'CSV': if skin_name == 'CSV':
self.assertFalse('erp5_xhtml_style' in selection) self.assertNotIn('erp5_xhtml_style', selection)
self.assertFalse('erp5_core' not in selection) self.assertIn('erp5_core', selection)
self.assertFalse('erp5_csv_style' not in selection) self.assertIn('erp5_csv_style', selection)
def stepCheckNoTrashBin(self, sequence=None, **kw): def stepCheckNoTrashBin(self, sequence=None, **kw):
""" """
...@@ -436,7 +436,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -436,7 +436,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
trash_ids = list(trash.objectIds()) trash_ids = list(trash.objectIds())
self.assertEqual(len(trash.objectIds()), 1) self.assertEqual(len(trash.objectIds()), 1)
bt_id = sequence.get('import_bt').getId() bt_id = sequence.get('import_bt').getId()
self.assertTrue(bt_id not in trash_ids[0]) self.assertNotIn(bt_id, trash_ids[0])
# portal types # portal types
def stepCreatePortalType(self, sequence=None, **kw): def stepCreatePortalType(self, sequence=None, **kw):
...@@ -1528,7 +1528,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1528,7 +1528,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
object_id = sequence.get('object_ptype_id') object_id = sequence.get('object_ptype_id')
object_pt = pt._getOb(object_id) object_pt = pt._getOb(object_id)
action_id = sequence.get('first_action_id') action_id = sequence.get('first_action_id')
self.assertTrue(action_id in [x.getReference() self.assertIn(action_id, [x.getReference()
for x in object_pt.getActionInformationList()]) for x in object_pt.getActionInformationList()])
def stepCheckFirstActionNotExists(self, sequence=None, **kw): def stepCheckFirstActionNotExists(self, sequence=None, **kw):
...@@ -1539,7 +1539,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1539,7 +1539,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
object_id = sequence.get('object_ptype_id') object_id = sequence.get('object_ptype_id')
object_pt = pt._getOb(object_id) object_pt = pt._getOb(object_id)
action_id = sequence.get('first_action_id') action_id = sequence.get('first_action_id')
self.assertFalse(action_id in [x.getReference() self.assertNotIn(action_id, [x.getReference()
for x in object_pt.getActionInformationList()]) for x in object_pt.getActionInformationList()])
def stepCheckSecondActionExists(self, sequence=None, **kw): def stepCheckSecondActionExists(self, sequence=None, **kw):
...@@ -1550,7 +1550,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1550,7 +1550,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
object_id = sequence.get('object_ptype_id') object_id = sequence.get('object_ptype_id')
object_pt = pt._getOb(object_id) object_pt = pt._getOb(object_id)
action_id = sequence.get('second_action_id') action_id = sequence.get('second_action_id')
self.assertTrue(action_id in [x.getReference() self.assertIn(action_id, [x.getReference()
for x in object_pt.getActionInformationList()]) for x in object_pt.getActionInformationList()])
def stepCheckSecondActionNotExists(self, sequence=None, **kw): def stepCheckSecondActionNotExists(self, sequence=None, **kw):
...@@ -1561,7 +1561,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1561,7 +1561,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
object_id = sequence.get('object_ptype_id') object_id = sequence.get('object_ptype_id')
object_pt = pt._getOb(object_id) object_pt = pt._getOb(object_id)
action_id = sequence.get('second_action_id') action_id = sequence.get('second_action_id')
self.assertFalse(action_id in [x.getReference() self.assertNotIn(action_id, [x.getReference()
for x in object_pt.getActionInformationList()]) for x in object_pt.getActionInformationList()])
def stepAddSecondActionToBusinessTemplate(self, sequence=None, **kw): def stepAddSecondActionToBusinessTemplate(self, sequence=None, **kw):
...@@ -1713,7 +1713,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1713,7 +1713,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
zsql_method = catalog._getOb(method_id, None) zsql_method = catalog._getOb(method_id, None)
self.assertNotEqual(zsql_method, None) self.assertNotEqual(zsql_method, None)
# check catalog properties # check catalog properties
self.assertTrue(method_id in catalog.sql_uncatalog_object) self.assertIn(method_id, catalog.sql_uncatalog_object)
# check filter # check filter
filter_dict = catalog.filter_dict[method_id] filter_dict = catalog.filter_dict[method_id]
self.assertEqual(filter_dict['filtered'], 1) self.assertEqual(filter_dict['filtered'], 1)
...@@ -1729,7 +1729,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1729,7 +1729,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
zsql_method = catalog._getOb(method_id, None) zsql_method = catalog._getOb(method_id, None)
self.assertNotEqual(zsql_method, None) self.assertNotEqual(zsql_method, None)
# check catalog properties # check catalog properties
self.assertTrue(method_id in catalog.sql_uncatalog_object) self.assertIn(method_id, catalog.sql_uncatalog_object)
# check filter # check filter
filter_dict = catalog.filter_dict[method_id] filter_dict = catalog.filter_dict[method_id]
self.assertEqual(filter_dict['filtered'], 1) self.assertEqual(filter_dict['filtered'], 1)
...@@ -1748,9 +1748,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1748,9 +1748,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
zsql_method = catalog._getOb(method_id, None) zsql_method = catalog._getOb(method_id, None)
self.assertTrue(zsql_method is None) self.assertTrue(zsql_method is None)
# check catalog properties # check catalog properties
self.assertTrue(method_id not in catalog.sql_uncatalog_object) self.assertNotIn(method_id, catalog.sql_uncatalog_object)
# check filter # check filter
self.assertTrue(method_id not in catalog.filter_dict.keys()) self.assertNotIn(method_id, catalog.filter_dict.keys())
def stepRemoveCatalogMethod(self, sequence=None, **kw): def stepRemoveCatalogMethod(self, sequence=None, **kw):
""" """
...@@ -1768,10 +1768,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1768,10 +1768,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
sql_uncatalog_object.remove(method_id) sql_uncatalog_object.remove(method_id)
sql_uncatalog_object.sort() sql_uncatalog_object.sort()
catalog.sql_uncatalog_object = tuple(sql_uncatalog_object) catalog.sql_uncatalog_object = tuple(sql_uncatalog_object)
self.assertTrue(method_id not in catalog.sql_uncatalog_object) self.assertNotIn(method_id, catalog.sql_uncatalog_object)
# remove filter # remove filter
del catalog.filter_dict[method_id] del catalog.filter_dict[method_id]
self.assertTrue(method_id not in catalog.filter_dict.keys()) self.assertNotIn(method_id, catalog.filter_dict.keys())
# Related key, Result key and table, and others # Related key, Result key and table, and others
def stepCreateKeysAndTable(self, sequence=list, **kw): def stepCreateKeysAndTable(self, sequence=list, **kw):
...@@ -1799,84 +1799,84 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1799,84 +1799,84 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
sql_search_tables.append(result_table) sql_search_tables.append(result_table)
sql_search_tables.sort() sql_search_tables.sort()
catalog.sql_search_tables = tuple(sql_search_tables) catalog.sql_search_tables = tuple(sql_search_tables)
self.assertTrue(result_table in catalog.sql_search_tables) self.assertIn(result_table, catalog.sql_search_tables)
# result key # result key
if result_key not in catalog.sql_search_result_keys: if result_key not in catalog.sql_search_result_keys:
sql_search_result_keys = list(catalog.sql_search_result_keys) sql_search_result_keys = list(catalog.sql_search_result_keys)
sql_search_result_keys.append(result_key) sql_search_result_keys.append(result_key)
sql_search_result_keys.sort() sql_search_result_keys.sort()
catalog.sql_search_result_keys = tuple(sql_search_result_keys) catalog.sql_search_result_keys = tuple(sql_search_result_keys)
self.assertTrue(result_key in catalog.sql_search_result_keys) self.assertIn(result_key, catalog.sql_search_result_keys)
# related key # related key
if related_key not in catalog.sql_catalog_related_keys: if related_key not in catalog.sql_catalog_related_keys:
sql_search_related_keys = list(catalog.sql_catalog_related_keys) sql_search_related_keys = list(catalog.sql_catalog_related_keys)
sql_search_related_keys.append(related_key) sql_search_related_keys.append(related_key)
sql_search_related_keys.sort() sql_search_related_keys.sort()
catalog.sql_catalog_related_keys = tuple(sql_search_related_keys) catalog.sql_catalog_related_keys = tuple(sql_search_related_keys)
self.assertTrue(related_key in catalog.sql_catalog_related_keys) self.assertIn(related_key, catalog.sql_catalog_related_keys)
# search keys # search keys
if search_key not in catalog.sql_catalog_search_keys: if search_key not in catalog.sql_catalog_search_keys:
sql_catalog_search_keys = list(catalog.sql_catalog_search_keys) sql_catalog_search_keys = list(catalog.sql_catalog_search_keys)
sql_catalog_search_keys.append(search_key) sql_catalog_search_keys.append(search_key)
sql_catalog_search_keys.sort() sql_catalog_search_keys.sort()
catalog.sql_catalog_search_keys = tuple(sql_catalog_search_keys) catalog.sql_catalog_search_keys = tuple(sql_catalog_search_keys)
self.assertTrue(search_key in catalog.sql_catalog_search_keys) self.assertIn(search_key, catalog.sql_catalog_search_keys)
# keyword keys # keyword keys
if keyword_key not in catalog.sql_catalog_keyword_search_keys: if keyword_key not in catalog.sql_catalog_keyword_search_keys:
sql_catalog_keyword_keys = list(catalog.sql_catalog_keyword_search_keys) sql_catalog_keyword_keys = list(catalog.sql_catalog_keyword_search_keys)
sql_catalog_keyword_keys.append(keyword_key) sql_catalog_keyword_keys.append(keyword_key)
sql_catalog_keyword_keys.sort() sql_catalog_keyword_keys.sort()
catalog.sql_catalog_keyword_search_keys = tuple(sql_catalog_keyword_keys) catalog.sql_catalog_keyword_search_keys = tuple(sql_catalog_keyword_keys)
self.assertTrue(keyword_key in catalog.sql_catalog_keyword_search_keys) self.assertIn(keyword_key, catalog.sql_catalog_keyword_search_keys)
# full_text keys # full_text keys
if full_text_key not in catalog.sql_catalog_full_text_search_keys: if full_text_key not in catalog.sql_catalog_full_text_search_keys:
sql_catalog_full_text_keys = list(catalog.sql_catalog_full_text_search_keys) sql_catalog_full_text_keys = list(catalog.sql_catalog_full_text_search_keys)
sql_catalog_full_text_keys.append(full_text_key) sql_catalog_full_text_keys.append(full_text_key)
sql_catalog_full_text_keys.sort() sql_catalog_full_text_keys.sort()
catalog.sql_catalog_full_text_search_keys = tuple(sql_catalog_full_text_keys) catalog.sql_catalog_full_text_search_keys = tuple(sql_catalog_full_text_keys)
self.assertTrue(full_text_key in catalog.sql_catalog_full_text_search_keys) self.assertIn(full_text_key, catalog.sql_catalog_full_text_search_keys)
# request # request
if request_key not in catalog.sql_catalog_request_keys: if request_key not in catalog.sql_catalog_request_keys:
sql_catalog_request_keys = list(catalog.sql_catalog_request_keys) sql_catalog_request_keys = list(catalog.sql_catalog_request_keys)
sql_catalog_request_keys.append(request_key) sql_catalog_request_keys.append(request_key)
sql_catalog_request_keys.sort() sql_catalog_request_keys.sort()
catalog.sql_catalog_request_keys = tuple(sql_catalog_request_keys) catalog.sql_catalog_request_keys = tuple(sql_catalog_request_keys)
self.assertTrue(request_key in catalog.sql_catalog_request_keys) self.assertIn(request_key, catalog.sql_catalog_request_keys)
# multivalue # multivalue
if multivalue_key not in catalog.sql_catalog_multivalue_keys: if multivalue_key not in catalog.sql_catalog_multivalue_keys:
sql_catalog_multivalue_keys = list(catalog.sql_catalog_multivalue_keys) sql_catalog_multivalue_keys = list(catalog.sql_catalog_multivalue_keys)
sql_catalog_multivalue_keys.append(multivalue_key) sql_catalog_multivalue_keys.append(multivalue_key)
sql_catalog_multivalue_keys.sort() sql_catalog_multivalue_keys.sort()
catalog.sql_catalog_multivalue_keys = tuple(sql_catalog_multivalue_keys) catalog.sql_catalog_multivalue_keys = tuple(sql_catalog_multivalue_keys)
self.assertTrue(multivalue_key in catalog.sql_catalog_multivalue_keys) self.assertIn(multivalue_key, catalog.sql_catalog_multivalue_keys)
# topic keys # topic keys
if topic_key not in catalog.sql_catalog_topic_search_keys: if topic_key not in catalog.sql_catalog_topic_search_keys:
sql_catalog_topic_keys = list(catalog.sql_catalog_topic_search_keys) sql_catalog_topic_keys = list(catalog.sql_catalog_topic_search_keys)
sql_catalog_topic_keys.append(topic_key) sql_catalog_topic_keys.append(topic_key)
sql_catalog_topic_keys.sort() sql_catalog_topic_keys.sort()
catalog.sql_catalog_topic_search_keys = tuple(sql_catalog_topic_keys) catalog.sql_catalog_topic_search_keys = tuple(sql_catalog_topic_keys)
self.assertTrue(topic_key in catalog.sql_catalog_topic_search_keys) self.assertIn(topic_key, catalog.sql_catalog_topic_search_keys)
# scriptable keys # scriptable keys
if scriptable_key not in catalog.sql_catalog_scriptable_keys: if scriptable_key not in catalog.sql_catalog_scriptable_keys:
sql_catalog_scriptable_keys = list(catalog.sql_catalog_scriptable_keys) sql_catalog_scriptable_keys = list(catalog.sql_catalog_scriptable_keys)
sql_catalog_scriptable_keys.append(scriptable_key) sql_catalog_scriptable_keys.append(scriptable_key)
sql_catalog_scriptable_keys.sort() sql_catalog_scriptable_keys.sort()
catalog.sql_catalog_scriptable_keys = tuple(sql_catalog_scriptable_keys) catalog.sql_catalog_scriptable_keys = tuple(sql_catalog_scriptable_keys)
self.assertTrue(scriptable_key in catalog.sql_catalog_scriptable_keys) self.assertIn(scriptable_key, catalog.sql_catalog_scriptable_keys)
# role keys # role keys
if role_key not in catalog.sql_catalog_role_keys: if role_key not in catalog.sql_catalog_role_keys:
sql_catalog_role_keys = list(catalog.sql_catalog_role_keys) sql_catalog_role_keys = list(catalog.sql_catalog_role_keys)
sql_catalog_role_keys.append(role_key) sql_catalog_role_keys.append(role_key)
sql_catalog_role_keys.sort() sql_catalog_role_keys.sort()
catalog.sql_catalog_role_keys = tuple(sql_catalog_role_keys) catalog.sql_catalog_role_keys = tuple(sql_catalog_role_keys)
self.assertTrue(role_key in catalog.sql_catalog_role_keys) self.assertIn(role_key, catalog.sql_catalog_role_keys)
# local_role keys # local_role keys
if local_role_key not in catalog.sql_catalog_local_role_keys: if local_role_key not in catalog.sql_catalog_local_role_keys:
sql_catalog_local_role_keys = list(catalog.sql_catalog_local_role_keys) sql_catalog_local_role_keys = list(catalog.sql_catalog_local_role_keys)
sql_catalog_local_role_keys.append(local_role_key) sql_catalog_local_role_keys.append(local_role_key)
sql_catalog_local_role_keys.sort() sql_catalog_local_role_keys.sort()
catalog.sql_catalog_local_role_keys = tuple(sql_catalog_local_role_keys) catalog.sql_catalog_local_role_keys = tuple(sql_catalog_local_role_keys)
self.assertTrue(local_role_key in catalog.sql_catalog_local_role_keys) self.assertIn(local_role_key, catalog.sql_catalog_local_role_keys)
sequence.edit(related_key=related_key, result_key=result_key, sequence.edit(related_key=related_key, result_key=result_key,
result_table=result_table, search_key=search_key, result_table=result_table, search_key=search_key,
...@@ -1915,10 +1915,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1915,10 +1915,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
# method related configuration # method related configuration
self.assertEqual(catalog.sql_getitem_by_uid, 'z_getitem_by_uid_2') self.assertEqual(catalog.sql_getitem_by_uid, 'z_getitem_by_uid_2')
# table related configuration # table related configuration
self.assertTrue('translation' in catalog.sql_search_tables) self.assertIn('translation', catalog.sql_search_tables)
# column related configuration # column related configuration
self.assertTrue('catalog.reference' self.assertIn('catalog.reference',
in catalog.sql_search_result_keys) catalog.sql_search_result_keys)
def stepModifyRelatedKey(self, sequence): def stepModifyRelatedKey(self, sequence):
catalog = self.getCatalogTool().getSQLCatalog() catalog = self.getCatalogTool().getSQLCatalog()
...@@ -1943,8 +1943,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1943,8 +1943,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
# stepModifyRelatedKey added related_key_2 and removed related_key # stepModifyRelatedKey added related_key_2 and removed related_key
# but the reinstallation of the BT replaced related_key_2 with # but the reinstallation of the BT replaced related_key_2 with
# related_key: # related_key:
self.assertTrue(related_key in related_key_list) self.assertIn(related_key, related_key_list)
self.assertFalse(related_key_2 in related_key_list) self.assertNotIn(related_key_2, related_key_list)
# make sure there's only one entry # make sure there's only one entry
self.assertTrue(related_key.startswith('fake_id |'), related_key) self.assertTrue(related_key.startswith('fake_id |'), related_key)
self.assertEqual(len([key for key in related_key_list self.assertEqual(len([key for key in related_key_list
...@@ -1955,8 +1955,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1955,8 +1955,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
related_key = sequence['related_key'] related_key = sequence['related_key']
related_key_2 = sequence['related_key_2'] related_key_2 = sequence['related_key_2']
related_key_list = list(catalog.sql_catalog_related_keys) related_key_list = list(catalog.sql_catalog_related_keys)
self.assertTrue(related_key in related_key_list) self.assertIn(related_key, related_key_list)
self.assertFalse(related_key_2 in related_key_list) self.assertNotIn(related_key_2, related_key_list)
# we manually duplicate the key in the list, creating an invalid situation # we manually duplicate the key in the list, creating an invalid situation
self.assertEqual(len([key for key in related_key_list self.assertEqual(len([key for key in related_key_list
if key.startswith('fake_id |')]), 1) if key.startswith('fake_id |')]), 1)
...@@ -1975,8 +1975,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1975,8 +1975,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
# This also means that an uninstallation of a BT does not # This also means that an uninstallation of a BT does not
# accidentally removes an overriding key from another BT that # accidentally removes an overriding key from another BT that
# depends on it. # depends on it.
self.assertFalse(related_key in related_key_list) self.assertNotIn(related_key, related_key_list)
self.assertTrue(related_key_2 in related_key_list) self.assertIn(related_key_2, related_key_list)
self.assertEqual(len([key for key in related_key_list self.assertEqual(len([key for key in related_key_list
if key.startswith('fake_id |')]), 1) if key.startswith('fake_id |')]), 1)
...@@ -1995,19 +1995,19 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -1995,19 +1995,19 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
sql_search_result_keys.remove(result_key) sql_search_result_keys.remove(result_key)
sql_search_result_keys.sort() sql_search_result_keys.sort()
catalog.sql_search_result_keys = tuple(sql_search_result_keys) catalog.sql_search_result_keys = tuple(sql_search_result_keys)
self.assertTrue(result_key not in catalog.sql_search_result_keys) self.assertNotIn(result_key, catalog.sql_search_result_keys)
# search table # search table
sql_search_tables = list(catalog.sql_search_tables) sql_search_tables = list(catalog.sql_search_tables)
sql_search_tables.remove(result_table) sql_search_tables.remove(result_table)
sql_search_tables.sort() sql_search_tables.sort()
catalog.sql_search_tables = tuple(sql_search_tables) catalog.sql_search_tables = tuple(sql_search_tables)
self.assertFalse(result_table in catalog.sql_search_tables) self.assertNotIn(result_table, catalog.sql_search_tables)
# related key # related key
related_key_2 = sequence['related_key_2'] related_key_2 = sequence['related_key_2']
sql_catalog_related_keys = list(catalog.sql_catalog_related_keys) sql_catalog_related_keys = list(catalog.sql_catalog_related_keys)
sql_catalog_related_keys.remove(related_key_2) sql_catalog_related_keys.remove(related_key_2)
catalog.sql_catalog_related_keys = tuple(sql_catalog_related_keys) catalog.sql_catalog_related_keys = tuple(sql_catalog_related_keys)
self.assertFalse(related_key_2 in catalog.sql_catalog_related_keys) self.assertNotIn(related_key_2, catalog.sql_catalog_related_keys)
def stepAddKeysAndTableToBusinessTemplate(self, sequence=None, **kw): def stepAddKeysAndTableToBusinessTemplate(self, sequence=None, **kw):
""" """
...@@ -2090,73 +2090,73 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2090,73 +2090,73 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
sql_search_result_keys.remove(result_key) sql_search_result_keys.remove(result_key)
sql_search_result_keys.sort() sql_search_result_keys.sort()
catalog.sql_search_result_keys = tuple(sql_search_result_keys) catalog.sql_search_result_keys = tuple(sql_search_result_keys)
self.assertTrue(result_key not in catalog.sql_search_result_keys) self.assertNotIn(result_key, catalog.sql_search_result_keys)
# related key # related key
sql_search_related_keys = list(catalog.sql_catalog_related_keys) sql_search_related_keys = list(catalog.sql_catalog_related_keys)
sql_search_related_keys.remove(related_key) sql_search_related_keys.remove(related_key)
sql_search_related_keys.sort() sql_search_related_keys.sort()
catalog.sql_catalog_related_keys = tuple(sql_search_related_keys) catalog.sql_catalog_related_keys = tuple(sql_search_related_keys)
self.assertTrue(related_key not in catalog.sql_catalog_related_keys) self.assertNotIn(related_key, catalog.sql_catalog_related_keys)
# result table # result table
sql_search_tables = list(catalog.sql_search_tables) sql_search_tables = list(catalog.sql_search_tables)
sql_search_tables.remove(result_table) sql_search_tables.remove(result_table)
sql_search_tables.sort() sql_search_tables.sort()
catalog.sql_search_tables = tuple(sql_search_tables) catalog.sql_search_tables = tuple(sql_search_tables)
self.assertTrue(result_table not in catalog.sql_search_tables) self.assertNotIn(result_table, catalog.sql_search_tables)
# search keys # search keys
sql_catalog_search_keys = list(catalog.sql_catalog_search_keys) sql_catalog_search_keys = list(catalog.sql_catalog_search_keys)
sql_catalog_search_keys.remove(search_key) sql_catalog_search_keys.remove(search_key)
sql_catalog_search_keys.sort() sql_catalog_search_keys.sort()
catalog.sql_catalog_search_keys = tuple(sql_catalog_search_keys) catalog.sql_catalog_search_keys = tuple(sql_catalog_search_keys)
self.assertTrue(search_key not in catalog.sql_catalog_search_keys) self.assertNotIn(search_key, catalog.sql_catalog_search_keys)
# keyword keys # keyword keys
sql_catalog_keyword_keys = list(catalog.sql_catalog_keyword_search_keys) sql_catalog_keyword_keys = list(catalog.sql_catalog_keyword_search_keys)
sql_catalog_keyword_keys.remove(keyword_key) sql_catalog_keyword_keys.remove(keyword_key)
sql_catalog_keyword_keys.sort() sql_catalog_keyword_keys.sort()
catalog.sql_catalog_keyword_search_keys = tuple(sql_catalog_keyword_keys) catalog.sql_catalog_keyword_search_keys = tuple(sql_catalog_keyword_keys)
self.assertTrue(keyword_key not in catalog.sql_catalog_keyword_search_keys) self.assertNotIn(keyword_key, catalog.sql_catalog_keyword_search_keys)
# full_text keys # full_text keys
sql_catalog_full_text_keys = list(catalog.sql_catalog_full_text_search_keys) sql_catalog_full_text_keys = list(catalog.sql_catalog_full_text_search_keys)
sql_catalog_full_text_keys.remove(full_text_key) sql_catalog_full_text_keys.remove(full_text_key)
sql_catalog_full_text_keys.sort() sql_catalog_full_text_keys.sort()
catalog.sql_catalog_full_text_search_keys = tuple(sql_catalog_full_text_keys) catalog.sql_catalog_full_text_search_keys = tuple(sql_catalog_full_text_keys)
self.assertTrue(full_text_key not in catalog.sql_catalog_full_text_search_keys) self.assertNotIn(full_text_key, catalog.sql_catalog_full_text_search_keys)
# request # request
sql_catalog_request_keys = list(catalog.sql_catalog_request_keys) sql_catalog_request_keys = list(catalog.sql_catalog_request_keys)
sql_catalog_request_keys.remove(request_key) sql_catalog_request_keys.remove(request_key)
sql_catalog_request_keys.sort() sql_catalog_request_keys.sort()
catalog.sql_catalog_request_keys = tuple(sql_catalog_request_keys) catalog.sql_catalog_request_keys = tuple(sql_catalog_request_keys)
self.assertTrue(request_key not in catalog.sql_catalog_request_keys) self.assertNotIn(request_key, catalog.sql_catalog_request_keys)
# multivalue # multivalue
sql_catalog_multivalue_keys = list(catalog.sql_catalog_multivalue_keys) sql_catalog_multivalue_keys = list(catalog.sql_catalog_multivalue_keys)
sql_catalog_multivalue_keys.remove(multivalue_key) sql_catalog_multivalue_keys.remove(multivalue_key)
sql_catalog_multivalue_keys.sort() sql_catalog_multivalue_keys.sort()
catalog.sql_catalog_multivalue_keys = tuple(sql_catalog_multivalue_keys) catalog.sql_catalog_multivalue_keys = tuple(sql_catalog_multivalue_keys)
self.assertTrue(multivalue_key not in catalog.sql_catalog_multivalue_keys) self.assertNotIn(multivalue_key, catalog.sql_catalog_multivalue_keys)
# topic keys # topic keys
sql_catalog_topic_keys = list(catalog.sql_catalog_topic_search_keys) sql_catalog_topic_keys = list(catalog.sql_catalog_topic_search_keys)
sql_catalog_topic_keys.remove(topic_key) sql_catalog_topic_keys.remove(topic_key)
sql_catalog_topic_keys.sort() sql_catalog_topic_keys.sort()
catalog.sql_catalog_topic_search_keys = tuple(sql_catalog_topic_keys) catalog.sql_catalog_topic_search_keys = tuple(sql_catalog_topic_keys)
self.assertTrue(topic_key not in catalog.sql_catalog_topic_search_keys) self.assertNotIn(topic_key, catalog.sql_catalog_topic_search_keys)
# scriptable keys # scriptable keys
sql_catalog_scriptable_keys = list(catalog.sql_catalog_scriptable_keys) sql_catalog_scriptable_keys = list(catalog.sql_catalog_scriptable_keys)
sql_catalog_scriptable_keys.remove(scriptable_key) sql_catalog_scriptable_keys.remove(scriptable_key)
sql_catalog_scriptable_keys.sort() sql_catalog_scriptable_keys.sort()
catalog.sql_catalog_scriptable_keys = tuple(sql_catalog_scriptable_keys) catalog.sql_catalog_scriptable_keys = tuple(sql_catalog_scriptable_keys)
self.assertTrue(scriptable_key not in catalog.sql_catalog_scriptable_keys) self.assertNotIn(scriptable_key, catalog.sql_catalog_scriptable_keys)
# role keys # role keys
sql_catalog_role_keys = list(catalog.sql_catalog_role_keys) sql_catalog_role_keys = list(catalog.sql_catalog_role_keys)
sql_catalog_role_keys.remove(role_key) sql_catalog_role_keys.remove(role_key)
sql_catalog_role_keys.sort() sql_catalog_role_keys.sort()
catalog.sql_catalog_role_keys = tuple(sql_catalog_role_keys) catalog.sql_catalog_role_keys = tuple(sql_catalog_role_keys)
self.assertTrue(role_key not in catalog.sql_catalog_role_keys) self.assertNotIn(role_key, catalog.sql_catalog_role_keys)
# local_role keys # local_role keys
sql_catalog_local_role_keys = list(catalog.sql_catalog_local_role_keys) sql_catalog_local_role_keys = list(catalog.sql_catalog_local_role_keys)
sql_catalog_local_role_keys.remove(local_role_key) sql_catalog_local_role_keys.remove(local_role_key)
sql_catalog_local_role_keys.sort() sql_catalog_local_role_keys.sort()
catalog.sql_catalog_local_role_keys = tuple(sql_catalog_local_role_keys) catalog.sql_catalog_local_role_keys = tuple(sql_catalog_local_role_keys)
self.assertTrue(local_role_key not in catalog.sql_catalog_local_role_keys) self.assertNotIn(local_role_key, catalog.sql_catalog_local_role_keys)
def stepCheckKeysAndTableExists(self, sequence=list, **kw): def stepCheckKeysAndTableExists(self, sequence=list, **kw):
""" """
...@@ -2190,29 +2190,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2190,29 +2190,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
catalog = self.getCatalogTool().getSQLCatalog() catalog = self.getCatalogTool().getSQLCatalog()
self.assertTrue(catalog is not None) self.assertTrue(catalog is not None)
# result key # result key
self.assertTrue(result_key in catalog.sql_search_result_keys) self.assertIn(result_key, catalog.sql_search_result_keys)
# related key # related key
self.assertTrue(related_key in catalog.sql_catalog_related_keys) self.assertIn(related_key, catalog.sql_catalog_related_keys)
# result table # result table
self.assertTrue(result_table in catalog.sql_search_tables) self.assertIn(result_table, catalog.sql_search_tables)
# search key # search key
self.assertTrue(search_key in catalog.sql_catalog_search_keys) self.assertIn(search_key, catalog.sql_catalog_search_keys)
# keyword key # keyword key
self.assertTrue(keyword_key in catalog.sql_catalog_keyword_search_keys) self.assertIn(keyword_key, catalog.sql_catalog_keyword_search_keys)
# full text key # full text key
self.assertTrue(full_text_key in catalog.sql_catalog_full_text_search_keys) self.assertIn(full_text_key, catalog.sql_catalog_full_text_search_keys)
# request key # request key
self.assertTrue(request_key in catalog.sql_catalog_request_keys) self.assertIn(request_key, catalog.sql_catalog_request_keys)
# multivalue key # multivalue key
self.assertTrue(multivalue_key in catalog.sql_catalog_multivalue_keys) self.assertIn(multivalue_key, catalog.sql_catalog_multivalue_keys)
# topic key # topic key
self.assertTrue(topic_key in catalog.sql_catalog_topic_search_keys) self.assertIn(topic_key, catalog.sql_catalog_topic_search_keys)
# scriptable key # scriptable key
self.assertTrue(scriptable_key in catalog.sql_catalog_scriptable_keys) self.assertIn(scriptable_key, catalog.sql_catalog_scriptable_keys)
# role key # role key
self.assertTrue(role_key in catalog.sql_catalog_role_keys) self.assertIn(role_key, catalog.sql_catalog_role_keys)
# local_role key # local_role key
self.assertTrue(local_role_key in catalog.sql_catalog_local_role_keys) self.assertIn(local_role_key, catalog.sql_catalog_local_role_keys)
def stepCheckKeysAndTableRemoved(self, sequence=list, **kw): def stepCheckKeysAndTableRemoved(self, sequence=list, **kw):
""" """
...@@ -2246,29 +2246,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2246,29 +2246,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
catalog = self.getCatalogTool().getSQLCatalog() catalog = self.getCatalogTool().getSQLCatalog()
self.assertTrue(catalog is not None) self.assertTrue(catalog is not None)
# result key # result key
self.assertTrue(result_key not in catalog.sql_search_result_keys) self.assertTrue(result_key, catalog.sql_search_result_keys)
# related key # related key
self.assertTrue(related_key not in catalog.sql_catalog_related_keys) self.assertTrue(related_key, catalog.sql_catalog_related_keys)
# result table # result table
self.assertTrue(result_table not in catalog.sql_search_tables) self.assertTrue(result_table, catalog.sql_search_tables)
# search key # search key
self.assertTrue(search_key not in catalog.sql_catalog_search_keys) self.assertTrue(search_key, catalog.sql_catalog_search_keys)
# keyword key # keyword key
self.assertTrue(keyword_key not in catalog.sql_catalog_keyword_search_keys) self.assertTrue(keyword_key, catalog.sql_catalog_keyword_search_keys)
# full text key # full text key
self.assertTrue(full_text_key not in catalog.sql_catalog_full_text_search_keys) self.assertTrue(full_text_key, catalog.sql_catalog_full_text_search_keys)
# request key # request key
self.assertTrue(request_key not in catalog.sql_catalog_request_keys) self.assertTrue(request_key, catalog.sql_catalog_request_keys)
# multivalue key # multivalue key
self.assertTrue(multivalue_key not in catalog.sql_catalog_multivalue_keys) self.assertTrue(multivalue_key, catalog.sql_catalog_multivalue_keys)
# topic key # topic key
self.assertTrue(topic_key not in catalog.sql_catalog_topic_search_keys) self.assertTrue(topic_key, catalog.sql_catalog_topic_search_keys)
# scriptable key # scriptable key
self.assertTrue(scriptable_key not in catalog.sql_catalog_scriptable_keys) self.assertTrue(scriptable_key, catalog.sql_catalog_scriptable_keys)
# role key # role key
self.assertTrue(role_key not in catalog.sql_catalog_role_keys) self.assertTrue(role_key, catalog.sql_catalog_role_keys)
# local_role key # local_role key
self.assertTrue(local_role_key not in catalog.sql_catalog_local_role_keys) self.assertTrue(local_role_key, catalog.sql_catalog_local_role_keys)
# Roles # Roles
def stepCreateRole(self, sequence=None, **kw): def stepCreateRole(self, sequence=None, **kw):
...@@ -2280,7 +2280,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2280,7 +2280,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
role_list = list(p.__ac_roles__) role_list = list(p.__ac_roles__)
role_list.append(new_role) role_list.append(new_role)
p.__ac_roles__ = tuple(role_list) p.__ac_roles__ = tuple(role_list)
self.assertTrue(new_role in p.__ac_roles__) self.assertIn(new_role, p.__ac_roles__)
sequence.edit(role=new_role) sequence.edit(role=new_role)
def stepRemoveRole(self, sequence=None, **kw): def stepRemoveRole(self, sequence=None, **kw):
...@@ -2293,7 +2293,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2293,7 +2293,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
role_list = list(p.__ac_roles__) role_list = list(p.__ac_roles__)
role_list.remove(role) role_list.remove(role)
p.__ac_roles__ = tuple(role_list) p.__ac_roles__ = tuple(role_list)
self.assertTrue(role not in p.__ac_roles__) self.assertNotIn(role, p.__ac_roles__)
def stepAddRoleToBusinessTemplate(self, sequence=None, **kw): def stepAddRoleToBusinessTemplate(self, sequence=None, **kw):
""" """
...@@ -2312,7 +2312,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2312,7 +2312,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
role = sequence.get('role', None) role = sequence.get('role', None)
self.assertTrue(role is not None) self.assertTrue(role is not None)
p = self.getPortal() p = self.getPortal()
self.assertTrue(role in p.__ac_roles__) self.assertIn(role, p.__ac_roles__)
def stepCheckRoleRemoved(self, sequence=None, **kw): def stepCheckRoleRemoved(self, sequence=None, **kw):
""" """
...@@ -2321,7 +2321,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2321,7 +2321,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
role = sequence.get('role', None) role = sequence.get('role', None)
self.assertTrue(role is not None) self.assertTrue(role is not None)
p = self.getPortal() p = self.getPortal()
self.assertTrue(role not in p.__ac_roles__) self.assertNotIn(role, p.__ac_roles__)
# Local Roles # Local Roles
def stepCreateLocalRoles(self, sequence=None, **kw): def stepCreateLocalRoles(self, sequence=None, **kw):
...@@ -2391,7 +2391,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2391,7 +2391,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
sql_connection = self.getSQLConnection() sql_connection = self.getSQLConnection()
result = sql_connection.manage_test(sql) result = sql_connection.manage_test(sql)
for line in result: for line in result:
self.assertTrue((line.uid, line.role) not in before_update_local_roles) self.assertNotIn((line.uid, line.role), before_update_local_roles)
def stepCheckLocalRolesRemoved(self, sequence=None, **kw): def stepCheckLocalRolesRemoved(self, sequence=None, **kw):
""" """
...@@ -2438,13 +2438,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2438,13 +2438,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
Check migration of Property Sheets from the Filesystem to ZODB Check migration of Property Sheets from the Filesystem to ZODB
""" """
property_sheet_tool = self.getPortalObject().portal_property_sheets property_sheet_tool = self.getPortalObject().portal_property_sheets
self.assertTrue('UnitTest' in property_sheet_tool.objectIds()) self.assertIn('UnitTest', property_sheet_tool.objectIds())
property_list = property_sheet_tool.UnitTest.contentValues() property_list = property_sheet_tool.UnitTest.contentValues()
self.assertEqual(len(property_list), 1) self.assertEqual(len(property_list), 1)
self.assertTrue(property_list[0].getReference() == 'ps_prop1') self.assertEqual(property_list[0].getReference(), 'ps_prop1')
self.assertTrue(property_list[0].getElementaryType() == 'string') self.assertEqual(property_list[0].getElementaryType(), 'string')
def stepRemovePropertySheet(self, sequence=None, sequencer_list=None, **kw): def stepRemovePropertySheet(self, sequence=None, sequencer_list=None, **kw):
""" """
...@@ -2504,7 +2504,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2504,7 +2504,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
""" """
ps_id = sequence.get('ps_title', None) ps_id = sequence.get('ps_title', None)
self.assertFalse(ps_id is None) self.assertFalse(ps_id is None)
self.assertFalse(ps_id in self.getPortalObject().portal_property_sheets.objectIds()) self.assertNotIn(ps_id, self.getPortalObject().portal_property_sheets.objectIds())
def stepCreateUpdatedPropertySheet(self, sequence=None, **kw): def stepCreateUpdatedPropertySheet(self, sequence=None, **kw):
""" """
...@@ -2921,29 +2921,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2921,29 +2921,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
ps = self.getSkinsTool() ps = self.getSkinsTool()
skin_id = sequence.get('skin_folder_id') skin_id = sequence.get('skin_folder_id')
# a new skin selection is added # a new skin selection is added
self.assertTrue('Foo' in ps.getSkinSelections()) self.assertIn('Foo', ps.getSkinSelections())
# and it contains good layers # and it contains good layers
layers = ps.getSkinPath('Foo').split(',') layers = ps.getSkinPath('Foo').split(',')
self.assertTrue(skin_id in layers, layers) self.assertIn(skin_id, layers)
self.assertTrue('erp5_core' in layers, layers) self.assertIn('erp5_core', layers)
self.assertFalse('erp5_xhtml_style' in layers, layers) self.assertNotIn('erp5_xhtml_style', layers)
skin_folder = ps._getOb(skin_id, None) skin_folder = ps._getOb(skin_id, None)
skin_selection_list = skin_folder.getProperty( skin_selection_list = skin_folder.getProperty(
'business_template_registered_skin_selections', ()) 'business_template_registered_skin_selections', ())
self.assertTrue('Foo' in skin_selection_list) self.assertIn('Foo', skin_selection_list)
def stepCheckStaticSkinSelection(self, sequence=None, **kw): def stepCheckStaticSkinSelection(self, sequence=None, **kw):
ps = self.getSkinsTool() ps = self.getSkinsTool()
skin_id = sequence.get('skin_folder_id') skin_id = sequence.get('skin_folder_id')
static_skin_id = sequence.get('static_skin_folder_id') static_skin_id = sequence.get('static_skin_folder_id')
# a new skin selection is added # a new skin selection is added
self.assertTrue('Foo' in ps.getSkinSelections()) self.assertIn('Foo', ps.getSkinSelections())
# and it contains good layers # and it contains good layers
layers = ps.getSkinPath('Foo').split(',') layers = ps.getSkinPath('Foo').split(',')
self.assertTrue(skin_id in layers, layers) self.assertIn(skin_id, layers)
self.assertTrue('erp5_core' in layers, layers) self.assertIn('erp5_core', layers)
self.assertFalse('erp5_xhtml_style' in layers, layers) self.assertNotIn('erp5_xhtml_style', layers)
self.assertTrue(static_skin_id in layers, layers) self.assertIn(static_skin_id, layers)
def stepCreateCustomWorkflow(self, sequence=None, **kw): def stepCreateCustomWorkflow(self, sequence=None, **kw):
""" """
...@@ -2973,8 +2973,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -2973,8 +2973,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
""" """
pt = self.getTemplateTool() pt = self.getTemplateTool()
template = pt.newContent(portal_type='Business Template') template = pt.newContent(portal_type='Business Template')
self.assertTrue(template.getBuildingState() == 'draft') self.assertEquals(template.getBuildingState(), 'draft')
self.assertTrue(template.getInstallationState() == 'not_installed') self.assertEquals(template.getInstallationState(), 'not_installed')
template.edit(title='custom geek template', template.edit(title='custom geek template',
version='1.0', version='1.0',
description='custom bt for unit_test') description='custom bt for unit_test')
...@@ -3180,7 +3180,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -3180,7 +3180,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
python_script_id = sequence.get('python_script_id') python_script_id = sequence.get('python_script_id')
skin_folder_id = sequence.get('skin_folder_id') skin_folder_id = sequence.get('skin_folder_id')
folder = self.portal.portal_skins[skin_folder_id] folder = self.portal.portal_skins[skin_folder_id]
self.assertTrue(python_script_id not in folder.objectIds()) self.assertNotIn(python_script_id, folder.objectIds())
def stepSetOldSitePropertyValue(self, sequence=None, **kw): def stepSetOldSitePropertyValue(self, sequence=None, **kw):
"""Set the old value to a site property.""" """Set the old value to a site property."""
...@@ -3221,13 +3221,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -3221,13 +3221,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
""" """
Check that a skin selection has been removed. Check that a skin selection has been removed.
""" """
self.assertTrue('Foo' not in self.portal.portal_skins.getSkinSelections()) self.assertNotIn('Foo', self.portal.portal_skins.getSkinSelections())
def stepCheckSkinSelectionNotRemoved(self, sequence=None, **kw): def stepCheckSkinSelectionNotRemoved(self, sequence=None, **kw):
""" """
Check that a skin selection has not been removed. Check that a skin selection has not been removed.
""" """
self.assertTrue('Foo' in self.portal.portal_skins.getSkinSelections()) self.assertIn('Foo', self.portal.portal_skins.getSkinSelections())
def stepUserDisableSkinSelectionRegistration(self, sequence=None, **kw): def stepUserDisableSkinSelectionRegistration(self, sequence=None, **kw):
""" """
...@@ -3253,9 +3253,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ...@@ -3253,9 +3253,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
select_skin_to_be_changed_list = sequence.get('select_skin_to_be_changed_list') select_skin_to_be_changed_list = sequence.get('select_skin_to_be_changed_list')
select_skin_not_to_be_changed_list = sequence.get('select_skin_not_to_be_changed_list') select_skin_not_to_be_changed_list = sequence.get('select_skin_not_to_be_changed_list')
for skin_name in select_skin_to_be_changed_list: for skin_name in select_skin_to_be_changed_list:
self.assertTrue(skin_folder_id in self.portal.portal_skins.getSkinPath(skin_name)) self.assertIn(skin_folder_id, self.portal.portal_skins.getSkinPath(skin_name))
for skin_name in select_skin_not_to_be_changed_list: for skin_name in select_skin_not_to_be_changed_list:
self.assertTrue(skin_folder_id not in self.portal.portal_skins.getSkinPath(skin_name)) self.assertNotIn(skin_folder_id, self.portal.portal_skins.getSkinPath(skin_name))
def stepCheckSkinFolderPriorityOn(self, sequence=None, **kw): def stepCheckSkinFolderPriorityOn(self, sequence=None, **kw):
""" """
...@@ -6424,11 +6424,11 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -6424,11 +6424,11 @@ class TestBusinessTemplate(BusinessTemplateMixin):
# This type provider, will be automatically registered on types tool during # This type provider, will be automatically registered on types tool during
# business template installation, because it contains type information # business template installation, because it contains type information
self.assertTrue('dummy_type_provider' in types_tool.type_provider_list) self.assertIn('dummy_type_provider', types_tool.type_provider_list)
# The type is reinstalled # The type is reinstalled
self.assertTrue('Dummy Type' in type_provider.objectIds()) self.assertIn('Dummy Type', type_provider.objectIds())
# is available from types tool # is available from types tool
self.assertTrue('Dummy Type' in [ti.getId() for self.assertIn('Dummy Type', [ti.getId() for
ti in types_tool.listTypeInfo()]) ti in types_tool.listTypeInfo()])
dummy_type = types_tool.getTypeInfo('Dummy Type') dummy_type = types_tool.getTypeInfo('Dummy Type')
...@@ -6459,7 +6459,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -6459,7 +6459,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
new_bt.uninstall() new_bt.uninstall()
self.assertNotEquals(None, types_tool.getTypeInfo('Base Category')) self.assertNotEquals(None, types_tool.getTypeInfo('Base Category'))
self.assertEqual(None, types_tool.getTypeInfo('Dummy Type')) self.assertEqual(None, types_tool.getTypeInfo('Dummy Type'))
self.assertFalse('dummy_type_provider' in types_tool.type_provider_list) self.assertNotIn('dummy_type_provider', types_tool.type_provider_list)
def test_type_provider_2(self): def test_type_provider_2(self):
self.portal.newContent(id='dummy_type_provider', portal_type="Types Tool") self.portal.newContent(id='dummy_type_provider', portal_type="Types Tool")
...@@ -6500,7 +6500,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -6500,7 +6500,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
# This type provider, will be automatically registered on types tool during # This type provider, will be automatically registered on types tool during
# business template installation, because it contains type information # business template installation, because it contains type information
self.assertTrue('dummy_type_provider' in types_tool.type_provider_list) self.assertIn('dummy_type_provider', types_tool.type_provider_list)
# Create a business template that has the same title but does not # Create a business template that has the same title but does not
# contain type_provider. # contain type_provider.
...@@ -6521,7 +6521,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -6521,7 +6521,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
new_bt.install(force=0, object_to_update={'dummy_type_provider':'remove'}) new_bt.install(force=0, object_to_update={'dummy_type_provider':'remove'})
self.assertNotEquals(None, types_tool.getTypeInfo('Base Category')) self.assertNotEquals(None, types_tool.getTypeInfo('Base Category'))
self.assertFalse('dummy_type_provider' in types_tool.type_provider_list) self.assertNotIn('dummy_type_provider', types_tool.type_provider_list)
def test_global_action(self): def test_global_action(self):
# Tests that global actions are properly exported and reimported # Tests that global actions are properly exported and reimported
...@@ -7526,7 +7526,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): ...@@ -7526,7 +7526,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
def stepCheckZodbDocumentRemoved(self, sequence=None, **kw): def stepCheckZodbDocumentRemoved(self, sequence=None, **kw):
component_tool = self.getPortalObject().portal_components component_tool = self.getPortalObject().portal_components
self.assertFalse(sequence['document_id'] in component_tool.objectIds()) self.assertNotIn(sequence['document_id'], component_tool.objectIds())
def stepRemoveZodbDocument(self, sequence=None, **kw): def stepRemoveZodbDocument(self, sequence=None, **kw):
self.portal.portal_components.manage_delObjects([sequence['document_id']]) self.portal.portal_components.manage_delObjects([sequence['document_id']])
...@@ -7559,7 +7559,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): ...@@ -7559,7 +7559,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
first_line = source_code.split('\n', 1)[0] first_line = source_code.split('\n', 1)[0]
with open(xml_path) as f: with open(xml_path) as f:
for line in f: for line in f:
self.assertFalse(first_line in line) self.assertNotIn(first_line, line)
def test_BusinessTemplateWithZodbDocument(self): def test_BusinessTemplateWithZodbDocument(self):
sequence_list = SequenceList() sequence_list = SequenceList()
...@@ -7697,7 +7697,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): ...@@ -7697,7 +7697,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
[component_id]) [component_id])
component_tool = self.getPortalObject().portal_components component_tool = self.getPortalObject().portal_components
self.assertTrue(component_id in component_tool.objectIds()) self.assertIn(component_id, component_tool.objectIds())
component = getattr(component_tool, component_id) component = getattr(component_tool, component_id)
self.assertEqual(component.getReference(), sequence['document_title']) self.assertEqual(component.getReference(), sequence['document_title'])
......
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