Commit 926841f6 authored by Jérome Perrin's avatar Jérome Perrin Committed by Rafael Monnerat

test: use assertIn(a, b) instead of assertTrue(a in b)

same as nexedi/erp5@2e366054
parent 6b081951
...@@ -246,7 +246,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -246,7 +246,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for new_array in new_array_list: for new_array in new_array_list:
if 'file_system_image/process_state/converted' in new_array.getPublicationSectionList(): if 'file_system_image/process_state/converted' in new_array.getPublicationSectionList():
break break
self.assertTrue('file_system_image/process_state/converted' in new_array.getPublicationSectionList()) self.assertIn('file_system_image/process_state/converted', new_array.getPublicationSectionList())
self.assertEquals(len(new_array.getArray()), 0) self.assertEquals(len(new_array.getArray()), 0)
...@@ -295,7 +295,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -295,7 +295,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for compute_node in self.compute_node_list: for compute_node in self.compute_node_list:
data_array_list = self._getRelatedDataArrayList(compute_node) data_array_list = self._getRelatedDataArrayList(compute_node)
self.assertEqual(len(data_array_list), 1) self.assertEqual(len(data_array_list), 1)
self.assertTrue("file_system_image/process_state/converted" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[0].getPublicationSectionList())
self.portal.portal_alarms.wendelin_handle_analysis.activeSense() self.portal.portal_alarms.wendelin_handle_analysis.activeSense()
self.tic() self.tic()
...@@ -304,7 +304,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -304,7 +304,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for compute_node in self.compute_node_list: for compute_node in self.compute_node_list:
data_array_list = self._getRelatedDataArrayList(compute_node) data_array_list = self._getRelatedDataArrayList(compute_node)
self.assertEqual(len(data_array_list), 1) self.assertEqual(len(data_array_list), 1)
self.assertTrue("file_system_image/process_state/converted" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[0].getPublicationSectionList())
# process data array # process data array
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
...@@ -315,7 +315,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -315,7 +315,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for compute_node in self.compute_node_list: for compute_node in self.compute_node_list:
data_array_list = self._getRelatedDataArrayList(compute_node) data_array_list = self._getRelatedDataArrayList(compute_node)
self.assertEqual(len(data_array_list), 2) self.assertEqual(len(data_array_list), 2)
self.assertTrue("file_system_image/process_state/converted" in data_array_list[-1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[-1].getPublicationSectionList())
self.portal.portal_alarms.wendelin_handle_analysis.activeSense() self.portal.portal_alarms.wendelin_handle_analysis.activeSense()
...@@ -324,7 +324,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -324,7 +324,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for compute_node in self.compute_node_list: for compute_node in self.compute_node_list:
data_array_list = self._getRelatedDataArrayList(compute_node) data_array_list = self._getRelatedDataArrayList(compute_node)
self.assertEqual(len(data_array_list), 2) self.assertEqual(len(data_array_list), 2)
self.assertTrue("file_system_image/process_state/converted" in data_array_list[-1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[-1].getPublicationSectionList())
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
...@@ -384,28 +384,28 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -384,28 +384,28 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for compute_node in self.compute_node_list: for compute_node in self.compute_node_list:
data_array_list = self._getRelatedDataArrayList(compute_node) data_array_list = self._getRelatedDataArrayList(compute_node)
self.assertEqual(len(data_array_list), 2) self.assertEqual(len(data_array_list), 2)
self.assertTrue("file_system_image/process_state/converted" in data_array_list[-1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[-1].getPublicationSectionList())
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
self.tic() self.tic()
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian10'])
self.assertEqual(len(data_array_list), 2) self.assertEqual(len(data_array_list), 2)
self.assertTrue("file_system_image/process_state/archived" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/archived", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian11']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian11'])
self.assertEqual(len(data_array_list), 2) self.assertEqual(len(data_array_list), 2)
self.assertTrue("file_system_image/process_state/archived" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/archived", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])
self.assertEqual(len(data_array_list), 2) self.assertEqual(len(data_array_list), 2)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
self.assertTrue('file_system_image/diff_end/identical' in data_array_list[1].getPublicationSectionList()) self.assertIn('file_system_image/diff_end/identical', data_array_list[1].getPublicationSectionList())
# now ingest different data for node_debian10 # now ingest different data for node_debian10
request_dict = { request_dict = {
...@@ -421,24 +421,24 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -421,24 +421,24 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
self.tic() self.tic()
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])
self.assertEqual(len(data_array_list), 3) self.assertEqual(len(data_array_list), 3)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
# This is the new one with different value # This is the new one with different value
self.assertTrue("file_system_image/process_state/converted" in data_array_list[2].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[2].getPublicationSectionList())
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
self.tic() self.tic()
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])
self.assertEqual(len(data_array_list), 4) self.assertEqual(len(data_array_list), 4)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[2].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[2].getPublicationSectionList())
# array 3 is the result of array 0 and array 2, Note: array 0 is the first access data # array 3 is the result of array 0 and array 2, Note: array 0 is the first access data
self.assertTrue("file_system_image/process_state/converted" in data_array_list[3].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[3].getPublicationSectionList())
predecessor_list = [x.getRelativeUrl() for x in data_array_list[3].getPredecessorValueList(portal_type='Data Array')] predecessor_list = [x.getRelativeUrl() for x in data_array_list[3].getPredecessorValueList(portal_type='Data Array')]
self.assertTrue(data_array_list[0].getRelativeUrl() in predecessor_list) self.assertIn(data_array_list[0].getRelativeUrl(), predecessor_list)
self.assertTrue(data_array_list[2].getRelativeUrl() in predecessor_list) self.assertIn(data_array_list[2].getRelativeUrl(), predecessor_list)
# only have one diff # only have one diff
self.assertTrue(len(data_array_list[3].getArray()), 1) self.assertTrue(len(data_array_list[3].getArray()), 1)
...@@ -447,17 +447,17 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -447,17 +447,17 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
# array 3 compare with database_debian10 # array 3 compare with database_debian10
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])
self.assertEqual(len(data_array_list), 5) self.assertEqual(len(data_array_list), 5)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[2].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[2].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[3].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[3].getPublicationSectionList())
# array 4 is result of array 3 and database_debian10 # array 4 is result of array 3 and database_debian10
self.assertTrue("file_system_image/process_state/converted" in data_array_list[4].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[4].getPublicationSectionList())
predecessor_list = [x.getRelativeUrl() for x in data_array_list[4].getPredecessorValueList(portal_type='Data Array')] predecessor_list = [x.getRelativeUrl() for x in data_array_list[4].getPredecessorValueList(portal_type='Data Array')]
last_detabase_debian10 = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian10'])[-1] last_detabase_debian10 = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian10'])[-1]
self.assertTrue(last_detabase_debian10.getRelativeUrl() in predecessor_list) self.assertIn(last_detabase_debian10.getRelativeUrl(), predecessor_list)
self.assertTrue(data_array_list[3].getRelativeUrl() in predecessor_list) self.assertIn(data_array_list[3].getRelativeUrl(), predecessor_list)
self.assertTrue(len(data_array_list[4].getArray()), 1) self.assertTrue(len(data_array_list[4].getArray()), 1)
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
...@@ -465,25 +465,25 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -465,25 +465,25 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
# array 4 compare with database_debian11 # array 4 compare with database_debian11
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])
self.assertEqual(len(data_array_list), 6) self.assertEqual(len(data_array_list), 6)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[2].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[2].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[3].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[3].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[4].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[4].getPublicationSectionList())
# array 5 is result of array 4 and database_debian11 # array 5 is result of array 4 and database_debian11
self.assertTrue("file_system_image/process_state/converted" in data_array_list[5].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[5].getPublicationSectionList())
predecessor_list = [x.getRelativeUrl() for x in data_array_list[5].getPredecessorValueList(portal_type='Data Array')] predecessor_list = [x.getRelativeUrl() for x in data_array_list[5].getPredecessorValueList(portal_type='Data Array')]
last_detabase_debian11 = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian11'])[-1] last_detabase_debian11 = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian11'])[-1]
self.assertTrue(last_detabase_debian11.getRelativeUrl() in predecessor_list) self.assertIn(last_detabase_debian11.getRelativeUrl(), predecessor_list)
self.assertTrue(data_array_list[4].getRelativeUrl() in predecessor_list) self.assertIn(data_array_list[4].getRelativeUrl(), predecessor_list)
self.assertTrue(len(data_array_list[5].getArray()), 1) self.assertTrue(len(data_array_list[5].getArray()), 1)
# no more database to compare # no more database to compare
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
self.tic() self.tic()
self.assertTrue("file_system_image/process_state/processed" in data_array_list[5].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[5].getPublicationSectionList())
self.assertTrue('file_system_image/diff_end/different' in data_array_list[5].getPublicationSectionList()) self.assertIn('file_system_image/diff_end/different', data_array_list[5].getPublicationSectionList())
def test_data_processing_for_multi_data_ingestion(self): def test_data_processing_for_multi_data_ingestion(self):
# almost same as test_data_processing_for_sequence_data_ingestion # almost same as test_data_processing_for_sequence_data_ingestion
...@@ -516,7 +516,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -516,7 +516,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for compute_node in self.compute_node_list: for compute_node in self.compute_node_list:
data_array_list = self._getRelatedDataArrayList(compute_node) data_array_list = self._getRelatedDataArrayList(compute_node)
self.assertEqual(len(data_array_list), 1) self.assertEqual(len(data_array_list), 1)
self.assertTrue("file_system_image/process_state/converted" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[0].getPublicationSectionList())
# process data array # process data array
...@@ -524,17 +524,17 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -524,17 +524,17 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
self.tic() self.tic()
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian10'])
self.assertEqual(len(data_array_list), 1) self.assertEqual(len(data_array_list), 1)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian11']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian11'])
self.assertEqual(len(data_array_list), 1) self.assertEqual(len(data_array_list), 1)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])
self.assertEqual(len(data_array_list), 1) self.assertEqual(len(data_array_list), 1)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
self.portal.portal_alarms.wendelin_handle_analysis.activeSense() self.portal.portal_alarms.wendelin_handle_analysis.activeSense()
...@@ -543,49 +543,49 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -543,49 +543,49 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
for compute_node in self.compute_node_list: for compute_node in self.compute_node_list:
data_array_list = self._getRelatedDataArrayList(compute_node) data_array_list = self._getRelatedDataArrayList(compute_node)
self.assertEqual(len(data_array_list), 2) self.assertEqual(len(data_array_list), 2)
self.assertTrue("file_system_image/process_state/converted" in data_array_list[-1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[-1].getPublicationSectionList())
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
self.tic() self.tic()
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian10'])
self.assertEqual(len(data_array_list), 2) self.assertEqual(len(data_array_list), 2)
self.assertTrue("file_system_image/process_state/archived" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/archived", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian11']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian11'])
self.assertEqual(len(data_array_list), 2) self.assertEqual(len(data_array_list), 2)
self.assertTrue("file_system_image/process_state/archived" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/archived", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])
self.assertEqual(len(data_array_list), 2) self.assertEqual(len(data_array_list), 2)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
self.assertTrue('file_system_image/diff_end/identical' in data_array_list[1].getPublicationSectionList()) self.assertIn('file_system_image/diff_end/identical', data_array_list[1].getPublicationSectionList())
self.portal.ERP5Site_createDataAnalysisList() self.portal.ERP5Site_createDataAnalysisList()
self.portal.ERP5Site_executeDataAnalysisList() self.portal.ERP5Site_executeDataAnalysisList()
self.tic() self.tic()
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])
self.assertEqual(len(data_array_list), 3) self.assertEqual(len(data_array_list), 3)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
# This is the new one with different value # This is the new one with different value
self.assertTrue("file_system_image/process_state/converted" in data_array_list[2].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[2].getPublicationSectionList())
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
self.tic() self.tic()
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])
self.assertEqual(len(data_array_list), 4) self.assertEqual(len(data_array_list), 4)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[2].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[2].getPublicationSectionList())
# array 3 is the result of array 0 and array 2, Note: array 0 is the first access data # array 3 is the result of array 0 and array 2, Note: array 0 is the first access data
self.assertTrue("file_system_image/process_state/converted" in data_array_list[3].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[3].getPublicationSectionList())
predecessor_list = [x.getRelativeUrl() for x in data_array_list[3].getPredecessorValueList(portal_type='Data Array')] predecessor_list = [x.getRelativeUrl() for x in data_array_list[3].getPredecessorValueList(portal_type='Data Array')]
self.assertTrue(data_array_list[0].getRelativeUrl() in predecessor_list) self.assertIn(data_array_list[0].getRelativeUrl(), predecessor_list)
self.assertTrue(data_array_list[2].getRelativeUrl() in predecessor_list) self.assertIn(data_array_list[2].getRelativeUrl(), predecessor_list)
# only have one diff # only have one diff
self.assertTrue(len(data_array_list[3].getArray()), 1) self.assertTrue(len(data_array_list[3].getArray()), 1)
...@@ -594,16 +594,16 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -594,16 +594,16 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
# array 3 compare with database_debian10 # array 3 compare with database_debian10
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])
self.assertEqual(len(data_array_list), 5) self.assertEqual(len(data_array_list), 5)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[2].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[2].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[3].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[3].getPublicationSectionList())
# array 4 is result of array 3 and database_debian10 # array 4 is result of array 3 and database_debian10
self.assertTrue("file_system_image/process_state/converted" in data_array_list[4].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[4].getPublicationSectionList())
predecessor_list = [x.getRelativeUrl() for x in data_array_list[4].getPredecessorValueList(portal_type='Data Array')] predecessor_list = [x.getRelativeUrl() for x in data_array_list[4].getPredecessorValueList(portal_type='Data Array')]
last_detabase_debian10 = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian10'])[-1] last_detabase_debian10 = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian10'])[-1]
self.assertTrue(last_detabase_debian10.getRelativeUrl() in predecessor_list) self.assertIn(last_detabase_debian10.getRelativeUrl(), predecessor_list)
self.assertTrue(data_array_list[3].getRelativeUrl() in predecessor_list) self.assertIn(data_array_list[3].getRelativeUrl(), predecessor_list)
self.assertTrue(len(data_array_list[4].getArray()), 1) self.assertTrue(len(data_array_list[4].getArray()), 1)
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
...@@ -611,25 +611,25 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -611,25 +611,25 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
# array 4 compare with database_debian11 # array 4 compare with database_debian11
data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10']) data_array_list = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])
self.assertEqual(len(data_array_list), 6) self.assertEqual(len(data_array_list), 6)
self.assertTrue("file_system_image/process_state/processed" in data_array_list[0].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[0].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[1].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[1].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[2].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[2].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[3].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[3].getPublicationSectionList())
self.assertTrue("file_system_image/process_state/processed" in data_array_list[4].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[4].getPublicationSectionList())
# array 5 is result of array 4 and database_debian11 # array 5 is result of array 4 and database_debian11
self.assertTrue("file_system_image/process_state/converted" in data_array_list[5].getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", data_array_list[5].getPublicationSectionList())
predecessor_list = [x.getRelativeUrl() for x in data_array_list[5].getPredecessorValueList(portal_type='Data Array')] predecessor_list = [x.getRelativeUrl() for x in data_array_list[5].getPredecessorValueList(portal_type='Data Array')]
last_detabase_debian11 = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian11'])[-1] last_detabase_debian11 = self._getRelatedDataArrayList(self.portal.compute_node_module['database_debian11'])[-1]
self.assertTrue(last_detabase_debian11.getRelativeUrl() in predecessor_list) self.assertIn(last_detabase_debian11.getRelativeUrl(), predecessor_list)
self.assertTrue(data_array_list[4].getRelativeUrl() in predecessor_list) self.assertIn(data_array_list[4].getRelativeUrl(), predecessor_list)
self.assertTrue(len(data_array_list[5].getArray()), 1) self.assertTrue(len(data_array_list[5].getArray()), 1)
# no more database to compare # no more database to compare
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
self.tic() self.tic()
self.assertTrue("file_system_image/process_state/processed" in data_array_list[5].getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", data_array_list[5].getPublicationSectionList())
self.assertTrue('file_system_image/diff_end/different' in data_array_list[5].getPublicationSectionList()) self.assertIn('file_system_image/diff_end/different', data_array_list[5].getPublicationSectionList())
def test_data_processing_check_copmute_node_state(self): def test_data_processing_check_copmute_node_state(self):
...@@ -666,8 +666,8 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -666,8 +666,8 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
self.tic() self.tic()
last_diff_array = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])[-1] last_diff_array = self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])[-1]
self.assertTrue(modified_array.getReference() in last_diff_array.getReference()) self.assertIn(modified_array.getReference(), last_diff_array.getReference())
self.assertTrue(default_array.getReference() in last_diff_array.getReference()) self.assertIn(default_array.getReference(), last_diff_array.getReference())
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
self.tic() self.tic()
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
...@@ -696,7 +696,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -696,7 +696,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
self.tic() self.tic()
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
self.tic() self.tic()
self.assertTrue('file_system_image/diff_end/identical' in self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])[-1].getPublicationSectionList()) self.assertIn('file_system_image/diff_end/identical', self._getRelatedDataArrayList(self.portal.compute_node_module['node_debian10'])[-1].getPublicationSectionList())
self.assertTrue(self.portal.compute_node_module['node_debian10'].ComputeNode_hasModifiedFile() is None) self.assertTrue(self.portal.compute_node_module['node_debian10'].ComputeNode_hasModifiedFile() is None)
...@@ -782,42 +782,42 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -782,42 +782,42 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
diff_server_data_array_list = [] diff_server_data_array_list = []
for i in server_data_array_list: for i in server_data_array_list:
self.assertTrue("file_system_image/process_state/processed" in i.getPublicationSectionList()) self.assertIn("file_system_image/process_state/processed", i.getPublicationSectionList())
diff_server_data_array_list.append(i.getPredecessorRelatedValue(portal_type='Data Array')) diff_server_data_array_list.append(i.getPredecessorRelatedValue(portal_type='Data Array'))
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
self.tic() self.tic()
self.assertTrue(diff_server_data_array_list[0].getPredecessorRelatedValue(portal_type='Data Array') in reference_data_array_list[0].getPredecessorRelatedValueList(portal_type='Data Array')) self.assertIn(diff_server_data_array_list[0].getPredecessorRelatedValue(portal_type='Data Array'), reference_data_array_list[0].getPredecessorRelatedValueList(portal_type='Data Array'))
diff_1 = diff_server_data_array_list[0].getPredecessorRelatedValue(portal_type='Data Array') diff_1 = diff_server_data_array_list[0].getPredecessorRelatedValue(portal_type='Data Array')
self.assertEqual(len(diff_1.getPredecessorValueList(portal_type='Data Array')), 2) self.assertEqual(len(diff_1.getPredecessorValueList(portal_type='Data Array')), 2)
self.assertTrue("file_system_image/process_state/converted" in diff_1.getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", diff_1.getPublicationSectionList())
self.assertTrue((diff_1.getArray() == [7, 9, 10, 11, 15, 17, 18]).all()) self.assertTrue((diff_1.getArray() == [7, 9, 10, 11, 15, 17, 18]).all())
self.assertTrue(diff_server_data_array_list[1].getPredecessorRelatedValue(portal_type='Data Array') in reference_data_array_list[0].getPredecessorRelatedValueList(portal_type='Data Array')) self.assertIn(diff_server_data_array_list[1].getPredecessorRelatedValue(portal_type='Data Array'), reference_data_array_list[0].getPredecessorRelatedValueList(portal_type='Data Array'))
diff_2 = diff_server_data_array_list[1].getPredecessorRelatedValue(portal_type='Data Array') diff_2 = diff_server_data_array_list[1].getPredecessorRelatedValue(portal_type='Data Array')
self.assertEqual(len(diff_2.getPredecessorValueList(portal_type='Data Array')), 2) self.assertEqual(len(diff_2.getPredecessorValueList(portal_type='Data Array')), 2)
self.assertTrue("file_system_image/process_state/converted" in diff_2.getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", diff_2.getPublicationSectionList())
self.assertTrue((diff_2.getArray() == [2, 8, 14]).all()) self.assertTrue((diff_2.getArray() == [2, 8, 14]).all())
self.assertTrue(diff_server_data_array_list[2].getPredecessorRelatedValue(portal_type='Data Array') in reference_data_array_list[0].getPredecessorRelatedValueList(portal_type='Data Array')) self.assertIn(diff_server_data_array_list[2].getPredecessorRelatedValue(portal_type='Data Array'), reference_data_array_list[0].getPredecessorRelatedValueList(portal_type='Data Array'))
diff_3 = diff_server_data_array_list[2].getPredecessorRelatedValue(portal_type='Data Array') diff_3 = diff_server_data_array_list[2].getPredecessorRelatedValue(portal_type='Data Array')
self.assertEqual(len(diff_3.getPredecessorValueList(portal_type='Data Array')), 2) self.assertEqual(len(diff_3.getPredecessorValueList(portal_type='Data Array')), 2)
self.assertTrue("file_system_image/process_state/converted" in diff_3.getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", diff_3.getPublicationSectionList())
self.assertTrue((diff_3.getArray() == [11, 17, 31]).all()) self.assertTrue((diff_3.getArray() == [11, 17, 31]).all())
self.assertTrue(diff_server_data_array_list[3].getPredecessorRelatedValue(portal_type='Data Array') in reference_data_array_list[1].getPredecessorRelatedValueList(portal_type='Data Array')) self.assertIn(diff_server_data_array_list[3].getPredecessorRelatedValue(portal_type='Data Array'), reference_data_array_list[1].getPredecessorRelatedValueList(portal_type='Data Array'))
diff_4 = diff_server_data_array_list[3].getPredecessorRelatedValue(portal_type='Data Array') diff_4 = diff_server_data_array_list[3].getPredecessorRelatedValue(portal_type='Data Array')
self.assertEqual(len(diff_4.getPredecessorValueList(portal_type='Data Array')), 2) self.assertEqual(len(diff_4.getPredecessorValueList(portal_type='Data Array')), 2)
self.assertTrue("file_system_image/process_state/converted" in diff_4.getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", diff_4.getPublicationSectionList())
self.assertTrue((diff_4.getArray() == [2, 24]).all()) self.assertTrue((diff_4.getArray() == [2, 24]).all())
self.assertTrue(diff_server_data_array_list[4].getPredecessorRelatedValue(portal_type='Data Array') in reference_data_array_list[1].getPredecessorRelatedValueList(portal_type='Data Array')) self.assertIn(diff_server_data_array_list[4].getPredecessorRelatedValue(portal_type='Data Array'), reference_data_array_list[1].getPredecessorRelatedValueList(portal_type='Data Array'))
diff_5 = diff_server_data_array_list[4].getPredecessorRelatedValue(portal_type='Data Array') diff_5 = diff_server_data_array_list[4].getPredecessorRelatedValue(portal_type='Data Array')
self.assertEqual(len(diff_5.getPredecessorValueList(portal_type='Data Array')), 2) self.assertEqual(len(diff_5.getPredecessorValueList(portal_type='Data Array')), 2)
self.assertTrue("file_system_image/process_state/converted" in diff_5.getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", diff_5.getPublicationSectionList())
self.assertTrue((diff_5.getArray() == [17, 28, 31]).all(), diff_5.getRelativeUrl()) self.assertTrue((diff_5.getArray() == [17, 28, 31]).all(), diff_5.getRelativeUrl())
...@@ -826,30 +826,30 @@ class testSlapOSAbyss(SlapOSTestCaseMixin): ...@@ -826,30 +826,30 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
self.assertTrue('file_system_image/diff_end/different' in diff_4.getPublicationSectionList()) self.assertIn('file_system_image/diff_end/different', diff_4.getPublicationSectionList())
self.assertTrue('file_system_image/diff_end/different' in diff_5.getPublicationSectionList()) self.assertIn('file_system_image/diff_end/different', diff_5.getPublicationSectionList())
self.assertTrue(diff_1.getPredecessorRelatedValue(portal_type='Data Array') in reference_data_array_list[1].getPredecessorRelatedValueList(portal_type='Data Array')) self.assertIn(diff_1.getPredecessorRelatedValue(portal_type='Data Array'), reference_data_array_list[1].getPredecessorRelatedValueList(portal_type='Data Array'))
diff_6 = diff_1.getPredecessorRelatedValue(portal_type='Data Array') diff_6 = diff_1.getPredecessorRelatedValue(portal_type='Data Array')
self.assertEqual(len(diff_6.getPredecessorValueList(portal_type='Data Array')), 2) self.assertEqual(len(diff_6.getPredecessorValueList(portal_type='Data Array')), 2)
self.assertTrue("file_system_image/process_state/converted" in diff_6.getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", diff_6.getPublicationSectionList())
self.assertTrue((diff_6.getArray() == [15, 17, 18]).all(), diff_6.getRelativeUrl()) self.assertTrue((diff_6.getArray() == [15, 17, 18]).all(), diff_6.getRelativeUrl())
self.assertTrue(diff_2.getPredecessorRelatedValue(portal_type='Data Array') in reference_data_array_list[1].getPredecessorRelatedValueList(portal_type='Data Array')) self.assertIn(diff_2.getPredecessorRelatedValue(portal_type='Data Array'), reference_data_array_list[1].getPredecessorRelatedValueList(portal_type='Data Array'))
diff_7 = diff_2.getPredecessorRelatedValue(portal_type='Data Array') diff_7 = diff_2.getPredecessorRelatedValue(portal_type='Data Array')
self.assertEqual(len(diff_7.getPredecessorValueList(portal_type='Data Array')), 2) self.assertEqual(len(diff_7.getPredecessorValueList(portal_type='Data Array')), 2)
self.assertTrue("file_system_image/process_state/converted" in diff_7.getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", diff_7.getPublicationSectionList())
self.assertTrue((diff_7.getArray() == [2]).all(), diff_7.getRelativeUrl()) self.assertTrue((diff_7.getArray() == [2]).all(), diff_7.getRelativeUrl())
self.assertTrue(diff_3.getPredecessorRelatedValue(portal_type='Data Array') in reference_data_array_list[1].getPredecessorRelatedValueList(portal_type='Data Array')) self.assertIn(diff_3.getPredecessorRelatedValue(portal_type='Data Array'), reference_data_array_list[1].getPredecessorRelatedValueList(portal_type='Data Array'))
diff_8 = diff_3.getPredecessorRelatedValue(portal_type='Data Array') diff_8 = diff_3.getPredecessorRelatedValue(portal_type='Data Array')
self.assertEqual(len(diff_8.getPredecessorValueList(portal_type='Data Array')), 2) self.assertEqual(len(diff_8.getPredecessorValueList(portal_type='Data Array')), 2)
self.assertTrue("file_system_image/process_state/converted" in diff_8.getPublicationSectionList()) self.assertIn("file_system_image/process_state/converted", diff_8.getPublicationSectionList())
self.assertTrue((diff_8.getArray() == [17, 31]).all(), diff_8.getRelativeUrl()) self.assertTrue((diff_8.getArray() == [17, 31]).all(), diff_8.getRelativeUrl())
self.portal.portal_alarms.slapos_process_data_array.activeSense() self.portal.portal_alarms.slapos_process_data_array.activeSense()
self.tic() self.tic()
for i in [diff_6, diff_7, diff_8]: for i in [diff_6, diff_7, diff_8]:
self.assertTrue('file_system_image/diff_end/different' in i.getPublicationSectionList()) self.assertIn('file_system_image/diff_end/different', i.getPublicationSectionList())
...@@ -1403,7 +1403,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder): ...@@ -1403,7 +1403,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
self.assertFalse(transaction_line.hasStopDate()) self.assertFalse(transaction_line.hasStopDate())
self.assertEqual([], transaction_line.contentValues( self.assertEqual([], transaction_line.contentValues(
portal_type='Delivery Cell')) portal_type='Delivery Cell'))
self.assertTrue(simulation_movement.getRelativeUrl() in self.assertIn(simulation_movement.getRelativeUrl(),
transaction_line.getDeliveryRelatedList( transaction_line.getDeliveryRelatedList(
portal_type='Simulation Movement')) portal_type='Simulation Movement'))
...@@ -1741,7 +1741,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis ...@@ -1741,7 +1741,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
self.assertFalse(transaction_line.hasStopDate()) self.assertFalse(transaction_line.hasStopDate())
self.assertEqual([], transaction_line.contentValues( self.assertEqual([], transaction_line.contentValues(
portal_type='Delivery Cell')) portal_type='Delivery Cell'))
self.assertTrue(simulation_movement.getRelativeUrl() in self.assertIn(simulation_movement.getRelativeUrl(),
transaction_line.getDeliveryRelatedList( transaction_line.getDeliveryRelatedList(
portal_type='Simulation Movement')) portal_type='Simulation Movement'))
......
...@@ -30,10 +30,10 @@ class TestInstanceTree(TestSlapOSConstraintMixin): ...@@ -30,10 +30,10 @@ class TestInstanceTree(TestSlapOSConstraintMixin):
def test_periodicity_hour_list_value(self): def test_periodicity_hour_list_value(self):
value = 7 value = 7
message = 'Attribute periodicity_hour_list value is [7] but should be [0]' message = 'Attribute periodicity_hour_list value is [7] but should be [0]'
self.assertFalse(message in self.getMessageList(self.subscription)) self.assertNotIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityHour(value) self.subscription.setPeriodicityHour(value)
self.assertTrue(message in self.getMessageList(self.subscription)) self.assertIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityHour(0) self.subscription.setPeriodicityHour(0)
...@@ -44,10 +44,10 @@ class TestInstanceTree(TestSlapOSConstraintMixin): ...@@ -44,10 +44,10 @@ class TestInstanceTree(TestSlapOSConstraintMixin):
def test_periodicity_minute_list_value(self): def test_periodicity_minute_list_value(self):
value = 7 value = 7
message = 'Attribute periodicity_minute_list value is [7] but should be [0]' message = 'Attribute periodicity_minute_list value is [7] but should be [0]'
self.assertFalse(message in self.getMessageList(self.subscription)) self.assertNotIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityMinute(value) self.subscription.setPeriodicityMinute(value)
self.assertTrue(message in self.getMessageList(self.subscription)) self.assertIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityMinute(0) self.subscription.setPeriodicityMinute(0)
...@@ -57,36 +57,36 @@ class TestInstanceTree(TestSlapOSConstraintMixin): ...@@ -57,36 +57,36 @@ class TestInstanceTree(TestSlapOSConstraintMixin):
def test_periodicity_month_day_list_lenght(self): def test_periodicity_month_day_list_lenght(self):
message = 'There was too many objects in periodicity_month_day_list' message = 'There was too many objects in periodicity_month_day_list'
self.assertFalse(message in self.getMessageList(self.subscription)) self.assertNotIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityMonthDayList([1, 2]) self.subscription.setPeriodicityMonthDayList([1, 2])
self.assertTrue(message in self.getMessageList(self.subscription)) self.assertIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityMonthDayList([1]) self.subscription.setPeriodicityMonthDayList([1])
self.assertFalse(message in self.getMessageList(self.subscription)) self.assertNotIn(message, self.getMessageList(self.subscription))
def test_periodicity_month_day_value_range(self): def test_periodicity_month_day_value_range(self):
message = 'The periodicity_month_day value is not between 1 and 28 '\ message = 'The periodicity_month_day value is not between 1 and 28 '\
'inclusive' 'inclusive'
self.assertFalse(message in self.getMessageList(self.subscription)) self.assertNotIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityMonthDay(0) self.subscription.setPeriodicityMonthDay(0)
self.assertTrue(message in self.getMessageList(self.subscription)) self.assertIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityMonthDay(29) self.subscription.setPeriodicityMonthDay(29)
self.assertTrue(message in self.getMessageList(self.subscription)) self.assertIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityMonthDay(28) self.subscription.setPeriodicityMonthDay(28)
self.assertFalse(message in self.getMessageList(self.subscription)) self.assertNotIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityMonthDay(1) self.subscription.setPeriodicityMonthDay(1)
self.assertFalse(message in self.getMessageList(self.subscription)) self.assertNotIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityMonthDay(15) self.subscription.setPeriodicityMonthDay(15)
self.assertFalse(message in self.getMessageList(self.subscription)) self.assertNotIn(message, self.getMessageList(self.subscription))
self.subscription.setPeriodicityMonthDay(None) self.subscription.setPeriodicityMonthDay(None)
self.assertFalse(message in self.getMessageList(self.subscription)) self.assertNotIn(message, self.getMessageList(self.subscription))
def test_periodicity_property(self): def test_periodicity_property(self):
template = 'Property existence error for property %s, this '\ template = 'Property existence error for property %s, this '\
...@@ -101,16 +101,16 @@ class TestInstanceTree(TestSlapOSConstraintMixin): ...@@ -101,16 +101,16 @@ class TestInstanceTree(TestSlapOSConstraintMixin):
class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin): class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
@withAbort @withAbort
def _test_currency(self, invoice, setter, message): def _test_currency(self, invoice, setter, message):
self.assertTrue(message in self.getMessageList(invoice)) self.assertIn(message, self.getMessageList(invoice))
currency = self.portal.currency_module.newContent(portal_type='Currency') currency = self.portal.currency_module.newContent(portal_type='Currency')
setter(currency.getRelativeUrl()) setter(currency.getRelativeUrl())
self.assertFalse(message in self.getMessageList(invoice)) self.assertNotIn(message, self.getMessageList(invoice))
resource = self.portal.service_module.newContent(portal_type='Service') resource = self.portal.service_module.newContent(portal_type='Service')
setter(resource.getRelativeUrl()) setter(resource.getRelativeUrl())
self.assertTrue(message in self.getMessageList(invoice)) self.assertIn(message, self.getMessageList(invoice))
def test_price_currency(self): def test_price_currency(self):
invoice = self.portal.accounting_module.newContent( invoice = self.portal.accounting_module.newContent(
...@@ -133,34 +133,34 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin): ...@@ -133,34 +133,34 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
setter = invoice.setSpecialise setter = invoice.setSpecialise
message = "Arity Error for Relation ['specialise'] and Type "\ message = "Arity Error for Relation ['specialise'] and Type "\
"('Sale Trade Condition',), arity is equal to 0 but should be at least 1" "('Sale Trade Condition',), arity is equal to 0 but should be at least 1"
self.assertTrue(message in self.getMessageList(invoice)) self.assertIn(message, self.getMessageList(invoice))
sale_condition = self.portal.sale_trade_condition_module.newContent( sale_condition = self.portal.sale_trade_condition_module.newContent(
portal_type='Sale Trade Condition') portal_type='Sale Trade Condition')
setter(sale_condition.getRelativeUrl()) setter(sale_condition.getRelativeUrl())
self.assertFalse(message in self.getMessageList(invoice)) self.assertNotIn(message, self.getMessageList(invoice))
purchase_condition = self.portal.purchase_trade_condition_module.newContent( purchase_condition = self.portal.purchase_trade_condition_module.newContent(
portal_type='Purchase Trade Condition') portal_type='Purchase Trade Condition')
setter(purchase_condition.getRelativeUrl()) setter(purchase_condition.getRelativeUrl())
self.assertTrue(message in self.getMessageList(invoice)) self.assertIn(message, self.getMessageList(invoice))
@withAbort @withAbort
def test_specialise_value(self): def test_specialise_value(self):
invoice = self.portal.accounting_module.newContent( invoice = self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction') portal_type='Sale Invoice Transaction')
message = "Only SlapOS trade condition is allowed" message = "Only SlapOS trade condition is allowed"
self.assertTrue(message in self.getMessageList(invoice)) self.assertIn(message, self.getMessageList(invoice))
sale_condition = self.portal.sale_trade_condition_module.newContent( sale_condition = self.portal.sale_trade_condition_module.newContent(
portal_type='Sale Trade Condition') portal_type='Sale Trade Condition')
invoice.setSpecialise(sale_condition.getRelativeUrl()) invoice.setSpecialise(sale_condition.getRelativeUrl())
self.assertTrue(message in self.getMessageList(invoice)) self.assertIn(message, self.getMessageList(invoice))
invoice.setSpecialise('sale_trade_condition_module/slapos_aggregated_trade_condition') invoice.setSpecialise('sale_trade_condition_module/slapos_aggregated_trade_condition')
self.assertFalse(message in self.getMessageList(invoice)) self.assertNotIn(message, self.getMessageList(invoice))
@withAbort @withAbort
def test_total_price_equal_accounting(self): def test_total_price_equal_accounting(self):
...@@ -170,13 +170,13 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin): ...@@ -170,13 +170,13 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
price_currency='currency_module/EUR') price_currency='currency_module/EUR')
invoice.newContent(portal_type='Invoice Line', quantity=1., price=1.) invoice.newContent(portal_type='Invoice Line', quantity=1., price=1.)
self.assertFalse(message in self.getMessageList(invoice)) self.assertNotIn(message, self.getMessageList(invoice))
self.portal.portal_workflow._jumpToStateFor(invoice, 'confirmed') self.portal.portal_workflow._jumpToStateFor(invoice, 'confirmed')
self.assertTrue(message in self.getMessageList(invoice)) self.assertIn(message, self.getMessageList(invoice))
invoice.receivable.setQuantity(-1.0) invoice.receivable.setQuantity(-1.0)
invoice.income.setQuantity(1.0) invoice.income.setQuantity(1.0)
self.assertFalse(message in self.getMessageList(invoice)) self.assertNotIn(message, self.getMessageList(invoice))
@withAbort @withAbort
def test_trade_model_match_lines(self): def test_trade_model_match_lines(self):
...@@ -188,14 +188,14 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin): ...@@ -188,14 +188,14 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
invoice.newContent(portal_type='Invoice Line', quantity=1., price=1., invoice.newContent(portal_type='Invoice Line', quantity=1., price=1.,
base_contribution='base_amount/invoicing/taxable') base_contribution='base_amount/invoicing/taxable')
self.assertFalse(message in self.getMessageList(invoice)) self.assertNotIn(message, self.getMessageList(invoice))
self.portal.portal_workflow._jumpToStateFor(invoice, 'confirmed') self.portal.portal_workflow._jumpToStateFor(invoice, 'confirmed')
self.assertTrue(message in self.getMessageList(invoice)) self.assertIn(message, self.getMessageList(invoice))
invoice.newContent(portal_type='Invoice Line', quantity=1., price=.196, invoice.newContent(portal_type='Invoice Line', quantity=1., price=.196,
use='trade/tax', use='trade/tax',
) )
self.assertFalse(message in self.getMessageList(invoice)) self.assertNotIn(message, self.getMessageList(invoice))
@withAbort @withAbort
def test_use_trade_sale_total_price_matches_delivery_constraint(self): def test_use_trade_sale_total_price_matches_delivery_constraint(self):
...@@ -210,16 +210,16 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin): ...@@ -210,16 +210,16 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
invoice_line = invoice.newContent(portal_type='Invoice Line', quantity=2., invoice_line = invoice.newContent(portal_type='Invoice Line', quantity=2.,
price=1., use='trade/sale') price=1., use='trade/sale')
self.assertFalse(message in self.getMessageList(invoice)) self.assertNotIn(message, self.getMessageList(invoice))
self.portal.portal_workflow._jumpToStateFor(invoice, 'confirmed') self.portal.portal_workflow._jumpToStateFor(invoice, 'confirmed')
self.assertFalse(message in self.getMessageList(invoice)) self.assertNotIn(message, self.getMessageList(invoice))
invoice.setSpecialise('sale_trade_condition_module/slapos_aggregated_trade_condition') invoice.setSpecialise('sale_trade_condition_module/slapos_aggregated_trade_condition')
self.assertTrue(message in self.getMessageList(invoice)) self.assertIn(message, self.getMessageList(invoice))
invoice_line.setQuantity(1.) invoice_line.setQuantity(1.)
self.assertFalse(message in self.getMessageList(invoice)) self.assertNotIn(message, self.getMessageList(invoice))
invoice.newContent(portal_type='Invoice Line', quantity=2., invoice.newContent(portal_type='Invoice Line', quantity=2.,
price=1.) price=1.)
self.assertFalse(message in self.getMessageList(invoice)) self.assertNotIn(message, self.getMessageList(invoice))
class TestSalePackingList(TestSlapOSConstraintMixin): class TestSalePackingList(TestSlapOSConstraintMixin):
@withAbort @withAbort
...@@ -228,9 +228,9 @@ class TestSalePackingList(TestSlapOSConstraintMixin): ...@@ -228,9 +228,9 @@ class TestSalePackingList(TestSlapOSConstraintMixin):
delivery = self.portal.sale_packing_list_module.newContent( delivery = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List') portal_type='Sale Packing List')
self.assertTrue(message in self.getMessageList(delivery)) self.assertIn(message, self.getMessageList(delivery))
delivery.newContent(portal_type='Sale Packing List Line') delivery.newContent(portal_type='Sale Packing List Line')
self.assertFalse(message in self.getMessageList(delivery)) self.assertNotIn(message, self.getMessageList(delivery))
@withAbort @withAbort
def test_reference_not_empty(self): def test_reference_not_empty(self):
...@@ -238,29 +238,29 @@ class TestSalePackingList(TestSlapOSConstraintMixin): ...@@ -238,29 +238,29 @@ class TestSalePackingList(TestSlapOSConstraintMixin):
delivery = self.portal.sale_packing_list_module.newContent( delivery = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List') portal_type='Sale Packing List')
self.assertFalse(message in self.getMessageList(delivery)) self.assertNotIn(message, self.getMessageList(delivery))
delivery.setReference(None) delivery.setReference(None)
self.assertTrue(message in self.getMessageList(delivery)) self.assertIn(message, self.getMessageList(delivery))
@withAbort @withAbort
def test_price_currency(self): def test_price_currency(self):
message = 'Exactly one Currency shall be selected' message = 'Exactly one Currency shall be selected'
delivery = self.portal.sale_packing_list_module.newContent( delivery = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List') portal_type='Sale Packing List')
self.assertTrue(message in self.getMessageList(delivery)) self.assertIn(message, self.getMessageList(delivery))
resource = self.portal.service_module.newContent(portal_type='Service') resource = self.portal.service_module.newContent(portal_type='Service')
delivery.setPriceCurrency(resource.getRelativeUrl()) delivery.setPriceCurrency(resource.getRelativeUrl())
self.assertTrue(message in self.getMessageList(delivery)) self.assertIn(message, self.getMessageList(delivery))
currency_1 = self.portal.currency_module.newContent(portal_type='Currency') currency_1 = self.portal.currency_module.newContent(portal_type='Currency')
currency_2 = self.portal.currency_module.newContent(portal_type='Currency') currency_2 = self.portal.currency_module.newContent(portal_type='Currency')
delivery.setPriceCurrencyList([currency_1.getRelativeUrl(), delivery.setPriceCurrencyList([currency_1.getRelativeUrl(),
currency_2.getRelativeUrl()]) currency_2.getRelativeUrl()])
self.assertTrue(message in self.getMessageList(delivery)) self.assertIn(message, self.getMessageList(delivery))
delivery.setPriceCurrency(currency_1.getRelativeUrl()) delivery.setPriceCurrency(currency_1.getRelativeUrl())
self.assertFalse(message in self.getMessageList(delivery)) self.assertNotIn(message, self.getMessageList(delivery))
@withAbort @withAbort
def _test_category_arrow(self, category): def _test_category_arrow(self, category):
...@@ -278,17 +278,17 @@ class TestSalePackingList(TestSlapOSConstraintMixin): ...@@ -278,17 +278,17 @@ class TestSalePackingList(TestSlapOSConstraintMixin):
portal_type='Organisation').getRelativeUrl() portal_type='Organisation').getRelativeUrl()
key = '%s_list' % category key = '%s_list' % category
self.assertTrue(message in self.getMessageList(delivery)) self.assertIn(message, self.getMessageList(delivery))
delivery.edit(**{key: [resource]}) delivery.edit(**{key: [resource]})
self.assertTrue(message in self.getMessageList(delivery)) self.assertIn(message, self.getMessageList(delivery))
delivery.edit(**{key: [person, organisation]}) delivery.edit(**{key: [person, organisation]})
self.assertTrue(message_2 in self.getMessageList(delivery)) self.assertIn(message_2, self.getMessageList(delivery))
delivery.edit(**{key: [person]}) delivery.edit(**{key: [person]})
self.assertFalse(message in self.getMessageList(delivery)) self.assertNotIn(message, self.getMessageList(delivery))
self.assertFalse(message_2 in self.getMessageList(delivery)) self.assertNotIn(message_2, self.getMessageList(delivery))
delivery.edit(**{key: [organisation]}) delivery.edit(**{key: [organisation]})
self.assertFalse(message in self.getMessageList(delivery)) self.assertNotIn(message, self.getMessageList(delivery))
self.assertFalse(message_2 in self.getMessageList(delivery)) self.assertNotIn(message_2, self.getMessageList(delivery))
def test_destination(self): def test_destination(self):
self._test_category_arrow('destination') self._test_category_arrow('destination')
...@@ -322,23 +322,23 @@ class TestSalePackingList(TestSlapOSConstraintMixin): ...@@ -322,23 +322,23 @@ class TestSalePackingList(TestSlapOSConstraintMixin):
portal_type='Sale Trade Condition').getRelativeUrl() portal_type='Sale Trade Condition').getRelativeUrl()
key = '%s_list' % category key = '%s_list' % category
self.assertTrue(message in self.getMessageList(delivery)) self.assertIn(message, self.getMessageList(delivery))
delivery.edit(**{key: [resource]}) delivery.edit(**{key: [resource]})
self.assertTrue(message in self.getMessageList(delivery)) self.assertIn(message, self.getMessageList(delivery))
delivery.edit(**{key: [stc_1, stc_2]}) delivery.edit(**{key: [stc_1, stc_2]})
self.assertTrue(message_2 in self.getMessageList(delivery)) self.assertIn(message_2, self.getMessageList(delivery))
delivery.edit(**{key: [stc_1]}) delivery.edit(**{key: [stc_1]})
self.assertFalse(message in self.getMessageList(delivery)) self.assertNotIn(message, self.getMessageList(delivery))
self.assertFalse(message_2 in self.getMessageList(delivery)) self.assertNotIn(message_2, self.getMessageList(delivery))
@withAbort @withAbort
def test_start_date(self): def test_start_date(self):
message = 'Property start_date must be defined' message = 'Property start_date must be defined'
delivery = self.portal.sale_packing_list_module.newContent( delivery = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List') portal_type='Sale Packing List')
self.assertTrue(message in self.getMessageList(delivery)) self.assertIn(message, self.getMessageList(delivery))
delivery.setStartDate('2012/01/01') delivery.setStartDate('2012/01/01')
self.assertFalse(message in self.getMessageList(delivery)) self.assertNotIn(message, self.getMessageList(delivery))
class TestSalePackingListLine(TestSlapOSConstraintMixin): class TestSalePackingListLine(TestSlapOSConstraintMixin):
@withAbort @withAbort
...@@ -350,14 +350,14 @@ class TestSalePackingListLine(TestSlapOSConstraintMixin): ...@@ -350,14 +350,14 @@ class TestSalePackingListLine(TestSlapOSConstraintMixin):
delivery_line = self.portal.sale_packing_list_module.newContent( delivery_line = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List').newContent( portal_type='Sale Packing List').newContent(
portal_type='Sale Packing List Line') portal_type='Sale Packing List Line')
self.assertTrue(message_price in self.getMessageList(delivery_line)) self.assertIn(message_price, self.getMessageList(delivery_line))
self.assertTrue(message_quantity in self.getMessageList(delivery_line)) self.assertIn(message_quantity, self.getMessageList(delivery_line))
delivery_line.setQuantity(1.0) delivery_line.setQuantity(1.0)
self.assertTrue(message_price in self.getMessageList(delivery_line)) self.assertIn(message_price, self.getMessageList(delivery_line))
self.assertFalse(message_quantity in self.getMessageList(delivery_line)) self.assertNotIn(message_quantity, self.getMessageList(delivery_line))
delivery_line.setPrice(1.0) delivery_line.setPrice(1.0)
self.assertFalse(message_price in self.getMessageList(delivery_line)) self.assertNotIn(message_price, self.getMessageList(delivery_line))
self.assertFalse(message_quantity in self.getMessageList(delivery_line)) self.assertNotIn(message_quantity, self.getMessageList(delivery_line))
@withAbort @withAbort
def test_resource_arity(self): def test_resource_arity(self):
...@@ -377,14 +377,14 @@ class TestSalePackingListLine(TestSlapOSConstraintMixin): ...@@ -377,14 +377,14 @@ class TestSalePackingListLine(TestSlapOSConstraintMixin):
portal_type='Service').getRelativeUrl() portal_type='Service').getRelativeUrl()
key = '%s_list' % category key = '%s_list' % category
self.assertTrue(message in self.getMessageList(delivery_line)) self.assertIn(message, self.getMessageList(delivery_line))
delivery_line.edit(**{key: [product]}) delivery_line.edit(**{key: [product]})
self.assertTrue(message in self.getMessageList(delivery_line)) self.assertIn(message, self.getMessageList(delivery_line))
delivery_line.edit(**{key: [service_1, service_2]}) delivery_line.edit(**{key: [service_1, service_2]})
self.assertTrue(message_2 in self.getMessageList(delivery_line)) self.assertIn(message_2, self.getMessageList(delivery_line))
delivery_line.edit(**{key: [service_1]}) delivery_line.edit(**{key: [service_1]})
self.assertFalse(message in self.getMessageList(delivery_line)) self.assertNotIn(message, self.getMessageList(delivery_line))
self.assertFalse(message_2 in self.getMessageList(delivery_line)) self.assertNotIn(message_2, self.getMessageList(delivery_line))
class TestSalePackingListLineConsumption(TestSlapOSConstraintMixin): class TestSalePackingListLineConsumption(TestSlapOSConstraintMixin):
@withAbort @withAbort
...@@ -397,15 +397,15 @@ class TestSalePackingListLineConsumption(TestSlapOSConstraintMixin): ...@@ -397,15 +397,15 @@ class TestSalePackingListLineConsumption(TestSlapOSConstraintMixin):
portal_type='Product').getRelativeUrl() portal_type='Product').getRelativeUrl()
key = '%s_list' % category key = '%s_list' % category
self.assertFalse(message in self.getMessageList(delivery_line)) self.assertNotIn(message, self.getMessageList(delivery_line))
delivery.edit(specialise='sale_trade_condition_module/slapos_consumption_trade_condition') delivery.edit(specialise='sale_trade_condition_module/slapos_consumption_trade_condition')
self.assertTrue(message in self.getMessageList(delivery_line)) self.assertIn(message, self.getMessageList(delivery_line))
delivery_line.edit(**{key: [product]}) delivery_line.edit(**{key: [product]})
self.assertTrue(message in self.getMessageList(delivery_line)) self.assertIn(message, self.getMessageList(delivery_line))
delivery_line.edit(**{key: [aggregate_1, aggregate_2]}) delivery_line.edit(**{key: [aggregate_1, aggregate_2]})
self.assertTrue(message in self.getMessageList(delivery_line)) self.assertIn(message, self.getMessageList(delivery_line))
delivery_line.edit(**{key: [aggregate_1]}) delivery_line.edit(**{key: [aggregate_1]})
self.assertFalse(message in self.getMessageList(delivery_line)) self.assertNotIn(message, self.getMessageList(delivery_line))
def test_aggregate_instance_tree(self): def test_aggregate_instance_tree(self):
self._test_aggregate("There should be one Instance Tree related", self._test_aggregate("There should be one Instance Tree related",
......
...@@ -125,7 +125,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin): ...@@ -125,7 +125,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
def requestComputeNode(self, title): def requestComputeNode(self, title):
requestXml = self.portal.portal_slap.requestComputer(title) requestXml = self.portal.portal_slap.requestComputer(title)
self.tic() self.tic()
self.assertTrue('marshal' in requestXml) self.assertIn('marshal', requestXml)
compute_node = xml_marshaller.xml_marshaller.loads(requestXml) compute_node = xml_marshaller.xml_marshaller.loads(requestXml)
compute_node_id = getattr(compute_node, '_computer_id', None) compute_node_id = getattr(compute_node, '_computer_id', None)
self.assertNotEqual(None, compute_node_id) self.assertNotEqual(None, compute_node_id)
......
...@@ -17,11 +17,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm( ...@@ -17,11 +17,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self.tic() self.tic()
# check that no interaction has recreated the instance # check that no interaction has recreated the instance
self.assertFalse(self.instance_tree.getTitle() in self.assertNotIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList()) self.instance_tree.getSuccessorTitleList())
self.instance_tree.InstanceTree_assertSuccessor() self.instance_tree.InstanceTree_assertSuccessor()
self.assertTrue(self.instance_tree.getTitle() in self.assertIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList()) self.instance_tree.getSuccessorTitleList())
def test_InstanceTree_assertSuccessor_stop_requested(self): def test_InstanceTree_assertSuccessor_stop_requested(self):
...@@ -31,11 +31,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm( ...@@ -31,11 +31,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self.tic() self.tic()
# check that no interaction has recreated the instance # check that no interaction has recreated the instance
self.assertFalse(self.instance_tree.getTitle() in self.assertNotIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList()) self.instance_tree.getSuccessorTitleList())
self.instance_tree.InstanceTree_assertSuccessor() self.instance_tree.InstanceTree_assertSuccessor()
self.assertTrue(self.instance_tree.getTitle() in self.assertIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList()) self.instance_tree.getSuccessorTitleList())
def test_InstanceTree_assertSuccessor_destroy_requested(self): def test_InstanceTree_assertSuccessor_destroy_requested(self):
...@@ -45,11 +45,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm( ...@@ -45,11 +45,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self.tic() self.tic()
# check that no interaction has recreated the instance # check that no interaction has recreated the instance
self.assertFalse(self.instance_tree.getTitle() in self.assertNotIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList()) self.instance_tree.getSuccessorTitleList())
self.instance_tree.InstanceTree_assertSuccessor() self.instance_tree.InstanceTree_assertSuccessor()
self.assertFalse(self.instance_tree.getTitle() in self.assertNotIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList()) self.instance_tree.getSuccessorTitleList())
def test_InstanceTree_assertSuccessor_archived(self): def test_InstanceTree_assertSuccessor_archived(self):
...@@ -58,11 +58,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm( ...@@ -58,11 +58,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self.tic() self.tic()
# check that no interaction has recreated the instance # check that no interaction has recreated the instance
self.assertFalse(self.instance_tree.getTitle() in self.assertNotIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList()) self.instance_tree.getSuccessorTitleList())
self.instance_tree.InstanceTree_assertSuccessor() self.instance_tree.InstanceTree_assertSuccessor()
self.assertFalse(self.instance_tree.getTitle() in self.assertNotIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList()) self.instance_tree.getSuccessorTitleList())
def test_alarm_renamed(self): def test_alarm_renamed(self):
......
...@@ -59,8 +59,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -59,8 +59,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16) serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate) self.assertIn(serial, compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
def test_generateCertificate_twice(self): def test_generateCertificate_twice(self):
self.login(self.compute_node.getUserId()) self.login(self.compute_node.getUserId())
...@@ -78,8 +78,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -78,8 +78,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16) serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate) self.assertIn(serial, compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertRaises(ValueError, self.compute_node.generateCertificate) self.assertRaises(ValueError, self.compute_node.generateCertificate)
self.assertEqual(None, self.portal.REQUEST.get('compute_node_key')) self.assertEqual(None, self.portal.REQUEST.get('compute_node_key'))
...@@ -271,8 +271,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -271,8 +271,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16) serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate) self.assertIn(serial, compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
...@@ -305,8 +305,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -305,8 +305,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16) serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate) self.assertIn(serial, compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
...@@ -340,8 +340,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -340,8 +340,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16) serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate) self.assertIn(serial, compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
self.assertNotEqual(None, destination_reference) self.assertNotEqual(None, destination_reference)
...@@ -375,9 +375,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -375,9 +375,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
serial = '0x%x' % int(new_certificate_login.getDestinationReference(), 16) serial = '0x%x' % int(new_certificate_login.getDestinationReference(), 16)
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate') compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
self.assertTrue(serial in compute_node_certificate) self.assertIn(serial, compute_node_certificate)
self.assertTrue(new_certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertIn(new_certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertFalse(certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertNotIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
...@@ -399,8 +399,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -399,8 +399,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16) serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate) self.assertIn(serial, compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
self.assertNotEqual(None, destination_reference) self.assertNotEqual(None, destination_reference)
...@@ -434,9 +434,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -434,9 +434,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
serial = '0x%x' % int(new_certificate_login.getDestinationReference(), 16) serial = '0x%x' % int(new_certificate_login.getDestinationReference(), 16)
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate') compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
self.assertTrue(serial in compute_node_certificate) self.assertIn(serial, compute_node_certificate)
self.assertTrue(new_certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertIn(new_certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertFalse(certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertNotIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
...@@ -471,9 +471,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -471,9 +471,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
serial = '0x%x' % int(third_certificate_login.getDestinationReference(), 16) serial = '0x%x' % int(third_certificate_login.getDestinationReference(), 16)
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate') compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
self.assertTrue(serial in compute_node_certificate) self.assertIn(serial, compute_node_certificate)
self.assertTrue(third_certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertIn(third_certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertFalse(new_certificate_login.getReference() in compute_node_certificate.decode('string_escape')) self.assertNotIn(new_certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(third_certificate_login.getReference(), self.assertNotEqual(third_certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
......
...@@ -21,7 +21,7 @@ class TestSlapOSConstraintMixin(SlapOSTestCaseMixin): ...@@ -21,7 +21,7 @@ class TestSlapOSConstraintMixin(SlapOSTestCaseMixin):
current_message_list = self.getMessageList(obj) current_message_list = self.getMessageList(obj)
# test the test: no expected message found # test the test: no expected message found
self.assertFalse(consistency_message in current_message_list) self.assertNotIn(consistency_message, current_message_list)
# required # required
...@@ -33,14 +33,14 @@ class TestSlapOSConstraintMixin(SlapOSTestCaseMixin): ...@@ -33,14 +33,14 @@ class TestSlapOSConstraintMixin(SlapOSTestCaseMixin):
# ...but in case of magic ones (reference->default_reference) # ...but in case of magic ones (reference->default_reference)
# use setter to set it to None # use setter to set it to None
obj.edit(**{property_id:None}) obj.edit(**{property_id:None})
self.assertTrue(consistency_message in self.getMessageList(obj)) self.assertIn(consistency_message, self.getMessageList(obj))
if empty_string: if empty_string:
obj.edit(**{property_id:''}) obj.edit(**{property_id:''})
self.assertTrue(consistency_message in self.getMessageList(obj)) self.assertIn(consistency_message, self.getMessageList(obj))
obj.edit(**{property_id:value}) obj.edit(**{property_id:value})
self.assertFalse(consistency_message in self.getMessageList(obj)) self.assertNotIn(consistency_message, self.getMessageList(obj))
self.assertSameSet(current_message_list, self.getMessageList(obj)) self.assertSameSet(current_message_list, self.getMessageList(obj))
class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin): class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin):
...@@ -63,14 +63,14 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin): ...@@ -63,14 +63,14 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin):
# test the test: no expected message found # test the test: no expected message found
current_message_list = self.getMessageList(partition) current_message_list = self.getMessageList(partition)
self.assertFalse(consistency_message in current_message_list) self.assertNotIn(consistency_message, current_message_list)
# check case for Software Instance # check case for Software Instance
software_instance.setAggregate(partition.getRelativeUrl()) software_instance.setAggregate(partition.getRelativeUrl())
software_instance.immediateReindexObject() software_instance.immediateReindexObject()
self.assertTrue(consistency_message in self.getMessageList(partition)) self.assertIn(consistency_message, self.getMessageList(partition))
self.portal.portal_workflow._jumpToStateFor(partition, 'busy') self.portal.portal_workflow._jumpToStateFor(partition, 'busy')
self.assertFalse(consistency_message in self.getMessageList(partition)) self.assertNotIn(consistency_message, self.getMessageList(partition))
self.portal.portal_workflow._jumpToStateFor(partition, 'free') self.portal.portal_workflow._jumpToStateFor(partition, 'free')
software_instance.setAggregate(None) software_instance.setAggregate(None)
software_instance.immediateReindexObject() software_instance.immediateReindexObject()
...@@ -78,9 +78,9 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin): ...@@ -78,9 +78,9 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin):
# check case fo Slave Instance # check case fo Slave Instance
slave_instance.setAggregate(partition.getRelativeUrl()) slave_instance.setAggregate(partition.getRelativeUrl())
slave_instance.immediateReindexObject() slave_instance.immediateReindexObject()
self.assertTrue(consistency_message in self.getMessageList(partition)) self.assertIn(consistency_message, self.getMessageList(partition))
self.portal.portal_workflow._jumpToStateFor(partition, 'busy') self.portal.portal_workflow._jumpToStateFor(partition, 'busy')
self.assertFalse(consistency_message in self.getMessageList(partition)) self.assertNotIn(consistency_message, self.getMessageList(partition))
self.portal.portal_workflow._jumpToStateFor(partition, 'free') self.portal.portal_workflow._jumpToStateFor(partition, 'free')
def test_busy_partition_has_one_related_instance(self): def test_busy_partition_has_one_related_instance(self):
...@@ -110,12 +110,12 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin): ...@@ -110,12 +110,12 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin):
# test the test: no expected message found # test the test: no expected message found
current_message_list = self.getMessageList(partition) current_message_list = self.getMessageList(partition)
self.assertFalse(consistency_message in current_message_list) self.assertNotIn(consistency_message, current_message_list)
# check case for Software Instance # check case for Software Instance
software_instance.edit(aggregate=None) software_instance.edit(aggregate=None)
software_instance.immediateReindexObject() software_instance.immediateReindexObject()
self.assertTrue(consistency_message in self.getMessageList(partition)) self.assertIn(consistency_message, self.getMessageList(partition))
# check case for many Software Instance # check case for many Software Instance
software_instance.edit(aggregate=partition.getRelativeUrl()) software_instance.edit(aggregate=partition.getRelativeUrl())
...@@ -125,7 +125,7 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin): ...@@ -125,7 +125,7 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin):
consistency_message_2 = "Arity Error for Relation ['default_aggregate'] and" \ consistency_message_2 = "Arity Error for Relation ['default_aggregate'] and" \
" Type ('Software Instance',), arity is equal to 2 but should be " \ " Type ('Software Instance',), arity is equal to 2 but should be " \
"between 1 and 1" "between 1 and 1"
self.assertTrue(consistency_message_2 in self.getMessageList(partition)) self.assertIn(consistency_message_2, self.getMessageList(partition))
# check case for many Slave Instane # check case for many Slave Instane
software_instance_2.edit(aggregate=None) software_instance_2.edit(aggregate=None)
...@@ -134,8 +134,8 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin): ...@@ -134,8 +134,8 @@ class TestSlapOSComputePartitionConstraint(TestSlapOSConstraintMixin):
slave_instance_2.edit(aggregate=partition.getRelativeUrl()) slave_instance_2.edit(aggregate=partition.getRelativeUrl())
slave_instance.immediateReindexObject() slave_instance.immediateReindexObject()
slave_instance_2.immediateReindexObject() slave_instance_2.immediateReindexObject()
self.assertFalse(consistency_message in self.getMessageList(partition)) self.assertNotIn(consistency_message, self.getMessageList(partition))
self.assertFalse(consistency_message_2 in self.getMessageList(partition)) self.assertNotIn(consistency_message_2, self.getMessageList(partition))
class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin): class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
def afterSetUp(self): def afterSetUp(self):
...@@ -153,16 +153,16 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -153,16 +153,16 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
"found, line 1, column 1 (line 1)" "found, line 1, column 1 (line 1)"
# test the test: no expected message found # test the test: no expected message found
self.assertFalse(consistency_message in current_message_list) self.assertNotIn(consistency_message, current_message_list)
# connection_xml is optional # connection_xml is optional
self.software_instance.edit(connection_xml=None) self.software_instance.edit(connection_xml=None)
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
self.software_instance.edit(connection_xml='') self.software_instance.edit(connection_xml='')
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
# if available shall be correct XML # if available shall be correct XML
...@@ -172,7 +172,7 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -172,7 +172,7 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
self.getMessageList(self.software_instance))) self.getMessageList(self.software_instance)))
self.software_instance.edit(connection_xml=self.generateEmptyXml()) self.software_instance.edit(connection_xml=self.generateEmptyXml())
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
def test_property_existence_source_reference(self): def test_property_existence_source_reference(self):
...@@ -182,10 +182,10 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -182,10 +182,10 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
'has never been set' 'has never been set'
# not required in draft state # not required in draft state
self.software_instance.edit(**{property_id:None}) self.software_instance.edit(**{property_id:None})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.software_instance.edit(**{property_id:''}) self.software_instance.edit(**{property_id:''})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'start_requested') 'start_requested')
...@@ -208,10 +208,10 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -208,10 +208,10 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'destroy_requested') 'destroy_requested')
self.software_instance.edit(**{property_id:None}) self.software_instance.edit(**{property_id:None})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.software_instance.edit(**{property_id:''}) self.software_instance.edit(**{property_id:''})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
def test_property_existence_ssl_key(self): def test_property_existence_ssl_key(self):
property_id = 'ssl_key' property_id = 'ssl_key'
...@@ -224,10 +224,10 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -224,10 +224,10 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'destroy_requested') 'destroy_requested')
self.software_instance.edit(**{property_id:None}) self.software_instance.edit(**{property_id:None})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.software_instance.edit(**{property_id:''}) self.software_instance.edit(**{property_id:''})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
def test_successor_related(self): def test_successor_related(self):
software_instance2 = self.portal.software_instance_module.newContent( software_instance2 = self.portal.software_instance_module.newContent(
...@@ -243,24 +243,24 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -243,24 +243,24 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
consistency_message = "There is more then one related successor" consistency_message = "There is more then one related successor"
# test the test: no expected message found # test the test: no expected message found
self.assertFalse(consistency_message in current_message_list) self.assertNotIn(consistency_message, current_message_list)
# if too many, it shall cry # if too many, it shall cry
software_instance2.edit(successor=self.software_instance.getRelativeUrl()) software_instance2.edit(successor=self.software_instance.getRelativeUrl())
software_instance3.edit(successor=self.software_instance.getRelativeUrl()) software_instance3.edit(successor=self.software_instance.getRelativeUrl())
self.tic() self.tic()
self.assertTrue(consistency_message in self.getMessageList(self.software_instance)) self.assertIn(consistency_message, self.getMessageList(self.software_instance))
# one is good # one is good
software_instance2.edit(successor=None) software_instance2.edit(successor=None)
self.tic() self.tic()
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
# none is good # none is good
software_instance3.edit(successor=None) software_instance3.edit(successor=None)
self.tic() self.tic()
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
def test_sla_xml(self): def test_sla_xml(self):
...@@ -271,16 +271,16 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -271,16 +271,16 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
"found, line 1, column 1 (line 1)" "found, line 1, column 1 (line 1)"
# test the test: no expected message found # test the test: no expected message found
self.assertFalse(consistency_message in current_message_list) self.assertNotIn(consistency_message, current_message_list)
# sla_xml is optional # sla_xml is optional
self.software_instance.edit(sla_xml=None) self.software_instance.edit(sla_xml=None)
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
self.software_instance.edit(sla_xml='') self.software_instance.edit(sla_xml='')
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
# if available shall be correct XML # if available shall be correct XML
...@@ -290,7 +290,7 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -290,7 +290,7 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
self.getMessageList(self.software_instance))) self.getMessageList(self.software_instance)))
self.software_instance.edit(sla_xml=self.generateEmptyXml()) self.software_instance.edit(sla_xml=self.generateEmptyXml())
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
def test_text_content(self): def test_text_content(self):
...@@ -301,16 +301,16 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -301,16 +301,16 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
"found, line 1, column 1 (line 1)" "found, line 1, column 1 (line 1)"
# test the test: no expected message found # test the test: no expected message found
self.assertFalse(consistency_message in current_message_list) self.assertNotIn(consistency_message, current_message_list)
# text_content is optional # text_content is optional
self.software_instance.edit(text_content=None) self.software_instance.edit(text_content=None)
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
self.software_instance.edit(text_content='') self.software_instance.edit(text_content='')
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
# if available shall be correct XML # if available shall be correct XML
...@@ -320,7 +320,7 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -320,7 +320,7 @@ class TestSlapOSSoftwareInstanceConstraint(TestSlapOSConstraintMixin):
self.getMessageList(self.software_instance))) self.getMessageList(self.software_instance)))
self.software_instance.edit(text_content=self.generateEmptyXml()) self.software_instance.edit(text_content=self.generateEmptyXml())
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin): class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin):
...@@ -338,10 +338,10 @@ class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -338,10 +338,10 @@ class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin):
property_id = 'source_reference' property_id = 'source_reference'
# not required in draft state # not required in draft state
self.software_instance.edit(**{property_id:None}) self.software_instance.edit(**{property_id:None})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.software_instance.edit(**{property_id:''}) self.software_instance.edit(**{property_id:''})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'start_requested') 'start_requested')
...@@ -355,10 +355,10 @@ class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -355,10 +355,10 @@ class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin):
property_id = 'text_content' property_id = 'text_content'
# not required in draft state # not required in draft state
self.software_instance.edit(**{property_id:None}) self.software_instance.edit(**{property_id:None})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.software_instance.edit(**{property_id:''}) self.software_instance.edit(**{property_id:''})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'start_requested') 'start_requested')
...@@ -384,24 +384,24 @@ class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin): ...@@ -384,24 +384,24 @@ class TestSlapOSSlaveInstanceConstraint(TestSlapOSConstraintMixin):
consistency_message = "There is more then one related successor" consistency_message = "There is more then one related successor"
# test the test: no expected message found # test the test: no expected message found
self.assertFalse(consistency_message in current_message_list) self.assertNotIn(consistency_message, current_message_list)
# if too many, it shall cry # if too many, it shall cry
software_instance2.edit(successor=self.software_instance.getRelativeUrl()) software_instance2.edit(successor=self.software_instance.getRelativeUrl())
software_instance3.edit(successor=self.software_instance.getRelativeUrl()) software_instance3.edit(successor=self.software_instance.getRelativeUrl())
self.tic() self.tic()
self.assertTrue(consistency_message in self.getMessageList(self.software_instance)) self.assertIn(consistency_message, self.getMessageList(self.software_instance))
# one is good # one is good
software_instance2.edit(successor=None) software_instance2.edit(successor=None)
self.tic() self.tic()
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
# none is good # none is good
software_instance3.edit(successor=None) software_instance3.edit(successor=None)
self.tic() self.tic()
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.assertSameSet(current_message_list, self.getMessageList(self.software_instance)) self.assertSameSet(current_message_list, self.getMessageList(self.software_instance))
class TestSlapOSInstanceTreeConstraint(TestSlapOSConstraintMixin): class TestSlapOSInstanceTreeConstraint(TestSlapOSConstraintMixin):
...@@ -429,10 +429,10 @@ class TestSlapOSInstanceTreeConstraint(TestSlapOSConstraintMixin): ...@@ -429,10 +429,10 @@ class TestSlapOSInstanceTreeConstraint(TestSlapOSConstraintMixin):
'has never been set' 'has never been set'
# not required in draft state # not required in draft state
self.software_instance.edit(**{property_id:None}) self.software_instance.edit(**{property_id:None})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.software_instance.edit(**{property_id:''}) self.software_instance.edit(**{property_id:''})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'start_requested') 'start_requested')
...@@ -446,10 +446,10 @@ class TestSlapOSInstanceTreeConstraint(TestSlapOSConstraintMixin): ...@@ -446,10 +446,10 @@ class TestSlapOSInstanceTreeConstraint(TestSlapOSConstraintMixin):
'has never been set' 'has never been set'
# not required in draft state # not required in draft state
self.software_instance.edit(**{property_id:None}) self.software_instance.edit(**{property_id:None})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.software_instance.edit(**{property_id:''}) self.software_instance.edit(**{property_id:''})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'start_requested') 'start_requested')
...@@ -463,10 +463,10 @@ class TestSlapOSInstanceTreeConstraint(TestSlapOSConstraintMixin): ...@@ -463,10 +463,10 @@ class TestSlapOSInstanceTreeConstraint(TestSlapOSConstraintMixin):
'has never been set' 'has never been set'
# not required in draft state # not required in draft state
self.software_instance.edit(**{property_id:None}) self.software_instance.edit(**{property_id:None})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.software_instance.edit(**{property_id:''}) self.software_instance.edit(**{property_id:''})
self.assertFalse(consistency_message in self.getMessageList(self.software_instance)) self.assertNotIn(consistency_message, self.getMessageList(self.software_instance))
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'start_requested') 'start_requested')
...@@ -478,17 +478,17 @@ class TestSlapOSPersonConstraint(TestSlapOSConstraintMixin): ...@@ -478,17 +478,17 @@ class TestSlapOSPersonConstraint(TestSlapOSConstraintMixin):
def test_role(self): def test_role(self):
person = self.portal.person_module.newContent(portal_type='Person') person = self.portal.person_module.newContent(portal_type='Person')
consistency_message = 'One role should be defined' consistency_message = 'One role should be defined'
self.assertTrue(consistency_message in self.getMessageList(person)) self.assertIn(consistency_message, self.getMessageList(person))
role_id_list = list(self.portal.portal_categories.role.objectIds()) role_id_list = list(self.portal.portal_categories.role.objectIds())
self.assertTrue(len(role_id_list) >= 2) self.assertTrue(len(role_id_list) >= 2)
person.setRole(role_id_list[0]) person.setRole(role_id_list[0])
self.assertFalse(consistency_message in self.getMessageList(person)) self.assertNotIn(consistency_message, self.getMessageList(person))
person.setRoleList(role_id_list) person.setRoleList(role_id_list)
self.assertTrue(consistency_message in self.getMessageList(person)) self.assertIn(consistency_message, self.getMessageList(person))
person.setRole(role_id_list[0]) person.setRole(role_id_list[0])
self.assertFalse(consistency_message in self.getMessageList(person)) self.assertNotIn(consistency_message, self.getMessageList(person))
def test_subordination_state(self): def test_subordination_state(self):
organisation = self.portal.organisation_module.newContent( organisation = self.portal.organisation_module.newContent(
...@@ -497,21 +497,21 @@ class TestSlapOSPersonConstraint(TestSlapOSConstraintMixin): ...@@ -497,21 +497,21 @@ class TestSlapOSPersonConstraint(TestSlapOSConstraintMixin):
subordination=organisation.getRelativeUrl()) subordination=organisation.getRelativeUrl())
consistency_message = 'The Organisation is not validated' consistency_message = 'The Organisation is not validated'
self.assertTrue(consistency_message in self.getMessageList(person)) self.assertIn(consistency_message, self.getMessageList(person))
organisation.validate() organisation.validate()
self.assertFalse(consistency_message in self.getMessageList(person)) self.assertNotIn(consistency_message, self.getMessageList(person))
def test_email(self): def test_email(self):
person = self.portal.person_module.newContent(portal_type='Person') person = self.portal.person_module.newContent(portal_type='Person')
consistency_message = 'Person have to contain an Email' consistency_message = 'Person have to contain an Email'
self.assertTrue(consistency_message in self.getMessageList(person)) self.assertIn(consistency_message, self.getMessageList(person))
person.newContent(portal_type='Email') person.newContent(portal_type='Email')
self.assertFalse(consistency_message in self.getMessageList(person)) self.assertNotIn(consistency_message, self.getMessageList(person))
class TestSlapOSAssignmentConstraint(TestSlapOSConstraintMixin): class TestSlapOSAssignmentConstraint(TestSlapOSConstraintMixin):
def test_parent_person_validated(self): def test_parent_person_validated(self):
...@@ -520,11 +520,11 @@ class TestSlapOSAssignmentConstraint(TestSlapOSConstraintMixin): ...@@ -520,11 +520,11 @@ class TestSlapOSAssignmentConstraint(TestSlapOSConstraintMixin):
consistency_message = 'The person document has to be validated to start '\ consistency_message = 'The person document has to be validated to start '\
'assignment' 'assignment'
self.assertTrue(consistency_message in self.getMessageList(assignment)) self.assertIn(consistency_message, self.getMessageList(assignment))
person.validate() person.validate()
self.assertFalse(consistency_message in self.getMessageList(assignment)) self.assertNotIn(consistency_message, self.getMessageList(assignment))
class TestSlapOSEmailConstraint(TestSlapOSConstraintMixin): class TestSlapOSEmailConstraint(TestSlapOSConstraintMixin):
def test_url_string_not_empty(self): def test_url_string_not_empty(self):
...@@ -532,20 +532,20 @@ class TestSlapOSEmailConstraint(TestSlapOSConstraintMixin): ...@@ -532,20 +532,20 @@ class TestSlapOSEmailConstraint(TestSlapOSConstraintMixin):
).newContent(portal_type='Email') ).newContent(portal_type='Email')
consistency_message = 'Email must be defined' consistency_message = 'Email must be defined'
self.assertTrue(consistency_message in self.getMessageList(email)) self.assertIn(consistency_message, self.getMessageList(email))
email.setUrlString(self.generateNewId()) email.setUrlString(self.generateNewId())
self.assertFalse(consistency_message in self.getMessageList(email)) self.assertNotIn(consistency_message, self.getMessageList(email))
class TestSlapOSComputeNodeConstraint(TestSlapOSConstraintMixin): class TestSlapOSComputeNodeConstraint(TestSlapOSConstraintMixin):
def test_title_not_empty(self): def test_title_not_empty(self):
compute_node = self.portal.compute_node_module.newContent(portal_type='Compute Node') compute_node = self.portal.compute_node_module.newContent(portal_type='Compute Node')
consistency_message = 'Title must be defined' consistency_message = 'Title must be defined'
self.assertTrue(consistency_message in self.getMessageList(compute_node)) self.assertIn(consistency_message, self.getMessageList(compute_node))
compute_node.setTitle(self.generateNewId()) compute_node.setTitle(self.generateNewId())
self.assertFalse(consistency_message in self.getMessageList(compute_node)) self.assertNotIn(consistency_message, self.getMessageList(compute_node))
class TestSlapOSReferenceConstraint(TestSlapOSConstraintMixin): class TestSlapOSReferenceConstraint(TestSlapOSConstraintMixin):
......
...@@ -1337,8 +1337,8 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin): ...@@ -1337,8 +1337,8 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16) serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in self.software_instance.getSslCertificate()) self.assertIn(serial, self.software_instance.getSslCertificate())
self.assertTrue(certificate_login.getReference() in \ self.assertIn(certificate_login.getReference(), \
self.software_instance.getSslCertificate().decode('string_escape')) self.software_instance.getSslCertificate().decode('string_escape'))
self.assertRaises(ValueError, self.software_instance.generateCertificate) self.assertRaises(ValueError, self.software_instance.generateCertificate)
......
...@@ -100,7 +100,7 @@ class TestSlapOSComputeNodeSecurity(TestSlapOSSecurityMixin): ...@@ -100,7 +100,7 @@ class TestSlapOSComputeNodeSecurity(TestSlapOSSecurityMixin):
self.login(user_id) self.login(user_id)
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-COMPUTER'], self.assertSameSet(['R-COMPUTER'],
user.getGroups()) user.getGroups())
...@@ -136,7 +136,7 @@ class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin): ...@@ -136,7 +136,7 @@ class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin):
# instance w/o subscription is loggable and it has some roles # instance w/o subscription is loggable and it has some roles
self.login(user_id) self.login(user_id)
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-INSTANCE'], self.assertSameSet(['R-INSTANCE'],
user.getGroups()) user.getGroups())
...@@ -154,7 +154,7 @@ class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin): ...@@ -154,7 +154,7 @@ class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin):
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
self.login(user_id) self.login(user_id)
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-INSTANCE', subscription_reference], self.assertSameSet(['R-INSTANCE', subscription_reference],
user.getGroups()) user.getGroups())
...@@ -196,7 +196,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin): ...@@ -196,7 +196,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.login(person.getUserId()) self.login(person.getUserId())
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertIn('Authenticated', user.getRoles())
self.assertSameSet([], user.getGroups()) self.assertSameSet([], user.getGroups())
...@@ -209,7 +209,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin): ...@@ -209,7 +209,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
self.login(person.getUserId()) self.login(person.getUserId())
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['G-COMPANY'], user.getGroups()) self.assertSameSet(['G-COMPANY'], user.getGroups())
# add to role category # add to role category
...@@ -220,7 +220,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin): ...@@ -220,7 +220,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
self.login(person.getUserId()) self.login(person.getUserId())
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-MEMBER', 'G-COMPANY'], user.getGroups()) self.assertSameSet(['R-MEMBER', 'G-COMPANY'], user.getGroups())
# add to role for project # add to role for project
...@@ -236,7 +236,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin): ...@@ -236,7 +236,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
self.login(person.getUserId()) self.login(person.getUserId())
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-MEMBER', 'G-COMPANY', project.getReference()], user.getGroups()) self.assertSameSet(['R-MEMBER', 'G-COMPANY', project.getReference()], user.getGroups())
# add to role for project # add to role for project
...@@ -253,7 +253,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin): ...@@ -253,7 +253,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
self.login(person.getUserId()) self.login(person.getUserId())
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-MEMBER', 'G-COMPANY', organisation.getReference(), self.assertSameSet(['R-MEMBER', 'G-COMPANY', organisation.getReference(),
project.getReference()], user.getGroups()) project.getReference()], user.getGroups())
......
...@@ -54,7 +54,7 @@ class TestSlapOSShadowPerson(TestSlapOSSecurityMixin): ...@@ -54,7 +54,7 @@ class TestSlapOSShadowPerson(TestSlapOSSecurityMixin):
self.login(shadow_user_id) self.login(shadow_user_id)
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-SHADOW-PERSON', 'SHADOW-%s' % user_id], self.assertSameSet(['R-SHADOW-PERSON', 'SHADOW-%s' % user_id],
user.getGroups()) user.getGroups())
...@@ -95,7 +95,7 @@ class TestSlapOSShadowComputeNode(TestSlapOSSecurityMixin): ...@@ -95,7 +95,7 @@ class TestSlapOSShadowComputeNode(TestSlapOSSecurityMixin):
self.login(shadow_user_id) self.login(shadow_user_id)
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-SHADOW-COMPUTENODE', 'SHADOW-%s' % user_id], self.assertSameSet(['R-SHADOW-COMPUTENODE', 'SHADOW-%s' % user_id],
user.getGroups()) user.getGroups())
...@@ -135,7 +135,7 @@ class TestSlapOSShadowSoftwareInstance(TestSlapOSSecurityMixin): ...@@ -135,7 +135,7 @@ class TestSlapOSShadowSoftwareInstance(TestSlapOSSecurityMixin):
self.login(shadow_user_id) self.login(shadow_user_id)
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-SHADOW-SOFTWAREINSTANCE', 'SHADOW-%s' % user_id], self.assertSameSet(['R-SHADOW-SOFTWAREINSTANCE', 'SHADOW-%s' % user_id],
user.getGroups()) user.getGroups())
......
...@@ -32,29 +32,29 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin): ...@@ -32,29 +32,29 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
) )
# Nothing to migrate # Nothing to migrate
self.assertFalse(migration_message in getMessageList(instance_nothing_to_migrate)) self.assertNotIn(migration_message, getMessageList(instance_nothing_to_migrate))
self.assertFalse(error_message in getMessageList(instance_nothing_to_migrate)) self.assertNotIn(error_message, getMessageList(instance_nothing_to_migrate))
# Migrate # Migrate
self.assertTrue(migration_message in getMessageList(instance_to_migrate)) self.assertIn(migration_message, getMessageList(instance_to_migrate))
self.assertFalse(error_message in getMessageList(instance_to_migrate)) self.assertNotIn(error_message, getMessageList(instance_to_migrate))
instance_to_migrate.fixConsistency() instance_to_migrate.fixConsistency()
self.assertEqual(None, instance_to_migrate.getPredecessor()) self.assertEqual(None, instance_to_migrate.getPredecessor())
self.assertEqual(instance_nothing_to_migrate.getRelativeUrl(), self.assertEqual(instance_nothing_to_migrate.getRelativeUrl(),
instance_to_migrate.getSuccessor()) instance_to_migrate.getSuccessor())
self.assertFalse(migration_message in getMessageList(instance_to_migrate)) self.assertNotIn(migration_message, getMessageList(instance_to_migrate))
self.assertFalse(error_message in getMessageList(instance_to_migrate)) self.assertNotIn(error_message, getMessageList(instance_to_migrate))
# Error # Error
self.assertFalse(migration_message in getMessageList(instance_badly_migrated)) self.assertNotIn(migration_message, getMessageList(instance_badly_migrated))
self.assertTrue(error_message in getMessageList(instance_badly_migrated)) self.assertIn(error_message, getMessageList(instance_badly_migrated))
instance_badly_migrated.fixConsistency() instance_badly_migrated.fixConsistency()
self.assertEqual(instance_nothing_to_migrate.getRelativeUrl(), self.assertEqual(instance_nothing_to_migrate.getRelativeUrl(),
instance_badly_migrated.getPredecessor()) instance_badly_migrated.getPredecessor())
self.assertEqual(instance_nothing_to_migrate.getRelativeUrl(), self.assertEqual(instance_nothing_to_migrate.getRelativeUrl(),
instance_badly_migrated.getSuccessor()) instance_badly_migrated.getSuccessor())
self.assertFalse(migration_message in getMessageList(instance_badly_migrated)) self.assertNotIn(migration_message, getMessageList(instance_badly_migrated))
self.assertTrue(error_message in getMessageList(instance_badly_migrated)) self.assertIn(error_message, getMessageList(instance_badly_migrated))
def test_upgrade_software_instance_predecessor(self): def test_upgrade_software_instance_predecessor(self):
return self.check_upgrade_instance_predecessor('Software Instance') return self.check_upgrade_instance_predecessor('Software Instance')
...@@ -107,10 +107,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin): ...@@ -107,10 +107,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
self.tic() self.tic()
# Nothing to migrate # Nothing to migrate
self.assertFalse(migration_message in getMessageList(hosting_subscription_nothing_to_migrate)) self.assertNotIn(migration_message, getMessageList(hosting_subscription_nothing_to_migrate))
# To migrate # To migrate
self.assertTrue(migration_message in getMessageList(hosting_subscription_to_migrate)) self.assertIn(migration_message, getMessageList(hosting_subscription_to_migrate))
hosting_subscription_to_migrate.fixConsistency() hosting_subscription_to_migrate.fixConsistency()
self.commit() self.commit()
...@@ -145,8 +145,8 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin): ...@@ -145,8 +145,8 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
migrated_instance_tree.getCreationDate()) migrated_instance_tree.getCreationDate())
# self.assertEqual(modification_date, # self.assertEqual(modification_date,
# migrated_instance_tree.getModificationDate()) # migrated_instance_tree.getModificationDate())
self.assertFalse('hosting_subscription_workflow' in migrated_instance_tree.workflow_history) self.assertNotIn('hosting_subscription_workflow', migrated_instance_tree.workflow_history)
self.assertFalse(migration_message in getMessageList(migrated_instance_tree)) self.assertNotIn(migration_message, getMessageList(migrated_instance_tree))
self.assertEqual(migrated_instance_tree.getRelativeUrl(), self.assertEqual(migrated_instance_tree.getRelativeUrl(),
software_instance.getAggregate()) software_instance.getAggregate())
self.assertEqual(1, len(self.portal.portal_catalog(uid=migrated_instance_tree.getUid()))) self.assertEqual(1, len(self.portal.portal_catalog(uid=migrated_instance_tree.getUid())))
...@@ -213,10 +213,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin): ...@@ -213,10 +213,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
self.tic() self.tic()
# Nothing to migrate # Nothing to migrate
self.assertFalse(migration_message in getMessageList(computer_nothing_to_migrate)) self.assertNotIn(migration_message, getMessageList(computer_nothing_to_migrate))
# To migrate # To migrate
self.assertTrue(migration_message in getMessageList(computer_to_migrate)) self.assertIn(migration_message, getMessageList(computer_to_migrate))
computer_to_migrate.fixConsistency() computer_to_migrate.fixConsistency()
self.commit() self.commit()
...@@ -258,9 +258,9 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin): ...@@ -258,9 +258,9 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
migrated_compute_node.getCreationDate()) migrated_compute_node.getCreationDate())
# self.assertEqual(modification_date, # self.assertEqual(modification_date,
# migrated_compute_node.getModificationDate()) # migrated_compute_node.getModificationDate())
self.assertFalse('computer_slap_interface_workflow' in migrated_compute_node.workflow_history) self.assertNotIn('computer_slap_interface_workflow', migrated_compute_node.workflow_history)
self.assertFalse(migration_message in getMessageList(migrated_compute_node)) self.assertNotIn(migration_message, getMessageList(migrated_compute_node))
self.assertEqual(migrated_compute_node.getRelativeUrl(), self.assertEqual(migrated_compute_node.getRelativeUrl(),
software_installation.getAggregate()) software_installation.getAggregate())
self.assertEqual(migrated_computer_partition.getRelativeUrl(), self.assertEqual(migrated_computer_partition.getRelativeUrl(),
...@@ -318,10 +318,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin): ...@@ -318,10 +318,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
self.tic() self.tic()
# Nothing to migrate # Nothing to migrate
self.assertFalse(migration_message in getMessageList(computer_nothing_to_migrate)) self.assertNotIn(migration_message, getMessageList(computer_nothing_to_migrate))
# To migrate # To migrate
self.assertTrue(migration_message in getMessageList(computer_partition_to_migrate)) self.assertIn(migration_message, getMessageList(computer_partition_to_migrate))
computer_partition_to_migrate.fixConsistency() computer_partition_to_migrate.fixConsistency()
self.commit() self.commit()
...@@ -344,8 +344,8 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin): ...@@ -344,8 +344,8 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
migrated_computer_partition.getCreationDate()) migrated_computer_partition.getCreationDate())
# self.assertEqual(modification_date, # self.assertEqual(modification_date,
# migrated_compute_node.getModificationDate()) # migrated_compute_node.getModificationDate())
self.assertFalse('computer_partition_slap_interface_workflow' in migrated_computer_partition.workflow_history) self.assertNotIn('computer_partition_slap_interface_workflow', migrated_computer_partition.workflow_history)
self.assertFalse(migration_message in getMessageList(computer_partition_to_migrate)) self.assertNotIn(migration_message, getMessageList(computer_partition_to_migrate))
self.assertEqual(1, len(self.portal.portal_catalog(uid=migrated_computer_partition.getUid()))) self.assertEqual(1, len(self.portal.portal_catalog(uid=migrated_computer_partition.getUid())))
...@@ -241,11 +241,11 @@ class TestSlapOSDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm(Slap ...@@ -241,11 +241,11 @@ class TestSlapOSDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm(Slap
self.tic() self.tic()
v = 'Visited by SoftwareRelease_findAndDestroySoftwareInstallation' v = 'Visited by SoftwareRelease_findAndDestroySoftwareInstallation'
self.assertFalse(v in self.assertNotIn(v,
[q['comment'] for q in published_software_release.workflow_history['edit_workflow']]) [q['comment'] for q in published_software_release.workflow_history['edit_workflow']])
self.assertTrue(v in self.assertIn(v,
[q['comment'] for q in archived_cleaned_software_release.workflow_history['edit_workflow']]) [q['comment'] for q in archived_cleaned_software_release.workflow_history['edit_workflow']])
self.assertTrue(v in self.assertIn(v,
[q['comment'] for q in archived_software_release.workflow_history['edit_workflow']]) [q['comment'] for q in archived_software_release.workflow_history['edit_workflow']])
@simulateByEditWorkflowMark('SoftwareInstallation_destroyWithSoftwareReleaseArchived') @simulateByEditWorkflowMark('SoftwareInstallation_destroyWithSoftwareReleaseArchived')
...@@ -304,9 +304,9 @@ class TestSlapOSDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm(Slap ...@@ -304,9 +304,9 @@ class TestSlapOSDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm(Slap
self.tic() self.tic()
v = 'Visited by SoftwareInstallation_destroyWithSoftwareReleaseArchived' v = 'Visited by SoftwareInstallation_destroyWithSoftwareReleaseArchived'
self.assertTrue(v in self.assertIn(v,
[q['comment'] for q in software_installation_validated_request_start.workflow_history['edit_workflow']]) [q['comment'] for q in software_installation_validated_request_start.workflow_history['edit_workflow']])
self.assertFalse(v in self.assertNotIn(v,
[q['comment'] for q in software_installation_validated_request_destroy.workflow_history['edit_workflow']]) [q['comment'] for q in software_installation_validated_request_destroy.workflow_history['edit_workflow']])
self.assertFalse(v in self.assertNotIn(v,
[q['comment'] for q in software_installation_invalidated_request_destroy.workflow_history['edit_workflow']]) [q['comment'] for q in software_installation_invalidated_request_destroy.workflow_history['edit_workflow']])
\ No newline at end of file
...@@ -127,7 +127,7 @@ class TestSlapOSEvent_getRSSTextContent(TestRSSSyleSkinsMixin): ...@@ -127,7 +127,7 @@ class TestSlapOSEvent_getRSSTextContent(TestRSSSyleSkinsMixin):
self.portal.portal_skins.changeSkin('RSS') self.portal.portal_skins.changeSkin('RSS')
text_content = event.Event_getRSSTextContent() text_content = event.Event_getRSSTextContent()
self.assertTrue(event.getTextContent() in text_content) self.assertIn(event.getTextContent(), text_content)
self.assertTrue("Sender: " in text_content, "Sender: not in %s" % text_content) self.assertTrue("Sender: " in text_content, "Sender: not in %s" % text_content)
self.assertTrue("Recipient: " in text_content, "Recipient: not in %s" % text_content) self.assertTrue("Recipient: " in text_content, "Recipient: not in %s" % text_content)
self.assertTrue("Content:" in text_content, "Content: not in %s" % text_content) self.assertTrue("Content:" in text_content, "Content: not in %s" % text_content)
......
...@@ -103,7 +103,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): ...@@ -103,7 +103,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
) )
) )
self.assertEqual(200, response.status) self.assertEqual(200, response.status)
self.assertTrue('last-modified' not in response.headers) self.assertNotIn('last-modified', response.headers)
self.assertEqual(first_etag, response.headers.get('etag')) self.assertEqual(first_etag, response.headers.get('etag'))
self.assertEqual(first_body_fingerprint, hashData(response.body)) self.assertEqual(first_body_fingerprint, hashData(response.body))
self.assertEqual(0, len(self.portal.portal_activities.getMessageList())) self.assertEqual(0, len(self.portal.portal_activities.getMessageList()))
...@@ -119,7 +119,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): ...@@ -119,7 +119,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response = self.portal_slap.getFullComputerInformation(self.compute_node_id) response = self.portal_slap.getFullComputerInformation(self.compute_node_id)
self.commit() self.commit()
self.assertEqual(200, response.status) self.assertEqual(200, response.status)
self.assertTrue('last-modified' not in response.headers) self.assertNotIn('last-modified', response.headers)
self.assertEqual(first_etag, response.headers.get('etag')) self.assertEqual(first_etag, response.headers.get('etag'))
self.assertEqual(first_body_fingerprint, hashData(response.body)) self.assertEqual(first_body_fingerprint, hashData(response.body))
self.assertEqual(current_activity_count, len(self.portal.portal_activities.getMessageList())) self.assertEqual(current_activity_count, len(self.portal.portal_activities.getMessageList()))
...@@ -132,7 +132,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): ...@@ -132,7 +132,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response = self.portal_slap.getFullComputerInformation(self.compute_node_id) response = self.portal_slap.getFullComputerInformation(self.compute_node_id)
self.commit() self.commit()
self.assertEqual(200, response.status) self.assertEqual(200, response.status)
self.assertTrue('last-modified' not in response.headers) self.assertNotIn('last-modified', response.headers)
second_etag = self.compute_node._calculateRefreshEtag() second_etag = self.compute_node._calculateRefreshEtag()
second_body_fingerprint = hashData( second_body_fingerprint = hashData(
self.portal_slap._getSlapComputeNodeXMLFromDict( self.portal_slap._getSlapComputeNodeXMLFromDict(
...@@ -154,7 +154,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): ...@@ -154,7 +154,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response = self.portal_slap.getFullComputerInformation(self.compute_node_id) response = self.portal_slap.getFullComputerInformation(self.compute_node_id)
self.commit() self.commit()
self.assertEqual(200, response.status) self.assertEqual(200, response.status)
self.assertTrue('last-modified' not in response.headers) self.assertNotIn('last-modified', response.headers)
self.assertEqual(second_etag, response.headers.get('etag')) self.assertEqual(second_etag, response.headers.get('etag'))
self.assertEqual(first_body_fingerprint, hashData(response.body)) self.assertEqual(first_body_fingerprint, hashData(response.body))
self.assertEqual(0, len(self.portal.portal_activities.getMessageList())) self.assertEqual(0, len(self.portal.portal_activities.getMessageList()))
...@@ -179,7 +179,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): ...@@ -179,7 +179,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response = self.portal_slap.getFullComputerInformation(self.compute_node_id) response = self.portal_slap.getFullComputerInformation(self.compute_node_id)
self.commit() self.commit()
self.assertEqual(200, response.status) self.assertEqual(200, response.status)
self.assertTrue('last-modified' not in response.headers) self.assertNotIn('last-modified', response.headers)
self.assertEqual(second_etag, response.headers.get('etag')) self.assertEqual(second_etag, response.headers.get('etag'))
self.assertEqual(first_body_fingerprint, hashData(response.body)) self.assertEqual(first_body_fingerprint, hashData(response.body))
self.assertEqual(current_activity_count, len(self.portal.portal_activities.getMessageList())) self.assertEqual(current_activity_count, len(self.portal.portal_activities.getMessageList()))
...@@ -193,7 +193,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): ...@@ -193,7 +193,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response = self.portal_slap.getFullComputerInformation(self.compute_node_id) response = self.portal_slap.getFullComputerInformation(self.compute_node_id)
self.commit() self.commit()
self.assertEqual(200, response.status) self.assertEqual(200, response.status)
self.assertTrue('last-modified' not in response.headers) self.assertNotIn('last-modified', response.headers)
third_etag = self.compute_node._calculateRefreshEtag() third_etag = self.compute_node._calculateRefreshEtag()
self.assertNotEqual(second_etag, third_etag) self.assertNotEqual(second_etag, third_etag)
self.assertEqual(third_etag, response.headers.get('etag')) self.assertEqual(third_etag, response.headers.get('etag'))
...@@ -220,7 +220,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): ...@@ -220,7 +220,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response = self.portal_slap.getFullComputerInformation(self.compute_node_id) response = self.portal_slap.getFullComputerInformation(self.compute_node_id)
self.commit() self.commit()
self.assertEqual(200, response.status) self.assertEqual(200, response.status)
self.assertTrue('last-modified' not in response.headers) self.assertNotIn('last-modified', response.headers)
self.assertEqual(third_etag, response.headers.get('etag')) self.assertEqual(third_etag, response.headers.get('etag'))
self.assertEqual(third_body_fingerprint, hashData(response.body)) self.assertEqual(third_body_fingerprint, hashData(response.body))
self.assertEqual(current_activity_count, len(self.portal.portal_activities.getMessageList())) self.assertEqual(current_activity_count, len(self.portal.portal_activities.getMessageList()))
...@@ -236,7 +236,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): ...@@ -236,7 +236,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
response = self.portal_slap.getFullComputerInformation(self.compute_node_id) response = self.portal_slap.getFullComputerInformation(self.compute_node_id)
self.commit() self.commit()
self.assertEqual(200, response.status) self.assertEqual(200, response.status)
self.assertTrue('last-modified' not in response.headers) self.assertNotIn('last-modified', response.headers)
fourth_etag = self.compute_node._calculateRefreshEtag() fourth_etag = self.compute_node._calculateRefreshEtag()
fourth_body_fingerprint = hashData( fourth_body_fingerprint = hashData(
self.portal_slap._getSlapComputeNodeXMLFromDict( self.portal_slap._getSlapComputeNodeXMLFromDict(
...@@ -269,7 +269,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin): ...@@ -269,7 +269,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertFalse('etag' in response.headers) self.assertNotIn('etag', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
...@@ -645,7 +645,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin): ...@@ -645,7 +645,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -693,7 +693,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin): ...@@ -693,7 +693,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
...@@ -807,7 +807,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin): ...@@ -807,7 +807,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -1130,7 +1130,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1130,7 +1130,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -1161,7 +1161,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1161,7 +1161,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertFalse('etag' in response.headers) self.assertNotIn('etag', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -1307,7 +1307,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1307,7 +1307,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -1357,7 +1357,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1357,7 +1357,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -1405,7 +1405,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1405,7 +1405,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -1535,7 +1535,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1535,7 +1535,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -2482,7 +2482,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2482,7 +2482,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -2530,7 +2530,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2530,7 +2530,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
...@@ -2610,7 +2610,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2610,7 +2610,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -2662,7 +2662,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2662,7 +2662,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -2710,7 +2710,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2710,7 +2710,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
...@@ -2840,7 +2840,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2840,7 +2840,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
response.headers.get('cache-control')) response.headers.get('cache-control'))
self.assertEqual('REMOTE_USER', self.assertEqual('REMOTE_USER',
response.headers.get('vary')) response.headers.get('vary'))
self.assertTrue('last-modified' in response.headers) self.assertIn('last-modified', response.headers)
self.assertEqual('text/xml; charset=utf-8', self.assertEqual('text/xml; charset=utf-8',
response.headers.get('content-type')) response.headers.get('content-type'))
# check returned XML # check returned XML
......
...@@ -88,7 +88,7 @@ class TestSlapOSCoreComputeNodeUpdateFromDict(SlapOSTestCaseMixinWithAbort): ...@@ -88,7 +88,7 @@ class TestSlapOSCoreComputeNodeUpdateFromDict(SlapOSTestCaseMixinWithAbort):
self.assertEqual(address.getIpAddress(), 'e') self.assertEqual(address.getIpAddress(), 'e')
self.assertEqual(address.getNetmask(), 'f') self.assertEqual(address.getNetmask(), 'f')
# Existing document should be edited if possible # Existing document should be edited if possible
self.assertTrue(address.getId() in ('foo', 'bar')) self.assertIn(address.getId(), ('foo', 'bar'))
############################################# #############################################
# Compute Partition network information # Compute Partition network information
......
...@@ -966,9 +966,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -966,9 +966,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
"TestSubscriptionSkins Notification Message %s %s" % ( "TestSubscriptionSkins Notification Message %s %s" % (
subscription_request.getLanguage(), notification_message), subscription_request.getLanguage(), notification_message),
mail_message.getTitle()) mail_message.getTitle())
self.assertTrue(subscription_request.getDefaultEmailText() in \ self.assertIn(subscription_request.getDefaultEmailText(), \
mail_message.getTextContent()) mail_message.getTextContent())
self.assertTrue(subscription_request.getDestinationSectionTitle() in \ self.assertIn(subscription_request.getDestinationSectionTitle(), \
mail_message.getTextContent()) mail_message.getTextContent())
def checkEmailPaymentNotification(self, subscription_request, def checkEmailPaymentNotification(self, subscription_request,
...@@ -984,9 +984,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -984,9 +984,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
mail_message.getTitle()) mail_message.getTitle())
invoice = subscription_request.SubscriptionRequest_verifyPaymentBalanceIsReady() invoice = subscription_request.SubscriptionRequest_verifyPaymentBalanceIsReady()
self.assertEqual(invoice.getSimulationState(), 'stopped') self.assertEqual(invoice.getSimulationState(), 'stopped')
self.assertTrue(invoice.getRelativeUrl() in \ self.assertIn(invoice.getRelativeUrl(), \
mail_message.getTextContent()) mail_message.getTextContent())
self.assertTrue(subscription_request.getDestinationSectionTitle() in \ self.assertIn(subscription_request.getDestinationSectionTitle(), \
mail_message.getTextContent()) mail_message.getTextContent())
def checkEmailInstanceNotification(self, subscription_request, def checkEmailInstanceNotification(self, subscription_request,
...@@ -1002,9 +1002,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -1002,9 +1002,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
mail_message.getTitle()) mail_message.getTitle())
instance_tree = subscription_request.getAggregateValue() instance_tree = subscription_request.getAggregateValue()
self.assertEqual(instance_tree.getSlapState(), 'start_requested') self.assertEqual(instance_tree.getSlapState(), 'start_requested')
self.assertTrue(instance_tree.getRelativeUrl() in \ self.assertIn(instance_tree.getRelativeUrl(), \
mail_message.getTextContent()) mail_message.getTextContent())
self.assertTrue(subscription_request.getDestinationSectionTitle() in \ self.assertIn(subscription_request.getDestinationSectionTitle(), \
mail_message.getTextContent()) mail_message.getTextContent())
def checkRelatedInstance(self, subscription_request): def checkRelatedInstance(self, subscription_request):
......
...@@ -664,7 +664,7 @@ class RunPromise(GenericPromise): ...@@ -664,7 +664,7 @@ class RunPromise(GenericPromise):
def test_method(result): def test_method(result):
self.assertTrue(isinstance(result, PromiseQueueResult)) self.assertTrue(isinstance(result, PromiseQueueResult))
self.assertTrue(isinstance(result.item, TestResult)) self.assertTrue(isinstance(result.item, TestResult))
self.assertTrue(result.name in [promise_failed, promise_name]) self.assertIn(result.name, [promise_failed, promise_name])
if result.name == promise_failed: if result.name == promise_failed:
self.assertEqual(result.item.hasFailed(), True) self.assertEqual(result.item.hasFailed(), True)
self.assertEqual(result.item.message, "failed") self.assertEqual(result.item.message, "failed")
...@@ -705,7 +705,7 @@ class RunPromise(GenericPromise): ...@@ -705,7 +705,7 @@ class RunPromise(GenericPromise):
def test_method(result): def test_method(result):
self.assertTrue(isinstance(result, PromiseQueueResult)) self.assertTrue(isinstance(result, PromiseQueueResult))
self.assertTrue(isinstance(result.item, TestResult)) self.assertTrue(isinstance(result.item, TestResult))
self.assertTrue(result.name in [first_promise, second_promise, third_promise]) self.assertIn(result.name, [first_promise, second_promise, third_promise])
self.assertEqual(result.item.hasFailed(), False) self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success") self.assertEqual(result.item.message, "success")
self.counter += 1 self.counter += 1
...@@ -771,7 +771,7 @@ class RunPromise(GenericPromise): ...@@ -771,7 +771,7 @@ class RunPromise(GenericPromise):
self.counter = 0 self.counter = 0
def test_method_first(result): def test_method_first(result):
self.assertTrue(result.name in [first_promise, second_promise]) self.assertIn(result.name, [first_promise, second_promise])
self.assertEqual(result.item.hasFailed(), False) self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success") self.assertEqual(result.item.message, "success")
self.counter += 1 self.counter += 1
...@@ -809,7 +809,7 @@ class RunPromise(GenericPromise): ...@@ -809,7 +809,7 @@ class RunPromise(GenericPromise):
self.counter = 0 self.counter = 0
def test_method(result): def test_method(result):
self.assertTrue(result.name in [first_promise, second_promise]) self.assertIn(result.name, [first_promise, second_promise])
self.assertEqual(result.item.hasFailed(), False) self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success") self.assertEqual(result.item.message, "success")
self.counter += 1 self.counter += 1
...@@ -956,7 +956,7 @@ class RunPromise(GenericPromise): ...@@ -956,7 +956,7 @@ class RunPromise(GenericPromise):
self.counter = 0 self.counter = 0
def test_method(result): def test_method(result):
self.assertTrue(result.name in [first_promise, second_promise]) self.assertIn(result.name, [first_promise, second_promise])
self.assertEqual(result.item.hasFailed(), False) self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success") self.assertEqual(result.item.message, "success")
self.counter += 1 self.counter += 1
...@@ -1082,7 +1082,7 @@ exit 0 ...@@ -1082,7 +1082,7 @@ exit 0
self.counter = 0 self.counter = 0
self.check_list = [first_promise, second_promise, third_promise] self.check_list = [first_promise, second_promise, third_promise]
def test_method(result): def test_method(result):
self.assertTrue(result.name in self.check_list) self.assertIn(result.name, self.check_list)
self.assertEqual(result.item.hasFailed(), False) self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success") self.assertEqual(result.item.message, "success")
self.counter += 1 self.counter += 1
...@@ -1110,7 +1110,7 @@ exit 0 ...@@ -1110,7 +1110,7 @@ exit 0
self.counter = 0 self.counter = 0
self.check_list = [first_promise, second_promise, third_promise] self.check_list = [first_promise, second_promise, third_promise]
def test_method(result): def test_method(result):
self.assertTrue(result.name in self.check_list) self.assertIn(result.name, self.check_list)
self.assertEqual(result.item.hasFailed(), False) self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success") self.assertEqual(result.item.message, "success")
self.counter += 1 self.counter += 1
...@@ -1186,7 +1186,7 @@ exit 0 ...@@ -1186,7 +1186,7 @@ exit 0
self.assertTrue(result.execution_time >= 1) self.assertTrue(result.execution_time >= 1)
self.assertEqual(result.title, 'my_promise') self.assertEqual(result.title, 'my_promise')
self.assertEqual(result.name, promise_name) self.assertEqual(result.name, promise_name)
self.assertTrue("Promise timed out after" in result.item.message) self.assertIn("Promise timed out after", result.item.message)
self.assertEqual(result.item.hasFailed(), True) self.assertEqual(result.item.hasFailed(), True)
self.configureLauncher(save_method=test_method, enable_anomaly=True, timeout=1) self.configureLauncher(save_method=test_method, enable_anomaly=True, timeout=1)
...@@ -1218,7 +1218,7 @@ echo "success" ...@@ -1218,7 +1218,7 @@ echo "success"
self.assertEqual(result.title, promise_name) self.assertEqual(result.title, promise_name)
self.assertEqual(result.name, promise_name) self.assertEqual(result.name, promise_name)
self.assertEqual(result.path, promise_path) self.assertEqual(result.path, promise_path)
self.assertTrue("Promise timed out after" in result.item.message) self.assertIn("Promise timed out after", result.item.message)
self.assertEqual(result.item.hasFailed(), True) self.assertEqual(result.item.hasFailed(), True)
self.assertTrue(isinstance(result.item.date, datetime)) self.assertTrue(isinstance(result.item.date, datetime))
......
...@@ -2392,7 +2392,7 @@ class TestSlapgridCPWithMasterPromise(MasterMixin, unittest.TestCase): ...@@ -2392,7 +2392,7 @@ class TestSlapgridCPWithMasterPromise(MasterMixin, unittest.TestCase):
log_file = '%s/.slapgrid/log/instance.log' % instance.partition_path log_file = '%s/.slapgrid/log/instance.log' % instance.partition_path
with open(log_file) as f: with open(log_file) as f:
self.assertTrue('Error Promise 254554802' in f.read()) self.assertIn('Error Promise 254554802', f.read())
self.assertTrue(instance.error) self.assertTrue(instance.error)
self.assertIsNone(instance.state) self.assertIsNone(instance.state)
...@@ -3135,7 +3135,7 @@ exit 0 ...@@ -3135,7 +3135,7 @@ exit 0
self._wait_prerm_script_finished(partition.partition_path) self._wait_prerm_script_finished(partition.partition_path)
with open(os.path.join(partition.partition_path, '.0-prerm_slapos_pre_delete.log')) as f: with open(os.path.join(partition.partition_path, '.0-prerm_slapos_pre_delete.log')) as f:
# the script is well finished... # the script is well finished...
self.assertTrue("finished prerm script." in f.read()) self.assertIn("finished prerm script.", f.read())
self.assertEqual(self.grid.agregateAndSendUsage(), slapgrid.SLAPGRID_SUCCESS) self.assertEqual(self.grid.agregateAndSendUsage(), slapgrid.SLAPGRID_SUCCESS)
# Assert partition directory is empty # Assert partition directory is empty
......
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