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 erp5@2e366054
parent 6b081951
......@@ -1403,7 +1403,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
self.assertFalse(transaction_line.hasStopDate())
self.assertEqual([], transaction_line.contentValues(
portal_type='Delivery Cell'))
self.assertTrue(simulation_movement.getRelativeUrl() in
self.assertIn(simulation_movement.getRelativeUrl(),
transaction_line.getDeliveryRelatedList(
portal_type='Simulation Movement'))
......@@ -1741,7 +1741,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
self.assertFalse(transaction_line.hasStopDate())
self.assertEqual([], transaction_line.contentValues(
portal_type='Delivery Cell'))
self.assertTrue(simulation_movement.getRelativeUrl() in
self.assertIn(simulation_movement.getRelativeUrl(),
transaction_line.getDeliveryRelatedList(
portal_type='Simulation Movement'))
......
......@@ -125,7 +125,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
def requestComputeNode(self, title):
requestXml = self.portal.portal_slap.requestComputer(title)
self.tic()
self.assertTrue('marshal' in requestXml)
self.assertIn('marshal', requestXml)
compute_node = xml_marshaller.xml_marshaller.loads(requestXml)
compute_node_id = getattr(compute_node, '_computer_id', None)
self.assertNotEqual(None, compute_node_id)
......
......@@ -17,11 +17,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self.tic()
# 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.InstanceTree_assertSuccessor()
self.assertTrue(self.instance_tree.getTitle() in
self.assertIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList())
def test_InstanceTree_assertSuccessor_stop_requested(self):
......@@ -31,11 +31,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self.tic()
# 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.InstanceTree_assertSuccessor()
self.assertTrue(self.instance_tree.getTitle() in
self.assertIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList())
def test_InstanceTree_assertSuccessor_destroy_requested(self):
......@@ -45,11 +45,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self.tic()
# 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.InstanceTree_assertSuccessor()
self.assertFalse(self.instance_tree.getTitle() in
self.assertNotIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList())
def test_InstanceTree_assertSuccessor_archived(self):
......@@ -58,11 +58,11 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
self.tic()
# 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.InstanceTree_assertSuccessor()
self.assertFalse(self.instance_tree.getTitle() in
self.assertNotIn(self.instance_tree.getTitle(),
self.instance_tree.getSuccessorTitleList())
def test_alarm_renamed(self):
......
......@@ -59,8 +59,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertIn(serial, compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
def test_generateCertificate_twice(self):
self.login(self.compute_node.getUserId())
......@@ -78,8 +78,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertIn(serial, compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertRaises(ValueError, self.compute_node.generateCertificate)
self.assertEqual(None, self.portal.REQUEST.get('compute_node_key'))
......@@ -271,8 +271,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertIn(serial, compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference())
......@@ -305,8 +305,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertIn(serial, compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference())
......@@ -340,8 +340,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertIn(serial, compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference())
self.assertNotEqual(None, destination_reference)
......@@ -375,9 +375,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
serial = '0x%x' % int(new_certificate_login.getDestinationReference(), 16)
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
self.assertTrue(serial in compute_node_certificate)
self.assertTrue(new_certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertFalse(certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertIn(serial, compute_node_certificate)
self.assertIn(new_certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference())
......@@ -399,8 +399,8 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in compute_node_certificate)
self.assertTrue(certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertIn(serial, compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference())
self.assertNotEqual(None, destination_reference)
......@@ -434,9 +434,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
serial = '0x%x' % int(new_certificate_login.getDestinationReference(), 16)
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
self.assertTrue(serial in compute_node_certificate)
self.assertTrue(new_certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertFalse(certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertIn(serial, compute_node_certificate)
self.assertIn(new_certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference())
......@@ -471,9 +471,9 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
serial = '0x%x' % int(third_certificate_login.getDestinationReference(), 16)
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
self.assertTrue(serial in compute_node_certificate)
self.assertTrue(third_certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertFalse(new_certificate_login.getReference() in compute_node_certificate.decode('string_escape'))
self.assertIn(serial, compute_node_certificate)
self.assertIn(third_certificate_login.getReference(), 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.compute_node.getReference())
......
......@@ -1337,8 +1337,8 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertTrue(serial in self.software_instance.getSslCertificate())
self.assertTrue(certificate_login.getReference() in \
self.assertIn(serial, self.software_instance.getSslCertificate())
self.assertIn(certificate_login.getReference(), \
self.software_instance.getSslCertificate().decode('string_escape'))
self.assertRaises(ValueError, self.software_instance.generateCertificate)
......
......@@ -100,7 +100,7 @@ class TestSlapOSComputeNodeSecurity(TestSlapOSSecurityMixin):
self.login(user_id)
user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles())
self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-COMPUTER'],
user.getGroups())
......@@ -136,7 +136,7 @@ class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin):
# instance w/o subscription is loggable and it has some roles
self.login(user_id)
user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles())
self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-INSTANCE'],
user.getGroups())
......@@ -154,7 +154,7 @@ class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin):
self.portal.portal_caches.clearAllCache()
self.login(user_id)
user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles())
self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-INSTANCE', subscription_reference],
user.getGroups())
......@@ -196,7 +196,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.login(person.getUserId())
user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles())
self.assertIn('Authenticated', user.getRoles())
self.assertSameSet([], user.getGroups())
......@@ -209,7 +209,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.portal.portal_caches.clearAllCache()
self.login(person.getUserId())
user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles())
self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['G-COMPANY'], user.getGroups())
# add to role category
......@@ -220,7 +220,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.portal.portal_caches.clearAllCache()
self.login(person.getUserId())
user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles())
self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-MEMBER', 'G-COMPANY'], user.getGroups())
# add to role for project
......@@ -236,7 +236,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.portal.portal_caches.clearAllCache()
self.login(person.getUserId())
user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles())
self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-MEMBER', 'G-COMPANY', project.getReference()], user.getGroups())
# add to role for project
......@@ -253,7 +253,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.portal.portal_caches.clearAllCache()
self.login(person.getUserId())
user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles())
self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-MEMBER', 'G-COMPANY', organisation.getReference(),
project.getReference()], user.getGroups())
......
......@@ -54,7 +54,7 @@ class TestSlapOSShadowPerson(TestSlapOSSecurityMixin):
self.login(shadow_user_id)
user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles())
self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-SHADOW-PERSON', 'SHADOW-%s' % user_id],
user.getGroups())
......@@ -95,7 +95,7 @@ class TestSlapOSShadowComputeNode(TestSlapOSSecurityMixin):
self.login(shadow_user_id)
user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles())
self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-SHADOW-COMPUTENODE', 'SHADOW-%s' % user_id],
user.getGroups())
......@@ -135,7 +135,7 @@ class TestSlapOSShadowSoftwareInstance(TestSlapOSSecurityMixin):
self.login(shadow_user_id)
user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles())
self.assertIn('Authenticated', user.getRoles())
self.assertSameSet(['R-SHADOW-SOFTWAREINSTANCE', 'SHADOW-%s' % user_id],
user.getGroups())
......
......@@ -32,29 +32,29 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
)
# Nothing to migrate
self.assertFalse(migration_message in getMessageList(instance_nothing_to_migrate))
self.assertFalse(error_message in getMessageList(instance_nothing_to_migrate))
self.assertNotIn(migration_message, getMessageList(instance_nothing_to_migrate))
self.assertNotIn(error_message, getMessageList(instance_nothing_to_migrate))
# Migrate
self.assertTrue(migration_message in getMessageList(instance_to_migrate))
self.assertFalse(error_message in getMessageList(instance_to_migrate))
self.assertIn(migration_message, getMessageList(instance_to_migrate))
self.assertNotIn(error_message, getMessageList(instance_to_migrate))
instance_to_migrate.fixConsistency()
self.assertEqual(None, instance_to_migrate.getPredecessor())
self.assertEqual(instance_nothing_to_migrate.getRelativeUrl(),
instance_to_migrate.getSuccessor())
self.assertFalse(migration_message in getMessageList(instance_to_migrate))
self.assertFalse(error_message in getMessageList(instance_to_migrate))
self.assertNotIn(migration_message, getMessageList(instance_to_migrate))
self.assertNotIn(error_message, getMessageList(instance_to_migrate))
# Error
self.assertFalse(migration_message in getMessageList(instance_badly_migrated))
self.assertTrue(error_message in getMessageList(instance_badly_migrated))
self.assertNotIn(migration_message, getMessageList(instance_badly_migrated))
self.assertIn(error_message, getMessageList(instance_badly_migrated))
instance_badly_migrated.fixConsistency()
self.assertEqual(instance_nothing_to_migrate.getRelativeUrl(),
instance_badly_migrated.getPredecessor())
self.assertEqual(instance_nothing_to_migrate.getRelativeUrl(),
instance_badly_migrated.getSuccessor())
self.assertFalse(migration_message in getMessageList(instance_badly_migrated))
self.assertTrue(error_message in getMessageList(instance_badly_migrated))
self.assertNotIn(migration_message, getMessageList(instance_badly_migrated))
self.assertIn(error_message, getMessageList(instance_badly_migrated))
def test_upgrade_software_instance_predecessor(self):
return self.check_upgrade_instance_predecessor('Software Instance')
......@@ -107,10 +107,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
self.tic()
# 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
self.assertTrue(migration_message in getMessageList(hosting_subscription_to_migrate))
self.assertIn(migration_message, getMessageList(hosting_subscription_to_migrate))
hosting_subscription_to_migrate.fixConsistency()
self.commit()
......@@ -145,8 +145,8 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
migrated_instance_tree.getCreationDate())
# self.assertEqual(modification_date,
# migrated_instance_tree.getModificationDate())
self.assertFalse('hosting_subscription_workflow' in migrated_instance_tree.workflow_history)
self.assertFalse(migration_message in getMessageList(migrated_instance_tree))
self.assertNotIn('hosting_subscription_workflow', migrated_instance_tree.workflow_history)
self.assertNotIn(migration_message, getMessageList(migrated_instance_tree))
self.assertEqual(migrated_instance_tree.getRelativeUrl(),
software_instance.getAggregate())
self.assertEqual(1, len(self.portal.portal_catalog(uid=migrated_instance_tree.getUid())))
......@@ -213,10 +213,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
self.tic()
# Nothing to migrate
self.assertFalse(migration_message in getMessageList(computer_nothing_to_migrate))
self.assertNotIn(migration_message, getMessageList(computer_nothing_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()
self.commit()
......@@ -258,9 +258,9 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
migrated_compute_node.getCreationDate())
# self.assertEqual(modification_date,
# 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(),
software_installation.getAggregate())
self.assertEqual(migrated_computer_partition.getRelativeUrl(),
......@@ -318,10 +318,10 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
self.tic()
# Nothing to migrate
self.assertFalse(migration_message in getMessageList(computer_nothing_to_migrate))
self.assertNotIn(migration_message, getMessageList(computer_nothing_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()
self.commit()
......@@ -344,8 +344,8 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
migrated_computer_partition.getCreationDate())
# self.assertEqual(modification_date,
# 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())))
......@@ -241,11 +241,11 @@ class TestSlapOSDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm(Slap
self.tic()
v = 'Visited by SoftwareRelease_findAndDestroySoftwareInstallation'
self.assertFalse(v in
self.assertNotIn(v,
[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']])
self.assertTrue(v in
self.assertIn(v,
[q['comment'] for q in archived_software_release.workflow_history['edit_workflow']])
@simulateByEditWorkflowMark('SoftwareInstallation_destroyWithSoftwareReleaseArchived')
......@@ -304,9 +304,9 @@ class TestSlapOSDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm(Slap
self.tic()
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']])
self.assertFalse(v in
self.assertNotIn(v,
[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']])
\ No newline at end of file
......@@ -127,7 +127,7 @@ class TestSlapOSEvent_getRSSTextContent(TestRSSSyleSkinsMixin):
self.portal.portal_skins.changeSkin('RSS')
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("Recipient: " in text_content, "Recipient: not in %s" % text_content)
self.assertTrue("Content:" in text_content, "Content: not in %s" % text_content)
......
......@@ -88,7 +88,7 @@ class TestSlapOSCoreComputeNodeUpdateFromDict(SlapOSTestCaseMixinWithAbort):
self.assertEqual(address.getIpAddress(), 'e')
self.assertEqual(address.getNetmask(), 'f')
# Existing document should be edited if possible
self.assertTrue(address.getId() in ('foo', 'bar'))
self.assertIn(address.getId(), ('foo', 'bar'))
#############################################
# Compute Partition network information
......
......@@ -966,9 +966,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
"TestSubscriptionSkins Notification Message %s %s" % (
subscription_request.getLanguage(), notification_message),
mail_message.getTitle())
self.assertTrue(subscription_request.getDefaultEmailText() in \
self.assertIn(subscription_request.getDefaultEmailText(), \
mail_message.getTextContent())
self.assertTrue(subscription_request.getDestinationSectionTitle() in \
self.assertIn(subscription_request.getDestinationSectionTitle(), \
mail_message.getTextContent())
def checkEmailPaymentNotification(self, subscription_request,
......@@ -984,9 +984,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
mail_message.getTitle())
invoice = subscription_request.SubscriptionRequest_verifyPaymentBalanceIsReady()
self.assertEqual(invoice.getSimulationState(), 'stopped')
self.assertTrue(invoice.getRelativeUrl() in \
self.assertIn(invoice.getRelativeUrl(), \
mail_message.getTextContent())
self.assertTrue(subscription_request.getDestinationSectionTitle() in \
self.assertIn(subscription_request.getDestinationSectionTitle(), \
mail_message.getTextContent())
def checkEmailInstanceNotification(self, subscription_request,
......@@ -1002,9 +1002,9 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
mail_message.getTitle())
instance_tree = subscription_request.getAggregateValue()
self.assertEqual(instance_tree.getSlapState(), 'start_requested')
self.assertTrue(instance_tree.getRelativeUrl() in \
self.assertIn(instance_tree.getRelativeUrl(), \
mail_message.getTextContent())
self.assertTrue(subscription_request.getDestinationSectionTitle() in \
self.assertIn(subscription_request.getDestinationSectionTitle(), \
mail_message.getTextContent())
def checkRelatedInstance(self, subscription_request):
......
......@@ -664,7 +664,7 @@ class RunPromise(GenericPromise):
def test_method(result):
self.assertTrue(isinstance(result, PromiseQueueResult))
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:
self.assertEqual(result.item.hasFailed(), True)
self.assertEqual(result.item.message, "failed")
......@@ -705,7 +705,7 @@ class RunPromise(GenericPromise):
def test_method(result):
self.assertTrue(isinstance(result, PromiseQueueResult))
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.message, "success")
self.counter += 1
......@@ -771,7 +771,7 @@ class RunPromise(GenericPromise):
self.counter = 0
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.message, "success")
self.counter += 1
......@@ -809,7 +809,7 @@ class RunPromise(GenericPromise):
self.counter = 0
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.message, "success")
self.counter += 1
......@@ -956,7 +956,7 @@ class RunPromise(GenericPromise):
self.counter = 0
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.message, "success")
self.counter += 1
......@@ -1082,7 +1082,7 @@ exit 0
self.counter = 0
self.check_list = [first_promise, second_promise, third_promise]
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.message, "success")
self.counter += 1
......@@ -1110,7 +1110,7 @@ exit 0
self.counter = 0
self.check_list = [first_promise, second_promise, third_promise]
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.message, "success")
self.counter += 1
......@@ -1186,7 +1186,7 @@ exit 0
self.assertTrue(result.execution_time >= 1)
self.assertEqual(result.title, 'my_promise')
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.configureLauncher(save_method=test_method, enable_anomaly=True, timeout=1)
......@@ -1218,7 +1218,7 @@ echo "success"
self.assertEqual(result.title, promise_name)
self.assertEqual(result.name, promise_name)
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.assertTrue(isinstance(result.item.date, datetime))
......
......@@ -2392,7 +2392,7 @@ class TestSlapgridCPWithMasterPromise(MasterMixin, unittest.TestCase):
log_file = '%s/.slapgrid/log/instance.log' % instance.partition_path
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.assertIsNone(instance.state)
......@@ -3135,7 +3135,7 @@ exit 0
self._wait_prerm_script_finished(partition.partition_path)
with open(os.path.join(partition.partition_path, '.0-prerm_slapos_pre_delete.log')) as f:
# 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)
# 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