Commit 175b5788 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

CLEANUP: use assertEqual instead of assertEquals

assertEquals is deprecated, see https://docs.python.org/2.7/library/unittest.html#deprecated-aliases

/reviewed-on !58
parent 52c634f5
......@@ -1095,11 +1095,11 @@ class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm(
self.portal.portal_workflow._jumpToStateFor(delivery, 'solved')
self.portal.portal_workflow._jumpToStateFor(delivery, 'confirmed')
delivery.Delivery_startConfirmedAggregatedSalePackingList()
self.assertEquals(delivery.getStartDate(),
self.assertEqual(delivery.getStartDate(),
DateTime().earliestTime())
self.assertEquals(delivery.getStopDate(),
self.assertEqual(delivery.getStopDate(),
DateTime().earliestTime())
self.assertEquals(delivery.getSimulationState(), 'started')
self.assertEqual(delivery.getSimulationState(), 'started')
class TestSlapOSDeliverStartedAggregatedSalePackingListAlarm(
SlapOSTestCaseMixin):
......
......@@ -495,27 +495,27 @@ class TestHostingSubscriptionSimulation(SlapOSTestCaseMixin):
# Check simulation movement property
self.assertEqual(movement_start_date, simulation_movement.getStartDate())
self.assertEqual(movement_stop_date, simulation_movement.getStopDate())
self.assertEquals(self.open_order_line.getQuantity(),
self.assertEqual(self.open_order_line.getQuantity(),
simulation_movement.getQuantity())
self.assertEquals(self.open_order_line.getQuantityUnit(),
self.assertEqual(self.open_order_line.getQuantityUnit(),
simulation_movement.getQuantityUnit())
self.assertEquals(self.open_order_line.getPrice(),
self.assertEqual(self.open_order_line.getPrice(),
simulation_movement.getPrice())
self.assertEquals(self.open_order_line.getPriceCurrency(),
self.assertEqual(self.open_order_line.getPriceCurrency(),
simulation_movement.getPriceCurrency())
self.assertEquals(self.open_order_line.getSource(),
self.assertEqual(self.open_order_line.getSource(),
simulation_movement.getSource())
self.assertEquals(self.open_order_line.getSourceSection(),
self.assertEqual(self.open_order_line.getSourceSection(),
simulation_movement.getSourceSection())
self.assertEquals(self.open_order_line.getDestination(),
self.assertEqual(self.open_order_line.getDestination(),
simulation_movement.getDestination())
self.assertEquals(self.open_order_line.getDestinationSection(),
self.assertEqual(self.open_order_line.getDestinationSection(),
simulation_movement.getDestinationSection())
self.assertEquals(self.open_order_line.getSpecialise(),
self.assertEqual(self.open_order_line.getSpecialise(),
simulation_movement.getSpecialise())
self.assertEquals(self.open_order_line.getResource(),
self.assertEqual(self.open_order_line.getResource(),
simulation_movement.getResource())
self.assertEquals(applied_rule.getSpecialiseValue().getTradePhaseList(),
self.assertEqual(applied_rule.getSpecialiseValue().getTradePhaseList(),
simulation_movement.getTradePhaseList())
self.assertSameSet(self.open_order_line.getAggregateList(),
simulation_movement.getAggregateList())
......@@ -611,27 +611,27 @@ class TestHostingSubscriptionSimulation(SlapOSTestCaseMixin):
# Check simulation movement property
self.assertEqual(movement_start_date, simulation_movement.getStartDate())
self.assertEqual(movement_stop_date, simulation_movement.getStopDate())
self.assertEquals(self.open_order_line.getQuantity(),
self.assertEqual(self.open_order_line.getQuantity(),
simulation_movement.getQuantity())
self.assertEquals(self.open_order_line.getQuantityUnit(),
self.assertEqual(self.open_order_line.getQuantityUnit(),
simulation_movement.getQuantityUnit())
self.assertEquals(self.open_order_line.getPrice(),
self.assertEqual(self.open_order_line.getPrice(),
simulation_movement.getPrice())
self.assertEquals(self.open_order_line.getPriceCurrency(),
self.assertEqual(self.open_order_line.getPriceCurrency(),
simulation_movement.getPriceCurrency())
self.assertEquals(self.open_order_line.getSource(),
self.assertEqual(self.open_order_line.getSource(),
simulation_movement.getSource())
self.assertEquals(self.open_order_line.getSourceSection(),
self.assertEqual(self.open_order_line.getSourceSection(),
simulation_movement.getSourceSection())
self.assertEquals(self.open_order_line.getDestination(),
self.assertEqual(self.open_order_line.getDestination(),
simulation_movement.getDestination())
self.assertEquals(self.open_order_line.getDestinationSection(),
self.assertEqual(self.open_order_line.getDestinationSection(),
simulation_movement.getDestinationSection())
self.assertEquals(self.open_order_line.getSpecialise(),
self.assertEqual(self.open_order_line.getSpecialise(),
simulation_movement.getSpecialise())
self.assertEquals(self.open_order_line.getResource(),
self.assertEqual(self.open_order_line.getResource(),
simulation_movement.getResource())
self.assertEquals(applied_rule.getSpecialiseValue().getTradePhaseList(),
self.assertEqual(applied_rule.getSpecialiseValue().getTradePhaseList(),
simulation_movement.getTradePhaseList())
self.assertSameSet(self.open_order_line.getAggregateList(),
simulation_movement.getAggregateList())
......
......@@ -144,7 +144,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
new_indexation_timestamp = portal.portal_catalog(
uid=order.getUid(),
select_dict={'indexation_timestamp': None})[0].indexation_timestamp
self.assertEquals(new_indexation_timestamp,
self.assertEqual(new_indexation_timestamp,
indexation_timestamp)
def test_OpenSaleOrder_reindexIfIndexedBeforeLine_line_indexed_after(self):
......@@ -184,7 +184,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
new_indexation_timestamp = portal.portal_catalog(
uid=order.getUid(),
select_dict={'indexation_timestamp': None})[0].indexation_timestamp
self.assertEquals(new_indexation_timestamp,
self.assertEqual(new_indexation_timestamp,
indexation_timestamp)
def test_OpenSaleOrder_reindexIfIndexedBeforeLine_REQUEST_disallowed(self):
......
......@@ -60,18 +60,18 @@ class TestSlapOSComputer_reportComputerConsumption(SlapOSTestCaseMixinWithAbort)
document_relative_url = computer.Computer_reportComputerConsumption(
new_id, consumption_xml)
document = self.portal.restrictedTraverse(document_relative_url)
self.assertEquals(document.getPortalType(),
self.assertEqual(document.getPortalType(),
"Computer Consumption TioXML File")
self.assertEquals(document.getSourceReference(), new_id)
self.assertEquals(document.getTitle(),
self.assertEqual(document.getSourceReference(), new_id)
self.assertEqual(document.getTitle(),
"%s consumption (%s)" % (computer.getReference(), new_id))
self.assertNotEquals(document.getReference(), "")
self.assertEquals(document.getVersion(), "1")
self.assertEquals(document.getData(), consumption_xml)
self.assertEquals(document.getClassification(), "personal")
self.assertEquals(document.getPublicationSection(), "other")
self.assertEquals(document.getValidationState(), "submitted")
self.assertEquals(document.getContributor(), computer.getRelativeUrl())
self.assertEqual(document.getVersion(), "1")
self.assertEqual(document.getData(), consumption_xml)
self.assertEqual(document.getClassification(), "personal")
self.assertEqual(document.getPublicationSection(), "other")
self.assertEqual(document.getValidationState(), "submitted")
self.assertEqual(document.getContributor(), computer.getRelativeUrl())
def test_reportComputerConsumption_reported_twice(self):
new_id = self.generateNewId()
......@@ -110,20 +110,20 @@ class TestSlapOSComputer_reportComputerConsumption(SlapOSTestCaseMixinWithAbort)
new_id, consumption_xml)
document2 = self.portal.restrictedTraverse(document2_relative_url)
self.assertEquals(document2.getPortalType(),
self.assertEqual(document2.getPortalType(),
"Computer Consumption TioXML File")
self.assertEquals(document2.getSourceReference(),
self.assertEqual(document2.getSourceReference(),
document1.getSourceReference())
self.assertEquals(document2.getTitle(), document1.getTitle())
self.assertEquals(document2.getReference(), document1.getReference())
self.assertEquals(document1.getVersion(), "1")
self.assertEquals(document2.getVersion(), "2")
self.assertEquals(document2.getData(), consumption_xml)
self.assertEquals(document2.getClassification(), "personal")
self.assertEquals(document2.getPublicationSection(), "other")
self.assertEquals(document1.getValidationState(), "submitted")
self.assertEquals(document2.getValidationState(), "submitted")
self.assertEquals(document2.getContributor(), computer.getRelativeUrl())
self.assertEqual(document2.getTitle(), document1.getTitle())
self.assertEqual(document2.getReference(), document1.getReference())
self.assertEqual(document1.getVersion(), "1")
self.assertEqual(document2.getVersion(), "2")
self.assertEqual(document2.getData(), consumption_xml)
self.assertEqual(document2.getClassification(), "personal")
self.assertEqual(document2.getPublicationSection(), "other")
self.assertEqual(document1.getValidationState(), "submitted")
self.assertEqual(document2.getValidationState(), "submitted")
self.assertEqual(document2.getContributor(), computer.getRelativeUrl())
class TestSlapOSComputerConsumptionTioXMLFile_parseXml(SlapOSTestCaseMixinWithAbort):
......
......@@ -68,17 +68,17 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
self.commit()
result = instance.SoftwareInstance_requestValidationPayment()
self.assertEquals(result, None)
self.assertEqual(result, None)
def test_addCloudContract(self):
person, instance, _ = self.createNeededDocuments()
contract = instance.SoftwareInstance_requestValidationPayment()
# Default property
self.assertEquals(contract.getPortalType(), 'Cloud Contract')
self.assertEquals(contract.getValidationState(), 'invalidated')
self.assertEquals(contract.getDestinationSection(), person.getRelativeUrl())
self.assertEquals(contract.getTitle(),
self.assertEqual(contract.getPortalType(), 'Cloud Contract')
self.assertEqual(contract.getValidationState(), 'invalidated')
self.assertEqual(contract.getDestinationSection(), person.getRelativeUrl())
self.assertEqual(contract.getTitle(),
'Contract for "%s"' % person.getTitle())
def test_addCloudContract_do_not_duplicate_contract_if_not_reindexed(self):
......@@ -87,7 +87,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
self.commit()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertNotEquals(contract, None)
self.assertEquals(contract2, None)
self.assertEqual(contract2, None)
def test_addCloudContract_existing_invalidated_contract(self):
_, instance, _ = self.createNeededDocuments()
......@@ -96,7 +96,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertNotEquals(contract, None)
self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
def test_addCloudContract_existing_validated_contract(self):
_, instance, _ = self.createNeededDocuments()
......@@ -106,7 +106,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertNotEquals(contract, None)
self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
def test_do_nothing_if_validated_contract(self):
person, instance, _ = self.createNeededDocuments()
......@@ -116,9 +116,9 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEquals(contract2.getCausality(""), "")
self.assertEquals(contract2.getValidationState(), "validated")
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEqual(contract2.getCausality(""), "")
self.assertEqual(contract2.getValidationState(), "validated")
def test_validate_contract_if_payment_found(self):
person, instance, _ = self.createNeededDocuments()
......@@ -129,41 +129,41 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
default_destination_section_value=person,
)
self.portal.portal_workflow._jumpToStateFor(payment, 'stopped')
self.assertEquals(contract.getValidationState(), "invalidated")
self.assertEqual(contract.getValidationState(), "invalidated")
self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEquals(contract2.getCausality(""), "")
self.assertEquals(contract2.getValidationState(), "validated")
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEqual(contract2.getCausality(""), "")
self.assertEqual(contract2.getValidationState(), "validated")
def test_create_invoice_if_needed_and_no_payment_found(self):
person, instance, _ = self.createNeededDocuments()
contract = self.createCloudContract()
contract.edit(destination_section_value=person)
self.assertEquals(contract.getValidationState(), "invalidated")
self.assertEqual(contract.getValidationState(), "invalidated")
self.tic()
before_date = DateTime()
contract2 = instance.SoftwareInstance_requestValidationPayment()
after_date = DateTime()
self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertNotEquals(contract2.getCausality(""), "")
self.assertEquals(contract2.getValidationState(), "invalidated")
self.assertEqual(contract2.getValidationState(), "invalidated")
invoice = contract2.getCausalityValue()
self.assertEquals(invoice.getPortalType(), 'Sale Invoice Transaction')
self.assertEquals(len(invoice.contentValues()), 1)
self.assertEquals(invoice.getSimulationState(), 'confirmed')
self.assertEquals(invoice.getCausalityState(), 'building')
self.assertEquals(invoice.getTitle(), 'Account validation')
self.assertEquals(invoice.getSource(), person.getRelativeUrl())
self.assertEquals(invoice.getDestination(), person.getRelativeUrl())
self.assertEquals(invoice.getDestinationSection(), person.getRelativeUrl())
self.assertEquals(invoice.getDestinationDecision(), person.getRelativeUrl())
self.assertEqual(invoice.getPortalType(), 'Sale Invoice Transaction')
self.assertEqual(len(invoice.contentValues()), 1)
self.assertEqual(invoice.getSimulationState(), 'confirmed')
self.assertEqual(invoice.getCausalityState(), 'building')
self.assertEqual(invoice.getTitle(), 'Account validation')
self.assertEqual(invoice.getSource(), person.getRelativeUrl())
self.assertEqual(invoice.getDestination(), person.getRelativeUrl())
self.assertEqual(invoice.getDestinationSection(), person.getRelativeUrl())
self.assertEqual(invoice.getDestinationDecision(), person.getRelativeUrl())
self.assertTrue(invoice.getStartDate() >= before_date)
self.assertTrue(invoice.getStartDate() <= after_date)
self.assertEquals(invoice.getStartDate(), invoice.getStopDate())
self.assertEqual(invoice.getStartDate(), invoice.getStopDate())
def test_do_nothing_if_invoice_is_ongoing(self):
person, instance, _ = self.createNeededDocuments()
......@@ -174,13 +174,13 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
destination_section_value=person,
causality_value=invoice,
)
self.assertEquals(contract.getValidationState(), "invalidated")
self.assertEqual(contract.getValidationState(), "invalidated")
self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEquals(contract2.getCausality(""), invoice.getRelativeUrl())
self.assertEquals(contract2.getValidationState(), "invalidated")
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEqual(contract2.getCausality(""), invoice.getRelativeUrl())
self.assertEqual(contract2.getValidationState(), "invalidated")
def test_forget_current_cancelled_invoice(self):
person, instance, _ = self.createNeededDocuments()
......@@ -191,13 +191,13 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
destination_section_value=person,
causality_value=invoice,
)
self.assertEquals(contract.getValidationState(), "invalidated")
self.assertEqual(contract.getValidationState(), "invalidated")
self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEquals(contract2.getCausality(""), "")
self.assertEquals(contract2.getValidationState(), "invalidated")
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEqual(contract2.getCausality(""), "")
self.assertEqual(contract2.getValidationState(), "invalidated")
def test_forget_current_grouped_invoice(self):
person, instance, _ = self.createNeededDocuments()
......@@ -214,13 +214,13 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
destination_section_value=person,
causality_value=invoice,
)
self.assertEquals(contract.getValidationState(), "invalidated")
self.assertEqual(contract.getValidationState(), "invalidated")
self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEquals(contract2.getCausality(""), "")
self.assertEquals(contract2.getValidationState(), "invalidated")
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEqual(contract2.getCausality(""), "")
self.assertEqual(contract2.getValidationState(), "invalidated")
def test_do_nothing_if_invoice_is_not_grouped(self):
person, instance, _ = self.createNeededDocuments()
......@@ -235,13 +235,13 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
destination_section_value=person,
causality_value=invoice,
)
self.assertEquals(contract.getValidationState(), "invalidated")
self.assertEqual(contract.getValidationState(), "invalidated")
self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEquals(contract2.getCausality(""), invoice.getRelativeUrl())
self.assertEquals(contract2.getValidationState(), "invalidated")
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertEqual(contract2.getCausality(""), invoice.getRelativeUrl())
self.assertEqual(contract2.getValidationState(), "invalidated")
class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
......@@ -266,7 +266,7 @@ class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
person = self.createPerson()
preference.setPreferredCloudContractEnabled(True)
result = person.Person_isAllowedToAllocate()
self.assertEquals(result, False)
self.assertEqual(result, False)
def test_not_allowed_by_default_with_disabled_preference(self):
preference = self.portal.portal_preferences.getActiveSystemPreference()
......@@ -274,7 +274,7 @@ class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
# If Contract is disabled, anyone can allocate
preference.setPreferredCloudContractEnabled(False)
result = person.Person_isAllowedToAllocate()
self.assertEquals(result, True)
self.assertEqual(result, True)
def test_allowed_if_has_a_validated_contract(self):
preference = self.portal.portal_preferences.getActiveSystemPreference()
......@@ -287,7 +287,7 @@ class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
preference.setPreferredCloudContractEnabled(True)
self.tic()
result = person.Person_isAllowedToAllocate()
self.assertEquals(result, True)
self.assertEqual(result, True)
def test_allowed_if_has_a_validated_contract_with_disabled_preference(self):
preference = self.portal.portal_preferences.getActiveSystemPreference()
......@@ -301,7 +301,7 @@ class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
self.tic()
result = person.Person_isAllowedToAllocate()
# If Contract is disabled, anyone can allocate
self.assertEquals(result, True)
self.assertEqual(result, True)
def test_not_allowed_if_has_an_invalidated_contract(self):
......@@ -315,7 +315,7 @@ class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
preference.setPreferredCloudContractEnabled(True)
self.tic()
result = person.Person_isAllowedToAllocate()
self.assertEquals(result, False)
self.assertEqual(result, False)
def test_not_allowed_if_has_an_invalidated_contract_with_disabled_preference(self):
preference = self.portal.portal_preferences.getActiveSystemPreference()
......@@ -329,7 +329,7 @@ class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
self.tic()
result = person.Person_isAllowedToAllocate()
# If Contract is disabled, anyone can allocate
self.assertEquals(result, True)
self.assertEqual(result, True)
def test_not_allowed_if_no_related_contract(self):
preference = self.portal.portal_preferences.getActiveSystemPreference()
......@@ -339,7 +339,7 @@ class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
self.portal.portal_workflow._jumpToStateFor(contract, 'validated')
self.tic()
result = person.Person_isAllowedToAllocate()
self.assertEquals(result, False)
self.assertEqual(result, False)
def test_not_allowed_if_no_related_contract_with_disabled_preference(self):
preference = self.portal.portal_preferences.getActiveSystemPreference()
......@@ -350,5 +350,5 @@ class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
self.tic()
result = person.Person_isAllowedToAllocate()
# If Contract is disabled, anyone can allocate
self.assertEquals(result, True)
self.assertEqual(result, True)
......@@ -415,8 +415,8 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
self._makeTree()
self._makeComputer()
self.assertEquals(self.computer.getAllocationScope(), "open/public")
self.assertEquals(self.computer.getCapacityScope(), "open")
self.assertEqual(self.computer.getAllocationScope(), "open/public")
self.assertEqual(self.computer.getCapacityScope(), "open")
self._installSoftware(self.computer,
self.software_instance.getUrlString())
......@@ -824,11 +824,11 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
self._makeTree()
self._makeComputer()
self.assertEquals(self.computer.getAllocationScope(), "open/public")
self.assertEquals(self.computer.getCapacityScope(), "open")
self.assertEqual(self.computer.getAllocationScope(), "open/public")
self.assertEqual(self.computer.getCapacityScope(), "open")
self.computer.edit(**{base_category: computer_category})
self.assertEquals(self.computer.getAllocationScope(), "open/public")
self.assertEquals(self.computer.getCapacityScope(), "open")
self.assertEqual(self.computer.getAllocationScope(), "open/public")
self.assertEqual(self.computer.getCapacityScope(), "open")
self._installSoftware(self.computer,
self.software_instance.getUrlString())
......
......@@ -391,7 +391,7 @@ class TestSlapOSCorePersonComputerSupply(SlapOSTestCaseMixin):
# Login as new user
self.login(person_user.getUserId())
new_person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()
self.assertEquals(person_user.getRelativeUrl(), new_person.getRelativeUrl())
self.assertEqual(person_user.getRelativeUrl(), new_person.getRelativeUrl())
def beforeTearDown(self):
if 'software_installation_url' in self.computer.REQUEST:
......@@ -1046,7 +1046,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.instance.requestStop(**request_kw)
connection_xml = self.generateSafeXml()
self.instance.updateConnection(connection_xml=connection_xml)
self.assertEquals(self.instance.getConnectionXml(), connection_xml)
self.assertEqual(self.instance.getConnectionXml(), connection_xml)
transaction.abort()
def test_updateConnectionRequired(self):
......@@ -1920,7 +1920,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
self.login(person_user.getUserId())
new_person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()
self.assertEquals(person_user.getRelativeUrl(), new_person.getRelativeUrl())
self.assertEqual(person_user.getRelativeUrl(), new_person.getRelativeUrl())
def beforeTearDown(self):
pass
......@@ -2055,7 +2055,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
state="started",
)
hosting_subscription = person.REQUEST.get('request_hosting_subscription')
self.assertEquals("start_requested", hosting_subscription.getSlapState())
self.assertEqual("start_requested", hosting_subscription.getSlapState())
person.requestSoftwareInstance(
software_release=software_release,
......@@ -2067,7 +2067,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
state="stopped",
)
hosting_subscription = person.REQUEST.get('request_hosting_subscription')
self.assertEquals("stop_requested", hosting_subscription.getSlapState())
self.assertEqual("stop_requested", hosting_subscription.getSlapState())
person.requestSoftwareInstance(
software_release=software_release,
......@@ -2079,7 +2079,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
state="destroyed",
)
hosting_subscription = person.REQUEST.get('request_hosting_subscription')
self.assertEquals(None, hosting_subscription)
self.assertEqual(None, hosting_subscription)
def test_Person_requestSoftwareInstance_returnHostingSubscriptionUrl(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()
......@@ -2105,7 +2105,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
state=state,
)
hosting_subscription = person.REQUEST.get('request_hosting_subscription')
self.assertEquals("Hosting Subscription",
self.assertEqual("Hosting Subscription",
hosting_subscription.getPortalType())
def test_Person_requestSoftwareInstance_createHostingSubscription(self):
......@@ -2136,17 +2136,17 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
state=state,
)
hosting_subscription = person.REQUEST.get('request_hosting_subscription')
self.assertEquals(software_release,
self.assertEqual(software_release,
hosting_subscription.getUrlString())
self.assertEquals(software_title, hosting_subscription.getTitle())
self.assertEquals(software_type, hosting_subscription.getSourceReference())
self.assertEquals(instance_xml, hosting_subscription.getTextContent())
self.assertEquals(sla_xml, hosting_subscription.getSlaXml())
self.assertEquals(shared, hosting_subscription.getRootSlave())
self.assertEquals("start_requested", hosting_subscription.getSlapState())
self.assertEquals("HOSTSUBS-%s" % (previous_id+1),
self.assertEqual(software_title, hosting_subscription.getTitle())
self.assertEqual(software_type, hosting_subscription.getSourceReference())
self.assertEqual(instance_xml, hosting_subscription.getTextContent())
self.assertEqual(sla_xml, hosting_subscription.getSlaXml())
self.assertEqual(shared, hosting_subscription.getRootSlave())
self.assertEqual("start_requested", hosting_subscription.getSlapState())
self.assertEqual("HOSTSUBS-%s" % (previous_id+1),
hosting_subscription.getReference())
self.assertEquals("validated", hosting_subscription.getValidationState())
self.assertEqual("validated", hosting_subscription.getValidationState())
def test_Person_requestSoftwareInstance_HostingSubscriptionNotReindexed(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()
......@@ -2237,20 +2237,20 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
)
hosting_subscription2 = person.REQUEST.get('request_hosting_subscription')
self.assertEquals(hosting_subscription.getRelativeUrl(),
self.assertEqual(hosting_subscription.getRelativeUrl(),
hosting_subscription2.getRelativeUrl())
self.assertEquals(hosting_subscription_reference,
self.assertEqual(hosting_subscription_reference,
hosting_subscription2.getReference())
self.assertEquals(software_release2,
self.assertEqual(software_release2,
hosting_subscription.getUrlString())
self.assertEquals(software_title, hosting_subscription.getTitle())
self.assertEquals(software_type2, hosting_subscription.getSourceReference())
self.assertEquals(instance_xml2, hosting_subscription.getTextContent())
self.assertEquals(sla_xml2, hosting_subscription.getSlaXml())
self.assertEquals(shared2, hosting_subscription.getRootSlave())
self.assertEquals("stop_requested", hosting_subscription.getSlapState())
self.assertEquals("validated", hosting_subscription.getValidationState())
self.assertEqual(software_title, hosting_subscription.getTitle())
self.assertEqual(software_type2, hosting_subscription.getSourceReference())
self.assertEqual(instance_xml2, hosting_subscription.getTextContent())
self.assertEqual(sla_xml2, hosting_subscription.getSlaXml())
self.assertEqual(shared2, hosting_subscription.getRootSlave())
self.assertEqual("stop_requested", hosting_subscription.getSlapState())
self.assertEqual("validated", hosting_subscription.getValidationState())
def test_Person_requestSoftwareInstance_duplicatedHostingSubscription(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()
......@@ -2352,15 +2352,15 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
self.assertNotEquals(hosting_subscription.getReference(),
hosting_subscription2.getReference())
self.assertEquals(software_release2,
self.assertEqual(software_release2,
hosting_subscription2.getUrlString())
self.assertEquals(software_title2, hosting_subscription2.getTitle())
self.assertEquals(software_type2, hosting_subscription2.getSourceReference())
self.assertEquals(instance_xml2, hosting_subscription2.getTextContent())
self.assertEquals(sla_xml2, hosting_subscription2.getSlaXml())
self.assertEquals(shared2, hosting_subscription2.getRootSlave())
self.assertEquals("stop_requested", hosting_subscription2.getSlapState())
self.assertEquals("validated", hosting_subscription2.getValidationState())
self.assertEqual(software_title2, hosting_subscription2.getTitle())
self.assertEqual(software_type2, hosting_subscription2.getSourceReference())
self.assertEqual(instance_xml2, hosting_subscription2.getTextContent())
self.assertEqual(sla_xml2, hosting_subscription2.getSlaXml())
self.assertEqual(shared2, hosting_subscription2.getRootSlave())
self.assertEqual("stop_requested", hosting_subscription2.getSlapState())
self.assertEqual("validated", hosting_subscription2.getValidationState())
def test_Person_requestSoftwareInstance_deletedHostingSubscription(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()
......@@ -2398,8 +2398,8 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
state="destroyed",
)
hosting_subscription2 = person.REQUEST.get('request_hosting_subscription')
self.assertEquals(None, hosting_subscription2)
self.assertEquals("destroy_requested", hosting_subscription.getSlapState())
self.assertEqual(None, hosting_subscription2)
self.assertEqual("destroy_requested", hosting_subscription.getSlapState())
def test_Person_requestSoftwareInstance_noConflictWithDeletedHostingSubscription(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()
......@@ -2435,7 +2435,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
shared=shared,
state="destroyed",
)
self.assertEquals("destroy_requested", hosting_subscription.getSlapState())
self.assertEqual("destroy_requested", hosting_subscription.getSlapState())
transaction.commit()
self.tic()
......@@ -2449,7 +2449,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
state="started",
)
hosting_subscription2 = person.REQUEST.get('request_hosting_subscription')
self.assertEquals("start_requested", hosting_subscription2.getSlapState())
self.assertEqual("start_requested", hosting_subscription2.getSlapState())
self.assertNotEquals(hosting_subscription.getRelativeUrl(),
hosting_subscription2.getRelativeUrl())
......@@ -2468,7 +2468,7 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin):
# Login as new user
self.login(person_user.getUserId())
new_person = portal.ERP5Site_getAuthenticatedMemberPersonValue()
self.assertEquals(person_user.getRelativeUrl(), new_person.getRelativeUrl())
self.assertEqual(person_user.getRelativeUrl(), new_person.getRelativeUrl())
def beforeTearDown(self):
pass
......
......@@ -19,41 +19,41 @@ class TestSlapOSConfigurator(SlapOSTestCaseMixin):
def testConfiguredModuleGeneratorIDViaConstraint(self):
""" Make sure Generator ID is well configured, in this
case we trust on promise outcome."""
self.assertEquals(self.portal.portal_ids.checkConsistency(), [])
self.assertEqual(self.portal.portal_ids.checkConsistency(), [])
self.portal.person_module.setIdGenerator("_Id_fake")
self.assertNotEquals(self.portal.portal_ids.checkConsistency(), [])
self.portal.portal_ids.fixConsistency()
self.assertEquals(self.portal.portal_ids.checkConsistency(), [])
self.assertEquals(self.portal.person_module.getIdGenerator(),
self.assertEqual(self.portal.portal_ids.checkConsistency(), [])
self.assertEqual(self.portal.person_module.getIdGenerator(),
"_generatePerDayId")
def testConfiguredShacacheWebSite(self):
""" Make sure Shacache WebSite is setuped by Alarm
case we trust on promise outcome."""
self.assertEquals(self.portal.web_site_module.checkConsistency(), [])
self.assertEqual(self.portal.web_site_module.checkConsistency(), [])
def testConfiguredCacheViaConstraint(self):
""" Make sure Volitile and Persistent Cache was configured well,
invoking the consistency to check """
self.assertEquals(self.portal.portal_memcached.checkConsistency(), [])
self.assertEqual(self.portal.portal_memcached.checkConsistency(), [])
def testConfiguredConversionServerViaConstraint(self):
""" Make sure Conversion Server was configured well,
invoking checkConsistency """
self.assertEquals(self.portal.portal_preferences.checkConsistency(), [])
self.assertEqual(self.portal.portal_preferences.checkConsistency(), [])
def testConfiguredCertificateAuthoringConstraint(self):
"""Make sure Certificate Authoring was configured well,
invoking checkConsistency.
Make sure PAS is well configured."""
self.assertEquals(self.portal.portal_certificate_authority.checkConsistency(), [])
self.assertEqual(self.portal.portal_certificate_authority.checkConsistency(), [])
def testConfiguredTemplateToolViaConstraint(self):
""" Make sure Template Tool Repositories was configured well,
invoking checkConsistency """
self.assertEquals(
self.assertEqual(
[ i for i in self.portal.portal_templates.checkConsistency()
if "(reinstall)" not in i.message], [])
......@@ -72,7 +72,7 @@ class TestSlapOSConfigurator(SlapOSTestCaseMixin):
memcached_tool = self.getPortal().portal_memcached
connection_dict = _getVolatileMemcachedServerDict()
url_string = 'erp5-memcached-volatile:%(port)s' % connection_dict
self.assertEquals(memcached_tool.default_memcached_plugin.getUrlString(),
self.assertEqual(memcached_tool.default_memcached_plugin.getUrlString(),
url_string)
def testConfiguredPersistentCache(self):
......@@ -89,7 +89,7 @@ class TestSlapOSConfigurator(SlapOSTestCaseMixin):
memcached_tool = self.getPortal().portal_memcached
connection_dict = _getPersistentMemcachedServerDict()
url_string = 'erp5-memcached-persistent:%(port)s' % connection_dict
self.assertEquals(memcached_tool.persistent_memcached_plugin.getUrlString(),
self.assertEqual(memcached_tool.persistent_memcached_plugin.getUrlString(),
url_string)
def testConfiguredConversionServer(self):
......@@ -106,7 +106,7 @@ class TestSlapOSConfigurator(SlapOSTestCaseMixin):
# set preference
preference_tool = self.portal.portal_preferences
conversion_url = _getConversionServerUrl()
self.assertEquals(preference_tool.getPreferredDocumentConversionServerUrl(), conversion_url)
self.assertEqual(preference_tool.getPreferredDocumentConversionServerUrl(), conversion_url)
def testConfiguredCertificateAuthoring(self):
""" Make sure Certificate Authoting is
......@@ -119,7 +119,7 @@ class TestSlapOSConfigurator(SlapOSTestCaseMixin):
return
self.assertTrue(self.portal.hasObject('portal_certificate_authority'))
self.assertEquals(os.environ['TEST_CA_PATH'],
self.assertEqual(os.environ['TEST_CA_PATH'],
self.portal.portal_certificate_authority.certificate_authority_path)
def testModuleHasIdGeneratorByDay(self):
......
......@@ -40,65 +40,65 @@ class TestSlapOSFolder_getOpenTicketList(TestCRMSkinsMixin):
module = ticket.getParentValue()
open_ticket_list = module.Folder_getOpenTicketList(title=ticket.getTitle())
self.assertEquals(len(open_ticket_list), expected_amount-1)
self.assertEqual(len(open_ticket_list), expected_amount-1)
ticket.submit()
ticket.immediateReindexObject()
open_ticket_list = module.Folder_getOpenTicketList(title=ticket.getTitle())
self.assertEquals(len(open_ticket_list), expected_amount)
self.assertEquals(open_ticket_list[0].getUid(), ticket.getUid())
self.assertEqual(len(open_ticket_list), expected_amount)
self.assertEqual(open_ticket_list[0].getUid(), ticket.getUid())
ticket.validate()
ticket.immediateReindexObject()
open_ticket_list = module.Folder_getOpenTicketList(title=ticket.getTitle())
self.assertEquals(len(open_ticket_list), expected_amount)
self.assertEquals(open_ticket_list[0].getUid(), ticket.getUid())
self.assertEqual(len(open_ticket_list), expected_amount)
self.assertEqual(open_ticket_list[0].getUid(), ticket.getUid())
ticket.suspend()
ticket.immediateReindexObject()
open_ticket_list = module.Folder_getOpenTicketList(title=ticket.getTitle())
self.assertEquals(len(open_ticket_list), expected_amount)
self.assertEquals(open_ticket_list[0].getUid(), ticket.getUid())
self.assertEqual(len(open_ticket_list), expected_amount)
self.assertEqual(open_ticket_list[0].getUid(), ticket.getUid())
ticket.invalidate()
ticket.immediateReindexObject()
open_ticket_list = module.Folder_getOpenTicketList(title=ticket.getTitle())
self.assertEquals(len(open_ticket_list), expected_amount)
self.assertEquals(open_ticket_list[0].getUid(), ticket.getUid())
self.assertEqual(len(open_ticket_list), expected_amount)
self.assertEqual(open_ticket_list[0].getUid(), ticket.getUid())
def _test_upgrade_decision(self, ticket, expected_amount):
module = ticket.getParentValue()
open_ticket_list = module.Folder_getOpenTicketList(title=ticket.getTitle())
self.assertEquals(len(open_ticket_list), expected_amount-1)
self.assertEqual(len(open_ticket_list), expected_amount-1)
ticket.plan()
ticket.immediateReindexObject()
open_ticket_list = module.Folder_getOpenTicketList(title=ticket.getTitle())
self.assertEquals(len(open_ticket_list), expected_amount-1)
self.assertEqual(len(open_ticket_list), expected_amount-1)
ticket.confirm()
ticket.immediateReindexObject()
open_ticket_list = module.Folder_getOpenTicketList(title=ticket.getTitle())
self.assertEquals(len(open_ticket_list), expected_amount)
self.assertEquals(open_ticket_list[0].getUid(), ticket.getUid())
self.assertEqual(len(open_ticket_list), expected_amount)
self.assertEqual(open_ticket_list[0].getUid(), ticket.getUid())
ticket.start()
ticket.immediateReindexObject()
open_ticket_list = module.Folder_getOpenTicketList(title=ticket.getTitle())
self.assertEquals(len(open_ticket_list), expected_amount-1)
self.assertEqual(len(open_ticket_list), expected_amount-1)
ticket.stop()
ticket.immediateReindexObject()
open_ticket_list = module.Folder_getOpenTicketList(title=ticket.getTitle())
self.assertEquals(len(open_ticket_list), expected_amount-1)
self.assertEqual(len(open_ticket_list), expected_amount-1)
ticket.deliver()
ticket.immediateReindexObject()
open_ticket_list = module.Folder_getOpenTicketList(title=ticket.getTitle())
self.assertEquals(len(open_ticket_list), expected_amount)
self.assertEquals(open_ticket_list[0].getUid(), ticket.getUid())
self.assertEqual(len(open_ticket_list), expected_amount)
self.assertEqual(open_ticket_list[0].getUid(), ticket.getUid())
def test_support_request(self):
def newSupportRequest():
......@@ -161,57 +161,57 @@ class TestSlapOSTicketEvent(TestCRMSkinsMixin):
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, None)
self.assertEqual(last_event, None)
event = newEvent(ticket)
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, None)
self.assertEqual(last_event, None)
event.plan()
event.immediateReindexObject()
self.assertEquals(last_event, None)
self.assertEqual(last_event, None)
event.confirm()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
self.assertEqual(last_event, event)
event.start()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
self.assertEqual(last_event, event)
event.stop()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
self.assertEqual(last_event, event)
event.deliver()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
self.assertEqual(last_event, event)
# Now we test unwanted cases (deleted and cancelled)
another_event = newEvent(ticket)
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
self.assertEqual(last_event, event)
another_event.cancel()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
self.assertEqual(last_event, event)
another_event = newEvent(ticket)
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
self.assertEqual(last_event, event)
another_event.delete()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
self.assertEqual(last_event, event)
class TestSlapOSEvent_getRSSTextContent(TestSlapOSTicketEvent):
......@@ -327,26 +327,26 @@ class TestSlapOSPerson_checkToCreateRegularisationRequest(SlapOSTestCaseMixinWit
before_date = DateTime()
ticket, event = person.Person_checkToCreateRegularisationRequest()
after_date = DateTime()
self.assertEquals(ticket.getPortalType(), 'Regularisation Request')
self.assertEquals(ticket.getSimulationState(), 'suspended')
self.assertEquals(ticket.getSourceProject(), person.getRelativeUrl())
self.assertEquals(ticket.getResource(),
self.assertEqual(ticket.getPortalType(), 'Regularisation Request')
self.assertEqual(ticket.getSimulationState(), 'suspended')
self.assertEqual(ticket.getSourceProject(), person.getRelativeUrl())
self.assertEqual(ticket.getResource(),
'service_module/slapos_crm_acknowledgement')
self.assertEquals(ticket.getTitle(),
self.assertEqual(ticket.getTitle(),
'Account regularisation expected for "%s"' % person.getTitle())
self.assertEquals(ticket.getDestination(),
self.assertEqual(ticket.getDestination(),
person.getRelativeUrl())
self.assertEquals(ticket.getDestinationDecision(),
self.assertEqual(ticket.getDestinationDecision(),
person.getRelativeUrl())
self.assertEquals(event.getPortalType(), 'Mail Message')
self.assertEquals(event.getResource(),
self.assertEqual(event.getPortalType(), 'Mail Message')
self.assertEqual(event.getResource(),
'service_module/slapos_crm_acknowledgement')
self.assertTrue(event.getStartDate() >= before_date)
self.assertTrue(event.getStopDate() <= after_date)
self.assertEquals(event.getTitle(), "Invoice payment requested")
self.assertEquals(event.getDestination(),
self.assertEqual(event.getTitle(), "Invoice payment requested")
self.assertEqual(event.getDestination(),
person.getRelativeUrl())
self.assertEquals(event.getSource(),
self.assertEqual(event.getSource(),
ticket.getSource())
expected_text_content = """Dear user,
......@@ -358,11 +358,11 @@ Do not hesitate to visit the web forum (http://community.slapos.org/forum) in ca
Regards,
The slapos team
"""
self.assertEquals(event.getTextContent(), expected_text_content,
self.assertEqual(event.getTextContent(), expected_text_content,
'\n'.join([x for x in difflib.unified_diff(
event.getTextContent().splitlines(),
expected_text_content.splitlines())]))
self.assertEquals(event.getSimulationState(), 'delivered')
self.assertEqual(event.getSimulationState(), 'delivered')
@simulate('NotificationTool_getDocumentValue',
'reference=None',
......@@ -392,41 +392,41 @@ The slapos team
before_date = DateTime()
ticket, event = person.Person_checkToCreateRegularisationRequest()
after_date = DateTime()
self.assertEquals(ticket.getPortalType(), 'Regularisation Request')
self.assertEquals(ticket.getSimulationState(), 'suspended')
self.assertEquals(ticket.getSourceProject(), person.getRelativeUrl())
self.assertEquals(ticket.getResource(),
self.assertEqual(ticket.getPortalType(), 'Regularisation Request')
self.assertEqual(ticket.getSimulationState(), 'suspended')
self.assertEqual(ticket.getSourceProject(), person.getRelativeUrl())
self.assertEqual(ticket.getResource(),
'service_module/slapos_crm_acknowledgement')
self.assertEquals(ticket.getTitle(),
self.assertEqual(ticket.getTitle(),
'Account regularisation expected for "%s"' % person.getTitle())
self.assertEquals(ticket.getDestination(),
self.assertEqual(ticket.getDestination(),
person.getRelativeUrl())
self.assertEquals(ticket.getDestinationDecision(),
self.assertEqual(ticket.getDestinationDecision(),
person.getRelativeUrl())
self.assertEquals(event.getPortalType(), 'Mail Message')
self.assertEquals(event.getResource(),
self.assertEqual(event.getPortalType(), 'Mail Message')
self.assertEqual(event.getResource(),
'service_module/slapos_crm_acknowledgement')
self.assertTrue(event.getStartDate() >= before_date)
self.assertTrue(event.getStopDate() <= after_date)
self.assertEquals(event.getTitle(),
self.assertEqual(event.getTitle(),
'Test NM title %s' % new_id)
self.assertEquals(event.getDestination(),
self.assertEqual(event.getDestination(),
person.getRelativeUrl())
self.assertEquals(event.getSource(),
self.assertEqual(event.getSource(),
ticket.getSource())
expected_text_content = 'Test NM content\n%s\n' % new_id
self.assertEquals(event.getTextContent(), expected_text_content,
self.assertEqual(event.getTextContent(), expected_text_content,
'\n'.join([x for x in difflib.unified_diff(
event.getTextContent().splitlines(),
expected_text_content.splitlines())]))
self.assertEquals(event.getSimulationState(), 'delivered')
self.assertEqual(event.getSimulationState(), 'delivered')
# def test_addRegularisationRequest_do_not_duplicate_ticket(self):
# person = self.createPerson()
# ticket = person.Person_checkToCreateRegularisationRequest()
# ticket2 = person.Person_checkToCreateRegularisationRequest()
# self.assertEquals(ticket.getRelativeUrl(), ticket2.getRelativeUrl())
# self.assertEqual(ticket.getRelativeUrl(), ticket2.getRelativeUrl())
@simulate('Entity_statBalance', '*args, **kwargs', 'return "1"')
def test_addRegularisationRequest_do_not_duplicate_ticket_if_not_reindexed(self):
......@@ -436,8 +436,8 @@ The slapos team
ticket2, event2 = person.Person_checkToCreateRegularisationRequest()
self.assertNotEquals(ticket, None)
self.assertNotEquals(event, None)
self.assertEquals(ticket2, None)
self.assertEquals(event2, None)
self.assertEqual(ticket2, None)
self.assertEqual(event2, None)
@simulate('Entity_statBalance', '*args, **kwargs', 'return "0"')
@simulate('RegularisationRequest_checkToSendUniqEvent',
......@@ -446,8 +446,8 @@ The slapos team
def test_addRegularisationRequest_balance_ok(self):
person = self.makePerson(index=0, user=0)
ticket, event = person.Person_checkToCreateRegularisationRequest()
self.assertEquals(ticket, None)
self.assertEquals(event, None)
self.assertEqual(ticket, None)
self.assertEqual(event, None)
@simulate('Entity_statBalance', '*args, **kwargs', 'return "1"')
def test_addRegularisationRequest_existing_suspended_ticket(self):
......@@ -458,8 +458,8 @@ The slapos team
ticket2, event2 = person.Person_checkToCreateRegularisationRequest()
self.assertNotEquals(ticket, None)
self.assertNotEquals(event, None)
self.assertEquals(ticket2.getRelativeUrl(), ticket.getRelativeUrl())
self.assertEquals(event2, None)
self.assertEqual(ticket2.getRelativeUrl(), ticket.getRelativeUrl())
self.assertEqual(event2, None)
@simulate('Entity_statBalance', '*args, **kwargs', 'return "1"')
def test_addRegularisationRequest_existing_validated_ticket(self):
......@@ -471,8 +471,8 @@ The slapos team
ticket2, event2 = person.Person_checkToCreateRegularisationRequest()
self.assertNotEquals(ticket, None)
self.assertNotEquals(event, None)
self.assertEquals(ticket2.getRelativeUrl(), ticket.getRelativeUrl())
self.assertEquals(event2, None)
self.assertEqual(ticket2.getRelativeUrl(), ticket.getRelativeUrl())
self.assertEqual(event2, None)
@simulate('Entity_statBalance', '*args, **kwargs', 'return "1"')
def test_addRegularisationRequest_existing_invalidated_ticket(self):
......@@ -519,7 +519,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket.validate()
ticket.suspend()
ticket.RegularisationRequest_invalidateIfPersonBalanceIsOk()
self.assertEquals(ticket.getSimulationState(), 'invalidated')
self.assertEqual(ticket.getSimulationState(), 'invalidated')
@simulate('Entity_statBalance', '*args, **kwargs', 'return "0"')
def test_invalidateIfPersonBalanceIsOk_not_suspended(self):
......@@ -528,7 +528,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket.edit(source_project_value=person)
ticket.validate()
ticket.RegularisationRequest_invalidateIfPersonBalanceIsOk()
self.assertEquals(ticket.getSimulationState(), 'validated')
self.assertEqual(ticket.getSimulationState(), 'validated')
@simulate('Entity_statBalance', '*args, **kwargs', 'return "0"')
def test_invalidateIfPersonBalanceIsOk_no_person(self):
......@@ -536,7 +536,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket.validate()
ticket.suspend()
ticket.RegularisationRequest_invalidateIfPersonBalanceIsOk()
self.assertEquals(ticket.getSimulationState(), 'suspended')
self.assertEqual(ticket.getSimulationState(), 'suspended')
@simulate('Entity_statBalance', '*args, **kwargs', 'return "1"')
def test_invalidateIfPersonBalanceIsOk_wrong_balance(self):
......@@ -546,7 +546,7 @@ class TestSlapOSRegularisationRequest_invalidateIfPersonBalanceIsOk(
ticket.validate()
ticket.suspend()
ticket.RegularisationRequest_invalidateIfPersonBalanceIsOk()
self.assertEquals(ticket.getSimulationState(), 'suspended')
self.assertEqual(ticket.getSimulationState(), 'suspended')
class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
......@@ -573,19 +573,19 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
'service_module/slapos_crm_spam', 'foo title', 'foo content', 'foo comment')
after_date = DateTime()
self.assertEquals(ticket.getSimulationState(), 'suspended')
self.assertEquals(ticket.getResource(), 'service_module/slapos_crm_spam')
self.assertEqual(ticket.getSimulationState(), 'suspended')
self.assertEqual(ticket.getResource(), 'service_module/slapos_crm_spam')
self.assertEquals(event.getPortalType(), 'Mail Message')
self.assertEquals(event.getSimulationState(), 'delivered')
self.assertEqual(event.getPortalType(), 'Mail Message')
self.assertEqual(event.getSimulationState(), 'delivered')
self.assertTrue(event.getStartDate() >= before_date)
self.assertTrue(event.getStopDate() <= after_date)
self.assertEquals(event.getTitle(), "foo title")
self.assertEquals(event.getResource(), 'service_module/slapos_crm_spam')
self.assertEquals(event.getFollowUp(), ticket.getRelativeUrl())
self.assertEquals(event.getSource(), "organisation_module/slapos")
self.assertEquals(event.getDestination(), person.getRelativeUrl())
self.assertEquals(event.getTextContent(), 'foo content')
self.assertEqual(event.getTitle(), "foo title")
self.assertEqual(event.getResource(), 'service_module/slapos_crm_spam')
self.assertEqual(event.getFollowUp(), ticket.getRelativeUrl())
self.assertEqual(event.getSource(), "organisation_module/slapos")
self.assertEqual(event.getDestination(), person.getRelativeUrl())
self.assertEqual(event.getTextContent(), 'foo content')
def test_checkToSendUniqEvent_service_required(self):
ticket = self.createRegularisationRequest()
......@@ -610,9 +610,9 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
event2 = ticket.RegularisationRequest_checkToSendUniqEvent(
'service_module/slapos_crm_spam', 'foo2 title', 'foo2 content', 'foo2 comment')
self.assertEquals(event.getTitle(), "foo title")
self.assertEquals(event.getTextContent(), 'foo content')
self.assertEquals(event.getRelativeUrl(), event2.getRelativeUrl())
self.assertEqual(event.getTitle(), "foo title")
self.assertEqual(event.getTextContent(), 'foo content')
self.assertEqual(event.getRelativeUrl(), event2.getRelativeUrl())
def test_checkToSendUniqEvent_manual_event(self):
person = self.makePerson(index=0, user=0)
......@@ -633,11 +633,11 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
event2 = ticket.RegularisationRequest_checkToSendUniqEvent(
'service_module/slapos_crm_spam', 'foo2 title', 'foo2 content', 'foo2 comment')
self.assertEquals(ticket.getResource(), 'foo/bar')
self.assertEqual(ticket.getResource(), 'foo/bar')
self.assertNotEquals(event.getTitle(), 'foo2 title')
self.assertEquals(event.getTextContent(), None)
self.assertEquals(event.getSimulationState(), 'draft')
self.assertEquals(event.getRelativeUrl(), event2.getRelativeUrl())
self.assertEqual(event.getTextContent(), None)
self.assertEqual(event.getSimulationState(), 'draft')
self.assertEqual(event.getRelativeUrl(), event2.getRelativeUrl())
def test_checkToSendUniqEvent_not_suspended(self):
person = self.makePerson(index=0, user=0)
......@@ -650,7 +650,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
event = ticket.RegularisationRequest_checkToSendUniqEvent(
'service_module/slapos_crm_spam', 'foo2 title', 'foo2 content', 'foo2 comment')
self.assertEquals(event, None)
self.assertEqual(event, None)
def test_checkToSendUniqEvent_event_not_reindexed(self):
person = self.makePerson(index=0, user=0)
......@@ -667,7 +667,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
event2 = ticket.RegularisationRequest_checkToSendUniqEvent(
'service_module/slapos_crm_spam', 'foo2 title', 'foo2 content', 'foo2 comment')
self.assertNotEquals(event, event2)
self.assertEquals(event2, None)
self.assertEqual(event2, None)
def test_checkToSendUniqEvent_REQUEST_disallowed(self):
ticket = self.createRegularisationRequest()
......@@ -950,7 +950,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
'service_module/slapos_crm_spam',
'foo2 title', 'foo2 content', 'foo2 comment')
self.assertEquals(event2, event.getRelativeUrl())
self.assertEqual(event2, event.getRelativeUrl())
self.assertEqual(
'Visited by RegularisationRequest_checkToSendUniqEvent %s %s %s %s' % \
('service_module/slapos_crm_spam', 'foo2 title', 'foo2 content',
......@@ -979,7 +979,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
'service_module/slapos_crm_spam',
'foo2 title', 'foo2 content', 'foo2 comment')
self.assertEquals(event2, None)
self.assertEqual(event2, None)
@simulate('RegularisationRequest_checkToSendUniqEvent',
'*args, **kwargs',
......@@ -1002,7 +1002,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
'service_module/slapos_crm_spam',
'foo2 title', 'foo2 content', 'foo2 comment')
self.assertEquals(event2, None)
self.assertEqual(event2, None)
@simulate('RegularisationRequest_checkToSendUniqEvent',
'*args, **kwargs',
......@@ -1026,7 +1026,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
'service_module/slapos_crm_spam',
'foo2 title', 'foo2 content', 'foo2 comment')
self.assertEquals(event2, None)
self.assertEqual(event2, None)
@simulate('RegularisationRequest_checkToSendUniqEvent',
'*args, **kwargs',
......@@ -1043,7 +1043,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
'service_module/slapos_crm_spam',
'foo2 title', 'foo2 content', 'foo2 comment')
self.assertEquals(event2, None)
self.assertEqual(event2, None)
@simulate('RegularisationRequest_checkToSendUniqEvent',
'*args, **kwargs',
......@@ -1066,7 +1066,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
'service_module/slapos_crm_spam',
'foo2 title', 'foo2 content', 'foo2 comment')
self.assertEquals(event2, None)
self.assertEqual(event2, None)
@simulate('RegularisationRequest_checkToSendUniqEvent',
'*args, **kwargs',
......@@ -1089,7 +1089,7 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
'service_module/slapos_crm_spam',
'foo2 title', 'foo2 content', 'foo2 comment')
self.assertEquals(event2, None)
self.assertEqual(event2, None)
def test_checkToTriggerNextEscalationStep_REQUEST_disallowed(self):
ticket = self.createRegularisationRequest()
......@@ -1606,19 +1606,19 @@ class TestSlapOSHostingSubscription_stopFromRegularisationRequest(
instance_xml = hosting_subscription.getTextContent()
sla_xml = hosting_subscription.getSlaXml()
shared = hosting_subscription.isRootSlave()
self.assertEquals(hosting_subscription.getSlapState(), "start_requested")
self.assertEqual(hosting_subscription.getSlapState(), "start_requested")
result = hosting_subscription.\
HostingSubscription_stopFromRegularisationRequest(person.getRelativeUrl())
self.assertEquals(result, True)
self.assertEquals(hosting_subscription.getUrlString(), software_release)
self.assertEquals(hosting_subscription.getTitle(), software_title)
self.assertEquals(hosting_subscription.getSourceReference(), software_type)
self.assertEquals(hosting_subscription.getTextContent(), instance_xml)
self.assertEquals(hosting_subscription.getSlaXml(), sla_xml)
self.assertEquals(hosting_subscription.isRootSlave(), shared)
self.assertEquals(hosting_subscription.getSlapState(), "stop_requested")
self.assertEqual(result, True)
self.assertEqual(hosting_subscription.getUrlString(), software_release)
self.assertEqual(hosting_subscription.getTitle(), software_title)
self.assertEqual(hosting_subscription.getSourceReference(), software_type)
self.assertEqual(hosting_subscription.getTextContent(), instance_xml)
self.assertEqual(hosting_subscription.getSlaXml(), sla_xml)
self.assertEqual(hosting_subscription.isRootSlave(), shared)
self.assertEqual(hosting_subscription.getSlapState(), "stop_requested")
def test_stopFromRegularisationRequest_stopped_subscription(self):
person = self.makePerson(index=0, user=0)
......@@ -1632,7 +1632,7 @@ class TestSlapOSHostingSubscription_stopFromRegularisationRequest(
result = hosting_subscription.\
HostingSubscription_stopFromRegularisationRequest(person.getRelativeUrl())
self.assertEquals(result, False)
self.assertEqual(result, False)
def test_stopFromRegularisationRequest_non_matching_person(self):
hosting_subscription = self.createHostingSubscription()
......@@ -1677,19 +1677,19 @@ class TestSlapOSHostingSubscription_deleteFromRegularisationRequest(
instance_xml = hosting_subscription.getTextContent()
sla_xml = hosting_subscription.getSlaXml()
shared = hosting_subscription.isRootSlave()
self.assertEquals(hosting_subscription.getSlapState(), "start_requested")
self.assertEqual(hosting_subscription.getSlapState(), "start_requested")
result = hosting_subscription.\
HostingSubscription_deleteFromRegularisationRequest(person.getRelativeUrl())
self.assertEquals(result, True)
self.assertEquals(hosting_subscription.getUrlString(), software_release)
self.assertEquals(hosting_subscription.getTitle(), software_title)
self.assertEquals(hosting_subscription.getSourceReference(), software_type)
self.assertEquals(hosting_subscription.getTextContent(), instance_xml)
self.assertEquals(hosting_subscription.getSlaXml(), sla_xml)
self.assertEquals(hosting_subscription.isRootSlave(), shared)
self.assertEquals(hosting_subscription.getSlapState(), "destroy_requested")
self.assertEqual(result, True)
self.assertEqual(hosting_subscription.getUrlString(), software_release)
self.assertEqual(hosting_subscription.getTitle(), software_title)
self.assertEqual(hosting_subscription.getSourceReference(), software_type)
self.assertEqual(hosting_subscription.getTextContent(), instance_xml)
self.assertEqual(hosting_subscription.getSlaXml(), sla_xml)
self.assertEqual(hosting_subscription.isRootSlave(), shared)
self.assertEqual(hosting_subscription.getSlapState(), "destroy_requested")
def test_deleteFromRegularisationRequest_stopped_subscription(self):
person = self.makePerson(index=0, user=0)
......@@ -1707,19 +1707,19 @@ class TestSlapOSHostingSubscription_deleteFromRegularisationRequest(
instance_xml = hosting_subscription.getTextContent()
sla_xml = hosting_subscription.getSlaXml()
shared = hosting_subscription.isRootSlave()
self.assertEquals(hosting_subscription.getSlapState(), "stop_requested")
self.assertEqual(hosting_subscription.getSlapState(), "stop_requested")
result = hosting_subscription.\
HostingSubscription_deleteFromRegularisationRequest(person.getRelativeUrl())
self.assertEquals(result, True)
self.assertEquals(hosting_subscription.getUrlString(), software_release)
self.assertEquals(hosting_subscription.getTitle(), software_title)
self.assertEquals(hosting_subscription.getSourceReference(), software_type)
self.assertEquals(hosting_subscription.getTextContent(), instance_xml)
self.assertEquals(hosting_subscription.getSlaXml(), sla_xml)
self.assertEquals(hosting_subscription.isRootSlave(), shared)
self.assertEquals(hosting_subscription.getSlapState(), "destroy_requested")
self.assertEqual(result, True)
self.assertEqual(hosting_subscription.getUrlString(), software_release)
self.assertEqual(hosting_subscription.getTitle(), software_title)
self.assertEqual(hosting_subscription.getSourceReference(), software_type)
self.assertEqual(hosting_subscription.getTextContent(), instance_xml)
self.assertEqual(hosting_subscription.getSlaXml(), sla_xml)
self.assertEqual(hosting_subscription.isRootSlave(), shared)
self.assertEqual(hosting_subscription.getSlapState(), "destroy_requested")
def test_deleteFromRegularisationRequest_destroyed_subscription(self):
person = self.makePerson(index=0, user=0)
......@@ -1733,7 +1733,7 @@ class TestSlapOSHostingSubscription_deleteFromRegularisationRequest(
result = hosting_subscription.\
HostingSubscription_deleteFromRegularisationRequest(person.getRelativeUrl())
self.assertEquals(result, False)
self.assertEqual(result, False)
def test_deleteFromRegularisationRequest_non_matching_person(self):
hosting_subscription = self.createHostingSubscription()
......@@ -1954,10 +1954,10 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
computer.edit(allocation_scope='open/public')
ticket = computer.Computer_checkAndUpdateAllocationScope()
self.tic()
self.assertEquals(computer.getAllocationScope(), 'open/personal')
self.assertEqual(computer.getAllocationScope(), 'open/personal')
#ticket = self._getGeneratedSupportRequest(computer)
self.assertNotEquals(None, ticket)
self.assertEquals(ticket.getSimulationState(), 'suspended')
self.assertEqual(ticket.getSimulationState(), 'suspended')
self.assertEqual('Visited by SupportRequest_trySendNotificationMessage ' \
'%s %s %s' % \
......@@ -1992,8 +1992,8 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
destination_section=friend_person.getRelativeUrl())
ticket = computer.Computer_checkAndUpdateAllocationScope()
self.tic()
self.assertEquals(computer.getAllocationScope(), 'open/personal')
self.assertEquals(ticket.getSimulationState(), 'suspended')
self.assertEqual(computer.getAllocationScope(), 'open/personal')
self.assertEqual(ticket.getSimulationState(), 'suspended')
self.assertEqual('Visited by SupportRequest_trySendNotificationMessage ' \
'%s %s %s' % \
('Allocation scope of %s changed to %s' % (computer.getReference(),
......@@ -2027,8 +2027,8 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
support_request = computer.Computer_checkAndUpdatePersonalAllocationScope()
self.tic()
self.assertEquals('suspended', support_request.getSimulationState())
self.assertEquals(computer.getAllocationScope(), target_allocation_scope)
self.assertEqual('suspended', support_request.getSimulationState())
self.assertEqual(computer.getAllocationScope(), target_allocation_scope)
self.assertEqual('Visited by SupportRequest_trySendNotificationMessage ' \
'%s %s %s' % \
('Allocation scope of %s changed to %s' % (computer.getReference(),
......@@ -2044,7 +2044,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
computer.edit(allocation_scope='open/personal')
computer.Computer_checkAndUpdateAllocationScope()
self.tic()
self.assertEquals(computer.getAllocationScope(), 'open/personal')
self.assertEqual(computer.getAllocationScope(), 'open/personal')
def test_computerAllowedAllocationScope_OpenPublic(self):
computer = self._makeComputer()
......@@ -2054,7 +2054,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
computer.edit(allocation_scope='open/public')
computer.Computer_checkAndUpdateAllocationScope()
self.tic()
self.assertEquals(computer.getAllocationScope(), 'open/public')
self.assertEqual(computer.getAllocationScope(), 'open/public')
def test_computerAllowedAllocationScope_OpenFriend(self):
computer = self._makeComputer()
......@@ -2066,7 +2066,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
destination_section=friend_person.getRelativeUrl())
computer.Computer_checkAndUpdateAllocationScope()
self.tic()
self.assertEquals(computer.getAllocationScope(), 'open/friend')
self.assertEqual(computer.getAllocationScope(), 'open/friend')
class TestComputer_hasContactedRecently(SlapOSTestCaseMixinWithAbort):
......@@ -2353,11 +2353,11 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
self.portal.REQUEST.get("support_request_in_progress", None))
# The support request is added to computer owner.
self.assertEquals(support_request.getDestinationDecision(),
self.assertEqual(support_request.getDestinationDecision(),
self.computer.getSourceAdministration())
self.assertEquals(support_request.getTitle(), title)
self.assertEquals(support_request.getDescription(), title)
self.assertEquals(support_request.getAggregateValue(),
self.assertEqual(support_request.getTitle(), title)
self.assertEqual(support_request.getDescription(), title)
self.assertEqual(support_request.getAggregateValue(),
self.computer)
def test_software_instance_Base_generateSupportRequestForSlapOS(self):
......@@ -2379,11 +2379,11 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
self.portal.REQUEST.get("support_request_in_progress", None))
# The support request is added to computer owner.
self.assertEquals(support_request.getDestinationDecision(),
self.assertEqual(support_request.getDestinationDecision(),
hosting_subscription.getDestinationSection())
self.assertEquals(support_request.getTitle(), title)
self.assertEquals(support_request.getDescription(), title)
self.assertEquals(support_request.getAggregateValue(),
self.assertEqual(support_request.getTitle(), title)
self.assertEqual(support_request.getDescription(), title)
self.assertEqual(support_request.getAggregateValue(),
instance)
def test_hosting_subscription_Base_generateSupportRequestForSlapOS(self):
......@@ -2402,12 +2402,12 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
self.portal.REQUEST.get("support_request_in_progress", None))
# The support request is added to computer owner.
self.assertEquals(support_request.getDestinationDecision(),
self.assertEqual(support_request.getDestinationDecision(),
hosting_subscription.getDestinationSection())
self.assertEquals(support_request.getTitle(), title)
self.assertEquals(support_request.getDescription(), title)
self.assertEquals(support_request.getAggregateValue(),
self.assertEqual(support_request.getTitle(), title)
self.assertEqual(support_request.getDescription(), title)
self.assertEqual(support_request.getAggregateValue(),
hosting_subscription)
def test_software_installation_Base_generateSupportRequestForSlapOS(self):
......@@ -2426,12 +2426,12 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
self.portal.REQUEST.get("support_request_in_progress", None))
# The support request is added to computer owner.
self.assertEquals(support_request.getDestinationDecision(),
self.assertEqual(support_request.getDestinationDecision(),
software_installation.getDestinationSection())
self.assertEquals(support_request.getTitle(), title)
self.assertEquals(support_request.getDescription(), title)
self.assertEquals(support_request.getAggregateValue(),
self.assertEqual(support_request.getTitle(), title)
self.assertEqual(support_request.getDescription(), title)
self.assertEqual(support_request.getAggregateValue(),
software_installation)
......@@ -2766,7 +2766,7 @@ class TestSlapOSHostingSubscription_createSupportRequestEvent(SlapOSTestCaseMixi
ticket.suspend()
self.tic()
self.assertEquals(None, self._getGeneratedSupportRequest(
self.assertEqual(None, self._getGeneratedSupportRequest(
hosting_subscription.getUid()))
hosting_subscription.HostingSubscription_createSupportRequestEvent(
......@@ -2781,7 +2781,7 @@ class TestSlapOSHostingSubscription_createSupportRequestEvent(SlapOSTestCaseMixi
@simulate('ERP5Site_isSupportRequestCreationClosed', '*args, **kwargs','return 1')
def testHostingSubscription_createSupportRequestEvent_closed(self):
hosting_subscription = self._makeHostingSubscription()
self.assertEquals(None,
self.assertEqual(None,
hosting_subscription.HostingSubscription_createSupportRequestEvent(
hosting_subscription, "test-slapos-crm-check.notification"))
......@@ -2789,7 +2789,7 @@ class TestSlapOSHostingSubscription_createSupportRequestEvent(SlapOSTestCaseMixi
def testHostingSubscription_createSupportRequestEvent_no_person(self):
hosting_subscription = self._makeHostingSubscription()
hosting_subscription.setDestinationSectionValue(None)
self.assertEquals(None,
self.assertEqual(None,
hosting_subscription.HostingSubscription_createSupportRequestEvent(
hosting_subscription, "test-slapos-crm-check.notification"))
......@@ -2886,17 +2886,17 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
{"created_at":"%s" % error_date, "text": "#error "}
)
self.assertEquals(instance.SoftwareInstance_hasReportedError(), None)
self.assertEqual(instance.SoftwareInstance_hasReportedError(), None)
instance.setAggregateValue(self.computer.partition1)
self.assertEquals(str(instance.SoftwareInstance_hasReportedError()), '#error ')
self.assertEqual(str(instance.SoftwareInstance_hasReportedError()), '#error ')
memcached_dict[instance.getReference()] = json.dumps(
{"created_at":"%s" % error_date, "text": "#access "}
)
self.assertEquals(instance.SoftwareInstance_hasReportedError(), None)
self.assertEqual(instance.SoftwareInstance_hasReportedError(), None)
def test_SoftwareInstallation_hasReportedError(self):
software_release = self._makeSoftwareRelease()
......@@ -2909,20 +2909,20 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
key_prefix='slap_tool',
plugin_path='portal_memcached/default_memcached_plugin')
self.assertEquals(installation.SoftwareInstallation_hasReportedError(), None)
self.assertEqual(installation.SoftwareInstallation_hasReportedError(), None)
error_date = DateTime()
memcached_dict[installation.getReference()] = json.dumps(
{"created_at":"%s" % error_date, "text": "#error "}
)
self.assertEquals(installation.SoftwareInstallation_hasReportedError(), error_date)
self.assertEqual(installation.SoftwareInstallation_hasReportedError(), error_date)
memcached_dict[installation.getReference()] = json.dumps(
{"created_at":"%s" % error_date, "text": "#building "}
)
self.assertEquals(installation.SoftwareInstallation_hasReportedError(), None)
self.assertEqual(installation.SoftwareInstallation_hasReportedError(), None)
@simulate('ERP5Site_isSupportRequestCreationClosed', '','return 0')
@simulate('HostingSubscription_createSupportRequestEvent',
......@@ -2941,13 +2941,13 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
try:
hosting_subscription = self._makeHostingSubscription()
self.assertEquals(hosting_subscription.getCreationDate(), date - 2)
self.assertEqual(hosting_subscription.getCreationDate(), date - 2)
self._makeSoftwareInstance(hosting_subscription,
self.generateNewSoftwareReleaseUrl())
instance = hosting_subscription.getPredecessorValue()
self.assertEquals(instance.getCreationDate(), date - 2)
self.assertEqual(instance.getCreationDate(), date - 2)
self._makeComputer()
self._makeComputerPartitionList()
......@@ -2962,7 +2962,7 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
{"created_at":"%s" % error_date, "text": "#error "}
)
self.assertEquals(
self.assertEqual(
'Visited by HostingSubscription_createSupportRequestEvent %s %s' % \
(instance.getUid(),
"slapos-crm-hosting-subscription-instance-state.notification"),
......@@ -2972,7 +2972,7 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
{"created_at":"%s" % error_date, "text": "#access "}
)
self.assertEquals(None,
self.assertEqual(None,
hosting_subscription.HostingSubscription_checkSoftwareInstanceState())
......@@ -3000,13 +3000,13 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
try:
hosting_subscription = self._makeHostingSubscription()
self.assertEquals(hosting_subscription.getCreationDate(), date - 2)
self.assertEqual(hosting_subscription.getCreationDate(), date - 2)
self._makeSoftwareInstance(hosting_subscription,
self.generateNewSoftwareReleaseUrl())
instance = hosting_subscription.getPredecessorValue()
self.assertEquals(instance.getCreationDate(), date - 2)
self.assertEqual(instance.getCreationDate(), date - 2)
self._makeComputer()
self._makeComputerPartitionList()
......@@ -3032,7 +3032,7 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
{"created_at":"%s" % error_date, "text": "#access "}
)
self.assertEquals(
self.assertEqual(
'Visited by HostingSubscription_createSupportRequestEvent %s %s' % \
(instance.getPredecessor(portal_type="Software Instance"),
"slapos-crm-hosting-subscription-instance-allocation.notification"),
......@@ -3042,7 +3042,7 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
instance.requestInstance(**kw)
self.tic()
self.assertEquals(
self.assertEqual(
None,
hosting_subscription.HostingSubscription_checkSoftwareInstanceState())
......@@ -3074,7 +3074,7 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
{"created_at":"%s" % error_date, "text": "#error "}
)
self.assertEquals(
self.assertEqual(
None,
hosting_subscription.HostingSubscription_checkSoftwareInstanceState())
......@@ -3107,17 +3107,17 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
)
self.assertNotEqual(first_event, None)
self.assertEquals(
self.assertEqual(
support_request.getFollowUpRelatedList(),
[first_event.getRelativeUrl()])
self.assertEquals(title, first_event.getTitle())
self.assertEquals(text_content, first_event.getTextContent())
self.assertEqual(title, first_event.getTitle())
self.assertEqual(text_content, first_event.getTextContent())
self.assertNotEquals(None, first_event.getStartDate())
self.assertEquals("service_module/slapos_crm_information",
self.assertEqual("service_module/slapos_crm_information",
first_event.getResource())
self.assertEquals(first_event.getDestination(), person.getRelativeUrl())
self.assertEquals(first_event.getFollowUp(), support_request.getRelativeUrl())
self.assertEqual(first_event.getDestination(), person.getRelativeUrl())
self.assertEqual(first_event.getFollowUp(), support_request.getRelativeUrl())
event = support_request.SupportRequest_trySendNotificationMessage(
message_title=title, message=text_content,
......@@ -3125,12 +3125,12 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
)
self.assertEqual(event, first_event)
self.assertEquals(title, event.getTitle())
self.assertEquals(text_content, event.getTextContent())
self.assertEqual(title, event.getTitle())
self.assertEqual(text_content, event.getTextContent())
self.assertNotEquals(None, event.getStartDate())
self.assertEquals("service_module/slapos_crm_information",
self.assertEqual("service_module/slapos_crm_information",
event.getResource())
self.assertEquals(event.getDestination(), person.getRelativeUrl())
self.assertEqual(event.getDestination(), person.getRelativeUrl())
title += "__zz"
event = support_request.SupportRequest_trySendNotificationMessage(
......@@ -3139,11 +3139,11 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
)
self.assertEqual(event.getTitle(), title)
self.assertEquals(text_content, event.getTextContent())
self.assertEqual(text_content, event.getTextContent())
self.assertNotEquals(None, event.getStartDate())
self.assertEquals("service_module/slapos_crm_information",
self.assertEqual("service_module/slapos_crm_information",
event.getResource())
self.assertEquals(event.getDestination(), person.getRelativeUrl())
self.assertEqual(event.getDestination(), person.getRelativeUrl())
another_support_request = self.portal.support_request_module.newContent(\
title=title, description=title,
......@@ -3159,17 +3159,17 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self.assertNotEqual(another_first_event, None)
self.assertEquals(
self.assertEqual(
another_support_request.getFollowUpRelatedList(),
[another_first_event.getRelativeUrl()])
self.assertEquals(title, another_first_event.getTitle())
self.assertEquals(text_content, another_first_event.getTextContent())
self.assertEqual(title, another_first_event.getTitle())
self.assertEqual(text_content, another_first_event.getTextContent())
self.assertNotEquals(None, another_first_event.getStartDate())
self.assertEquals("service_module/slapos_crm_information",
self.assertEqual("service_module/slapos_crm_information",
another_first_event.getResource())
self.assertEquals(another_first_event.getDestination(), person.getRelativeUrl())
self.assertEquals(another_first_event.getFollowUp(),
self.assertEqual(another_first_event.getDestination(), person.getRelativeUrl())
self.assertEqual(another_first_event.getFollowUp(),
another_support_request.getRelativeUrl())
......@@ -3222,33 +3222,33 @@ class TestSupportRequestUpdateMonitoringState(SlapOSTestCaseMixin):
'%s" % (context.getRelativeUrl(),)')
def testSupportRequest_updateMonitoringState(self):
support_request = self._makeSupportRequest()
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringState())
support_request.validate()
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringState())
# Now try to go to set a computer...
support_request.setAggregateValue(self._makeComputer())
self.assertEquals(
self.assertEqual(
"Visited by SupportRequest_updateMonitoringComputerState %s" % \
support_request.getRelativeUrl(),
support_request.SupportRequest_updateMonitoringState())
hs = self._makeHostingSubscription()
support_request.setAggregateValue(hs)
self.assertEquals(
self.assertEqual(
"Visited by SupportRequest_updateMonitoringHostingSubscriptionState %s" %\
support_request.getRelativeUrl(),
support_request.SupportRequest_updateMonitoringState())
hs.getSlapState = getFakeSlapState
self.assertEquals(
self.assertEqual(
"Visited by SupportRequest_updateMonitoringDestroyRequestedState %s" %\
support_request.getRelativeUrl(),
support_request.SupportRequest_updateMonitoringState())
support_request.invalidate()
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringState())
@simulate('SupportRequest_trySendNotificationMessage',
......@@ -3257,13 +3257,13 @@ class TestSupportRequestUpdateMonitoringState(SlapOSTestCaseMixin):
'%s %s %s" % (message_title, message, source_relative_url)')
def testSupportRequest_updateMonitoringComputerState(self):
support_request = self._makeSupportRequest()
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringComputerState())
support_request.validate()
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringComputerState())
support_request.setAggregateValue(self._makeHostingSubscription())
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringComputerState())
support_request.setAggregateValue(self._makeComputer())
......@@ -3275,14 +3275,14 @@ class TestSupportRequestUpdateMonitoringState(SlapOSTestCaseMixin):
"created_at": DateTime().strftime("%Y/%m/%d %H:%M")
})
# W/o destination decision the ticket is not notified.
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringComputerState())
support_request.setDestinationDecisionValue(self.makePerson(user=0))
expected_text = """Visited by SupportRequest_trySendNotificationMessage Computer is contacting again Suspending this ticket as the computer contacted again. %s""" % support_request.getDestinationDecision()
self.assertEquals(expected_text,
self.assertEqual(expected_text,
support_request.SupportRequest_updateMonitoringComputerState())
self.assertEquals(support_request.getSimulationState(), "suspended")
self.assertEqual(support_request.getSimulationState(), "suspended")
@simulate('SupportRequest_trySendNotificationMessage',
"message_title, message, source_relative_url",
......@@ -3290,27 +3290,27 @@ class TestSupportRequestUpdateMonitoringState(SlapOSTestCaseMixin):
'%s %s %s" % (message_title, message, source_relative_url)')
def testSupportRequest_updateMonitoringHostingSubscriptionState(self):
support_request = self._makeSupportRequest()
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringHostingSubscriptionState())
support_request.validate()
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringHostingSubscriptionState())
support_request.setAggregateValue(self._makeComputer())
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringHostingSubscriptionState())
support_request.setAggregateValue(self._makeHostingSubscription())
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringHostingSubscriptionState())
support_request.setDestinationDecisionValue(self.makePerson(user=0))
self.assertEquals("Visited by SupportRequest_trySendNotificationMessage Suspending this ticket as the problem is not present anymore Suspending this ticket as the problem is not present anymore. %s" % \
self.assertEqual("Visited by SupportRequest_trySendNotificationMessage Suspending this ticket as the problem is not present anymore Suspending this ticket as the problem is not present anymore. %s" % \
support_request.getDestinationDecision(),
support_request.SupportRequest_updateMonitoringHostingSubscriptionState())
self.assertEquals("suspended",
self.assertEqual("suspended",
support_request.getSimulationState())
......@@ -3320,14 +3320,14 @@ class TestSupportRequestUpdateMonitoringState(SlapOSTestCaseMixin):
'%s %s %s" % (message_title, message, source_relative_url)')
def testSupportRequest_updateMonitoringDestroyRequestedState(self):
support_request = self._makeSupportRequest()
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringDestroyRequestedState())
support_request.validate()
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringDestroyRequestedState())
support_request.setAggregateValue(self._makeComputer())
self.assertEquals(None,
self.assertEqual(None,
support_request.SupportRequest_updateMonitoringDestroyRequestedState())
hs = self._makeHostingSubscription()
......@@ -3339,10 +3339,10 @@ class TestSupportRequestUpdateMonitoringState(SlapOSTestCaseMixin):
support_request.setDestinationDecisionValue(self.makePerson(user=0))
expected_text = """Visited by SupportRequest_trySendNotificationMessage Hosting Subscription was destroyed was destroyed by the user Closing this ticket as the Hosting Subscription was destroyed by the user.
%s""" % support_request.getDestinationDecision()
self.assertEquals(expected_text,
self.assertEqual(expected_text,
support_request.SupportRequest_updateMonitoringDestroyRequestedState())
self.assertEquals("invalidated",
self.assertEqual("invalidated",
support_request.getSimulationState())
......@@ -42,7 +42,7 @@ context.edit(description=description)""")
reference="ACTPROC-%s" % new_id,
description="Active Process %s" % new_id,
)
self.assertEquals(active_process.getCreationDate(), date)
self.assertEqual(active_process.getCreationDate(), date)
self._simulateActiveProcess_deleteSelf()
try:
......
......@@ -527,7 +527,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
# is covered by unit tests
packing_list_line_list = subscription.getAggregateRelatedValueList(
portal_type='Sale Packing List Line')
self.assertEquals(len(packing_list_line_list), 1)
self.assertEqual(len(packing_list_line_list), 1)
for packing_list_line in packing_list_line_list:
packing_list = packing_list_line.getParentValue()
self.assertEqual('Sale Packing List',
......@@ -936,7 +936,7 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
# is covered by unit tests
packing_list_line_list = subscription.getAggregateRelatedValueList(
portal_type='Sale Packing List Line')
self.assertEquals(len(packing_list_line_list), 1)
self.assertEqual(len(packing_list_line_list), 1)
for packing_list_line in packing_list_line_list:
packing_list = packing_list_line.getParentValue()
self.assertEqual('Sale Packing List',
......
......@@ -37,7 +37,7 @@ class TestSlapOSGroupRoleSecurityMixin(SlapOSTestCaseMixinWithAbort):
self._acquirePermissions(context))
def assertSecurityGroup(self, context, security_group_list, acquired):
self.assertEquals(acquired, context._getAcquireLocalRoles())
self.assertEqual(acquired, context._getAcquireLocalRoles())
self.assertSameSet(
security_group_list,
self._getLocalRoles(context)
......
......@@ -72,8 +72,8 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
body="",
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
home_page_hal = json.loads(response.read())
#####################################################
......@@ -101,8 +101,8 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
body="",
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
user_hal = json.loads(response.read())
#####################################################
......@@ -134,7 +134,7 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 201)
self.assertEqual(response.status, 201)
self.tic()
......@@ -158,8 +158,8 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
subscription_collection_hal = json.loads(response.read())
#####################################################
......@@ -180,8 +180,8 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
subscription_hal = json.loads(response.read())
#####################################################
......@@ -204,8 +204,8 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
instance_collection_hal = json.loads(response.read())
#####################################################
......@@ -226,8 +226,8 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
instance_hal = json.loads(response.read())
#####################################################
......@@ -251,8 +251,8 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
self.tic()
......@@ -276,8 +276,8 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
news_hal = json.loads(response.read())
# We are going to check computer and software
......@@ -315,8 +315,8 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
computer_collection_hal = json.loads(response.read())
#####################################################
......@@ -337,8 +337,8 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
computer_hal = json.loads(response.read())
#####################################################
......@@ -361,8 +361,8 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
software_collection_hal = json.loads(response.read())
#####################################################
......@@ -382,7 +382,7 @@ class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
body="",
)
response = connection.getresponse()
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.getheader('Content-Type'), content_type)
software_hal = json.loads(response.read())
......@@ -438,8 +438,8 @@ class TestSlapOSHypermediaInstanceScenario(SlapOSTestCaseMixin):
body="",
)
response = connection.getresponse()
self.assertEquals(response.status, 200, response)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200, response)
self.assertEqual(response.getheader('Content-Type'), content_type)
home_page_hal = json.loads(response.read())
#####################################################
......@@ -467,8 +467,8 @@ class TestSlapOSHypermediaInstanceScenario(SlapOSTestCaseMixin):
body="",
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
instance_hal = json.loads(response.read())
#####################################################
......@@ -492,8 +492,8 @@ class TestSlapOSHypermediaInstanceScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
self.tic()
......@@ -517,8 +517,8 @@ class TestSlapOSHypermediaInstanceScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
self.tic()
......@@ -543,8 +543,8 @@ class TestSlapOSHypermediaInstanceScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
subscription_hal = json.loads(response.read())
self.tic()
......@@ -567,8 +567,8 @@ class TestSlapOSHypermediaInstanceScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
subscription_hal = json.loads(response.read())
self.tic()
......@@ -593,8 +593,8 @@ class TestSlapOSHypermediaInstanceScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
instance_collection_hal = json.loads(response.read())
#####################################################
......@@ -615,7 +615,7 @@ class TestSlapOSHypermediaInstanceScenario(SlapOSTestCaseMixin):
)
response = connection.getresponse()
self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type)
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader('Content-Type'), content_type)
instance_hal = json.loads(response.read())
......@@ -57,8 +57,8 @@ class TestSlapOSPersonERP5Document_getHateoas(TestSlapOSHypermediaMixin):
person_user = self._makePerson()
fake_request = do_fake_request("GET")
result = person_user.ERP5Document_getHateoas(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 406)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 406)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -67,8 +67,8 @@ class TestSlapOSPersonERP5Document_getHateoas(TestSlapOSHypermediaMixin):
person_user = self._makePerson()
fake_request = do_fake_request("POST")
result = person_user.ERP5Document_getHateoas(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 405)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 405)
self.assertEqual(result, "")
@simulate('Base_getRequestUrl', '*args, **kwargs',
......@@ -80,8 +80,8 @@ class TestSlapOSPersonERP5Document_getHateoas(TestSlapOSHypermediaMixin):
person_user = self._makePerson()
fake_request = do_fake_request("GET")
result = person_user.ERP5Document_getHateoas(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
self.assertEqual(fake_request.RESPONSE.status, 200)
self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
results = json.loads(result)
......@@ -112,7 +112,7 @@ class TestSlapOSPersonERP5Document_getHateoas(TestSlapOSHypermediaMixin):
]:
self.assertTrue(action in action_object_slap, \
"%s not in %s" % (action, action_object_slap))
self.assertEquals(results['_links']['action_object_slap_post'], {
self.assertEqual(results['_links']['action_object_slap_post'], {
u"href": u'%s/Person_requestHateoasHostingSubscription' % \
person_user.absolute_url(),
u"name": u"request_hateoas_hosting_subscription",
......@@ -136,12 +136,12 @@ class TestSlapOSERP5Document_getHateoas_me(TestSlapOSHypermediaMixin):
self.changeSkin('Hal')
fake_request = do_fake_request("GET")
result = self.portal.ERP5Document_getHateoas(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
self.assertEqual(fake_request.RESPONSE.status, 200)
self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
result = json.loads(result)
self.assertEquals(result['_links']['self'],
self.assertEqual(result['_links']['self'],
{"href": "http://example.org/bar"}
)
self.assertEqual(result['_links'].get('me'), me)
......@@ -188,8 +188,8 @@ class TestSlapOSPerson_requestHateoasHostingSubscription(TestSlapOSHypermediaMix
fake_request = do_fake_request("POST")
result = person_user.Person_requestHateoasHostingSubscription(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 406)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 406)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/json"')
......@@ -199,8 +199,8 @@ class TestSlapOSPerson_requestHateoasHostingSubscription(TestSlapOSHypermediaMix
fake_request = do_fake_request("GET")
result = person_user.Person_requestHateoasHostingSubscription(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 405)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 405)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/json"')
......@@ -209,8 +209,8 @@ class TestSlapOSPerson_requestHateoasHostingSubscription(TestSlapOSHypermediaMix
fake_request = do_fake_request("POST")
result = self.portal.Person_requestHateoasHostingSubscription(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 403)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 403)
self.assertEqual(result, "")
@simulate('Base_getRequestBody', '*args, **kwargs',
'return "[}"')
......@@ -222,8 +222,8 @@ class TestSlapOSPerson_requestHateoasHostingSubscription(TestSlapOSHypermediaMix
fake_request = do_fake_request("POST")
result = person_user.Person_requestHateoasHostingSubscription(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 400)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 400)
self.assertEqual(result, "")
@simulate('Base_getRequestBody', '*args, **kwargs',
'return "%s"' % json.dumps({
......@@ -236,8 +236,8 @@ class TestSlapOSPerson_requestHateoasHostingSubscription(TestSlapOSHypermediaMix
fake_request = do_fake_request("POST")
result = person_user.Person_requestHateoasHostingSubscription(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 400)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 400)
self.assertEqual(result, "")
@simulate('Base_getRequestBody', '*args, **kwargs',
'return """%s"""' % json.dumps({
......@@ -257,8 +257,8 @@ class TestSlapOSPerson_requestHateoasHostingSubscription(TestSlapOSHypermediaMix
fake_request = do_fake_request("POST")
result = person_user.Person_requestHateoasHostingSubscription(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 201)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 201)
self.assertEqual(result, "")
# XXX Test that person.request is called.
class TestSlapOSPerson_getHateoasHostingSubscriptionList(TestSlapOSHypermediaMixin):
......@@ -278,8 +278,8 @@ class TestSlapOSPerson_getHateoasHostingSubscriptionList(TestSlapOSHypermediaMix
fake_request = do_fake_request("GET")
result = person_user.Person_getHateoasHostingSubscriptionList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 406)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 406)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json')
......@@ -288,8 +288,8 @@ class TestSlapOSPerson_getHateoasHostingSubscriptionList(TestSlapOSHypermediaMix
fake_request = do_fake_request("POST")
result = self.portal.Person_getHateoasHostingSubscriptionList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 405)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 405)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -298,8 +298,8 @@ class TestSlapOSPerson_getHateoasHostingSubscriptionList(TestSlapOSHypermediaMix
fake_request = do_fake_request("GET")
result = self.portal.Person_getHateoasHostingSubscriptionList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 403)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 403)
self.assertEqual(result, "")
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/foo"')
......@@ -316,11 +316,11 @@ class TestSlapOSPerson_getHateoasHostingSubscriptionList(TestSlapOSHypermediaMix
fake_request = do_fake_request("GET")
result = person_user.Person_getHateoasHostingSubscriptionList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
self.assertEqual(fake_request.RESPONSE.status, 200)
self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
self.assertEquals(result, json.dumps({
self.assertEqual(result, json.dumps({
'_links': {
"self": {
"href": "http://example.org/foo",
......@@ -354,8 +354,8 @@ class TestSlapOSHostingSubscription_getHateoasInstanceList(TestSlapOSHypermediaM
fake_request = do_fake_request("GET")
result = subscription.HostingSubscription_getHateoasInstanceList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 406)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 406)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -364,8 +364,8 @@ class TestSlapOSHostingSubscription_getHateoasInstanceList(TestSlapOSHypermediaM
fake_request = do_fake_request("POST")
result = self.portal.HostingSubscription_getHateoasInstanceList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 405)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 405)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -374,8 +374,8 @@ class TestSlapOSHostingSubscription_getHateoasInstanceList(TestSlapOSHypermediaM
fake_request = do_fake_request("GET")
result = self.portal.HostingSubscription_getHateoasInstanceList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 403)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 403)
self.assertEqual(result, "")
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/bar"')
......@@ -391,11 +391,11 @@ class TestSlapOSHostingSubscription_getHateoasInstanceList(TestSlapOSHypermediaM
fake_request = do_fake_request("GET")
result = subscription.HostingSubscription_getHateoasInstanceList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
self.assertEqual(fake_request.RESPONSE.status, 200)
self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
self.assertEquals(result, json.dumps({
self.assertEqual(result, json.dumps({
'_links': {
"self": {
"href": "http://example.org/bar"
......@@ -429,8 +429,8 @@ class TestSlapOSHostingSubscription_getHateoasRootSoftwareInstance(TestSlapOSHyp
fake_request = do_fake_request("GET")
result = subscription.HostingSubscription_getHateoasRootSoftwareInstance(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 406)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 406)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -439,8 +439,8 @@ class TestSlapOSHostingSubscription_getHateoasRootSoftwareInstance(TestSlapOSHyp
fake_request = do_fake_request("POST")
result = self.portal.HostingSubscription_getHateoasRootSoftwareInstance(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 405)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 405)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -449,8 +449,8 @@ class TestSlapOSHostingSubscription_getHateoasRootSoftwareInstance(TestSlapOSHyp
fake_request = do_fake_request("GET")
result = self.portal.HostingSubscription_getHateoasRootSoftwareInstance(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 403)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 403)
self.assertEqual(result, "")
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/bar"')
......@@ -468,11 +468,11 @@ class TestSlapOSHostingSubscription_getHateoasRootSoftwareInstance(TestSlapOSHyp
fake_request = do_fake_request("GET")
result = subscription.HostingSubscription_getHateoasRootSoftwareInstance(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
self.assertEqual(fake_request.RESPONSE.status, 200)
self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
self.assertEquals(result, json.dumps({
self.assertEqual(result, json.dumps({
'_links': {
"self": {
"href": "http://example.org/bar"
......@@ -521,8 +521,8 @@ class TestSlapOSInstance_getHateoasNews(TestSlapOSHypermediaMixin):
fake_request = do_fake_request("GET")
result = instance.Instance_getHateoasNews(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 406)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 406)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -532,8 +532,8 @@ class TestSlapOSInstance_getHateoasNews(TestSlapOSHypermediaMixin):
fake_request = do_fake_request("POST")
result = instance.Instance_getHateoasNews(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 405)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 405)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -541,8 +541,8 @@ class TestSlapOSInstance_getHateoasNews(TestSlapOSHypermediaMixin):
def test_getHateoasNewsInstance_not_instance_context(self):
fake_request = do_fake_request("GET")
result = self.portal.Instance_getHateoasNews(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 403)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 403)
self.assertEqual(result, "")
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/bar"')
......@@ -554,12 +554,12 @@ class TestSlapOSInstance_getHateoasNews(TestSlapOSHypermediaMixin):
fake_request = do_fake_request("GET")
result = instance.Instance_getHateoasNews(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
self.assertEqual(fake_request.RESPONSE.status, 200)
self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
self.assertEquals(json.loads(result), json.loads(json.dumps({
self.assertEqual(json.loads(result), json.loads(json.dumps({
'news': [{
"user": "SlapOS Master",
"text": "#error no data found for %s" % instance.getReference()
......@@ -609,8 +609,8 @@ class TestSlapOSInstance_getHateoasRelatedHostingSubscription(TestSlapOSHypermed
fake_request = do_fake_request("GET")
result = instance.Instance_getHateoasRelatedHostingSubscription(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 406)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 406)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -620,8 +620,8 @@ class TestSlapOSInstance_getHateoasRelatedHostingSubscription(TestSlapOSHypermed
fake_request = do_fake_request("POST")
result = instance.Instance_getHateoasRelatedHostingSubscription(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 405)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 405)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -629,8 +629,8 @@ class TestSlapOSInstance_getHateoasRelatedHostingSubscription(TestSlapOSHypermed
def test_getHateoasRelatedHostingSubscription_not_instance_context(self):
fake_request = do_fake_request("GET")
result = self.portal.Instance_getHateoasRelatedHostingSubscription(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 403)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 403)
self.assertEqual(result, "")
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/bar"')
......@@ -645,12 +645,12 @@ class TestSlapOSInstance_getHateoasRelatedHostingSubscription(TestSlapOSHypermed
fake_request = do_fake_request("GET")
result = instance.Instance_getHateoasRelatedHostingSubscription(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
self.assertEqual(fake_request.RESPONSE.status, 200)
self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
self.assertEquals(json.loads(result), json.loads(json.dumps({
self.assertEqual(json.loads(result), json.loads(json.dumps({
'_links': {
"self": {
"href": "http://example.org/bar"
......@@ -691,8 +691,8 @@ class TestSlapOSInstance_getHateoasInformation(TestSlapOSHypermediaMixin):
def test_getHateoas_wrong_ACCEPT(self):
fake_request = do_fake_request("GET")
result = self.portal.Instance_getHateoasInformation(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 406)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 406)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -701,8 +701,8 @@ class TestSlapOSInstance_getHateoasInformation(TestSlapOSHypermediaMixin):
fake_request = do_fake_request("POST")
result = self.portal.Instance_getHateoasInformation(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 405)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 405)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -710,8 +710,8 @@ class TestSlapOSInstance_getHateoasInformation(TestSlapOSHypermediaMixin):
def test_getHateoas_request_not_correct_context(self):
fake_request = do_fake_request("GET")
result = self.portal.Instance_getHateoasInformation(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 403)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 403)
self.assertEqual(result, "")
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/foo"')
......@@ -726,11 +726,11 @@ class TestSlapOSInstance_getHateoasInformation(TestSlapOSHypermediaMixin):
fake_request = do_fake_request("GET")
result = instance.Instance_getHateoasInformation(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
self.assertEqual(fake_request.RESPONSE.status, 200)
self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
self.assertEquals(json.loads(result), json.loads(json.dumps({
self.assertEqual(json.loads(result), json.loads(json.dumps({
'title': instance.getTitle(),
'requested_state': 'started',
'slave': False,
......@@ -768,8 +768,8 @@ class TestSlapOSPerson_getHateoasComputerList(TestSlapOSHypermediaMixin):
def test_getHateoasComputerList_wrong_ACCEPT(self):
fake_request = do_fake_request("GET")
result = self.portal.Person_getHateoasComputerList(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 406)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 406)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -778,8 +778,8 @@ class TestSlapOSPerson_getHateoasComputerList(TestSlapOSHypermediaMixin):
fake_request = do_fake_request("POST")
result = self.portal.Person_getHateoasComputerList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 405)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 405)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -787,8 +787,8 @@ class TestSlapOSPerson_getHateoasComputerList(TestSlapOSHypermediaMixin):
def test_getHateoasComputerList_request_not_correct_context(self):
fake_request = do_fake_request("GET")
result = self.portal.Person_getHateoasComputerList(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 403)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 403)
self.assertEqual(result, "")
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/foo"')
......@@ -803,11 +803,11 @@ class TestSlapOSPerson_getHateoasComputerList(TestSlapOSHypermediaMixin):
fake_request = do_fake_request("GET")
self.changeSkin('Hal')
result = person_user.Person_getHateoasComputerList(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
self.assertEqual(fake_request.RESPONSE.status, 200)
self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
self.assertEquals(json.loads(result), json.loads(json.dumps({
self.assertEqual(json.loads(result), json.loads(json.dumps({
'_links': {
"self": {
"href": "http://example.org/foo"
......@@ -841,8 +841,8 @@ class TestSlapOSComputer_getHateoasSoftwareInstallationList(TestSlapOSHypermedia
fake_request = do_fake_request("GET")
result = self.portal.Computer_getHateoasSoftwareInstallationList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 406)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 406)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -851,8 +851,8 @@ class TestSlapOSComputer_getHateoasSoftwareInstallationList(TestSlapOSHypermedia
fake_request = do_fake_request("POST")
result = self.portal.Computer_getHateoasSoftwareInstallationList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 405)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 405)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -861,8 +861,8 @@ class TestSlapOSComputer_getHateoasSoftwareInstallationList(TestSlapOSHypermedia
fake_request = do_fake_request("GET")
result = self.portal.Computer_getHateoasSoftwareInstallationList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 403)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 403)
self.assertEqual(result, "")
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/foo"')
......@@ -877,11 +877,11 @@ class TestSlapOSComputer_getHateoasSoftwareInstallationList(TestSlapOSHypermedia
fake_request = do_fake_request("GET")
result = computer.Computer_getHateoasSoftwareInstallationList(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
self.assertEqual(fake_request.RESPONSE.status, 200)
self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
self.assertEquals(json.loads(result), json.loads(json.dumps({
self.assertEqual(json.loads(result), json.loads(json.dumps({
'_links': {
"self": {
"href": "http://example.org/foo"
......@@ -906,8 +906,8 @@ class TestSlapOSSoftwareInstallation_getHateoasInformation(TestSlapOSHypermediaM
def test_getHateoas_wrong_ACCEPT(self):
fake_request = do_fake_request("GET")
result = self.portal.SoftwareInstallation_getHateoasInformation(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 406)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 406)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -916,8 +916,8 @@ class TestSlapOSSoftwareInstallation_getHateoasInformation(TestSlapOSHypermediaM
fake_request = do_fake_request("POST")
result = self.portal.SoftwareInstallation_getHateoasInformation(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 405)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 405)
self.assertEqual(result, "")
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
......@@ -925,8 +925,8 @@ class TestSlapOSSoftwareInstallation_getHateoasInformation(TestSlapOSHypermediaM
def test_getHateoas_request_not_correct_context(self):
fake_request = do_fake_request("GET")
result = self.portal.SoftwareInstallation_getHateoasInformation(REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 403)
self.assertEquals(result, "")
self.assertEqual(fake_request.RESPONSE.status, 403)
self.assertEqual(result, "")
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/foo"')
......@@ -941,11 +941,11 @@ class TestSlapOSSoftwareInstallation_getHateoasInformation(TestSlapOSHypermediaM
fake_request = do_fake_request("GET")
result = software_installation.SoftwareInstallation_getHateoasInformation(
REQUEST=fake_request)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
self.assertEqual(fake_request.RESPONSE.status, 200)
self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
self.assertEquals(json.loads(result), json.loads(json.dumps({
self.assertEqual(json.loads(result), json.loads(json.dumps({
'title': software_installation.getTitle(),
'status': 'started',
'_links': {
......
......@@ -153,8 +153,8 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
transaction.PaymentTransaction_startPayzenPayment()
finally:
self._dropPaymentTransaction_getTotalPayablePrice()
self.assertEquals(transaction.getSimulationState(), simulation_state)
self.assertEquals(transaction.getModificationDate(), modification_date)
self.assertEqual(transaction.getSimulationState(), simulation_state)
self.assertEqual(transaction.getModificationDate(), modification_date)
def test_not_payzen_payment(self):
new_id = self.generateNewId()
......@@ -171,8 +171,8 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
transaction.PaymentTransaction_startPayzenPayment()
finally:
self._dropPaymentTransaction_getTotalPayablePrice()
self.assertEquals(transaction.getSimulationState(), simulation_state)
self.assertEquals(transaction.getModificationDate(), modification_date)
self.assertEqual(transaction.getSimulationState(), simulation_state)
self.assertEqual(transaction.getModificationDate(), modification_date)
def test_zero_amount_payment(self):
new_id = self.generateNewId()
......@@ -191,8 +191,8 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
transaction.PaymentTransaction_startPayzenPayment()
finally:
self._dropPaymentTransaction_getTotalPayablePrice()
self.assertEquals(transaction.getSimulationState(), simulation_state)
self.assertEquals(transaction.getModificationDate(), modification_date)
self.assertEqual(transaction.getSimulationState(), simulation_state)
self.assertEqual(transaction.getModificationDate(), modification_date)
def test_expected_payment(self):
new_id = self.generateNewId()
......@@ -209,7 +209,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
transaction.PaymentTransaction_startPayzenPayment()
finally:
self._dropPaymentTransaction_getTotalPayablePrice()
self.assertEquals(transaction.getSimulationState(), 'started')
self.assertEqual(transaction.getSimulationState(), 'started')
class TestSlapOSPayzenUpdateStartedPayment(SlapOSTestCaseMixinWithAbort):
......@@ -225,8 +225,8 @@ class TestSlapOSPayzenUpdateStartedPayment(SlapOSTestCaseMixinWithAbort):
simulation_state = transaction.getSimulationState()
modification_date = transaction.getModificationDate()
transaction.PaymentTransaction_updateStatus()
self.assertEquals(transaction.getSimulationState(), simulation_state)
self.assertEquals(transaction.getModificationDate(), modification_date)
self.assertEqual(transaction.getSimulationState(), simulation_state)
self.assertEqual(transaction.getModificationDate(), modification_date)
def test_not_payzen_payment(self):
new_id = self.generateNewId()
......@@ -239,8 +239,8 @@ class TestSlapOSPayzenUpdateStartedPayment(SlapOSTestCaseMixinWithAbort):
simulation_state = transaction.getSimulationState()
modification_date = transaction.getModificationDate()
transaction.PaymentTransaction_updateStatus()
self.assertEquals(transaction.getSimulationState(), simulation_state)
self.assertEquals(transaction.getModificationDate(), modification_date)
self.assertEqual(transaction.getSimulationState(), simulation_state)
self.assertEqual(transaction.getModificationDate(), modification_date)
def test_not_registered_payment(self):
new_id = self.generateNewId()
......@@ -253,7 +253,7 @@ class TestSlapOSPayzenUpdateStartedPayment(SlapOSTestCaseMixinWithAbort):
self.portal.portal_workflow._jumpToStateFor(transaction, 'started')
transaction.PaymentTransaction_updateStatus()
self.assertEquals(transaction.getSimulationState(), 'started')
self.assertEqual(transaction.getSimulationState(), 'started')
def _simulatePaymentTransaction_createPaidPayzenEvent(self):
script_name = 'PaymentTransaction_createPayzenEvent'
......@@ -322,7 +322,7 @@ return Foo()
self.assertEqual(
"",
transaction.workflow_history['edit_workflow'][-2]['comment'])
self.assertEquals(transaction.getSimulationState(), 'stopped')
self.assertEqual(transaction.getSimulationState(), 'stopped')
def test_not_paid_payment(self):
new_id = self.generateNewId()
......@@ -346,7 +346,7 @@ return Foo()
self.assertEqual(
'Visited by PaymentTransaction_createPayzenEvent',
transaction.workflow_history['edit_workflow'][-1]['comment'])
self.assertEquals(transaction.getSimulationState(), 'started')
self.assertEqual(transaction.getSimulationState(), 'started')
def _simulatePaymentTransaction_updateStatus(self):
script_name = 'PaymentTransaction_updateStatus'
......
......@@ -9,7 +9,7 @@ class TestSlapOSCurrency_getIntegrationMapping(SlapOSTestCaseMixinWithAbort):
def test_integratedCurrency(self):
currency = self.portal.currency_module.EUR
self.assertEquals(currency.Currency_getIntegrationMapping(), '978')
self.assertEqual(currency.Currency_getIntegrationMapping(), '978')
def test_getIntegrationMapping_notIntegratedCurrency(self):
new_id = self.generateNewId()
......@@ -37,7 +37,7 @@ class TestSlapOSAccountingTransaction_updateStartDate(SlapOSTestCaseMixinWithAbo
date = DateTime("2001/01/01")
payment_transaction = self.createPaymentTransaction()
payment_transaction.AccountingTransaction_updateStartDate(date)
self.assertEquals(payment_transaction.getStartDate(), date)
self.assertEqual(payment_transaction.getStartDate(), date)
def test_REQUEST_disallowed(self):
date = DateTime()
......@@ -52,14 +52,14 @@ class TestSlapOSPaymentTransaction_getPayzenId(SlapOSTestCaseMixinWithAbort):
def test_getPayzenId_newPaymentTransaction(self):
payment_transaction = self.createPaymentTransaction()
self.assertEquals(payment_transaction.PaymentTransaction_getPayzenId(), (None, None))
self.assertEqual(payment_transaction.PaymentTransaction_getPayzenId(), (None, None))
def test_getPayzenId_mappedPaymentTransaction(self):
payment_transaction = self.createPaymentTransaction()
transaction_date, payzen_id = payment_transaction.PaymentTransaction_generatePayzenId()
transaction_date2, payzen_id2 = payment_transaction.PaymentTransaction_getPayzenId()
self.assertEquals(payzen_id, payzen_id2)
self.assertEquals(transaction_date, transaction_date2)
self.assertEqual(payzen_id, payzen_id2)
self.assertEqual(transaction_date, transaction_date2)
def test_getPayzenId_manualMappedPaymentTransaction(self):
payment_transaction = self.createPaymentTransaction()
......@@ -77,8 +77,8 @@ class TestSlapOSPaymentTransaction_getPayzenId(SlapOSTestCaseMixinWithAbort):
setDestinationReference("20010101_123456")
transaction_date, payzen_id = payment_transaction.PaymentTransaction_getPayzenId()
self.assertEquals(payzen_id, "123456")
self.assertEquals(transaction_date, DateTime("20010101"))
self.assertEqual(payzen_id, "123456")
self.assertEqual(transaction_date, DateTime("20010101"))
def test_getPayzenId_REQUEST_disallowed(self):
payment_transaction = self.createPaymentTransaction()
......@@ -100,27 +100,27 @@ class TestSlapOSPaymentTransaction_generatePayzenId(SlapOSTestCaseMixinWithAbort
# Integration tool returns category value as mapping if nothing is set
mapping = integration_site.getCategoryFromMapping(
'Causality/%s' % transaction_url)
self.assertEquals(mapping, 'causality/%s' % transaction_url)
self.assertEqual(mapping, 'causality/%s' % transaction_url)
category = integration_site.getMappingFromCategory(mapping)
self.assertEquals(category, 'Causality/%s' % transaction_url)
self.assertEqual(category, 'Causality/%s' % transaction_url)
transaction_date, payzen_id = payment_transaction.PaymentTransaction_generatePayzenId()
mapping = integration_site.getCategoryFromMapping(
'Causality/%s' % transaction_url)
self.assertEquals(mapping, "%s_%s" % (
self.assertEqual(mapping, "%s_%s" % (
transaction_date.asdatetime().strftime('%Y%m%d'), payzen_id))
category = integration_site.getMappingFromCategory('causality/%s' % mapping)
# XXX Not indexed yet
# self.assertEquals(category, 'Causality/%s' % transaction_url)
# self.assertEqual(category, 'Causality/%s' % transaction_url)
self.assertNotEquals(payzen_id, None)
self.assertEquals(len(payzen_id), 6)
self.assertEquals(str(int(payzen_id)).zfill(6), payzen_id)
self.assertEqual(len(payzen_id), 6)
self.assertEqual(str(int(payzen_id)).zfill(6), payzen_id)
self.assertNotEquals(transaction_date, None)
self.assertEquals(transaction_date.timezone(), 'UTC')
self.assertEquals(transaction_date.asdatetime().strftime('%Y%m%d'),
self.assertEqual(transaction_date.timezone(), 'UTC')
self.assertEqual(transaction_date.asdatetime().strftime('%Y%m%d'),
DateTime().toZone('UTC').asdatetime().strftime('%Y%m%d'))
......@@ -128,14 +128,14 @@ class TestSlapOSPaymentTransaction_generatePayzenId(SlapOSTestCaseMixinWithAbort
payment_transaction = self.createPaymentTransaction()
payment_transaction.PaymentTransaction_generatePayzenId()
payzen_id = payment_transaction.PaymentTransaction_generatePayzenId()
self.assertEquals(payzen_id, (None, None))
self.assertEqual(payzen_id, (None, None))
def test_generatePayzenId_increasePaymentId(self):
payment_transaction = self.createPaymentTransaction()
payment_transaction2 = self.createPaymentTransaction()
date, payzen_id = payment_transaction.PaymentTransaction_generatePayzenId()
date2, payzen_id2 = payment_transaction2.PaymentTransaction_generatePayzenId()
self.assertEquals(date.asdatetime().strftime('%Y%m%d'),
self.assertEqual(date.asdatetime().strftime('%Y%m%d'),
date2.asdatetime().strftime('%Y%m%d'))
self.assertNotEquals(payzen_id, payzen_id2)
self.assertTrue(int(payzen_id) < int(payzen_id2))
......@@ -160,20 +160,20 @@ class TestSlapOSPaymentTransaction_createPayzenEvent(SlapOSTestCaseMixinWithAbor
def test_createPayzenEvent_newPayment(self):
payment_transaction = self.createPaymentTransaction()
payzen_event = payment_transaction.PaymentTransaction_createPayzenEvent()
self.assertEquals(payzen_event.getPortalType(), "Payzen Event")
self.assertEquals(payzen_event.getSource(),
self.assertEqual(payzen_event.getPortalType(), "Payzen Event")
self.assertEqual(payzen_event.getSource(),
"portal_secure_payments/slapos_payzen_test")
self.assertEquals(payzen_event.getDestination(), payment_transaction.getRelativeUrl())
self.assertEqual(payzen_event.getDestination(), payment_transaction.getRelativeUrl())
def test_createPayzenEvent_kwParameter(self):
payment_transaction = self.createPaymentTransaction()
payzen_event = payment_transaction.PaymentTransaction_createPayzenEvent(
title='foo')
self.assertEquals(payzen_event.getPortalType(), "Payzen Event")
self.assertEquals(payzen_event.getSource(),
self.assertEqual(payzen_event.getPortalType(), "Payzen Event")
self.assertEqual(payzen_event.getSource(),
"portal_secure_payments/slapos_payzen_test")
self.assertEquals(payzen_event.getDestination(), payment_transaction.getRelativeUrl())
self.assertEquals(payzen_event.getTitle(), "foo")
self.assertEqual(payzen_event.getDestination(), payment_transaction.getRelativeUrl())
self.assertEqual(payzen_event.getTitle(), "foo")
class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
......@@ -208,7 +208,7 @@ class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
event.edit(destination_value=payment)
event.PayzenEvent_processUpdate('a', False)
self.assertEquals(event.getValidationState(), "confirmed")
self.assertEqual(event.getValidationState(), "confirmed")
self.assertEqual(
'Signature does not match',
event.workflow_history['system_event_workflow'][-1]['comment'])
......@@ -232,7 +232,7 @@ class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
}
event.PayzenEvent_processUpdate(data_kw, True)
self.assertEquals(event.getValidationState(), "confirmed")
self.assertEqual(event.getValidationState(), "confirmed")
self.assertEqual(
"Unknown errorCode 'foo'",
event.workflow_history['system_event_workflow'][-1]['comment'])
......@@ -248,7 +248,7 @@ class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
}
event.PayzenEvent_processUpdate(data_kw, True)
self.assertEquals(event.getValidationState(), "confirmed")
self.assertEqual(event.getValidationState(), "confirmed")
self.assertEqual(
"Unknown transactionStatus 'foo'",
event.workflow_history['system_event_workflow'][-1]['comment'])
......@@ -264,7 +264,7 @@ class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
}
event.PayzenEvent_processUpdate(data_kw, True)
self.assertEquals(event.getValidationState(), "confirmed")
self.assertEqual(event.getValidationState(), "confirmed")
self.assertEqual(
"Transaction status '2' ('To be forced - Contact issuer') " \
"is not supported",
......@@ -283,12 +283,12 @@ class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
event.PayzenEvent_processUpdate(data_kw, True)
self.assertEquals(event.getValidationState(), "acknowledged")
self.assertEqual(event.getValidationState(), "acknowledged")
self.assertEqual(
'Automatic acknowledge as result of correct communication',
event.workflow_history['system_event_workflow'][-1]['comment'])
self.assertEquals(payment.getSimulationState(), "confirmed")
self.assertEqual(payment.getSimulationState(), "confirmed")
self.assertEqual(
'Transaction status 0 (Initial (being treated)) did not changed ' \
'the document state',
......@@ -356,10 +356,10 @@ class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
'authDevise': 1,
}
self.assertEquals(payment.PaymentTransaction_getTotalPayablePrice(), 0)
self.assertEqual(payment.PaymentTransaction_getTotalPayablePrice(), 0)
event.PayzenEvent_processUpdate(data_kw, True)
self.assertEquals(event.getValidationState(), "confirmed")
self.assertEqual(event.getValidationState(), "confirmed")
self.assertEqual(
'Received amount (1) does not match stored on transaction (0)',
event.workflow_history['system_event_workflow'][-1]['comment'])
......@@ -379,10 +379,10 @@ class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
'authDevise': "dollars",
}
self.assertEquals(payment.PaymentTransaction_getTotalPayablePrice(), 0)
self.assertEqual(payment.PaymentTransaction_getTotalPayablePrice(), 0)
event.PayzenEvent_processUpdate(data_kw, True)
self.assertEquals(event.getValidationState(), "confirmed")
self.assertEqual(event.getValidationState(), "confirmed")
self.assertEqual(
"Received devise ('dollars') does not match stored on transaction ('978')",
event.workflow_history['system_event_workflow'][-1]['comment'])
......@@ -405,7 +405,7 @@ class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
event.PayzenEvent_processUpdate(data_kw, True)
self.assertEquals(event.getValidationState(), "confirmed")
self.assertEqual(event.getValidationState(), "confirmed")
self.assertEqual(
'Expected to put transaction in stopped state, but achieved only ' \
'cancelled state',
......@@ -428,8 +428,8 @@ class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
event.PayzenEvent_processUpdate(data_kw, True)
self.assertEquals(payment.getSimulationState(), "stopped")
self.assertEquals(event.getValidationState(), "acknowledged")
self.assertEqual(payment.getSimulationState(), "stopped")
self.assertEqual(event.getValidationState(), "acknowledged")
self.assertEqual(
'Automatic acknowledge as result of correct communication',
event.workflow_history['system_event_workflow'][-1]['comment'])
......@@ -475,7 +475,7 @@ return addToDate(DateTime(), to_add={'day': -1, 'second': -1}).toZone('UTC'), 'f
finally:
self._dropPaymentTransaction_getPayzenId()
self.assertEquals(event.getValidationState(), "acknowledged")
self.assertEqual(event.getValidationState(), "acknowledged")
self.assertEqual(
'Transaction not found on payzen side.',
event.workflow_history['system_event_workflow'][-1]['comment'])
......@@ -499,11 +499,11 @@ return addToDate(DateTime(), to_add={'day': -1, 'second': -1}).toZone('UTC'), 'f
finally:
self._dropPaymentTransaction_getPayzenId()
self.assertEquals(event.getValidationState(), "acknowledged")
self.assertEqual(event.getValidationState(), "acknowledged")
self.assertEqual(
'Transaction not found on payzen side.',
event.workflow_history['system_event_workflow'][-1]['comment'])
self.assertEquals(payment.getSimulationState(), "cancelled")
self.assertEqual(payment.getSimulationState(), "cancelled")
self.assertEqual(
'Aborting unknown payzen payment.',
payment.workflow_history['accounting_workflow'][-1]['comment'])
......@@ -520,11 +520,11 @@ return addToDate(DateTime(), to_add={'day': -1, 'second': -1}).toZone('UTC'), 'f
event.PayzenEvent_processUpdate(data_kw, True)
self.assertEquals(event.getValidationState(), "acknowledged")
self.assertEqual(event.getValidationState(), "acknowledged")
self.assertEqual(
'Refused payzen payment.',
event.workflow_history['system_event_workflow'][-1]['comment'])
self.assertEquals(payment.getSimulationState(), "cancelled")
self.assertEqual(payment.getSimulationState(), "cancelled")
self.assertEqual(
'Aborting refused payzen payment.',
payment.workflow_history['accounting_workflow'][-1]['comment'])
......@@ -539,58 +539,58 @@ class TestSlapOSPayzenBase_getPayzenServiceRelativeUrl(SlapOSTestCaseMixinWithAb
def test_getPayzenServiceRelativeUrl_default_result(self):
result = self.portal.Base_getPayzenServiceRelativeUrl()
self.assertEquals(result, 'portal_secure_payments/slapos_payzen_test')
self.assertEqual(result, 'portal_secure_payments/slapos_payzen_test')
class TestSlapOSPayzenAccountingTransaction_getPaymentState(
SlapOSTestCaseMixinWithAbort):
def test_AccountingTransaction_getPaymentState_draft_payment(self):
invoice = self.createSaleInvoiceTransaction()
self.assertEquals("Cancelled", invoice.AccountingTransaction_getPaymentState())
self.assertEqual("Cancelled", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_deleted_payment(self):
invoice = self.createSaleInvoiceTransaction()
invoice.delete()
self.assertEquals("Cancelled", invoice.AccountingTransaction_getPaymentState())
self.assertEqual("Cancelled", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_cancelled_payment(self):
invoice = self.createSaleInvoiceTransaction()
invoice.cancel()
self.assertEquals("Cancelled", invoice.AccountingTransaction_getPaymentState())
self.assertEqual("Cancelled", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_planned_payment(self):
invoice = self.createSaleInvoiceTransaction()
invoice.plan()
self.assertEquals("Ongoing", invoice.AccountingTransaction_getPaymentState())
self.assertEqual("Ongoing", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_confirmed_payment(self):
invoice = self.createSaleInvoiceTransaction()
invoice.setStartDate(DateTime())
invoice.confirm()
self.assertEquals("Ongoing", invoice.AccountingTransaction_getPaymentState())
self.assertEqual("Ongoing", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_started_payment(self):
invoice = self.createSaleInvoiceTransaction()
invoice.start()
self.assertEquals("Ongoing", invoice.AccountingTransaction_getPaymentState())
self.assertEqual("Ongoing", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_reversed_payment(self):
invoice = self.createPayzenSaleInvoiceTransaction()
self.tic()
reversal = invoice.SaleInvoiceTransaction_createReversalPayzenTransaction()
self.tic()
self.assertEquals("Cancelled", invoice.AccountingTransaction_getPaymentState())
self.assertEquals(0, invoice.getTotalPrice() + reversal.getTotalPrice())
self.assertEqual("Cancelled", invoice.AccountingTransaction_getPaymentState())
self.assertEqual(0, invoice.getTotalPrice() + reversal.getTotalPrice())
def test_AccountingTransaction_getPaymentState_free_payment(self):
invoice = self.createPayzenSaleInvoiceTransaction(price=0)
self.tic()
self.assertEquals("Free!", invoice.AccountingTransaction_getPaymentState())
self.assertEqual("Free!", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_unpaid_payment(self):
invoice = self.createPayzenSaleInvoiceTransaction()
# If payment is not indexed or not started the state should be unpaid
self.assertEquals("Unpaid", invoice.AccountingTransaction_getPaymentState())
self.assertEqual("Unpaid", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_paynow_payment(self):
person = self.makePerson()
......@@ -598,7 +598,7 @@ class TestSlapOSPayzenAccountingTransaction_getPaymentState(
destination_section=person.getRelativeUrl())
self.tic()
self.login(person.getUserId())
self.assertEquals("Pay now", invoice.AccountingTransaction_getPaymentState())
self.assertEqual("Pay now", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_waiting_payment(self):
person = self.makePerson()
......@@ -608,7 +608,7 @@ class TestSlapOSPayzenAccountingTransaction_getPaymentState(
payment = invoice.SaleInvoiceTransaction_getPayzenPaymentRelatedValue()
payment.PaymentTransaction_generatePayzenId()
self.login(person.getUserId())
self.assertEquals("Waiting for payment confirmation",
self.assertEqual("Waiting for payment confirmation",
invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_paid_payment(self):
......@@ -618,7 +618,7 @@ class TestSlapOSPayzenAccountingTransaction_getPaymentState(
node_value = line.getSourceValue(portal_type='Account')
if node_value.getAccountType() == 'asset/receivable':
line.setGroupingReference("TEST%s" % self.new_id)
self.assertEquals("Paid", invoice.AccountingTransaction_getPaymentState())
self.assertEqual("Paid", invoice.AccountingTransaction_getPaymentState())
class TestSlapOSPayzenPaymentTransaction_redirectToManualPayzenPayment(
SlapOSTestCaseMixinWithAbort):
......@@ -712,7 +712,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
finally:
self._dropPaymentTransaction_getVADSUrlDict()
self.assertEquals("%s/already_registered" % payment.getRelativeUrl(),
self.assertEqual("%s/already_registered" % payment.getRelativeUrl(),
redirect)
class TestSlapOSPayzenSaleInvoiceTransaction_getPayzenPaymentRelatedValue(
......@@ -723,16 +723,16 @@ class TestSlapOSPayzenSaleInvoiceTransaction_getPayzenPaymentRelatedValue(
self.tic()
payment = invoice.SaleInvoiceTransaction_getPayzenPaymentRelatedValue()
self.assertNotEquals(None, payment)
self.assertEquals(payment.getSimulationState(), "started")
self.assertEquals(payment.getCausalityValue(), invoice)
self.assertEquals(payment.getPaymentModeUid(),
self.assertEqual(payment.getSimulationState(), "started")
self.assertEqual(payment.getCausalityValue(), invoice)
self.assertEqual(payment.getPaymentModeUid(),
self.portal.portal_categories.payment_mode.payzen.getUid())
payment.setStartDate(DateTime())
payment.stop()
payment.immediateReindexObject()
payment = invoice.SaleInvoiceTransaction_getPayzenPaymentRelatedValue()
self.assertEquals(None, payment)
self.assertEqual(None, payment)
class TestSlapOSPayzenSaleInvoiceTransaction_createReversalPayzenTransaction(
SlapOSTestCaseMixinWithAbort):
......
......@@ -172,7 +172,7 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
self.assertNotEquals(transaction_id, None)
# Event state
self.assertEquals(event.getValidationState(), "acknowledged")
self.assertEqual(event.getValidationState(), "acknowledged")
data_dict = {
'vads_language': 'en',
......@@ -228,7 +228,7 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
# Event message state
event_message_list = event.contentValues(portal_type="Payzen Event Message")
self.assertEquals(len(event_message_list), 1)
self.assertEqual(len(event_message_list), 1)
message = event_message_list[0]
self.assertEqual(message.getTitle(), 'Shown Page')
self.assertEqual(message.getTextContent(), expected_html_page,
......@@ -259,8 +259,8 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
def mockSoapGetInfo(self, method_to_call, expected_args, result_tuple):
payment_service = self.portal.portal_secure_payments.slapos_payzen_test
def mocksoad_getInfo(arg1, arg2):
self.assertEquals(arg1, expected_args[0])
self.assertEquals(arg2, expected_args[1])
self.assertEqual(arg1, expected_args[0])
self.assertEqual(arg2, expected_args[1])
return result_tuple
setattr(payment_service, 'soap_getInfo', mocksoad_getInfo)
try:
......@@ -312,17 +312,17 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
self._dropPayzenEvent_processUpdate()
event_message_list = event.contentValues(portal_type="Payzen Event Message")
self.assertEquals(len(event_message_list), 2)
self.assertEqual(len(event_message_list), 2)
sent_message = [x for x in event_message_list \
if x.getTitle() == 'Sent SOAP'][0]
self.assertEquals(sent_message.getTextContent(), mocked_sent_text)
self.assertEqual(sent_message.getTextContent(), mocked_sent_text)
received_message = [x for x in event_message_list \
if x.getTitle() == 'Received SOAP'][0]
self.assertEquals(received_message.getPredecessor(),
self.assertEqual(received_message.getPredecessor(),
sent_message.getRelativeUrl())
self.assertEquals(received_message.getTextContent(), mocked_received_text)
self.assertEqual(received_message.getTextContent(), mocked_received_text)
self.assertEqual(
'Visited by PayzenEvent_processUpdate',
......
......@@ -256,7 +256,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
release_list = software_product.SoftwareProduct_getSortedSoftwareReleaseList(
software_product.getReference())
self.assertEquals([release.getUrlString() for release in release_list],
self.assertEqual([release.getUrlString() for release in release_list],
['http://example.org/2-%s.cfg' % self.new_id, 'http://example.org/1-%s.cfg' % self.new_id])
def test_getSortedSoftwareReleaseListFromSoftwareProduct_Changed(self):
......@@ -283,11 +283,11 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
release_list = software_product.SoftwareProduct_getSortedSoftwareReleaseList(
software_product.getReference())
self.assertEquals([release.getUrlString() for release in release_list],
self.assertEqual([release.getUrlString() for release in release_list],
['http://example.org/1-%s.cfg' % self.new_id, 'http://example.org/2-%s.cfg' % self.new_id])
release_list = software_product.SoftwareProduct_getSortedSoftwareReleaseList(
software_release_url='http://example.org/1-%s.cfg' % self.new_id)
self.assertEquals([release.getUrlString() for release in release_list],
self.assertEqual([release.getUrlString() for release in release_list],
['http://example.org/1-%s.cfg' % self.new_id, 'http://example.org/2-%s.cfg' % self.new_id])
......@@ -385,7 +385,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
upgrade_decision_line.setAggregateValue(computer)
found_computer = upgrade_decision.UpgradeDecision_getComputer()
self.assertEquals(computer.getRelativeUrl(),
self.assertEqual(computer.getRelativeUrl(),
found_computer.getRelativeUrl())
def testUpgradeDecision_getComputer_2_lines(self):
......@@ -398,7 +398,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
upgrade_decision_line = self._makeUpgradeDecisionLine(upgrade_decision)
found_computer = upgrade_decision.UpgradeDecision_getComputer()
self.assertEquals(computer.getRelativeUrl(),
self.assertEqual(computer.getRelativeUrl(),
found_computer.getRelativeUrl())
def testUpgradeDecision_getComputer_2_computer(self):
......@@ -418,7 +418,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
self._makeUpgradeDecisionLine(upgrade_decision)
found_computer = upgrade_decision.UpgradeDecision_getComputer()
self.assertEquals(None, found_computer)
self.assertEqual(None, found_computer)
def testUpgradeDecision_getHostingSubscription(self):
......@@ -429,7 +429,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
upgrade_decision_line.setAggregateValue(hosting_subscription)
found_hosting_subscription = upgrade_decision.UpgradeDecision_getHostingSubscription()
self.assertEquals(hosting_subscription.getRelativeUrl(),
self.assertEqual(hosting_subscription.getRelativeUrl(),
found_hosting_subscription.getRelativeUrl())
......@@ -443,7 +443,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
upgrade_decision_line = self._makeUpgradeDecisionLine(upgrade_decision)
found_hosting_subscription = upgrade_decision.UpgradeDecision_getHostingSubscription()
self.assertEquals(hosting_subscription.getRelativeUrl(),
self.assertEqual(hosting_subscription.getRelativeUrl(),
found_hosting_subscription.getRelativeUrl())
......@@ -464,7 +464,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
self._makeUpgradeDecisionLine(upgrade_decision)
found_hosting_subscription = upgrade_decision.UpgradeDecision_getHostingSubscription()
self.assertEquals(None, found_hosting_subscription)
self.assertEqual(None, found_hosting_subscription)
def testUpgradeDecision_getSoftwareRelease(self):
......@@ -475,7 +475,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
upgrade_decision_line.setAggregateValue(software_release)
found_software_release = upgrade_decision.UpgradeDecision_getSoftwareRelease()
self.assertEquals(software_release.getRelativeUrl(),
self.assertEqual(software_release.getRelativeUrl(),
found_software_release.getRelativeUrl())
def testUpgradeDecision_getSoftwareRelease_2_lines(self):
......@@ -488,7 +488,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
upgrade_decision_line = self._makeUpgradeDecisionLine(upgrade_decision)
found_software_release = upgrade_decision.UpgradeDecision_getSoftwareRelease()
self.assertEquals(software_release.getRelativeUrl(),
self.assertEqual(software_release.getRelativeUrl(),
found_software_release.getRelativeUrl())
def testUpgradeDecision_getSoftwareRelease_2_sr(self):
......@@ -508,7 +508,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
self._makeUpgradeDecisionLine(upgrade_decision)
found_software_release = upgrade_decision.UpgradeDecision_getSoftwareRelease()
self.assertEquals(None, found_software_release)
self.assertEqual(None, found_software_release)
def testUpgradeDecision_upgradeHostingSubscription(self):
......@@ -1321,7 +1321,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
"?portal_status_message=This%20Upgrade%20Decision%20has%20been%20"\
"requested%2C%20it%20will%20be%20processed%20in%20few%20minutes."),
"%s contains the wrong message" % redirect_url)
self.assertEquals(upgrade_decision.getSimulationState(), 'started')
self.assertEqual(upgrade_decision.getSimulationState(), 'started')
def testBase_acceptUpgradeDecision_started_decision(self):
upgrade_decision = self._makeUpgradeDecision()
......@@ -1403,7 +1403,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
"?portal_status_message=Thanks%20Upgrade%20Decision%20has%20been"\
"%20rejected%20Successfully%20%28You%20cannot%20use%20it%20anymore%29."),
"%s contains the wrong message" % redirect_url)
self.assertEquals(upgrade_decision.getSimulationState(), 'rejected')
self.assertEqual(upgrade_decision.getSimulationState(), 'rejected')
def testBase_rejectUpgradeDecision_planned_upgrade_decision(self):
upgrade_decision = self._makeUpgradeDecision()
......@@ -1415,7 +1415,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
"?portal_status_message=Thanks%20Upgrade%20Decision%20has%20been"\
"%20rejected%20Successfully%20%28You%20cannot%20use%20it%20anymore%29."),
"%s contains the wrong message" % redirect_url)
self.assertEquals(upgrade_decision.getSimulationState(), 'rejected')
self.assertEqual(upgrade_decision.getSimulationState(), 'rejected')
def testBase_rejectUpgradeDecision_confirmed_upgrade_decision(self):
upgrade_decision = self._makeUpgradeDecision()
......@@ -1427,7 +1427,7 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
"?portal_status_message=Thanks%20Upgrade%20Decision%20has%20been"\
"%20rejected%20Successfully%20%28You%20cannot%20use%20it%20anymore%29."),
"%s contains the wrong message" % redirect_url)
self.assertEquals(upgrade_decision.getSimulationState(), 'rejected')
self.assertEqual(upgrade_decision.getSimulationState(), 'rejected')
def testBase_rejectUpgradeDecision_started_decision(self):
upgrade_decision = self._makeUpgradeDecision()
......@@ -1504,18 +1504,18 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
upgrade_decision.setReference("UD-TESTDECISION")
upgrade_decision.confirm()
requested_state = "started"
self.assertEquals(upgrade_decision.getSimulationState(), 'confirmed')
self.assertEqual(upgrade_decision.getSimulationState(), 'confirmed')
upgrade_decision.UpgradeDecision_requestChangeState(requested_state)
self.assertEquals(upgrade_decision.getSimulationState(), 'started')
self.assertEqual(upgrade_decision.getSimulationState(), 'started')
def testUpgradeDecision_requestChangeState_reject(self):
upgrade_decision = self._makeUpgradeDecision()
upgrade_decision.setReference("UD-TESTDECISION")
upgrade_decision.confirm()
requested_state = "rejected"
self.assertEquals(upgrade_decision.getSimulationState(), 'confirmed')
self.assertEqual(upgrade_decision.getSimulationState(), 'confirmed')
upgrade_decision.UpgradeDecision_requestChangeState(requested_state)
self.assertEquals(upgrade_decision.getSimulationState(), 'rejected')
self.assertEqual(upgrade_decision.getSimulationState(), 'rejected')
def testUpgradeDecision_requestChangeState_stopped(self):
upgrade_decision = self._makeUpgradeDecision()
......@@ -1523,10 +1523,10 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
upgrade_decision.confirm()
upgrade_decision.stop()
requested_state = "started"
self.assertEquals(upgrade_decision.getSimulationState(), 'stopped')
self.assertEqual(upgrade_decision.getSimulationState(), 'stopped')
result = upgrade_decision.UpgradeDecision_requestChangeState(requested_state)
self.assertEquals(upgrade_decision.getSimulationState(), 'stopped')
self.assertEquals(result, "Transition from state %s to %s is not permitted" % (
self.assertEqual(upgrade_decision.getSimulationState(), 'stopped')
self.assertEqual(result, "Transition from state %s to %s is not permitted" % (
upgrade_decision.getSimulationState(), requested_state))
def testUpgradeDecision_requestChangeState_rejected(self):
......@@ -1535,10 +1535,10 @@ class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
upgrade_decision.confirm()
upgrade_decision.start()
requested_state = "rejected"
self.assertEquals(upgrade_decision.getSimulationState(), 'started')
self.assertEqual(upgrade_decision.getSimulationState(), 'started')
result = upgrade_decision.UpgradeDecision_requestChangeState(requested_state)
self.assertEquals(upgrade_decision.getSimulationState(), 'started')
self.assertEquals(result, "Transition from state %s to %s is not permitted" % (
self.assertEqual(upgrade_decision.getSimulationState(), 'started')
self.assertEqual(result, "Transition from state %s to %s is not permitted" % (
upgrade_decision.getSimulationState(), requested_state))
def testUpgradeDecision_isUpgradeFinished_hosting_subscription(self):
......@@ -1591,21 +1591,21 @@ ${new_software_release_url}""",
self.tic()
self.assertEquals(None, upgrade_decision.UpgradeDecision_notify())
self.assertEqual(None, upgrade_decision.UpgradeDecision_notify())
upgrade_decision.plan()
self.tic()
self.assertEquals(None, upgrade_decision.UpgradeDecision_notify())
self.assertEqual(None, upgrade_decision.UpgradeDecision_notify())
self.tic()
self.assertEquals(upgrade_decision.getSimulationState(), 'confirmed')
self.assertEquals(len(upgrade_decision.getFollowUpRelatedValueList()), 1)
self.assertEqual(upgrade_decision.getSimulationState(), 'confirmed')
self.assertEqual(len(upgrade_decision.getFollowUpRelatedValueList()), 1)
event = upgrade_decision.getFollowUpRelatedValue()
self.assertEquals(event.getTitle(),
self.assertEqual(event.getTitle(),
"New Software available for Installation at %s" % computer.getTitle())
self.assertEqual(event.getTextContent().splitlines(),
......@@ -1614,7 +1614,7 @@ ${new_software_release_url}""",
software_release.getUrlString()])
self.assertEquals(event.getSimulationState(), "delivered")
self.assertEqual(event.getSimulationState(), "delivered")
@simulate('NotificationTool_getDocumentValue',
'reference=None',
......@@ -1654,21 +1654,21 @@ ${new_software_release_url}""",
self.tic()
self.assertEquals(None, upgrade_decision.UpgradeDecision_notify())
self.assertEqual(None, upgrade_decision.UpgradeDecision_notify())
upgrade_decision.plan()
self.tic()
self.assertEquals(None, upgrade_decision.UpgradeDecision_notify())
self.assertEqual(None, upgrade_decision.UpgradeDecision_notify())
self.tic()
self.assertEquals(upgrade_decision.getSimulationState(), 'confirmed')
self.assertEquals(len(upgrade_decision.getFollowUpRelatedValueList()), 1)
self.assertEqual(upgrade_decision.getSimulationState(), 'confirmed')
self.assertEqual(len(upgrade_decision.getFollowUpRelatedValueList()), 1)
event = upgrade_decision.getFollowUpRelatedValue()
self.assertEquals(event.getTitle(),
self.assertEqual(event.getTitle(),
"New Upgrade available for %s" % hosting_subscription.getTitle())
self.assertEqual(event.getTextContent().splitlines(),
......@@ -1676,7 +1676,7 @@ ${new_software_release_url}""",
old_url, software_release.getTitle(), software_release.getReference(),
software_release.getUrlString()])
self.assertEquals(event.getSimulationState(), "delivered")
self.assertEqual(event.getSimulationState(), "delivered")
@simulate('NotificationTool_getDocumentValue',
......@@ -1716,22 +1716,22 @@ ${new_software_release_url}""",
self.tic()
self.assertEquals(None, upgrade_decision.UpgradeDecision_notifyDelivered())
self.assertEqual(None, upgrade_decision.UpgradeDecision_notifyDelivered())
upgrade_decision.start()
upgrade_decision.stop()
self.tic()
self.assertEquals(None, upgrade_decision.UpgradeDecision_notifyDelivered())
self.assertEqual(None, upgrade_decision.UpgradeDecision_notifyDelivered())
self.tic()
self.assertEquals(upgrade_decision.getSimulationState(), 'delivered')
self.assertEquals(len(upgrade_decision.getFollowUpRelatedValueList()), 1)
self.assertEqual(upgrade_decision.getSimulationState(), 'delivered')
self.assertEqual(len(upgrade_decision.getFollowUpRelatedValueList()), 1)
event = upgrade_decision.getFollowUpRelatedValue()
self.assertEquals(event.getTitle(),
self.assertEqual(event.getTitle(),
"Upgrade processed at %s for %s" % (computer.getTitle(),
software_release.getReference()))
......@@ -1740,7 +1740,7 @@ ${new_software_release_url}""",
software_release.getTitle(), software_release.getReference(),
software_release.getUrlString()])
self.assertEquals(event.getSimulationState(), "delivered")
self.assertEqual(event.getSimulationState(), "delivered")
@simulate('NotificationTool_getDocumentValue',
'reference=None',
......@@ -1782,22 +1782,22 @@ ${new_software_release_url}""",
self.tic()
self.assertEquals(None, upgrade_decision.UpgradeDecision_notifyDelivered())
self.assertEqual(None, upgrade_decision.UpgradeDecision_notifyDelivered())
upgrade_decision.start()
upgrade_decision.stop()
self.tic()
self.assertEquals(None, upgrade_decision.UpgradeDecision_notifyDelivered())
self.assertEqual(None, upgrade_decision.UpgradeDecision_notifyDelivered())
self.tic()
self.assertEquals(upgrade_decision.getSimulationState(), 'delivered')
self.assertEquals(len(upgrade_decision.getFollowUpRelatedValueList()), 1)
self.assertEqual(upgrade_decision.getSimulationState(), 'delivered')
self.assertEqual(len(upgrade_decision.getFollowUpRelatedValueList()), 1)
event = upgrade_decision.getFollowUpRelatedValue()
self.assertEquals(event.getTitle(),
self.assertEqual(event.getTitle(),
"Upgrade Processed for %s (%s)" % (hosting_subscription.getTitle(),
software_release.getReference()))
......@@ -1806,6 +1806,6 @@ ${new_software_release_url}""",
old_url, software_release.getTitle(), software_release.getReference(),
software_release.getUrlString()])
self.assertEquals(event.getSimulationState(), "delivered")
self.assertEqual(event.getSimulationState(), "delivered")
......@@ -672,10 +672,10 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
self._makeComplexComputer()
self.login(self.computer_user_id)
destroy_requested = self.destroy_requested_software_installation
self.assertEquals(destroy_requested.getValidationState(), "validated")
self.assertEqual(destroy_requested.getValidationState(), "validated")
self.portal_slap.destroyedSoftwareRelease(
destroy_requested.getUrlString(), self.computer_id)
self.assertEquals(destroy_requested.getValidationState(), "invalidated")
self.assertEqual(destroy_requested.getValidationState(), "invalidated")
def test_availableSoftwareRelease(self):
self._makeComplexComputer()
......
......@@ -1429,7 +1429,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
portal_type=self.computer_portal_type,
reference=computer_reference,
)
self.assertEquals(0, len(result_list))
self.assertEqual(0, len(result_list))
def stepCheckUnauthorizedSlapGetComputerPartitionListCall(self, sequence,
**kw):
......@@ -2040,7 +2040,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid)
computer_partition_list = computer.getComputerPartitionList()
self.assertEquals(computer_partition_amount,
self.assertEqual(computer_partition_amount,
len(computer_partition_list))
def stepCheckSuccessComputerPartitionGetIdCall(self, sequence, **kw):
......@@ -2053,7 +2053,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id)
self.assertEquals(partition_id, computer_partition.getId())
self.assertEqual(partition_id, computer_partition.getId())
def stepCheckSuccessSoftwareReleaseGetURICall(self, sequence, **kw):
"""
......@@ -2063,7 +2063,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url, timeout=None)
software_release = self.slap.registerSoftwareRelease(url)
self.assertEquals(url, software_release.getURI())
self.assertEqual(url, software_release.getURI())
def stepCheckUnauthorizedComputerGetSoftwareReleaseListCall(self, sequence,
**kw):
......@@ -2085,7 +2085,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid)
self.assertEquals([], [q for q in computer.getSoftwareReleaseList() \
self.assertEqual([], [q for q in computer.getSoftwareReleaseList() \
if q.getState() != 'destroyed'])
def stepCheckDestroyedStateGetSoftwareReleaseListCall(self, sequence, **kw):
......@@ -2097,7 +2097,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid)
self.assertEquals(1, len(computer.getSoftwareReleaseList()))
self.assertEqual(1, len(computer.getSoftwareReleaseList()))
software_release = computer.getSoftwareReleaseList()[0]
self.assertEqual('destroyed', software_release.getState())
......@@ -2110,7 +2110,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid)
self.assertEquals(1, len(computer.getSoftwareReleaseList()))
self.assertEqual(1, len(computer.getSoftwareReleaseList()))
self.assertTrue(isinstance(computer.getSoftwareReleaseList()[0],
slap.SoftwareRelease))
......@@ -2313,7 +2313,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
url = sequence["software_release_uri"]
software_release = computer_partition.getSoftwareRelease()
self.assertTrue(isinstance(software_release, slap.SoftwareRelease))
self.assertEquals(url, software_release.getURI())
self.assertEqual(url, software_release.getURI())
def stepCheckSuccessComputerPartitionGetInstanceParameterDictCall(self,
sequence, **kw):
......@@ -2450,7 +2450,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id)
self.assertEquals('stopped', computer_partition.getState())
self.assertEqual('stopped', computer_partition.getState())
def stepCheckStartedComputerPartitionGetStateCall(self, sequence, **kw):
"""
......@@ -2463,7 +2463,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id)
self.assertEquals('started', computer_partition.getState())
self.assertEqual('started', computer_partition.getState())
def stepCheckDestroyedComputerPartitionGetStateCall(self, sequence, **kw):
"""
......@@ -2477,7 +2477,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id)
self.assertEquals('destroyed', computer_partition.getState())
self.assertEqual('destroyed', computer_partition.getState())
def stepCheckComputerPartitionIsFree(self, sequence, **kw):
computer_partition_uid = sequence["computer_partition_uid"]
......@@ -2707,22 +2707,22 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.slave_instance_portal_type,
self.software_instance_portal_type,
self.software_instance_portal_type]
self.assertEquals(expected_portal_type_list, sorted(portal_type_list))
self.assertEqual(expected_portal_type_list, sorted(portal_type_list))
computer_partition_list = [obj.getAggregateValue(
portal_type=self.computer_partition_portal_type) \
for obj in sale_packing_list_line_list]
uid_list = [computer_partition.getUid() \
for computer_partition in computer_partition_list]
self.assertEquals(1, len(set(uid_list)))
self.assertEqual(1, len(set(uid_list)))
def stepCheckSlaveInstanceReady(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
self.assertEquals(self.slave_instance_portal_type,
self.assertEqual(self.slave_instance_portal_type,
slave_instance.getPortalType())
sale_order_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_order_line_portal_type)
self.assertEquals("confirmed", sale_order_line.getSimulationState())
self.assertEqual("confirmed", sale_order_line.getSimulationState())
sale_packing_list_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_packing_list_line_portal_type)
self.assertNotEquals(sale_packing_list_line.getAggregate(
......@@ -2743,12 +2743,12 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
software_release_uri = sale_packing_list_line.getResultValue(
portal_type="Software Release")
software_release_uri_list.append(software_release_uri.getUrlString())
self.assertEquals(1, len(set(software_release_uri_list)))
self.assertEqual(1, len(set(software_release_uri_list)))
def stepCheckSlaveInstanceAllocationWithTwoDifferentSoftwareInstance(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
self.assertEquals(self.slave_instance_portal_type,
self.assertEqual(self.slave_instance_portal_type,
slave_instance.getPortalType())
sale_packing_list_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_packing_list_line_portal_type)
......@@ -2759,9 +2759,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_partition_list = [obj.getAggregate(
portal_type=self.computer_partition_portal_type)\
for obj in sale_packing_list_line_list]
self.assertEquals(computer_partition_list[0],
self.assertEqual(computer_partition_list[0],
computer_partition_list[1])
self.assertEquals(4, len(computer_partition_list))
self.assertEqual(4, len(computer_partition_list))
def stepCheckSlaveInstanceNotReady(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
......@@ -2786,7 +2786,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
partition_id)
parameter_dict = computer_partition.getInstanceParameterDict()
slave_instance_list = parameter_dict["slave_instance_list"]
self.assertEquals([], slave_instance_list)
self.assertEqual([], slave_instance_list)
def stepCheckSlaveInstanceListFromOneComputerPartition(self, sequence,
expected_amount=1):
......@@ -2797,14 +2797,14 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_partition = self.slap.registerComputerPartition(computer_guid,
partition_id)
parameter_dict = computer_partition.getInstanceParameterDict()
self.assertEquals(
self.assertEqual(
sequence.get('requested_software_type',
'requested_software_type'),
parameter_dict["slap_software_type"])
slave_instance_list = parameter_dict["slave_instance_list"]
self.assertEquals(expected_amount, len(slave_instance_list))
self.assertEqual(expected_amount, len(slave_instance_list))
for slave_instance in slave_instance_list:
self.assertEquals(
self.assertEqual(
sequence.get('requested_software_type',
'requested_software_type'),
slave_instance["slap_software_type"])
......
......@@ -175,7 +175,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
'query' : sequence['start'],
'range' : 'min'})
self.assertEquals(len(sale_packing_list_list), 1)
self.assertEqual(len(sale_packing_list_list), 1)
sale_packing_list = sale_packing_list_list[0]
sequence['sale_packing_list'] = sale_packing_list
......@@ -194,7 +194,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
xml = etree.tostring(etree.XML(xml, parser))
sequence.edit(check_quantity='first')
self.assertEquals(xml, initial_xml)
self.assertEqual(xml, initial_xml)
def stepCheckSaleInvoiceExists(self, sequence, **kw):
"""
......@@ -213,11 +213,11 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
'query' : sequence['start'],
'range' : 'min'})
self.assertEquals(len(sale_invoice_list), self.sale_invoice_list_quantity)
self.assertEqual(len(sale_invoice_list), self.sale_invoice_list_quantity)
for sale_invoice in sale_invoice_list:
self.assertEquals(sale_invoice.getTitle(), 'Resource consumptions')
self.assertEquals(sale_invoice.getSimulationState(), 'planned')
self.assertEqual(sale_invoice.getTitle(), 'Resource consumptions')
self.assertEqual(sale_invoice.getSimulationState(), 'planned')
sequence.edit(sale_invoice_list=sale_invoice_list)
......@@ -227,18 +227,18 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
"""
# We retrieve the sale invoice
sale_invoice = sequence['sale_invoice_list']
self.assertEquals(len(sale_invoice), self.sale_invoice_list_quantity)
self.assertEqual(len(sale_invoice), self.sale_invoice_list_quantity)
sale_invoice_line_list = sale_invoice[0].getObject().contentValues(
portal_type='Invoice Line')
self.assertEquals(
self.assertEqual(
len(sale_invoice_line_list),
self.sale_invoice_line_list_quantity)
# Then, we check quantities in sale invoice's lines
for sale_invoice_line in sale_invoice_line_list:
self.assertEquals(
self.assertEqual(
sale_invoice_line.getQuantity(),
self.sale_invoice_line_quantity)
......@@ -279,7 +279,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
# We retrieve sale invoice list
sale_invoice_list = sequence['sale_invoice_list']
self.assertEquals(len(sale_invoice_list), self.sale_invoice_list_quantity)
self.assertEqual(len(sale_invoice_list), self.sale_invoice_list_quantity)
# We retrieve computer
computer_id = sequence['computer_reference']
......@@ -291,7 +291,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
sale_invoice.contentValues(portal_type='Invoice Line')
# We check the number of line in sale invoices
self.assertEquals(
self.assertEqual(
len(sale_invoice_line_list),
self.sale_invoice_line_list_quantity)
......@@ -305,9 +305,9 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
id = partition_id)[0].getObject().getTitle()
if partition_title == 'slappart0':
self.assertEquals(sale_invoice_line.getQuantity(), quantity1)
self.assertEqual(sale_invoice_line.getQuantity(), quantity1)
else:
self.assertEquals(sale_invoice_line.getQuantity(), quantity2)
self.assertEqual(sale_invoice_line.getQuantity(), quantity2)
class TestVifibUsageReport(TestVifibUsageReportMixin):
......
......@@ -92,7 +92,7 @@ class TestCollectDatabase(unittest.TestCase):
database = db.Database(self.instance_root)
database.connect()
try:
self.assertEquals(
self.assertEqual(
[u'user', u'folder', u'computer', u'system', u'disk', u'temperature', u'heating'],
database.getTableList())
finally:
......@@ -109,12 +109,12 @@ class TestCollectDatabase(unittest.TestCase):
original_execute = database._execute
try:
database._execute = _fake_execute
self.assertEquals("SELECT * FROM user ", database.select('user'))
self.assertEquals("SELECT DATE FROM user WHERE date = '0.1' AND time=\"00:02\" ",
self.assertEqual("SELECT * FROM user ", database.select('user'))
self.assertEqual("SELECT DATE FROM user WHERE date = '0.1' AND time=\"00:02\" ",
database.select('user', 0.1, 'DATE', 'time="00:02"'))
self.assertEquals("SELECT DATE FROM user WHERE date = '0.1' GROUP BY time ORDER BY date",
self.assertEqual("SELECT DATE FROM user WHERE date = '0.1' GROUP BY time ORDER BY date",
database.select('user', 0.1, 'DATE', order='date', group='time' ))
self.assertEquals("SELECT DATE FROM user WHERE date = '0.1' limit 1",
self.assertEqual("SELECT DATE FROM user WHERE date = '0.1' limit 1",
database.select('user', 0.1, 'DATE', limit=1))
finally:
database._execute = original_execute
......@@ -129,7 +129,7 @@ class TestCollectDatabase(unittest.TestCase):
'fakeuser0', 10, '10-12345', '0.1', '10.0', '1',
'10.0', '10.0', '0.1', '0.1', 'DATE', 'TIME')
database.commit()
self.assertEquals([i for i in database.select('user')],
self.assertEqual([i for i in database.select('user')],
[(u'fakeuser0', 10.0, u'10-12345', 0.1, 10.0,
1.0, 10.0, 10.0, 0.1, 0.1, u'DATE', u'TIME', 0)])
finally:
......@@ -143,7 +143,7 @@ class TestCollectDatabase(unittest.TestCase):
database.inserFolderSnapshot(
'fakeuser0', '0.1', 'DATE', 'TIME')
database.commit()
self.assertEquals([i for i in database.select('folder')],
self.assertEqual([i for i in database.select('folder')],
[(u'fakeuser0', 0.1, u'DATE', u'TIME', 0)])
finally:
database.close()
......@@ -156,7 +156,7 @@ class TestCollectDatabase(unittest.TestCase):
database.insertComputerSnapshot(
'1', '0', '0', '100', '0', '/dev/sdx1', 'DATE', 'TIME')
database.commit()
self.assertEquals([i for i in database.select('computer')],
self.assertEqual([i for i in database.select('computer')],
[(1.0, 0.0, u'0', 100.0, u'0', u'/dev/sdx1', u'DATE', u'TIME', 0)])
finally:
database.close()
......@@ -169,7 +169,7 @@ class TestCollectDatabase(unittest.TestCase):
database.insertDiskPartitionSnapshot(
'/dev/sdx1', '10', '20', '/mnt', 'DATE', 'TIME')
database.commit()
self.assertEquals([i for i in database.select('disk')],
self.assertEqual([i for i in database.select('disk')],
[(u'/dev/sdx1', u'10', u'20', u'/mnt', u'DATE', u'TIME', 0)])
finally:
database.close()
......@@ -183,7 +183,7 @@ class TestCollectDatabase(unittest.TestCase):
'10.0', '1', '2', '12.0', '1', '1', 'DATE', 'TIME')
database.commit()
self.assertEquals([i for i in database.select('system')],
self.assertEqual([i for i in database.select('system')],
[(0.1, 10.0, 100.0, 100.0, 10.0, 1.0,
2.0, 12.0, 1.0, 1.0, u'DATE', u'TIME', 0)])
finally:
......@@ -198,14 +198,14 @@ class TestCollectDatabase(unittest.TestCase):
'10.0', '1', '2', '12.0', '1', '1', 'EXPECTED-DATE', 'TIME')
database.commit()
self.assertEquals([i for i in database.getDateScopeList()],
self.assertEqual([i for i in database.getDateScopeList()],
[('EXPECTED-DATE', 1)])
self.assertEquals([i for i in \
self.assertEqual([i for i in \
database.getDateScopeList(ignore_date='EXPECTED-DATE')],
[])
self.assertEquals([i for i in \
self.assertEqual([i for i in \
database.getDateScopeList(reported=1)],
[])
......@@ -214,11 +214,11 @@ class TestCollectDatabase(unittest.TestCase):
def test_garbage_collection_date_list(self):
database = db.Database(self.instance_root)
self.assertEquals(len(database._getGarbageCollectionDateList()), 3)
self.assertEquals(len(database._getGarbageCollectionDateList(1)), 1)
self.assertEquals(len(database._getGarbageCollectionDateList(0)), 0)
self.assertEqual(len(database._getGarbageCollectionDateList()), 3)
self.assertEqual(len(database._getGarbageCollectionDateList(1)), 1)
self.assertEqual(len(database._getGarbageCollectionDateList(0)), 0)
self.assertEquals(database._getGarbageCollectionDateList(1),
self.assertEqual(database._getGarbageCollectionDateList(1),
[strftime("%Y-%m-%d")])
def test_garbage(self):
......@@ -235,17 +235,17 @@ class TestCollectDatabase(unittest.TestCase):
database.markDayAsReported(date_scope="1983-01-10",
table_list=database.table_list)
database.commit()
self.assertEquals(len([x for x in database.select('system')]), 1)
self.assertEquals(len([x for x in database.select('computer')]), 1)
self.assertEquals(len([x for x in database.select('disk')]), 1)
self.assertEqual(len([x for x in database.select('system')]), 1)
self.assertEqual(len([x for x in database.select('computer')]), 1)
self.assertEqual(len([x for x in database.select('disk')]), 1)
database.close()
database.garbageCollect()
database.connect()
self.assertEquals(len([x for x in database.select('system')]), 0)
self.assertEquals(len([x for x in database.select('computer')]), 0)
self.assertEquals(len([x for x in database.select('disk')]), 0)
self.assertEqual(len([x for x in database.select('system')]), 0)
self.assertEqual(len([x for x in database.select('computer')]), 0)
self.assertEqual(len([x for x in database.select('disk')]), 0)
def test_mark_day_as_reported(self):
......@@ -258,7 +258,7 @@ class TestCollectDatabase(unittest.TestCase):
'10.0', '1', '2', '12.0', '1', '1', 'NOT-EXPECTED-DATE', 'TIME')
database.commit()
self.assertEquals([i for i in database.select('system')],
self.assertEqual([i for i in database.select('system')],
[(0.1, 10.0, 100.0, 100.0, 10.0, 1.0,
2.0, 12.0, 1.0, 1.0, u'EXPECTED-DATE', u'TIME', 0),
(0.1, 10.0, 100.0, 100.0, 10.0, 1.0,
......@@ -268,7 +268,7 @@ class TestCollectDatabase(unittest.TestCase):
table_list=["system"])
database.commit()
self.assertEquals([i for i in database.select('system')],
self.assertEqual([i for i in database.select('system')],
[(0.1, 10.0, 100.0, 100.0, 10.0, 1.0,
2.0, 12.0, 1.0, 1.0, u'EXPECTED-DATE', u'TIME', 1),
(0.1, 10.0, 100.0, 100.0, 10.0, 1.0,
......@@ -309,7 +309,7 @@ class TestCollectReport(unittest.TestCase):
'%s/1983-01-10/dump_temperature.csv' % self.instance_root,
'%s/1983-01-10/dump_system.csv' % self.instance_root]
self.assertEquals(set(glob.glob("%s/1983-01-10/*.csv" % self.instance_root)),
self.assertEqual(set(glob.glob("%s/1983-01-10/*.csv" % self.instance_root)),
set(csv_path_list))
def test_system_csv_report(self):
......@@ -338,7 +338,7 @@ class TestCollectReport(unittest.TestCase):
'%s/system_net_in_dropped.csv' % self.instance_root,
'%s/system_loadavg.csv' % self.instance_root]
self.assertEquals(set(glob.glob("%s/*.csv" % self.instance_root)), set(csv_path_list))
self.assertEqual(set(glob.glob("%s/*.csv" % self.instance_root)), set(csv_path_list))
def test_compress_log_directory(self):
log_directory = "%s/test_compress" % self.instance_root
......@@ -362,9 +362,9 @@ class TestCollectReport(unittest.TestCase):
self.assertTrue(os.path.exists("%s.tar.gz" % dump_folder))
with tarfile.open("%s.tar.gz" % dump_folder) as tf:
self.assertEquals(tf.getmembers()[0].name, "1990-01-01")
self.assertEquals(tf.getmembers()[1].name, "1990-01-01/test.txt")
self.assertEquals(tf.extractfile(tf.getmembers()[1]).read(), 'hi')
self.assertEqual(tf.getmembers()[0].name, "1990-01-01")
self.assertEqual(tf.getmembers()[1].name, "1990-01-01/test.txt")
self.assertEqual(tf.extractfile(tf.getmembers()[1]).read(), 'hi')
class TestCollectSnapshot(unittest.TestCase):
......@@ -383,8 +383,8 @@ class TestCollectSnapshot(unittest.TestCase):
process_snapshot = snapshot.ProcessSnapshot(process)
self.assertNotEquals(process_snapshot.username, None)
self.assertEquals(int(process_snapshot.pid), os.getpid())
self.assertEquals(int(process_snapshot.process.split("-")[0]),
self.assertEqual(int(process_snapshot.pid), os.getpid())
self.assertEqual(int(process_snapshot.process.split("-")[0]),
os.getpid())
self.assertNotEquals(process_snapshot.cpu_percent , None)
......@@ -431,13 +431,13 @@ class TestCollectSnapshot(unittest.TestCase):
self.assertNotEquals(computer_snapshot.memory_size , None)
self.assertNotEquals(computer_snapshot.memory_type , None)
self.assertEquals(type(computer_snapshot.system_snapshot),
self.assertEqual(type(computer_snapshot.system_snapshot),
snapshot.SystemSnapshot)
self.assertNotEquals(computer_snapshot.disk_snapshot_list, [])
self.assertNotEquals(computer_snapshot.partition_list, [])
self.assertEquals(type(computer_snapshot.disk_snapshot_list[0]),
self.assertEqual(type(computer_snapshot.disk_snapshot_list[0]),
snapshot.DiskPartitionSnapshot)
def test_system_snapshot(self):
......@@ -483,19 +483,19 @@ class TestCollectEntity(unittest.TestCase):
user_dict = entity.get_user_list(config)
username_list = ['slapuser0', 'slapuser1', 'slapuser2']
self.assertEquals(username_list, user_dict.keys())
self.assertEqual(username_list, user_dict.keys())
for name in username_list:
self.assertEquals(user_dict[name].name, name)
self.assertEquals(user_dict[name].snapshot_list, [])
self.assertEqual(user_dict[name].name, name)
self.assertEqual(user_dict[name].snapshot_list, [])
expected_path = "%s/slappart%s" % (self.instance_root, name.strip("slapuser"))
self.assertEquals(user_dict[name].path, expected_path)
self.assertEqual(user_dict[name].path, expected_path)
def test_user_add_snapshot(self):
user = self.getFakeUser()
self.assertEquals(user.snapshot_list, [])
self.assertEqual(user.snapshot_list, [])
user.append("SNAPSHOT")
self.assertEquals(user.snapshot_list, ["SNAPSHOT"])
self.assertEqual(user.snapshot_list, ["SNAPSHOT"])
def test_user_save(self):
disk_snapshot_params = {'enable': False}
......@@ -504,17 +504,17 @@ class TestCollectEntity(unittest.TestCase):
user.append(snapshot.ProcessSnapshot(process))
database = FakeDatabase()
user.save(database, "DATE", "TIME")
self.assertEquals(database.invoked_method_list[0], ("connect", ""))
self.assertEqual(database.invoked_method_list[0], ("connect", ""))
self.assertEquals(database.invoked_method_list[1][0], "insertUserSnapshot")
self.assertEquals(database.invoked_method_list[1][1][0], ("fakeuser0",))
self.assertEquals(database.invoked_method_list[1][1][1].keys(),
self.assertEqual(database.invoked_method_list[1][0], "insertUserSnapshot")
self.assertEqual(database.invoked_method_list[1][1][0], ("fakeuser0",))
self.assertEqual(database.invoked_method_list[1][1][1].keys(),
['cpu_time', 'cpu_percent', 'process',
'memory_rss', 'pid', 'memory_percent',
'io_rw_counter', 'insertion_date', 'insertion_time',
'io_cycles_counter', 'cpu_num_threads'])
self.assertEquals(database.invoked_method_list[2], ("commit", ""))
self.assertEquals(database.invoked_method_list[3], ("close", ""))
self.assertEqual(database.invoked_method_list[2], ("commit", ""))
self.assertEqual(database.invoked_method_list[3], ("close", ""))
def test_user_save_disk_snapshot(self):
disk_snapshot_params = {'enable': True, 'testing': True}
......@@ -523,25 +523,25 @@ class TestCollectEntity(unittest.TestCase):
user.append(snapshot.ProcessSnapshot(process))
database = FakeDatabase2()
user.save(database, "DATE", "TIME")
self.assertEquals(database.invoked_method_list[0], ("connect", ""))
self.assertEqual(database.invoked_method_list[0], ("connect", ""))
self.assertEquals(database.invoked_method_list[1][0], "insertUserSnapshot")
self.assertEquals(database.invoked_method_list[1][1][0], ("fakeuser0",))
self.assertEquals(database.invoked_method_list[1][1][1].keys(),
self.assertEqual(database.invoked_method_list[1][0], "insertUserSnapshot")
self.assertEqual(database.invoked_method_list[1][1][0], ("fakeuser0",))
self.assertEqual(database.invoked_method_list[1][1][1].keys(),
['cpu_time', 'cpu_percent', 'process',
'memory_rss', 'pid', 'memory_percent',
'io_rw_counter', 'insertion_date', 'insertion_time',
'io_cycles_counter', 'cpu_num_threads'])
self.assertEquals(database.invoked_method_list[2], ("commit", ""))
self.assertEquals(database.invoked_method_list[3], ("close", ""))
self.assertEqual(database.invoked_method_list[2], ("commit", ""))
self.assertEqual(database.invoked_method_list[3], ("close", ""))
self.assertEquals(database.invoked_method_list[4], ("connect", ""))
self.assertEquals(database.invoked_method_list[5][0], "inserFolderSnapshot")
self.assertEquals(database.invoked_method_list[5][1][0], ("fakeuser0",))
self.assertEquals(database.invoked_method_list[5][1][1].keys(),
self.assertEqual(database.invoked_method_list[4], ("connect", ""))
self.assertEqual(database.invoked_method_list[5][0], "inserFolderSnapshot")
self.assertEqual(database.invoked_method_list[5][1][0], ("fakeuser0",))
self.assertEqual(database.invoked_method_list[5][1][1].keys(),
['insertion_date', 'disk_usage', 'insertion_time'])
self.assertEquals(database.invoked_method_list[6], ("commit", ""))
self.assertEquals(database.invoked_method_list[7], ("close", ""))
self.assertEqual(database.invoked_method_list[6], ("commit", ""))
self.assertEqual(database.invoked_method_list[7], ("close", ""))
def test_user_save_disk_snapshot_cycle(self):
disk_snapshot_params = {'enable': True, 'time_cycle': 3600, 'testing': True}
......@@ -550,58 +550,58 @@ class TestCollectEntity(unittest.TestCase):
user.append(snapshot.ProcessSnapshot(process))
database = FakeDatabase2()
user.save(database, "DATE", "TIME")
self.assertEquals(database.invoked_method_list[0], ("connect", ""))
self.assertEqual(database.invoked_method_list[0], ("connect", ""))
self.assertEquals(database.invoked_method_list[1][0], "insertUserSnapshot")
self.assertEquals(database.invoked_method_list[1][1][0], ("fakeuser0",))
self.assertEquals(database.invoked_method_list[1][1][1].keys(),
self.assertEqual(database.invoked_method_list[1][0], "insertUserSnapshot")
self.assertEqual(database.invoked_method_list[1][1][0], ("fakeuser0",))
self.assertEqual(database.invoked_method_list[1][1][1].keys(),
['cpu_time', 'cpu_percent', 'process',
'memory_rss', 'pid', 'memory_percent',
'io_rw_counter', 'insertion_date', 'insertion_time',
'io_cycles_counter', 'cpu_num_threads'])
self.assertEquals(database.invoked_method_list[2], ("commit", ""))
self.assertEquals(database.invoked_method_list[3], ("close", ""))
self.assertEqual(database.invoked_method_list[2], ("commit", ""))
self.assertEqual(database.invoked_method_list[3], ("close", ""))
self.assertEquals(database.invoked_method_list[4], ("connect", ""))
self.assertEquals(database.invoked_method_list[5][0], "select")
self.assertEquals(database.invoked_method_list[5][1][0], ())
self.assertEquals(database.invoked_method_list[5][1][1].keys(),
self.assertEqual(database.invoked_method_list[4], ("connect", ""))
self.assertEqual(database.invoked_method_list[5][0], "select")
self.assertEqual(database.invoked_method_list[5][1][0], ())
self.assertEqual(database.invoked_method_list[5][1][1].keys(),
['table', 'where', 'limit', 'order', 'columns'])
self.assertEquals(database.invoked_method_list[6][0], "inserFolderSnapshot")
self.assertEquals(database.invoked_method_list[6][1][0], ("fakeuser0",))
self.assertEquals(database.invoked_method_list[6][1][1].keys(),
self.assertEqual(database.invoked_method_list[6][0], "inserFolderSnapshot")
self.assertEqual(database.invoked_method_list[6][1][0], ("fakeuser0",))
self.assertEqual(database.invoked_method_list[6][1][1].keys(),
['insertion_date', 'disk_usage', 'insertion_time'])
self.assertEquals(database.invoked_method_list[7], ("commit", ""))
self.assertEquals(database.invoked_method_list[8], ("close", ""))
self.assertEqual(database.invoked_method_list[7], ("commit", ""))
self.assertEqual(database.invoked_method_list[8], ("close", ""))
def test_computer_entity(self):
computer = entity.Computer(snapshot.ComputerSnapshot())
database = FakeDatabase()
computer.save(database, "DATE", "TIME")
self.assertEquals(database.invoked_method_list[0], ("connect", ""))
self.assertEqual(database.invoked_method_list[0], ("connect", ""))
self.assertEquals(database.invoked_method_list[1][0], "insertComputerSnapshot")
self.assertEquals(database.invoked_method_list[1][1][0], ())
self.assertEquals(database.invoked_method_list[1][1][1].keys(),
self.assertEqual(database.invoked_method_list[1][0], "insertComputerSnapshot")
self.assertEqual(database.invoked_method_list[1][1][0], ())
self.assertEqual(database.invoked_method_list[1][1][1].keys(),
['insertion_time', 'insertion_date', 'cpu_num_core',
'partition_list', 'cpu_frequency', 'memory_size',
'cpu_type', 'memory_type'])
self.assertEquals(database.invoked_method_list[2][0], "insertSystemSnapshot")
self.assertEquals(database.invoked_method_list[2][1][0], ())
self.assertEquals(set(database.invoked_method_list[2][1][1].keys()),
self.assertEqual(database.invoked_method_list[2][0], "insertSystemSnapshot")
self.assertEqual(database.invoked_method_list[2][1][0], ())
self.assertEqual(set(database.invoked_method_list[2][1][1].keys()),
set([ 'memory_used', 'cpu_percent', 'insertion_date', 'insertion_time',
'loadavg', 'memory_free', 'net_in_bytes', 'net_in_dropped',
'net_in_errors', 'net_out_bytes', 'net_out_dropped',
'net_out_errors']))
self.assertEquals(database.invoked_method_list[3][0], "insertDiskPartitionSnapshot")
self.assertEquals(database.invoked_method_list[3][1][0], ())
self.assertEquals(set(database.invoked_method_list[3][1][1].keys()),
self.assertEqual(database.invoked_method_list[3][0], "insertDiskPartitionSnapshot")
self.assertEqual(database.invoked_method_list[3][1][0], ())
self.assertEqual(set(database.invoked_method_list[3][1][1].keys()),
set([ 'used', 'insertion_date', 'partition', 'free',
'mountpoint', 'insertion_time' ]))
self.assertEquals(database.invoked_method_list[-2], ("commit", ""))
self.assertEquals(database.invoked_method_list[-1], ("close", ""))
self.assertEqual(database.invoked_method_list[-2], ("commit", ""))
self.assertEqual(database.invoked_method_list[-1], ("close", ""))
......@@ -73,16 +73,16 @@ class TestConfigureLocal(unittest.TestCase):
with open(self.temp_dir + '/slapos-proxy.cfg') as fout:
proxy_config = ConfigParser()
proxy_config.readfp(fout)
self.assertEquals(proxy_config.get('slapos', 'instance_root'),
self.assertEqual(proxy_config.get('slapos', 'instance_root'),
self.instance_root)
self.assertEquals(proxy_config.get('slapos', 'software_root'),
self.assertEqual(proxy_config.get('slapos', 'software_root'),
expected_software_root)
with open(self.temp_dir + '/slapos.cfg') as fout:
proxy_config = ConfigParser()
proxy_config.readfp(fout)
self.assertEquals(proxy_config.get('slapos', 'instance_root'),
self.assertEqual(proxy_config.get('slapos', 'instance_root'),
self.instance_root)
self.assertEquals(proxy_config.get('slapos', 'software_root'),
self.assertEqual(proxy_config.get('slapos', 'software_root'),
expected_software_root)
def test_configure_local_environment(self):
......@@ -102,16 +102,16 @@ class TestConfigureLocal(unittest.TestCase):
with open(self.temp_dir + '/slapos-proxy.cfg') as fout:
proxy_config = ConfigParser()
proxy_config.readfp(fout)
self.assertEquals(proxy_config.get('slapos', 'instance_root'),
self.assertEqual(proxy_config.get('slapos', 'instance_root'),
self.instance_root)
self.assertEquals(proxy_config.get('slapos', 'software_root'),
self.assertEqual(proxy_config.get('slapos', 'software_root'),
self.software_root)
with open(self.temp_dir + '/slapos.cfg') as fout:
proxy_config = ConfigParser()
proxy_config.readfp(fout)
self.assertEquals(proxy_config.get('slapos', 'instance_root'),
self.assertEqual(proxy_config.get('slapos', 'instance_root'),
self.instance_root)
self.assertEquals(proxy_config.get('slapos', 'software_root'),
self.assertEqual(proxy_config.get('slapos', 'software_root'),
self.software_root)
log_file = proxy_config.get('slapformat', 'log_file')
self.assertTrue(log_file.startswith(log_folder),
......
......@@ -186,7 +186,7 @@ class TestSlapOSPromiseLauncher(TestSlapOSPromiseMixin):
with self.assertRaises(ImportError) as exc:
promise_module = promise_process._loadPromiseModule()
self.assertEquals(exc.exception.message, 'No module named my_promise_no_py')
self.assertEqual(exc.exception.message, 'No module named my_promise_no_py')
def test_promise_match_interface_no_implement(self):
promise_name = 'my_promise_noimplement.py'
......@@ -210,7 +210,7 @@ class RunPromise(GenericPromise):
promise_module = promise_process._loadPromiseModule()
message = "RunPromise class in my_promise_noimplement.py must implements" \
" 'IPromise' interface. zope_interface.implements(interface.IPromise) is missing ?"
self.assertEquals(exc.exception.message, message)
self.assertEqual(exc.exception.message, message)
def test_promise_match_interface_no_generic(self):
promise_name = 'my_promise_nogeneric.py'
......@@ -236,7 +236,7 @@ class RunPromise(object):
with self.assertRaises(RuntimeError) as exc:
promise_module = promise_process._loadPromiseModule()
self.assertEquals(exc.exception.message, 'RunPromise class is not a subclass of GenericPromise class.')
self.assertEqual(exc.exception.message, 'RunPromise class is not a subclass of GenericPromise class.')
def test_promise_match_interface_no_sense(self):
promise_name = 'my_promise_nosense.py'
......@@ -263,7 +263,7 @@ class RunPromise(GenericPromise):
with self.assertRaises(TypeError) as exc:
promise_module = promise_process._loadPromiseModule()
promise = promise_module.RunPromise({})
self.assertEquals(exc.exception.message,
self.assertEqual(exc.exception.message,
"Can't instantiate abstract class RunPromise with abstract methods sense")
def test_promise_extra_config(self):
......@@ -292,9 +292,9 @@ class RunPromise(GenericPromise):
promise_module = promise_process._loadPromiseModule()
promise = promise_module.RunPromise(promise_process.argument_dict)
self.assertEquals(promise.getConfig('foo'), 'bar')
self.assertEquals(promise.getConfig('my-config'), 4522111)
self.assertEquals(promise.getConfig('text'), config_dict['text'])
self.assertEqual(promise.getConfig('foo'), 'bar')
self.assertEqual(promise.getConfig('my-config'), 4522111)
self.assertEqual(promise.getConfig('text'), config_dict['text'])
def test_promise_extra_config_reserved_name(self):
promise_name = 'my_promise_extra.py'
......@@ -321,7 +321,7 @@ class RunPromise(GenericPromise):
with self.assertRaises(ValueError) as exc:
promise_module = promise_process._loadPromiseModule()
self.assertEquals(exc.exception.message, "Extra parameter name 'name' cannot be used.\n%s" % config_dict)
self.assertEqual(exc.exception.message, "Extra parameter name 'name' cannot be used.\n%s" % config_dict)
def test_runpromise(self):
promise_name = 'my_promise.py'
......@@ -350,7 +350,7 @@ class RunPromise(GenericPromise):
with open(state_file) as f:
result_dict = json.loads(f.read())
result_dict['result'].pop('date')
self.assertEquals(json.loads(expected_result), result_dict)
self.assertEqual(json.loads(expected_result), result_dict)
def test_runpromise_multiple(self):
promise_name = 'my_promise.py'
......@@ -384,7 +384,7 @@ class RunPromise(GenericPromise):
result_dict = json.loads(f.read())
result_dict['result'].pop('date')
expected_dict = expected_result % {'promise_dir': self.plugin_dir, 'name': 'my_promise'}
self.assertEquals(json.loads(expected_dict), result_dict)
self.assertEqual(json.loads(expected_dict), result_dict)
# second promise
state_file = os.path.join(self.partition_dir, PROMISE_RESULT_FOLDER_NAME, 'my_second_promise.status.json')
......@@ -393,7 +393,7 @@ class RunPromise(GenericPromise):
result_dict = json.loads(f.read())
result_dict['result'].pop('date')
expected_dict = expected_result % {'promise_dir': self.plugin_dir, 'name': 'my_second_promise'}
self.assertEquals(json.loads(expected_dict), result_dict)
self.assertEqual(json.loads(expected_dict), result_dict)
def test_runpromise_no_logdir(self):
promise_name = 'my_promise.py'
......@@ -413,11 +413,11 @@ class RunPromise(GenericPromise):
self.assertTrue(isinstance(result, PromiseQueueResult))
self.assertTrue(isinstance(result.item, TestResult))
self.assertTrue(result.execution_time != 0)
self.assertEquals(result.title, 'my_promise')
self.assertEquals(result.name, promise_name)
self.assertEquals(result.path, os.path.join(self.plugin_dir, promise_name))
self.assertEquals(result.item.message, "success")
self.assertEquals(result.item.hasFailed(), False)
self.assertEqual(result.title, 'my_promise')
self.assertEqual(result.name, promise_name)
self.assertEqual(result.path, os.path.join(self.plugin_dir, promise_name))
self.assertEqual(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertTrue(isinstance(result.item.date, datetime))
self.configureLauncher(save_method=test_method)
......@@ -435,11 +435,11 @@ class RunPromise(GenericPromise):
self.assertTrue(isinstance(result, PromiseQueueResult))
self.assertTrue(isinstance(result.item, TestResult))
self.assertTrue(result.execution_time != 0)
self.assertEquals(result.title, 'my_promise')
self.assertEquals(result.name, promise_name)
self.assertEquals(result.path, os.path.join(self.plugin_dir, promise_name))
self.assertEquals(result.item.message, "success")
self.assertEquals(result.item.hasFailed(), False)
self.assertEqual(result.title, 'my_promise')
self.assertEqual(result.name, promise_name)
self.assertEqual(result.path, os.path.join(self.plugin_dir, promise_name))
self.assertEqual(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertTrue(isinstance(result.item.date, datetime))
# no promise log output dir
......@@ -458,11 +458,11 @@ class RunPromise(GenericPromise):
self.assertTrue(isinstance(result, PromiseQueueResult))
self.assertTrue(isinstance(result.item, AnomalyResult))
self.assertTrue(result.execution_time != 0)
self.assertEquals(result.title, 'my_promise')
self.assertEquals(result.name, promise_name)
self.assertEquals(result.path, os.path.join(self.plugin_dir, promise_name))
self.assertEquals(result.item.message, "success")
self.assertEquals(result.item.hasFailed(), False)
self.assertEqual(result.title, 'my_promise')
self.assertEqual(result.name, promise_name)
self.assertEqual(result.path, os.path.join(self.plugin_dir, promise_name))
self.assertEqual(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertTrue(isinstance(result.item.date, datetime))
self.configureLauncher(save_method=test_method, enable_anomaly=True)
......@@ -483,11 +483,11 @@ class RunPromise(GenericPromise):
self.assertTrue(isinstance(result.item, TestResult))
self.assertTrue(result.name in [promise_failed, promise_name])
if result.name == promise_failed:
self.assertEquals(result.item.hasFailed(), True)
self.assertEquals(result.item.message, "failed")
self.assertEqual(result.item.hasFailed(), True)
self.assertEqual(result.item.message, "failed")
else:
self.assertEquals(result.item.hasFailed(), False)
self.assertEquals(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success")
self.counter += 1
self.configureLauncher(save_method=test_method)
......@@ -497,7 +497,7 @@ class RunPromise(GenericPromise):
with self.assertRaises(PromiseError):
self.launcher.run()
self.assertEquals(self.counter, 2)
self.assertEqual(self.counter, 2)
self.assertTrue(os.path.exists(state_file))
self.assertTrue(os.path.exists(os.path.join(self.log_dir, 'my_promise.log')))
self.assertTrue(os.path.exists(os.path.join(self.log_dir, 'my_failed_promise.log')))
......@@ -511,8 +511,8 @@ class RunPromise(GenericPromise):
self.assertTrue(isinstance(result, PromiseQueueResult))
self.assertTrue(isinstance(result.item, TestResult))
self.assertTrue(result.name in [first_promise, second_promise, third_promise])
self.assertEquals(result.item.hasFailed(), False)
self.assertEquals(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success")
self.counter += 1
self.configureLauncher(save_method=test_method)
......@@ -523,7 +523,7 @@ class RunPromise(GenericPromise):
# run promise will not fail
self.launcher.run()
self.assertEquals(self.counter, 3)
self.assertEqual(self.counter, 3)
self.assertTrue(os.path.exists(state_file))
self.assertTrue(os.path.exists(os.path.join(self.log_dir, 'my_first_promise.log')))
self.assertTrue(os.path.exists(os.path.join(self.log_dir, 'my_second_promise.log')))
......@@ -540,7 +540,7 @@ class RunPromise(GenericPromise):
# run promise will fail when promise fail (usefull for slapgrid)
with self.assertRaises(PromiseError) as exc:
self.launcher.run()
self.assertEquals(exc.exception.message, 'Promise %r failed.' % second_promise)
self.assertEqual(exc.exception.message, 'Promise %r failed.' % second_promise)
# force to reload the module without rerun python
os.system('rm %s/*.pyc' % self.plugin_dir)
......@@ -565,15 +565,15 @@ class RunPromise(GenericPromise):
def test_method_first(result):
self.assertTrue(result.name in [first_promise, second_promise])
self.assertEquals(result.item.hasFailed(), False)
self.assertEquals(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success")
self.counter += 1
def test_method_one(result):
self.counter += 1
self.assertEquals(result.name, first_promise)
self.assertEquals(result.item.hasFailed(), False)
self.assertEquals(result.item.message, "success")
self.assertEqual(result.name, first_promise)
self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success")
self.configureLauncher(save_method=test_method_first)
# ~2 seconds
......@@ -582,19 +582,19 @@ class RunPromise(GenericPromise):
self.generatePromiseScript(second_promise, success=True, periodicity=0.05)
self.launcher.run()
self.assertEquals(self.counter, 2)
self.assertEqual(self.counter, 2)
self.configureLauncher(save_method=test_method_one)
time.sleep(2)
self.counter = 0
self.launcher.run() # only my_first_promise will run
self.assertEquals(self.counter, 1)
self.assertEqual(self.counter, 1)
time.sleep(3)
self.counter = 0
self.configureLauncher(save_method=test_method_first)
self.launcher.run()
self.assertEquals(self.counter, 2)
self.assertEqual(self.counter, 2)
def test_runpromise_with_periodicity_same(self):
first_promise = 'my_first_promise.py'
......@@ -603,8 +603,8 @@ class RunPromise(GenericPromise):
def test_method(result):
self.assertTrue(result.name in [first_promise, second_promise])
self.assertEquals(result.item.hasFailed(), False)
self.assertEquals(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success")
self.counter += 1
self.configureLauncher(save_method=test_method)
......@@ -613,19 +613,19 @@ class RunPromise(GenericPromise):
self.generatePromiseScript(second_promise, success=True, periodicity=0.03)
self.launcher.run()
self.assertEquals(self.counter, 2)
self.assertEqual(self.counter, 2)
self.configureLauncher(save_method=test_method)
time.sleep(1)
self.counter = 0
self.launcher.run() # run nothing
self.assertEquals(self.counter, 0)
self.assertEqual(self.counter, 0)
time.sleep(1)
self.counter = 0
self.configureLauncher(save_method=test_method)
self.launcher.run()
self.assertEquals(self.counter, 2)
self.assertEqual(self.counter, 2)
def test_runpromise_with_periodicity_result_failed(self):
first_promise = 'my_first_promise.py'
......@@ -643,14 +643,14 @@ class RunPromise(GenericPromise):
with self.assertRaises(PromiseError) as exc:
self.launcher.run()
self.assertEquals(exc.exception.message, 'Promise %r failed.' % second_promise)
self.assertEqual(exc.exception.message, 'Promise %r failed.' % second_promise)
self.assertTrue(os.path.exists(first_state_file))
self.assertTrue(os.path.exists(second_state_file))
first_result = json.load(open(first_state_file))
second_result = json.load(open(second_state_file))
self.assertEquals(first_result['name'], first_promise)
self.assertEquals(second_result['name'], second_promise)
self.assertEqual(first_result['name'], first_promise)
self.assertEqual(second_result['name'], second_promise)
first_date = first_result['result']['date']
second_date = second_result['result']['date']
......@@ -658,19 +658,19 @@ class RunPromise(GenericPromise):
time.sleep(2)
with self.assertRaises(PromiseError) as exc:
self.launcher.run() # only my_first_promise will run but second_promise still failing
self.assertEquals(exc.exception.message, 'Promise %r failed.' % second_promise)
self.assertEqual(exc.exception.message, 'Promise %r failed.' % second_promise)
first_result = json.load(open(first_state_file))
second_result = json.load(open(second_state_file))
self.assertNotEquals(first_result['result']['date'], first_date)
self.assertEquals(second_result['result']['date'], second_date)
self.assertEqual(second_result['result']['date'], second_date)
first_date = first_result['result']['date']
time.sleep(3)
self.configureLauncher()
with self.assertRaises(PromiseError) as exc:
self.launcher.run()
self.assertEquals(exc.exception.message, 'Promise %r failed.' % second_promise)
self.assertEqual(exc.exception.message, 'Promise %r failed.' % second_promise)
first_result = json.load(open(first_state_file))
second_result = json.load(open(second_state_file))
......@@ -693,14 +693,14 @@ class RunPromise(GenericPromise):
with self.assertRaises(PromiseError) as exc:
self.launcher.run()
self.assertEquals(exc.exception.message, 'Promise %r failed.' % second_promise)
self.assertEqual(exc.exception.message, 'Promise %r failed.' % second_promise)
self.assertTrue(os.path.exists(first_state_file))
self.assertTrue(os.path.exists(second_state_file))
first_result = json.load(open(first_state_file))
second_result = json.load(open(second_state_file))
self.assertEquals(first_result['name'], first_promise)
self.assertEquals(second_result['name'], second_promise)
self.assertEqual(first_result['name'], first_promise)
self.assertEqual(second_result['name'], second_promise)
first_date = first_result['result']['date']
second_date = second_result['result']['date']
......@@ -708,12 +708,12 @@ class RunPromise(GenericPromise):
time.sleep(2)
with self.assertRaises(PromiseError) as exc:
self.launcher.run() # only my_first_promise will run but second_promise still failing
self.assertEquals(exc.exception.message, 'Promise %r failed.' % second_promise)
self.assertEqual(exc.exception.message, 'Promise %r failed.' % second_promise)
first_result = json.load(open(first_state_file))
second_result = json.load(open(second_state_file))
self.assertNotEquals(first_result['result']['date'], first_date)
self.assertEquals(second_result['result']['date'], second_date)
self.assertEqual(second_result['result']['date'], second_date)
first_date = first_result['result']['date']
second_date = second_result['result']['date']
......@@ -738,8 +738,8 @@ class RunPromise(GenericPromise):
def test_method(result):
self.assertTrue(result.name in [first_promise, second_promise])
self.assertEquals(result.item.hasFailed(), False)
self.assertEquals(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success")
self.counter += 1
self.configureLauncher(save_method=test_method)
......@@ -748,30 +748,30 @@ class RunPromise(GenericPromise):
self.generatePromiseScript(second_promise, success=True, periodicity=0.03)
self.launcher.run()
self.assertEquals(self.counter, 2)
self.assertEqual(self.counter, 2)
self.configureLauncher(save_method=test_method)
time.sleep(1)
self.counter = 0
self.launcher.run() # run nothing
self.assertEquals(self.counter, 0)
self.assertEqual(self.counter, 0)
self.configureLauncher(save_method=test_method, force=True)
self.counter = 0
self.launcher.run() # will run all as force is True
self.assertEquals(self.counter, 2)
self.assertEqual(self.counter, 2)
self.configureLauncher(save_method=test_method)
time.sleep(1)
self.counter = 0
self.launcher.run() # run nothing
self.assertEquals(self.counter, 0)
self.assertEqual(self.counter, 0)
time.sleep(1)
self.counter = 0
self.configureLauncher(save_method=test_method)
self.launcher.run() # after 2 seconds will run all
self.assertEquals(self.counter, 2)
self.assertEqual(self.counter, 2)
def test_runpromise_wrapped(self):
promise_name = "my_bash_promise"
......@@ -788,11 +788,11 @@ echo "success"
self.assertTrue(isinstance(result, PromiseQueueResult))
self.assertTrue(isinstance(result.item, TestResult))
self.assertTrue(result.execution_time != 0)
self.assertEquals(result.title, promise_name)
self.assertEquals(result.name, promise_name)
self.assertEquals(result.path, os.path.join(self.legacy_promise_dir, promise_name))
self.assertEquals(result.item.message, "success")
self.assertEquals(result.item.hasFailed(), False)
self.assertEqual(result.title, promise_name)
self.assertEqual(result.name, promise_name)
self.assertEqual(result.path, os.path.join(self.legacy_promise_dir, promise_name))
self.assertEqual(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertTrue(isinstance(result.item.date, datetime))
self.configureLauncher(save_method=test_method)
......@@ -816,7 +816,7 @@ exit 1
state_file = os.path.join(self.partition_dir, PROMISE_STATE_FOLDER_NAME)
with self.assertRaises(PromiseError) as exc:
self.launcher.run()
self.assertEquals(exc.exception.message, 'Promise %r failed.' % promise_name)
self.assertEqual(exc.exception.message, 'Promise %r failed.' % promise_name)
def test_runpromise_wrapped_mixed(self):
self.called = 0
......@@ -825,12 +825,12 @@ exit 1
self.called += 1
result_dict.pop(result.name)
if result.title == "first_promise" or result.title == "second_promise":
self.assertEquals(result.item.message, "success")
self.assertEqual(result.item.message, "success")
if result.title == "my_bash_promise":
self.assertEquals(result.item.message, "promise 1 succeeded")
self.assertEqual(result.item.message, "promise 1 succeeded")
if result.title == "my_bash_promise2":
self.assertEquals(result.item.message, "promise 2 succeeded")
self.assertEquals(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "promise 2 succeeded")
self.assertEqual(result.item.hasFailed(), False)
promise_name = "my_bash_promise"
promise_path = os.path.join(self.legacy_promise_dir, promise_name)
......@@ -853,7 +853,7 @@ exit 0
self.configureLauncher(save_method=test_method)
self.launcher.run()
self.assertEquals(self.called, 4)
self.assertEqual(self.called, 4)
def test_runpromise_run_only(self):
......@@ -864,8 +864,8 @@ exit 0
self.check_list = [first_promise, second_promise, third_promise]
def test_method(result):
self.assertTrue(result.name in self.check_list)
self.assertEquals(result.item.hasFailed(), False)
self.assertEquals(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success")
self.counter += 1
self.configureLauncher(save_method=test_method)
......@@ -875,14 +875,14 @@ exit 0
# run promise will not fail
self.launcher.run()
self.assertEquals(self.counter, 3)
self.assertEqual(self.counter, 3)
self.counter = 0
self.check_list = [second_promise]
self.configureLauncher(save_method=test_method, run_list=[second_promise], force=True)
time.sleep(1)
self.launcher.run()
self.assertEquals(self.counter, 1)
self.assertEqual(self.counter, 1)
def test_runpromise_run_only_multiple(self):
first_promise = 'my_first_promise.py'
......@@ -892,8 +892,8 @@ exit 0
self.check_list = [first_promise, second_promise, third_promise]
def test_method(result):
self.assertTrue(result.name in self.check_list)
self.assertEquals(result.item.hasFailed(), False)
self.assertEquals(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertEqual(result.item.message, "success")
self.counter += 1
self.configureLauncher(save_method=test_method)
......@@ -903,14 +903,14 @@ exit 0
# run promise will not fail
self.launcher.run()
self.assertEquals(self.counter, 3)
self.assertEqual(self.counter, 3)
self.counter = 0
self.check_list = [third_promise, second_promise]
self.configureLauncher(save_method=test_method, run_list=self.check_list, force=True)
time.sleep(1)
self.launcher.run()
self.assertEquals(self.counter, 2)
self.assertEqual(self.counter, 2)
def writeLatestPromiseResult(self):
state_file = os.path.join(self.partition_dir, PROMISE_RESULT_FOLDER_NAME, 'my_promise.status.json')
......@@ -965,10 +965,10 @@ exit 0
self.assertTrue(isinstance(result, PromiseQueueResult))
self.assertTrue(isinstance(result.item, AnomalyResult))
self.assertTrue(result.execution_time >= 1)
self.assertEquals(result.title, 'my_promise')
self.assertEquals(result.name, promise_name)
self.assertEqual(result.title, 'my_promise')
self.assertEqual(result.name, promise_name)
self.assertTrue("Promise timed out after" in result.item.message)
self.assertEquals(result.item.hasFailed(), True)
self.assertEqual(result.item.hasFailed(), True)
self.configureLauncher(save_method=test_method, enable_anomaly=True, timeout=1)
self.generatePromiseScript(promise_name, success=True, content="""import time
......@@ -996,11 +996,11 @@ echo "success"
self.assertTrue(isinstance(result, PromiseQueueResult))
self.assertTrue(isinstance(result.item, TestResult))
self.assertTrue(result.execution_time >= 1)
self.assertEquals(result.title, promise_name)
self.assertEquals(result.name, promise_name)
self.assertEquals(result.path, promise_path)
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.assertEquals(result.item.hasFailed(), True)
self.assertEqual(result.item.hasFailed(), True)
self.assertTrue(isinstance(result.item.date, datetime))
self.configureLauncher(save_method=test_method, timeout=1)
......@@ -1108,16 +1108,16 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
promise_process = self.createPromiseProcess()
promise_module = promise_process._loadPromiseModule()
promise = promise_module.RunPromise(self.promise_config)
self.assertEquals(promise.getPeriodicity(), 1)
self.assertEquals(promise.getName(), self.promise_name)
self.assertEquals(promise.getTitle(), 'my_promise')
self.assertEquals(promise.getPartitionFolder(), self.partition_dir)
self.assertEquals(promise.getPromiseFile(), self.promise_path)
self.assertEquals(promise.getLogFolder(), self.log_dir)
self.assertEquals(promise.getLogFile(), os.path.join(self.log_dir, 'my_promise.log'))
self.assertEqual(promise.getPeriodicity(), 1)
self.assertEqual(promise.getName(), self.promise_name)
self.assertEqual(promise.getTitle(), 'my_promise')
self.assertEqual(promise.getPartitionFolder(), self.partition_dir)
self.assertEqual(promise.getPromiseFile(), self.promise_path)
self.assertEqual(promise.getLogFolder(), self.log_dir)
self.assertEqual(promise.getLogFile(), os.path.join(self.log_dir, 'my_promise.log'))
promise.setPeriodicity(2)
self.assertEquals(promise.getPeriodicity(), 2)
self.assertEqual(promise.getPeriodicity(), 2)
with self.assertRaises(ValueError):
promise.setPeriodicity(0)
......@@ -1125,11 +1125,11 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
result = self.queue.get(True, 1)
self.assertTrue(isinstance(result, PromiseQueueResult))
self.assertTrue(isinstance(result.item, AnomalyResult))
self.assertEquals(result.title, 'my_promise')
self.assertEquals(result.name, self.promise_name)
self.assertEquals(result.path, os.path.join(self.plugin_dir, self.promise_name))
self.assertEquals(result.item.message, "success")
self.assertEquals(result.item.hasFailed(), False)
self.assertEqual(result.title, 'my_promise')
self.assertEqual(result.name, self.promise_name)
self.assertEqual(result.path, os.path.join(self.plugin_dir, self.promise_name))
self.assertEqual(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertTrue(isinstance(result.item.date, datetime))
def test_promise_anomaly_disabled(self):
......@@ -1142,11 +1142,11 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
result = self.queue.get(True, 1)
self.assertTrue(isinstance(result, PromiseQueueResult))
self.assertTrue(isinstance(result.item, TestResult))
self.assertEquals(result.title, 'my_promise')
self.assertEquals(result.name, self.promise_name)
self.assertEquals(result.path, os.path.join(self.plugin_dir, self.promise_name))
self.assertEquals(result.item.message, "success")
self.assertEquals(result.item.hasFailed(), False)
self.assertEqual(result.title, 'my_promise')
self.assertEqual(result.name, self.promise_name)
self.assertEqual(result.path, os.path.join(self.plugin_dir, self.promise_name))
self.assertEqual(result.item.message, "success")
self.assertEqual(result.item.hasFailed(), False)
self.assertTrue(isinstance(result.item.date, datetime))
def test_promise_with_raise(self):
......@@ -1159,10 +1159,10 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
# no raise
promise.run()
result = self.queue.get(True, 1)
self.assertEquals(result.title, 'my_promise')
self.assertEquals(result.name, self.promise_name)
self.assertEquals(result.item.message, "Bad Promise raised")
self.assertEquals(result.item.hasFailed(), True)
self.assertEqual(result.title, 'my_promise')
self.assertEqual(result.name, self.promise_name)
self.assertEqual(result.item.message, "Bad Promise raised")
self.assertEqual(result.item.hasFailed(), True)
def test_promise_no_return(self):
promise_content = "return"
......@@ -1174,10 +1174,10 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
# no raise
promise.run()
result = self.queue.get(True, 1)
self.assertEquals(result.title, 'my_promise')
self.assertEquals(result.name, self.promise_name)
self.assertEquals(result.item.message, "No result found!")
self.assertEquals(result.item.hasFailed(), False)
self.assertEqual(result.title, 'my_promise')
self.assertEqual(result.name, self.promise_name)
self.assertEqual(result.item.message, "No result found!")
self.assertEqual(result.item.hasFailed(), False)
def test_promise_resultfromlog(self):
promise_content = "self.logger.info('Promise is running...')"
......@@ -1191,11 +1191,11 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
# get all messages during the latest minute
latest_message_list = promise.getLastPromiseResultList(result_count=1)
date = datetime.strptime(date.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')
self.assertEquals(len(latest_message_list), 1)
self.assertEquals(
self.assertEqual(len(latest_message_list), 1)
self.assertEqual(
latest_message_list[0][0],
{'date': date, 'status': 'INFO', 'message': 'Promise is running...'})
self.assertEquals(
self.assertEqual(
latest_message_list[0][1],
{'date': date, 'status': 'INFO', 'message': 'success'})
......@@ -1211,12 +1211,12 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
# get all messages during the latest minute
latest_message_list = promise.getLastPromiseResultList(result_count=1)
date = datetime.strptime(date.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')
self.assertEquals(len(latest_message_list), 1)
self.assertEquals(
self.assertEqual(len(latest_message_list), 1)
self.assertEqual(
latest_message_list[0][0],
{'date': date, 'status': 'ERROR',
'message': 'Promise is running...\nmessage in new line'})
self.assertEquals(
self.assertEqual(
latest_message_list[0][1],
{'date': date, 'status': 'INFO', 'message': 'success'})
......@@ -1230,17 +1230,17 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
date = datetime.now()
promise.sense()
self.assertEquals(promise.getLogFolder(), None)
self.assertEquals(promise.getLogFile(), None)
self.assertEqual(promise.getLogFolder(), None)
self.assertEqual(promise.getLogFile(), None)
# get all messages during the latest minute
latest_message_list = promise.getLastPromiseResultList(result_count=1)
date = datetime.strptime(date.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')
self.assertEquals(len(latest_message_list), 1)
self.assertEquals(
self.assertEqual(len(latest_message_list), 1)
self.assertEqual(
latest_message_list[0][0],
{'date': date, 'status': 'INFO', 'message': 'Promise is running...'})
self.assertEquals(
self.assertEqual(
latest_message_list[0][1],
{'date': date, 'status': 'INFO', 'message': 'success'})
......@@ -1267,13 +1267,13 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
start_date = datetime.strptime(start_date.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')
end_date_string = (start_date - timedelta(minutes=9)).strftime('%Y-%m-%d %H:%M:%S')
end_date = datetime.strptime(end_date_string, '%Y-%m-%d %H:%M:%S')
self.assertEquals(len(latest_message_list), 10)
self.assertEqual(len(latest_message_list), 10)
for message in latest_message_list:
self.assertEquals(len(message), 1)
self.assertEquals(
self.assertEqual(len(message), 1)
self.assertEqual(
latest_message_list[0][0],
{'date': start_date, 'status': 'INFO', 'message': 'Promise result 49'})
self.assertEquals(
self.assertEqual(
latest_message_list[-1][0],
{'date': end_date, 'status': 'INFO', 'message': 'Promise result 40'})
......@@ -1312,13 +1312,13 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
end_date_string = (start_date - timedelta(seconds=30*19)).strftime('%Y-%m-%d %H:%M:%S')
end_date = datetime.strptime(end_date_string, '%Y-%m-%d %H:%M:%S')
# there is 2 result line per minutes
self.assertEquals(len(latest_message_list), 10)
self.assertEqual(len(latest_message_list), 10)
for message in latest_message_list:
self.assertEquals(len(message), 2)
self.assertEquals(
self.assertEqual(len(message), 2)
self.assertEqual(
latest_message_list[0][1],
{'date': start_date, 'status': 'INFO', 'message': 'Promise result 0'})
self.assertEquals(
self.assertEqual(
latest_message_list[-1][0],
{'date': end_date, 'status': 'INFO', 'message': 'Promise result 19'})
......@@ -1356,11 +1356,11 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
end_date_string = (start_date - timedelta(seconds=30)).strftime('%Y-%m-%d %H:%M:%S')
end_date = datetime.strptime(end_date_string, '%Y-%m-%d %H:%M:%S')
# there is 2 result line per minutes
self.assertEquals(len(latest_message_list), 1)
self.assertEquals(
self.assertEqual(len(latest_message_list), 1)
self.assertEqual(
latest_message_list[0][0],
{'date': end_date, 'status': 'INFO', 'message': 'Promise result 1'})
self.assertEquals(
self.assertEqual(
latest_message_list[0][1],
{'date': start_date, 'status': 'INFO', 'message': 'Promise result 0'})
......@@ -1398,19 +1398,19 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
end_date_string = (start_date - timedelta(seconds=30*3)).strftime('%Y-%m-%d %H:%M:%S')
end_date = datetime.strptime(end_date_string, '%Y-%m-%d %H:%M:%S')
# there is 2 result line per minutes
self.assertEquals(len(latest_message_list), 2)
self.assertEqual(len(latest_message_list), 2)
for message in latest_message_list:
self.assertEquals(len(message), 2)
self.assertEquals(
self.assertEqual(len(message), 2)
self.assertEqual(
latest_message_list[0][1],
{'date': start_date, 'status': 'INFO', 'message': 'Promise result 0'})
self.assertEquals(
self.assertEqual(
latest_message_list[-1][0],
{'date': end_date, 'status': 'INFO', 'message': 'Promise result 3'})
latest_message_list = promise.getLastPromiseResultList(result_count=100)
# all results
self.assertEquals(len(latest_message_list), 25)
self.assertEqual(len(latest_message_list), 25)
def test_promise_defaulttest(self):
promise_content = 'self.logger.info("Promise is running...\\nmessage in new line")'
......@@ -1423,8 +1423,8 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
result = promise._test(result_count=1, failure_amount=1)
self.assertTrue(isinstance(result, TestResult))
self.assertEquals(result.message, 'Promise is running...\nmessage in new line\nsuccess')
self.assertEquals(result.hasFailed(), False)
self.assertEqual(result.message, 'Promise is running...\nmessage in new line\nsuccess')
self.assertEqual(result.hasFailed(), False)
def test_promise_defaulttest_failure(self):
self.initialisePromise(success=False)
......@@ -1436,8 +1436,8 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
result = promise._test(result_count=1, failure_amount=1)
self.assertTrue(isinstance(result, TestResult))
self.assertEquals(result.message, 'failed')
self.assertEquals(result.hasFailed(), True)
self.assertEqual(result.message, 'failed')
self.assertEqual(result.hasFailed(), True)
def test_promise_defaulttest_error_if_two_fail(self):
self.initialisePromise(success=False, timeout=1)
......@@ -1450,8 +1450,8 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
# fail if 2 errors found
result = promise._test(result_count=2, failure_amount=2)
self.assertTrue(isinstance(result, TestResult))
self.assertEquals(result.message, 'failed')
self.assertEquals(result.hasFailed(), False)
self.assertEqual(result.message, 'failed')
self.assertEqual(result.hasFailed(), False)
self.initialisePromise(success=False, timeout=1)
promise_process = self.createPromiseProcess()
......@@ -1459,8 +1459,8 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
promise = promise_module.RunPromise(self.promise_config)
promise.sense()
result = promise._test(result_count=2, failure_amount=2)
self.assertEquals(result.message, 'failed')
self.assertEquals(result.hasFailed(), True)
self.assertEqual(result.message, 'failed')
self.assertEqual(result.hasFailed(), True)
# will continue to fail
self.initialisePromise(success=False, timeout=1)
......@@ -1469,8 +1469,8 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
promise = promise_module.RunPromise(self.promise_config)
promise.sense()
result = promise._test(result_count=2, failure_amount=2)
self.assertEquals(result.message, 'failed')
self.assertEquals(result.hasFailed(), True)
self.assertEqual(result.message, 'failed')
self.assertEqual(result.hasFailed(), True)
def test_promise_defaulttest_anomaly(self):
promise_content = 'self.logger.info("Promise is running...\\nmessage in new line")'
......@@ -1483,8 +1483,8 @@ class TestSlapOSGenericPromise(TestSlapOSPromiseMixin):
result = promise._anomaly(result_count=1, failure_amount=1)
self.assertTrue(isinstance(result, AnomalyResult))
self.assertEquals(result.message, 'Promise is running...\nmessage in new line\nsuccess')
self.assertEquals(result.hasFailed(), False)
self.assertEqual(result.message, 'Promise is running...\nmessage in new line\nsuccess')
self.assertEqual(result.hasFailed(), False)
if __name__ == '__main__':
......
......@@ -79,7 +79,7 @@ class TestSlap(SlapMixin):
"""
slap_instance = slapos.slap.slap()
slap_instance.initializeConnection(self.server_url)
self.assertEquals(slap_instance._connection_helper.slapgrid_uri, self.server_url)
self.assertEqual(slap_instance._connection_helper.slapgrid_uri, self.server_url)
def test_slap_initialisation_ipv6_and_port(self):
slap_instance = slapos.slap.slap()
......@@ -866,7 +866,7 @@ class TestComputerPartition(SlapMixin):
'software_type', 'mysecondref')
with open(transaction_file_path, 'r') as f:
content_list = f.read().strip().split('\n')
self.assertEquals(list(set(content_list)), ['myref', 'mysecondref'])
self.assertEqual(list(set(content_list)), ['myref', 'mysecondref'])
def _test_new_computer_partition_state(self, state):
"""
......
......@@ -586,7 +586,7 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual([])
self.assertItemsEqual(os.listdir(self.software_root), [])
st = os.stat(os.path.join(self.instance_root, 'var'))
self.assertEquals(stat.S_IMODE(st.st_mode), 0o755)
self.assertEqual(stat.S_IMODE(st.st_mode), 0o755)
def test_one_partition(self):
computer = ComputerForTest(self.software_root, self.instance_root)
......@@ -1989,7 +1989,7 @@ class TestSlapgridCPWithMasterPromise(MasterMixin, unittest.TestCase):
instance.setPromise('promise_%s' % i, promise)
self.assertEqual(self.grid.processComputerPartitionList(),
slapos.grid.slapgrid.SLAPGRID_PROMISE_FAIL)
self.assertEquals(instance.error, 1)
self.assertEqual(instance.error, 1)
self.assertNotEqual('started', instance.state)
def test_one_succeeding_one_timing_out_promises(self):
......@@ -2019,7 +2019,7 @@ class TestSlapgridCPWithMasterPromise(MasterMixin, unittest.TestCase):
self.assertEqual(self.grid.processComputerPartitionList(),
slapos.grid.slapgrid.SLAPGRID_PROMISE_FAIL)
self.assertEquals(instance.error, 1)
self.assertEqual(instance.error, 1)
self.assertNotEqual(instance.state, 'started')
def test_promise_run_if_partition_started_fail(self):
......
......@@ -270,7 +270,7 @@ class TestInformation(BasicMixin, unittest.TestCase):
'/getComputerPartitionCertificate?computer_id=%s&computer_partition_id=%s' % (
self.computer_id, 'slappart0'))
response = xml_marshaller.xml_marshaller.loads(rv.data)
self.assertEquals({'certificate': '', 'key': ''}, response)
self.assertEqual({'certificate': '', 'key': ''}, response)
def test_computerBang(self):
"""
......@@ -278,7 +278,7 @@ class TestInformation(BasicMixin, unittest.TestCase):
"""
rv = self.app.post( '/computerBang?computer_id=%s' % ( self.computer_id))
response = xml_marshaller.xml_marshaller.loads(rv.data)
self.assertEquals('', response)
self.assertEqual('', response)
class MasterMixin(BasicMixin, unittest.TestCase):
"""
......
......@@ -83,28 +83,28 @@ class TestUtil(unittest.TestCase):
uid_check_root_slaptest = os.stat(root_slaptest)[4]
gid_check_root_slaptest = os.stat(root_slaptest)[5]
self.assertEquals(uid, uid_check_root_slaptest)
self.assertEquals(gid, gid_check_root_slaptest)
self.assertEqual(uid, uid_check_root_slaptest)
self.assertEqual(gid, gid_check_root_slaptest)
uid_check_wanted_directory0 = os.stat(wanted_directory0)[4]
gid_check_wanted_directory0 = os.stat(wanted_directory0)[5]
self.assertEquals(uid, uid_check_wanted_directory0)
self.assertEquals(gid, gid_check_wanted_directory0)
self.assertEqual(uid, uid_check_wanted_directory0)
self.assertEqual(gid, gid_check_wanted_directory0)
uid_check_wanted_directory1 = os.stat(wanted_directory1)[4]
gid_check_wanted_directory1 = os.stat(wanted_directory1)[5]
self.assertEquals(uid, uid_check_wanted_directory1)
self.assertEquals(gid, gid_check_wanted_directory1)
self.assertEqual(uid, uid_check_wanted_directory1)
self.assertEqual(gid, gid_check_wanted_directory1)
uid_check_wanted_directory2 = os.stat(wanted_directory2)[4]
gid_check_wanted_directory2 = os.stat(wanted_directory2)[5]
self.assertEquals(uid, uid_check_wanted_directory2)
self.assertEquals(gid, gid_check_wanted_directory2)
self.assertEqual(uid, uid_check_wanted_directory2)
self.assertEqual(gid, gid_check_wanted_directory2)
uid_check_file_txt = os.stat(create_file_txt[1])[4]
gid_check_file_txt = os.stat(create_file_txt[1])[5]
self.assertEquals(uid, uid_check_file_txt)
self.assertEquals(gid, gid_check_file_txt)
self.assertEqual(uid, uid_check_file_txt)
self.assertEqual(gid, gid_check_file_txt)
shutil.rmtree(root_slaptest)
......
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