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