Commit 3b4d4028 authored by Rafael Monnerat's avatar Rafael Monnerat

py3: 2to3 -j 20 --write --nobackups --no-diffs --fix=asserts master

parent 0ede1d85
...@@ -40,8 +40,8 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -40,8 +40,8 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self.assertTrue(owner_person.Entity_hasOutstandingAmount(include_planned=True)) self.assertTrue(owner_person.Entity_hasOutstandingAmount(include_planned=True))
amount_list = owner_person.Entity_getOutstandingAmountList(include_planned=True) amount_list = owner_person.Entity_getOutstandingAmountList(include_planned=True)
self.assertEquals(len(amount_list), 1) self.assertEqual(len(amount_list), 1)
self.assertEquals(amount_list[0].total_price, 24.384) self.assertEqual(amount_list[0].total_price, 24.384)
self.assertFalse(owner_person.Entity_hasOutstandingAmount()) self.assertFalse(owner_person.Entity_hasOutstandingAmount())
self.assertEqual(subscription_request.getSimulationState(), "invalidated") self.assertEqual(subscription_request.getSimulationState(), "invalidated")
open_sale_order = self.portal.portal_catalog.getResultValue( open_sale_order = self.portal.portal_catalog.getResultValue(
...@@ -80,12 +80,12 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -80,12 +80,12 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self.assertTrue(owner_person.Entity_hasOutstandingAmount(include_planned=True)) self.assertTrue(owner_person.Entity_hasOutstandingAmount(include_planned=True))
amount_list = owner_person.Entity_getOutstandingAmountList(include_planned=True) amount_list = owner_person.Entity_getOutstandingAmountList(include_planned=True)
self.assertEquals(len(amount_list), 1) self.assertEqual(len(amount_list), 1)
self.assertEquals(amount_list[0].total_price, 175.584) self.assertEqual(amount_list[0].total_price, 175.584)
self.assertTrue(owner_person.Entity_hasOutstandingAmount()) self.assertTrue(owner_person.Entity_hasOutstandingAmount())
amount_list = owner_person.Entity_getOutstandingAmountList() amount_list = owner_person.Entity_getOutstandingAmountList()
self.assertEquals(len(amount_list), 1) self.assertEqual(len(amount_list), 1)
self.assertEquals(amount_list[0].total_price, 125.184) self.assertEqual(amount_list[0].total_price, 125.184)
self.assertEqual(first_invoice.getSimulationState(), "stopped") self.assertEqual(first_invoice.getSimulationState(), "stopped")
# Ensure no unexpected object has been created # Ensure no unexpected object has been created
# 4 accounting transactions # 4 accounting transactions
...@@ -110,16 +110,16 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -110,16 +110,16 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
) )
) )
payment_transaction.stop() payment_transaction.stop()
self.assertEquals(payment_transaction.AccountingTransaction_getTotalCredit(), 74.78399999999999) self.assertEqual(payment_transaction.AccountingTransaction_getTotalCredit(), 74.78399999999999)
self.tic() self.tic()
self.assertTrue(owner_person.Entity_hasOutstandingAmount(include_planned=True)) self.assertTrue(owner_person.Entity_hasOutstandingAmount(include_planned=True))
amount_list = owner_person.Entity_getOutstandingAmountList(include_planned=True) amount_list = owner_person.Entity_getOutstandingAmountList(include_planned=True)
self.assertEquals(len(amount_list), 1) self.assertEqual(len(amount_list), 1)
self.assertEquals(amount_list[0].total_price, 100.8) self.assertEqual(amount_list[0].total_price, 100.8)
self.assertTrue(owner_person.Entity_hasOutstandingAmount()) self.assertTrue(owner_person.Entity_hasOutstandingAmount())
amount_list = owner_person.Entity_getOutstandingAmountList() amount_list = owner_person.Entity_getOutstandingAmountList()
self.assertEquals(len(amount_list), 1) self.assertEqual(len(amount_list), 1)
self.assertEquals(amount_list[0].total_price, 50.4) self.assertEqual(amount_list[0].total_price, 50.4)
self.assertTrue(first_invoice.SaleInvoiceTransaction_isLettered()) self.assertTrue(first_invoice.SaleInvoiceTransaction_isLettered())
# Ensure no unexpected object has been created # Ensure no unexpected object has been created
self.assertRelatedObjectCount(project, 22) self.assertRelatedObjectCount(project, 22)
...@@ -136,15 +136,15 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -136,15 +136,15 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
) )
) )
payment_transaction.stop() payment_transaction.stop()
self.assertEquals(payment_transaction.AccountingTransaction_getTotalCredit(), 50.4) self.assertEqual(payment_transaction.AccountingTransaction_getTotalCredit(), 50.4)
self.tic() self.tic()
self.assertTrue(owner_person.Entity_hasOutstandingAmount(include_planned=True)) self.assertTrue(owner_person.Entity_hasOutstandingAmount(include_planned=True))
amount_list = owner_person.Entity_getOutstandingAmountList(include_planned=True) amount_list = owner_person.Entity_getOutstandingAmountList(include_planned=True)
self.assertEquals(len(amount_list), 1) self.assertEqual(len(amount_list), 1)
self.assertEquals(amount_list[0].total_price, 50.4) self.assertEqual(amount_list[0].total_price, 50.4)
self.assertFalse(owner_person.Entity_hasOutstandingAmount()) self.assertFalse(owner_person.Entity_hasOutstandingAmount())
amount_list = owner_person.Entity_getOutstandingAmountList() amount_list = owner_person.Entity_getOutstandingAmountList()
self.assertEquals(len(amount_list), 0) self.assertEqual(len(amount_list), 0)
# Ensure no unexpected object has been created # Ensure no unexpected object has been created
self.assertRelatedObjectCount(project, 22) self.assertRelatedObjectCount(project, 22)
...@@ -236,7 +236,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -236,7 +236,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self.logout() self.logout()
self.login() self.login()
# Check that no activity has been triggered yet # Check that no activity has been triggered yet
self.assertEquals(self.portal.portal_catalog.countResults( self.assertEqual(self.portal.portal_catalog.countResults(
portal_type='Compute Node', portal_type='Compute Node',
follow_up__uid=project.getUid() follow_up__uid=project.getUid()
)[0][0], 0) )[0][0], 0)
...@@ -246,7 +246,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -246,7 +246,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
# 1 invoice for the compute node # 1 invoice for the compute node
# per user: # per user:
# 1 monthly invoice for products # 1 monthly invoice for products
self.assertEquals(self.portal.portal_catalog.countResults( self.assertEqual(self.portal.portal_catalog.countResults(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
source_project__uid=project.getUid() source_project__uid=project.getUid()
)[0][0], 1 + len(person_list)) )[0][0], 1 + len(person_list))
...@@ -271,7 +271,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -271,7 +271,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
# Execute activities for all services # Execute activities for all services
# To try detection bad activity tag dependencies # To try detection bad activity tag dependencies
self.tic() self.tic()
self.assertEquals(self.portal.portal_catalog.countResults( self.assertEqual(self.portal.portal_catalog.countResults(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
source_project__uid=project.getUid() source_project__uid=project.getUid()
)[0][0], 1 + len(person_list)) )[0][0], 1 + len(person_list))
...@@ -283,7 +283,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -283,7 +283,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self.login() self.login()
self.portal.portal_alarms.update_open_order_simulation.activeSense() self.portal.portal_alarms.update_open_order_simulation.activeSense()
self.tic() self.tic()
self.assertEquals(self.portal.portal_catalog.countResults( self.assertEqual(self.portal.portal_catalog.countResults(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
source_project__uid=project.getUid() source_project__uid=project.getUid()
)[0][0], (1 + len(person_list)) * 3) )[0][0], (1 + len(person_list)) * 3)
...@@ -327,15 +327,15 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -327,15 +327,15 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
parent_uid=invoice.getUid(), parent_uid=invoice.getUid(),
resource__uid=self.portal.service_module.slapos_tax.getUid() resource__uid=self.portal.service_module.slapos_tax.getUid()
) )
self.assertEquals(tax_line.getPrice(), 0) self.assertEqual(tax_line.getPrice(), 0)
self.assertEquals(invoice.getTotalPrice(), 42) self.assertEqual(invoice.getTotalPrice(), 42)
with PinnedDateTime(self, creation_date + 35): with PinnedDateTime(self, creation_date + 35):
self.portal.portal_alarms.update_open_order_simulation.activeSense() self.portal.portal_alarms.update_open_order_simulation.activeSense()
self.tic() self.tic()
self.assertEquals(invoice.getTotalPrice(), 42) self.assertEqual(invoice.getTotalPrice(), 42)
self.assertEquals(invoice.getSimulationState(), 'stopped') self.assertEqual(invoice.getSimulationState(), 'stopped')
# Ensure no unexpected object has been created # Ensure no unexpected object has been created
# 2 invoice lines # 2 invoice lines
......
...@@ -75,7 +75,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort): ...@@ -75,7 +75,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
# check that alarm was called after the object was reindexed # check that alarm was called after the object was reindexed
self.assertTrue(next_indexation_timestamp < edit_timestamp) self.assertTrue(next_indexation_timestamp < edit_timestamp)
self.assertEquals( self.assertEqual(
len(alarm.workflow_history['edit_workflow']), len(alarm.workflow_history['edit_workflow']),
workflow_history_count + 1 workflow_history_count + 1
) )
...@@ -101,11 +101,11 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort): ...@@ -101,11 +101,11 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
next_indexation_timestamp = self.getIndexationDate(document) next_indexation_timestamp = self.getIndexationDate(document)
edit_timestamp = alarm.getModificationDate() edit_timestamp = alarm.getModificationDate()
# check that the document was not reindexed # check that the document was not reindexed
self.assertEquals(previous_indexation_timestamp, next_indexation_timestamp) self.assertEqual(previous_indexation_timestamp, next_indexation_timestamp)
# check that alarm was called after the object was reindexed # check that alarm was called after the object was reindexed
self.assertTrue(next_indexation_timestamp < edit_timestamp) self.assertTrue(next_indexation_timestamp < edit_timestamp)
self.assertEquals( self.assertEqual(
len(alarm.workflow_history['edit_workflow']), len(alarm.workflow_history['edit_workflow']),
workflow_history_count + 1 workflow_history_count + 1
) )
...@@ -129,9 +129,9 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort): ...@@ -129,9 +129,9 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
next_indexation_timestamp = self.getIndexationDate(document) next_indexation_timestamp = self.getIndexationDate(document)
# check that the document was not reindex # check that the document was not reindex
self.assertEquals(previous_indexation_timestamp, next_indexation_timestamp) self.assertEqual(previous_indexation_timestamp, next_indexation_timestamp)
# check that the alarm was not triggered # check that the alarm was not triggered
self.assertEquals( self.assertEqual(
len(alarm.workflow_history['edit_workflow']), len(alarm.workflow_history['edit_workflow']),
workflow_history_count workflow_history_count
) )
...@@ -157,7 +157,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort): ...@@ -157,7 +157,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
# check that alarm was called ONCE after the object was reindexed # check that alarm was called ONCE after the object was reindexed
self.assertTrue(next_indexation_timestamp < edit_timestamp) self.assertTrue(next_indexation_timestamp < edit_timestamp)
self.assertEquals( self.assertEqual(
len(alarm.workflow_history['edit_workflow']), len(alarm.workflow_history['edit_workflow']),
workflow_history_count + 1 workflow_history_count + 1
) )
...@@ -182,7 +182,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort): ...@@ -182,7 +182,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self.tic() self.tic()
# check that alarm was called ONCE # check that alarm was called ONCE
self.assertEquals( self.assertEqual(
len(alarm.workflow_history['edit_workflow']), len(alarm.workflow_history['edit_workflow']),
workflow_history_count + 1 workflow_history_count + 1
) )
...@@ -213,7 +213,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort): ...@@ -213,7 +213,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
# check that alarm was called ONCE after the object was reindexed # check that alarm was called ONCE after the object was reindexed
self.assertTrue(next_indexation_timestamp < edit_timestamp) self.assertTrue(next_indexation_timestamp < edit_timestamp)
self.assertEquals( self.assertEqual(
len(alarm.workflow_history['edit_workflow']), len(alarm.workflow_history['edit_workflow']),
workflow_history_count + 1 workflow_history_count + 1
) )
...@@ -241,7 +241,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort): ...@@ -241,7 +241,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
with TemporaryAlarmScript(alarm, 'Alarm_allocateInstance'): with TemporaryAlarmScript(alarm, 'Alarm_allocateInstance'):
self.tic() self.tic()
self.assertEquals( self.assertEqual(
len(alarm.workflow_history['edit_workflow']), len(alarm.workflow_history['edit_workflow']),
workflow_history_count + 3 workflow_history_count + 3
) )
...@@ -277,7 +277,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort): ...@@ -277,7 +277,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self.assertTrue(next_indexation_timestamp1 < edit_timestamp) self.assertTrue(next_indexation_timestamp1 < edit_timestamp)
self.assertTrue(next_indexation_timestamp2 < edit_timestamp) self.assertTrue(next_indexation_timestamp2 < edit_timestamp)
self.assertEquals( self.assertEqual(
len(alarm.workflow_history['edit_workflow']), len(alarm.workflow_history['edit_workflow']),
workflow_history_count + 1 workflow_history_count + 1
) )
...@@ -314,7 +314,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort): ...@@ -314,7 +314,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self.assertTrue(next_indexation_timestamp1 < edit_timestamp) self.assertTrue(next_indexation_timestamp1 < edit_timestamp)
self.assertTrue(next_indexation_timestamp2 < edit_timestamp) self.assertTrue(next_indexation_timestamp2 < edit_timestamp)
self.assertEquals( self.assertEqual(
len(alarm.workflow_history['edit_workflow']), len(alarm.workflow_history['edit_workflow']),
workflow_history_count + 1 workflow_history_count + 1
) )
...@@ -349,7 +349,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort): ...@@ -349,7 +349,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self.assertTrue(next_indexation_timestamp < edit_timestamp1) self.assertTrue(next_indexation_timestamp < edit_timestamp1)
self.assertTrue(next_indexation_timestamp < edit_timestamp2) self.assertTrue(next_indexation_timestamp < edit_timestamp2)
self.assertEquals( self.assertEqual(
len(alarm1.workflow_history['edit_workflow']), len(alarm1.workflow_history['edit_workflow']),
workflow_history_count1 + 1 workflow_history_count1 + 1
) )
...@@ -357,7 +357,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort): ...@@ -357,7 +357,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
'Visited by Alarm_allocateInstance', 'Visited by Alarm_allocateInstance',
alarm1.workflow_history['edit_workflow'][-1]['comment'] alarm1.workflow_history['edit_workflow'][-1]['comment']
) )
self.assertEquals( self.assertEqual(
len(alarm2.workflow_history['edit_workflow']), len(alarm2.workflow_history['edit_workflow']),
workflow_history_count2 + 1 workflow_history_count2 + 1
) )
......
...@@ -101,7 +101,7 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -101,7 +101,7 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
portal_type='Regularisation Request', portal_type='Regularisation Request',
destination__uid=owner_person.getUid() destination__uid=owner_person.getUid()
) )
self.assertEquals(regularisation_request.getSimulationState(), 'suspended') self.assertEqual(regularisation_request.getSimulationState(), 'suspended')
################################################## ##################################################
# Trigger regularisation request escalation # Trigger regularisation request escalation
...@@ -124,21 +124,21 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -124,21 +124,21 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
# Items must be deleted # Items must be deleted
# Open Order must be archived # Open Order must be archived
# Invoice must be paid with Deposit # Invoice must be paid with Deposit
self.assertEquals(project.getValidationState(), 'invalidated') self.assertEqual(project.getValidationState(), 'invalidated')
self.assertEquals(instance_tree.getValidationState(), 'archived') self.assertEqual(instance_tree.getValidationState(), 'archived')
self.assertEquals(instance_tree.getSlapState(), 'destroy_requested') self.assertEqual(instance_tree.getSlapState(), 'destroy_requested')
self.assertEquals(compute_node.getValidationState(), 'invalidated') self.assertEqual(compute_node.getValidationState(), 'invalidated')
open_order_list = self.portal.portal_catalog( open_order_list = self.portal.portal_catalog(
portal_type='Open Sale Order', portal_type='Open Sale Order',
destination_section__uid=owner_person.getUid() destination_section__uid=owner_person.getUid()
) )
hosting_subscription_list = [] hosting_subscription_list = []
self.assertEquals(len(open_order_list), 3) self.assertEqual(len(open_order_list), 3)
for open_order in open_order_list: for open_order in open_order_list:
self.assertEquals(open_order.getValidationState(), 'archived') self.assertEqual(open_order.getValidationState(), 'archived')
self.assertNotEquals(open_order.getStopDate(), open_order.getStartDate()) self.assertNotEqual(open_order.getStopDate(), open_order.getStartDate())
self.assertNotEquals(open_order.getStopDate(), None) self.assertNotEqual(open_order.getStopDate(), None)
self.assertEquals(open_order.getStopDate(), DateTime('2020/07/17')) self.assertEqual(open_order.getStopDate(), DateTime('2020/07/17'))
for line in open_order.contentValues(): for line in open_order.contentValues():
for cell in line.contentValues(): for cell in line.contentValues():
...@@ -149,12 +149,12 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -149,12 +149,12 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
if tmp is not None: if tmp is not None:
hosting_subscription_list.append(tmp) hosting_subscription_list.append(tmp)
self.assertEquals(len(hosting_subscription_list), 3) self.assertEqual(len(hosting_subscription_list), 3)
for hosting_subscription in hosting_subscription_list: for hosting_subscription in hosting_subscription_list:
self.assertEquals(hosting_subscription.getValidationState(), 'archived') self.assertEqual(hosting_subscription.getValidationState(), 'archived')
self.assertEquals(regularisation_request.getSimulationState(), 'suspended') self.assertEqual(regularisation_request.getSimulationState(), 'suspended')
self.assertEquals(regularisation_request.getResourceId(), self.assertEqual(regularisation_request.getResourceId(),
'slapos_crm_delete_acknowledgement') 'slapos_crm_delete_acknowledgement')
# No planned invoice is expected # No planned invoice is expected
...@@ -162,15 +162,15 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -162,15 +162,15 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
outstanding_amount_list = owner_person.Entity_getOutstandingAmountList( outstanding_amount_list = owner_person.Entity_getOutstandingAmountList(
ledger_uid=ledger_uid ledger_uid=ledger_uid
) )
self.assertEquals(len(outstanding_amount_list), 1) self.assertEqual(len(outstanding_amount_list), 1)
self.assertEquals(outstanding_amount_list[0].total_price, 132) self.assertEqual(outstanding_amount_list[0].total_price, 132)
planned_outstanding_amount_list = owner_person.Entity_getOutstandingAmountList( planned_outstanding_amount_list = owner_person.Entity_getOutstandingAmountList(
ledger_uid=ledger_uid, ledger_uid=ledger_uid,
include_planned=True include_planned=True
) )
self.assertEquals(len(planned_outstanding_amount_list), 1) self.assertEqual(len(planned_outstanding_amount_list), 1)
self.assertEquals(outstanding_amount_list[0].total_price, self.assertEqual(outstanding_amount_list[0].total_price,
planned_outstanding_amount_list[0].total_price) planned_outstanding_amount_list[0].total_price)
......
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