From d18c84809a8701a4f9fc030ee1d634bc9331d58c Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Wed, 8 Jan 2014 17:49:30 +0100 Subject: [PATCH] stop using deprecated aliases of TestCase methods. see http://docs.python.org/2/library/unittest.html#deprecated-aliases --- ...erp5.testMaxmaDemoConfigurationWorkflow.py | 14 +- bt5/erp5_configurator_maxma_demo/bt/revision | 2 +- ....erp5.testRunMyDocConfigurationWorkflow.py | 42 +- bt5/erp5_configurator_run_my_doc/bt/revision | 2 +- ....erp5.testStandardConfigurationWorkflow.py | 500 +++++----- bt5/erp5_configurator_standard/bt/revision | 2 +- .../test.erp5.testUNGConfigurationWorkflow.py | 134 +-- bt5/erp5_configurator_ung/bt/revision | 2 +- .../test.erp5.TestEGovMixin.py | 6 +- bt5/erp5_egov/bt/revision | 2 +- .../test.erp5.testDiscussionThread.py | 16 +- bt5/erp5_forum_tutorial/bt/revision | 2 +- .../test.erp5.testLiveIngestion.py | 30 +- bt5/erp5_ingestion/bt/revision | 2 +- .../test.erp5.testERP5PaypalSecurePayment.py | 2 +- bt5/erp5_paypal_secure_payment/bt/revision | 2 +- ...test.erp5.testResearchItemSummaryReport.py | 12 +- bt5/erp5_research_item/bt/revision | 2 +- .../TestTemplateItem/testRunMyDoc.py | 18 +- bt5/erp5_run_my_doc/bt/revision | 2 +- .../test.erp5.testSafeImage.py | 26 +- bt5/erp5_safeimage/bt/revision | 2 +- .../test.erp5.testERP5SocialContracts.py | 20 +- bt5/erp5_social_contracts/bt/revision | 2 +- .../test.erp5.testTaskDistribution.py | 58 +- bt5/erp5_test_result/bt/revision | 2 +- .../test.erp5.testLiveUpgrader.py | 64 +- bt5/erp5_upgrader/bt/revision | 2 +- .../test.erp5.testShaCache.py | 20 +- bt5/erp5_web_shacache/bt/revision | 2 +- .../portal_components/test.erp5.testShaDir.py | 44 +- bt5/erp5_web_shadir/bt/revision | 2 +- .../test.erp5.testUNGSecurity.py | 40 +- bt5/erp5_web_ung_role/bt/revision | 2 +- .../portal_components/test.erp5.testUNG.py | 126 +-- bt5/erp5_web_ung_theme/bt/revision | 2 +- .../test.erp5.testShaCacheExternal.py | 22 +- .../test.erp5.testShaCacheSecurity.py | 2 +- .../test.erp5.testShaDirExternal.py | 28 +- .../test.erp5.testShaDirSecurity.py | 4 +- bt5/networkcache_erp5/bt/revision | 2 +- product/CMFActivity/tests/testCMFActivity.py | 260 +++--- product/CMFCategory/tests/testCMFCategory.py | 250 ++--- product/ERP5/tests/testAccessTab.py | 36 +- product/ERP5/tests/testAccounting.py | 860 +++++++++--------- product/ERP5/tests/testAccountingReports.py | 546 +++++------ product/ERP5/tests/testAccountingRules.py | 130 +-- .../ERP5/tests/testAccounting_l10n_fr_m9.py | 34 +- product/ERP5/tests/testAdvancedInvoicing.py | 76 +- product/ERP5/tests/testAlarm.py | 120 +-- product/ERP5/tests/testAmount.py | 406 ++++----- product/ERP5/tests/testApparelModel.py | 2 +- .../ERP5/tests/testApparelTransformation.py | 10 +- product/ERP5/tests/testBPMCore.py | 54 +- product/ERP5/tests/testBase.py | 148 +-- product/ERP5/tests/testBudget.py | 330 +++---- product/ERP5/tests/testBug.py | 50 +- product/ERP5/tests/testBusinessTemplate.py | 796 ++++++++-------- product/ERP5/tests/testCRM.py | 270 +++--- product/ERP5/tests/testCalendar.py | 172 ++-- product/ERP5/tests/testContentTranslation.py | 36 +- .../ERP5/tests/testConversionInSimulation.py | 40 +- product/ERP5/tests/testCrmReports.py | 128 +-- product/ERP5/tests/testDataProtection.py | 4 +- ...stDeliveryBuilderToSupportMultipleLines.py | 76 +- product/ERP5/tests/testDomainTool.py | 56 +- product/ERP5/tests/testERP5Administration.py | 6 +- product/ERP5/tests/testERP5Base.py | 456 +++++----- product/ERP5/tests/testERP5Category.py | 48 +- product/ERP5/tests/testERP5Commerce.py | 122 +-- product/ERP5/tests/testERP5Coordinate.py | 56 +- product/ERP5/tests/testERP5Core.py | 62 +- product/ERP5/tests/testERP5Credential.py | 124 +-- .../tests/testERP5CurrencyExchangeLine.py | 100 +- product/ERP5/tests/testERP5Simulation.py | 20 +- product/ERP5/tests/testERP5Web.py | 202 ++-- product/ERP5/tests/testERP5WebWithCRM.py | 26 +- product/ERP5/tests/testERP5WebWithDms.py | 95 +- product/ERP5/tests/testERP5eGov.py | 30 +- product/ERP5/tests/testEditorField.py | 6 +- .../ERP5/tests/testFieldLibraryGuideline.py | 38 +- product/ERP5/tests/testGeographicalAddress.py | 4 +- product/ERP5/tests/testI18NSearch.py | 8 +- product/ERP5/tests/testICal.py | 56 +- product/ERP5/tests/testIdTool.py | 110 +-- product/ERP5/tests/testIdToolUpgrade.py | 38 +- product/ERP5/tests/testImmobilisation.py | 96 +- product/ERP5/tests/testIntrospectionTool.py | 2 +- product/ERP5/tests/testInventory.py | 60 +- product/ERP5/tests/testInventoryAPI.py | 732 +++++++-------- product/ERP5/tests/testInventoryModule.py | 34 +- product/ERP5/tests/testInvoice.py | 486 +++++----- product/ERP5/tests/testItem.py | 156 ++-- product/ERP5/tests/testKM.py | 54 +- product/ERP5/tests/testMRP.py | 20 +- product/ERP5/tests/testMilestoneReporting.py | 8 +- product/ERP5/tests/testMovementGroup.py | 78 +- product/ERP5/tests/testNotificationTool.py | 78 +- product/ERP5/tests/testOrder.py | 492 +++++----- product/ERP5/tests/testPackingList.py | 174 ++-- product/ERP5/tests/testPasswordTool.py | 20 +- product/ERP5/tests/testPayroll.py | 332 +++---- product/ERP5/tests/testPayroll_l10n_fr.py | 8 +- product/ERP5/tests/testPerson.py | 38 +- product/ERP5/tests/testPredicate.py | 28 +- product/ERP5/tests/testProductionOrder.py | 154 ++-- .../ERP5/tests/testProductionOrderApparel.py | 140 +-- .../ERP5/tests/testProductionPackingList.py | 80 +- product/ERP5/tests/testProject.py | 14 +- product/ERP5/tests/testQueryModule.py | 20 +- product/ERP5/tests/testRSS.py | 64 +- product/ERP5/tests/testResource.py | 56 +- .../ERP5/tests/testReturnedSalePackingList.py | 66 +- product/ERP5/tests/testRule.py | 98 +- .../tests/testSimulationElementPerformance.py | 164 ++-- product/ERP5/tests/testSpellChecking.py | 8 +- product/ERP5/tests/testSupply.py | 12 +- product/ERP5/tests/testTask.py | 80 +- .../ERP5/tests/testTaskReportDivergence.py | 28 +- product/ERP5/tests/testTaskReporting.py | 8 +- product/ERP5/tests/testTemplate.py | 28 +- product/ERP5/tests/testTemplateTool.py | 128 +-- product/ERP5/tests/testTradeCondition.py | 110 +-- product/ERP5/tests/testTradeModelLine.py | 60 +- product/ERP5/tests/testTradeReports.py | 66 +- product/ERP5/tests/testTransformation.py | 44 +- product/ERP5/tests/testTranslation.py | 30 +- product/ERP5/tests/testTrashTool.py | 60 +- product/ERP5/tests/testUrl.py | 16 +- product/ERP5/tests/testWebCrawler.py | 28 +- product/ERP5/tests/testWebDavSupport.py | 34 +- product/ERP5/tests/testWorklist.py | 10 +- product/ERP5/tests/testXHTML.py | 8 +- .../ERP5Banking/tests/TestERP5BankingMixin.py | 2 +- .../tests/testERP5BankingCheckPayment.py | 14 +- .../testERP5BankingCheckbookReception.py | 8 +- .../testERP5BankingCheckbookVaultTransfer.py | 2 +- .../testERP5BankingClassificationSurvey.py | 4 +- .../tests/testERP5BankingCounterDate.py | 2 +- .../testERP5BankingTravelerCheckPurchase.py | 2 +- .../tests/testERP5BankingTravelerCheckSale.py | 2 +- product/ERP5Catalog/tests/testArchive.py | 18 +- product/ERP5Catalog/tests/testERP5Catalog.py | 382 ++++---- .../testERP5CatalogSecurityUidOptimization.py | 16 +- .../tests/ConfiguratorTestMixin.py | 212 ++--- .../tests/testConfiguratorItem.py | 216 ++--- .../tests/testConfiguratorTool.py | 2 +- product/ERP5Form/tests/testAudioField.py | 4 +- product/ERP5Form/tests/testFieldValueCache.py | 4 +- product/ERP5Form/tests/testFields.py | 252 ++--- product/ERP5Form/tests/testGUIwithSecurity.py | 2 +- product/ERP5Form/tests/testListBox.py | 30 +- product/ERP5Form/tests/testOOoChart.py | 32 +- product/ERP5Form/tests/testPlanningBox.py | 32 +- product/ERP5Form/tests/testPreferences.py | 132 +-- product/ERP5Form/tests/testProxyField.py | 12 +- product/ERP5Form/tests/testScribusUtils.py | 38 +- product/ERP5Form/tests/testSelectionTool.py | 90 +- product/ERP5Form/tests/testVideoField.py | 4 +- product/ERP5OOo/tests/testDeferredStyle.py | 12 +- product/ERP5OOo/tests/testDms.py | 348 +++---- .../ERP5OOo/tests/testFormPrintoutAsODG.py | 2 +- .../ERP5OOo/tests/testFormPrintoutAsODT.py | 58 +- product/ERP5OOo/tests/testIngestion.py | 384 ++++---- .../ERP5OOo/tests/testOOoConversionCache.py | 12 +- product/ERP5OOo/tests/testOOoDynamicStyle.py | 8 +- product/ERP5OOo/tests/testOOoImport.py | 86 +- product/ERP5OOo/tests/testOOoParser.py | 50 +- product/ERP5OOo/tests/testOOoStyle.py | 92 +- .../ERP5Security/tests/testERP5Security.py | 44 +- .../tests/testERP5DocumentSyncML.py | 50 +- product/ERP5SyncML/tests/testERP5SyncML.py | 426 ++++----- .../ERP5SyncML/tests/testERP5SyncMLVCard.py | 28 +- .../tests/testBusinessTemplateInstallation.py | 2 +- .../tests/testSaleOrderERP5Synchronization.py | 8 +- .../tests/ERP5TypeFunctionalTestCase.py | 2 +- product/ERP5Type/tests/ERP5TypeTestCase.py | 6 +- product/ERP5Type/tests/_testSQLBench.py | 2 +- .../ERP5Type/tests/namingConventionTest.py | 2 +- .../ERP5Type/tests/testBackportUnittest.py | 84 +- product/ERP5Type/tests/testCSSPacker.py | 8 +- product/ERP5Type/tests/testCacheTool.py | 18 +- product/ERP5Type/tests/testClassTool.py | 4 +- product/ERP5Type/tests/testConstraint.py | 8 +- .../tests/testDynamicClassGeneration.py | 204 ++--- product/ERP5Type/tests/testERP5Type.py | 794 ++++++++-------- product/ERP5Type/tests/testFolder.py | 38 +- product/ERP5Type/tests/testFolderMigration.py | 150 +-- product/ERP5Type/tests/testJSPacker.py | 4 +- product/ERP5Type/tests/testLocalizer.py | 28 +- product/ERP5Type/tests/testMemcachedTool.py | 2 +- product/ERP5Type/tests/testPerformance.py | 12 +- product/ERP5Type/tests/testSessionTool.py | 20 +- .../tests/testTransactionalVariable.py | 48 +- product/ERP5Type/tests/testXMLMatrix.py | 32 +- product/ERP5Wizard/tests/testGeneratorCall.py | 20 +- .../ERP5Workflow/tests/testERP5Workflow.py | 20 +- product/Formulator/tests/testForm.py | 26 +- product/Formulator/tests/testFormValidator.py | 90 +- product/Formulator/tests/testSerializeForm.py | 40 +- .../tests/test_FSMailTemplate.py | 6 +- .../MailTemplates/tests/test_MailTemplate.py | 20 +- .../tests/testImageMagickPortalTransforms.py | 28 +- product/PortalTransforms/tests/test_engine.py | 70 +- product/PortalTransforms/tests/test_graph.py | 6 +- .../PortalTransforms/tests/test_transforms.py | 32 +- product/ZSQLCatalog/tests/testZSQLCatalog.py | 18 +- product/Zelenium/tests/test_zuite.py | 30 +- 208 files changed, 8636 insertions(+), 8633 deletions(-) diff --git a/bt5/erp5_configurator_maxma_demo/TestTemplateItem/portal_components/test.erp5.testMaxmaDemoConfigurationWorkflow.py b/bt5/erp5_configurator_maxma_demo/TestTemplateItem/portal_components/test.erp5.testMaxmaDemoConfigurationWorkflow.py index 0a816e0e8a..36c3b73762 100644 --- a/bt5/erp5_configurator_maxma_demo/TestTemplateItem/portal_components/test.erp5.testMaxmaDemoConfigurationWorkflow.py +++ b/bt5/erp5_configurator_maxma_demo/TestTemplateItem/portal_components/test.erp5.testMaxmaDemoConfigurationWorkflow.py @@ -83,8 +83,8 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin): response_dict = sequence.get("response_dict") # configuration is finished. We are at the Install state. # On maxma demo, installation is the first slide. - self.assertEquals('show', response_dict['command']) - self.assertEquals('Install', response_dict['next']) + self.assertEqual('show', response_dict['command']) + self.assertEqual('Install', response_dict['next']) def stepSetMaxmaDemoWorkflow(self, sequence=None, sequence_list=None, **kw): """ Set Consulting Workflow into Business Configuration """ @@ -130,7 +130,7 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin): # Check Gadgets for gadget in self.portal.portal_gadgets.searchFolder(): - self.assertEquals('public', gadget.getValidationState(), + self.assertEqual('public', gadget.getValidationState(), "%s is not public but %s" % (gadget.getRelativeUrl(), gadget.getValidationState())) gadget.Base_checkConsistency() @@ -140,11 +140,11 @@ class TestMaxmaDemoConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin): reference=self.user_reference) self.assertNotEquals(user.Person_getAvailableAssignmentValueList(), []) - self.assertEquals(user.getTitle(), "Jack Vale") - self.assertEquals(user.getValidationState(), "validated") - self.assertEquals(user.getSubordination(), + self.assertEqual(user.getTitle(), "Jack Vale") + self.assertEqual(user.getValidationState(), "validated") + self.assertEqual(user.getSubordination(), 'organisation_module/myorganisation') - self.assertEquals(user.getSubordinationTitle(), "Maxma Co") + self.assertEqual(user.getSubordinationTitle(), "Maxma Co") ### STEPS DEFAULT_SEQUENCE_LIST = """ diff --git a/bt5/erp5_configurator_maxma_demo/bt/revision b/bt5/erp5_configurator_maxma_demo/bt/revision index 8580e7b684..b74e882ae3 100644 --- a/bt5/erp5_configurator_maxma_demo/bt/revision +++ b/bt5/erp5_configurator_maxma_demo/bt/revision @@ -1 +1 @@ -30 \ No newline at end of file +31 \ No newline at end of file diff --git a/bt5/erp5_configurator_run_my_doc/TestTemplateItem/portal_components/test.erp5.testRunMyDocConfigurationWorkflow.py b/bt5/erp5_configurator_run_my_doc/TestTemplateItem/portal_components/test.erp5.testRunMyDocConfigurationWorkflow.py index cb6c503181..7775eeb4e3 100644 --- a/bt5/erp5_configurator_run_my_doc/TestTemplateItem/portal_components/test.erp5.testRunMyDocConfigurationWorkflow.py +++ b/bt5/erp5_configurator_run_my_doc/TestTemplateItem/portal_components/test.erp5.testRunMyDocConfigurationWorkflow.py @@ -114,13 +114,13 @@ class TestRunMyDocsConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): """ Check if organisation was created fine """ business_configuration = sequence.get("business_configuration") organisation_config_save = business_configuration['3'] - self.assertEquals(organisation_config_save.getTitle(), + self.assertEqual(organisation_config_save.getTitle(), "My Organisation") - self.assertEquals(1, len(organisation_config_save.contentValues())) + self.assertEqual(1, len(organisation_config_save.contentValues())) organisation_config_item = organisation_config_save['1'] - self.assertEquals(organisation_config_item.getPortalType(), + self.assertEqual(organisation_config_item.getPortalType(), 'Organisation Configurator Item') - self.assertEquals(organisation_config_item.getDefaultEmailText(), + self.assertEqual(organisation_config_item.getDefaultEmailText(), 'me@example.com') def stepSetupUserAccountNumberThree(self, sequence=None, sequence_list=None, **kw): @@ -140,9 +140,9 @@ class TestRunMyDocsConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): """ Check the multiple user account form """ response_dict = sequence.get("response_dict") if 'command' in response_dict: - self.assertEquals('show', response_dict['command']) - self.assertEquals('Previous', response_dict['previous']) - self.assertEquals('Configure ERP5 Preferences', response_dict['next']) + self.assertEqual('show', response_dict['command']) + self.assertEqual('Previous', response_dict['previous']) + self.assertEqual('Configure ERP5 Preferences', response_dict['next']) self.assertCurrentStep('RunMyDoc Preferences', response_dict) def stepSetupPreferenceConfigurationBrazil(self, sequence=None, sequence_list=None, **kw): @@ -166,30 +166,30 @@ class TestRunMyDocsConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): business_configuration = sequence.get("business_configuration") person_config_save = business_configuration["5"] person_config_item = person_config_save["1"] - self.assertEquals(person_config_item.getReference(), "person_creator") + self.assertEqual(person_config_item.getReference(), "person_creator") person_config_item = person_config_save["2"] - self.assertEquals(person_config_item.getReference(), "person_assignee") + self.assertEqual(person_config_item.getReference(), "person_assignee") person_config_item = person_config_save["3"] - self.assertEquals(person_config_item.getReference(), "person_assignor") + self.assertEqual(person_config_item.getReference(), "person_assignor") def stepCheckMultipleUserAccountThreeFrance(self, sequence=None, sequence_list=None, **kw): """ Check if the users were created correctly """ business_configuration = sequence.get("business_configuration") person_config_save = business_configuration["5"] person_config_item = person_config_save["1"] - self.assertEquals(person_config_item.getReference(), "french_creator") + self.assertEqual(person_config_item.getReference(), "french_creator") person_config_item = person_config_save["2"] - self.assertEquals(person_config_item.getReference(), "french_assignee") + self.assertEqual(person_config_item.getReference(), "french_assignee") person_config_item = person_config_save["3"] - self.assertEquals(person_config_item.getReference(), "french_assignor") + self.assertEqual(person_config_item.getReference(), "french_assignor") def stepCheckSystemPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw): """ Check System Preference""" system_preference = self.portal.portal_catalog.getResultValue(portal_type="System Preference") conversion_dict = _getConversionServerDict() - self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(), + self.assertEqual(system_preference.getPreferredOoodocServerPortNumber(), conversion_dict['port']) - self.assertEquals(system_preference.getPreferredOoodocServerAddress(), + self.assertEqual(system_preference.getPreferredOoodocServerAddress(), conversion_dict['hostname']) def stepCheckUserPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw): @@ -197,13 +197,13 @@ class TestRunMyDocsConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): portal_catalog = self.portal.portal_catalog preference = portal_catalog.getResultValue(portal_type="Preference", title='Preference for Person Assignor') - self.assertEquals(preference.getPreferenceState(), "enabled") + self.assertEqual(preference.getPreferenceState(), "enabled") preference = portal_catalog.getResultValue(portal_type="Preference", title='Preference for Person Assignee') - self.assertEquals(preference.getPreferenceState(), "enabled") + self.assertEqual(preference.getPreferenceState(), "enabled") preference = portal_catalog.getResultValue(portal_type="Preference", title='Preference for Person Creator') - self.assertEquals(preference.getPreferenceState(), "enabled") + self.assertEqual(preference.getPreferenceState(), "enabled") def _stepCheckKnowledgePadRole(self): """ Check if Knowledge Pad is configured correctly """ @@ -216,10 +216,10 @@ class TestRunMyDocsConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): self.portal.KnowledgePad_addBoxList(uids=[gadget_uid], active_pad_relative_url=pad.getRelativeUrl()) self.tic() - self.assertEquals(len(pad.contentValues()), 1) + self.assertEqual(len(pad.contentValues()), 1) box = pad.contentValues()[0] - self.assertEquals(box.getValidationState(), 'visible') - self.assertEquals(box.getSpecialise(), 'portal_gadgets/test_wizard_gadget') + self.assertEqual(box.getValidationState(), 'visible') + self.assertEqual(box.getSpecialise(), 'portal_gadgets/test_wizard_gadget') class TestRunMyDocsConfiguratorWorkflowFranceLanguage(TestRunMyDocsConfiguratorWorkflowMixin): """ diff --git a/bt5/erp5_configurator_run_my_doc/bt/revision b/bt5/erp5_configurator_run_my_doc/bt/revision index 3cacc0b93c..ca7bf83ac5 100644 --- a/bt5/erp5_configurator_run_my_doc/bt/revision +++ b/bt5/erp5_configurator_run_my_doc/bt/revision @@ -1 +1 @@ -12 \ No newline at end of file +13 \ No newline at end of file diff --git a/bt5/erp5_configurator_standard/TestTemplateItem/portal_components/test.erp5.testStandardConfigurationWorkflow.py b/bt5/erp5_configurator_standard/TestTemplateItem/portal_components/test.erp5.testStandardConfigurationWorkflow.py index 8b43ef4194..abca208f59 100644 --- a/bt5/erp5_configurator_standard/TestTemplateItem/portal_components/test.erp5.testStandardConfigurationWorkflow.py +++ b/bt5/erp5_configurator_standard/TestTemplateItem/portal_components/test.erp5.testStandardConfigurationWorkflow.py @@ -184,15 +184,15 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): person_list = self.getBusinessConfigurationObjectList(business_configuration, 'Person') self.assertNotEquals(len(person_list), 0) for person in person_list: - self.assertEquals('validated', person.getValidationState()) + self.assertEqual('validated', person.getValidationState()) person.Base_checkConsistency() assignment_list = person.contentValues(portal_type='Assignment') self.assertNotEquals(len(assignment_list), 0) for assignment in assignment_list: - self.assertEquals('open', assignment.getValidationState()) + self.assertEqual('open', assignment.getValidationState()) self.assertNotEquals(None, assignment.getStartDate()) self.assertNotEquals(None, assignment.getStopDate()) - self.assertEquals(assignment.getGroup(), "my_group") + self.assertEqual(assignment.getGroup(), "my_group") assignment.Base_checkConsistency() def stepCheckPersonInformationList(self, sequence=None, sequence_list=None, **kw): @@ -201,7 +201,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): """ business_configuration = sequence.get("business_configuration") person_list = self.getBusinessConfigurationObjectList(business_configuration, 'Person') - self.assertEquals(len(person_list), len(self.user_list)) + self.assertEqual(len(person_list), len(self.user_list)) for person in person_list: user_info = None for user_dict in self.user_list: @@ -210,21 +210,21 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): break self.assertNotEquals(user_info, None) - self.assertEquals(user_info["field_your_first_name"], + self.assertEqual(user_info["field_your_first_name"], person.getFirstName()) - self.assertEquals(user_info["field_your_last_name"], + self.assertEqual(user_info["field_your_last_name"], person.getLastName()) self.assertNotEquals(person.getPassword(), None) - self.assertEquals(user_info["field_your_function"], + self.assertEqual(user_info["field_your_function"], person.getFunction()) - self.assertEquals(user_info["field_your_default_email_text"], + self.assertEqual(user_info["field_your_default_email_text"], person.getDefaultEmailText()) - self.assertEquals(user_info["field_your_default_telephone_text"], + self.assertEqual(user_info["field_your_default_telephone_text"], person.getDefaultTelephoneText()) assignment_list = person.contentValues(portal_type='Assignment') - self.assertEquals(len(assignment_list), 1) - self.assertEquals('my_group', assignment_list[0].getGroup()) + self.assertEqual(len(assignment_list), 1) + self.assertEqual('my_group', assignment_list[0].getGroup()) def stepCheckSocialTitleCategory(self, sequence=None,sequence_list=None, **kw): """Check that the social title category is configured. @@ -240,7 +240,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): organisation_list = self.getBusinessConfigurationObjectList(business_configuration, 'Organisation') self.assertNotEquals(len(organisation_list), 0) organisation = organisation_list[0] - self.assertEquals('validated', organisation.getValidationState()) + self.assertEqual('validated', organisation.getValidationState()) organisation.Base_checkConsistency() def stepCheckBaseCategoryList(self, sequence=None, sequence_list=None, **kw): @@ -249,9 +249,9 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): We use role as an example """ role = self.portal.portal_categories.role - self.assertEquals('Role', role.getTitle()) - self.assertEquals(['subordination'], role.getAcquisitionBaseCategoryList()) - self.assertEquals(['default_career'], role.getAcquisitionObjectIdList()) + self.assertEqual('Role', role.getTitle()) + self.assertEqual(['subordination'], role.getAcquisitionBaseCategoryList()) + self.assertEqual(['default_career'], role.getAcquisitionObjectIdList()) # ... this is enough to proove it has not been erased by an empty one def stepCheckOrganisationSite(self, sequence=None, sequence_list=None, **kw): @@ -262,7 +262,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): organisation_list = self.getBusinessConfigurationObjectList(business_configuration, 'Organisation') self.assertNotEquals(len(organisation_list), 0) - self.assertEquals(self.portal.portal_categories.site.main, + self.assertEqual(self.portal.portal_categories.site.main, organisation_list[0].getSiteValue()) @@ -290,7 +290,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): currency_list = self.getBusinessConfigurationObjectList(business_configuration, 'Currency') self.assertNotEquals(len(currency_list), 0) for currency in currency_list: - self.assertEquals('validated', currency.getValidationState()) + self.assertEqual('validated', currency.getValidationState()) currency.Base_checkConsistency() def stepCheckValidServiceList(self, sequence=None, sequence_list=None, **kw): @@ -301,7 +301,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): service_list = self.getBusinessConfigurationObjectList(business_configuration, 'Service') self.assertNotEquals(len(service_list), 0) for service in service_list: - self.assertEquals('validated', service.getValidationState()) + self.assertEqual('validated', service.getValidationState()) self.assertNotEquals(None, service.getUseValue()) service.Base_checkConsistency() @@ -311,12 +311,12 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): """ business_configuration = sequence.get("business_configuration") alarm_list = self.getBusinessConfigurationObjectList(business_configuration, 'Alarm') - self.assertEquals(len(alarm_list), 2) + self.assertEqual(len(alarm_list), 2) for alarm in alarm_list: - self.failUnless(alarm.getPeriodicityStartDate() < DateTime()) + self.assertTrue(alarm.getPeriodicityStartDate() < DateTime()) self.assertNotEquals(alarm.getPeriodicityStartDate(), None) - self.assertEquals(alarm.getPeriodicityMinuteFrequency(), 5) - self.assertEquals(alarm.getEnabled(), True) + self.assertEqual(alarm.getPeriodicityMinuteFrequency(), 5) + self.assertEqual(alarm.getEnabled(), True) self.assertNotEquals(alarm.getActiveSenseMethodId(), None) def stepCheckPublicGadgetList(self, sequence=None, sequence_list=None, **kw): @@ -326,7 +326,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): business_configuration = sequence.get("business_configuration") gadget_list = self.getBusinessConfigurationObjectList(business_configuration, 'Gadget') for gadget in gadget_list: - self.assertEquals('public', gadget.getValidationState(), + self.assertEqual('public', gadget.getValidationState(), "%s is not public but %s" % (gadget.getRelativeUrl(), gadget.getValidationState())) gadget.Base_checkConsistency() @@ -339,10 +339,10 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): business_configuration = sequence.get("business_configuration") bt5_object = business_configuration.getSpecialiseValue() preference_list = bt5_object.getTemplatePreferenceList() - self.assertEquals(len(preference_list), 2) + self.assertEqual(len(preference_list), 2) for preference in preference_list: - self.assertEquals(preference_tool[preference].getPreferenceState(), + self.assertEqual(preference_tool[preference].getPreferenceState(), 'global') organisation_list = self.getBusinessConfigurationObjectList(business_configuration, @@ -353,49 +353,49 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): # ui # The default preferences are not disabled anymore, there is no reason to # assert such properties. - #self.assertEquals('dmy', preference_tool.getPreferredDateOrder()) + #self.assertEqual('dmy', preference_tool.getPreferredDateOrder()) #self.assertTrue(preference_tool.getPreferredHtmlStyleAccessTab()) - self.assertEquals('ODT', preference_tool.getPreferredReportStyle()) - self.assertEquals('pdf', preference_tool.getPreferredReportFormat()) - self.assertEquals(10, preference_tool.getPreferredMoneyQuantityFieldWidth()) + self.assertEqual('ODT', preference_tool.getPreferredReportStyle()) + self.assertEqual('pdf', preference_tool.getPreferredReportFormat()) + self.assertEqual(10, preference_tool.getPreferredMoneyQuantityFieldWidth()) currency_reference = sequence.get('configuration_currency_reference') - self.assertEquals('currency_module/%s' % currency_reference, + self.assertEqual('currency_module/%s' % currency_reference, preference_tool.getPreferredAccountingTransactionCurrency()) - self.assertEquals(sequence.get('configuration_gap') , + self.assertEqual(sequence.get('configuration_gap') , preference_tool.getPreferredAccountingTransactionGap()) # on Business Configuration - #self.assertEquals('localhost', preference_tool.getPreferredOoodocServerAddress()) - #self.assertEquals(8011, preference_tool.getPreferredOoodocServerPortNumber()) + #self.assertEqual('localhost', preference_tool.getPreferredOoodocServerAddress()) + #self.assertEqual(8011, preference_tool.getPreferredOoodocServerPortNumber()) # accounting - self.assertEquals('group/my_group', + self.assertEqual('group/my_group', preference_tool.getPreferredAccountingTransactionSectionCategory()) - self.assertEquals('organisation_module/%s' % organisation_id, + self.assertEqual('organisation_module/%s' % organisation_id, preference_tool.getPreferredAccountingTransactionSourceSection()) - self.assertEquals(preference_tool.getPreferredSectionCategory(), + self.assertEqual(preference_tool.getPreferredSectionCategory(), 'group/my_group') - self.assertEquals('organisation_module/%s' % organisation_id, + self.assertEqual('organisation_module/%s' % organisation_id, preference_tool.getPreferredSection()) self.assertSameSet(['delivered', 'stopped'], preference_tool.getPreferredAccountingTransactionSimulationStateList()) # trade - self.assertEquals(['role/supplier'], preference_tool.getPreferredSupplierRoleList()) - self.assertEquals(['role/client'], preference_tool.getPreferredClientRoleList()) - self.assertEquals(['use/trade/sale'], preference_tool.getPreferredSaleUseList()) - self.assertEquals(['use/trade/purchase'], preference_tool.getPreferredPurchaseUseList()) - self.assertEquals(['use/trade/container'], preference_tool.getPreferredPackingUseList()) - self.assertEquals(['use/trade/tax'], preference_tool.getPreferredTaxUseList()) + self.assertEqual(['role/supplier'], preference_tool.getPreferredSupplierRoleList()) + self.assertEqual(['role/client'], preference_tool.getPreferredClientRoleList()) + self.assertEqual(['use/trade/sale'], preference_tool.getPreferredSaleUseList()) + self.assertEqual(['use/trade/purchase'], preference_tool.getPreferredPurchaseUseList()) + self.assertEqual(['use/trade/container'], preference_tool.getPreferredPackingUseList()) + self.assertEqual(['use/trade/tax'], preference_tool.getPreferredTaxUseList()) # CRM - self.assertEquals(['use/crm/event'], preference_tool.getPreferredEventUseList()) - self.assertEquals(['use/crm/campaign'], preference_tool.getPreferredCampaignUseList()) - self.assertEquals(['use/crm/sale_opportunity'], preference_tool.getPreferredSaleOpportunityUseList()) - self.assertEquals(['use/crm/support_request'], preference_tool.getPreferredSupportRequestUseList()) - self.assertEquals(['use/crm/meeting'], preference_tool.getPreferredMeetingUseList()) + self.assertEqual(['use/crm/event'], preference_tool.getPreferredEventUseList()) + self.assertEqual(['use/crm/campaign'], preference_tool.getPreferredCampaignUseList()) + self.assertEqual(['use/crm/sale_opportunity'], preference_tool.getPreferredSaleOpportunityUseList()) + self.assertEqual(['use/crm/support_request'], preference_tool.getPreferredSupportRequestUseList()) + self.assertEqual(['use/crm/meeting'], preference_tool.getPreferredMeetingUseList()) def stepCheckEventResourceItemList(self, sequence=None, sequence_list=None): self.assertTrue(self.all_username_list) @@ -436,29 +436,29 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): Test modules business application. """ ba = self.portal.portal_categories.business_application - self.assertEquals('Base', + self.assertEqual('Base', self.portal.organisation_module.getBusinessApplicationTitle()) - self.assertEquals('Base', + self.assertEqual('Base', self.portal.person_module.getBusinessApplicationTitle()) - self.assertEquals('Base', + self.assertEqual('Base', self.portal.currency_module.getBusinessApplicationTitle()) - self.assertEquals(set([self.portal.organisation_module, + self.assertEqual(set([self.portal.organisation_module, self.portal.person_module, self.portal.currency_module, ba.base]), set(ba.base.getBusinessApplicationRelatedValueList())) - self.assertEquals('CRM', + self.assertEqual('CRM', self.portal.campaign_module.getBusinessApplicationTitle()) - self.assertEquals('CRM', + self.assertEqual('CRM', self.portal.event_module.getBusinessApplicationTitle()) - self.assertEquals('CRM', + self.assertEqual('CRM', self.portal.sale_opportunity_module.getBusinessApplicationTitle()) - self.assertEquals('CRM', + self.assertEqual('CRM', self.portal.meeting_module.getBusinessApplicationTitle()) - self.assertEquals('CRM', + self.assertEqual('CRM', self.portal.support_request_module.getBusinessApplicationTitle()) - self.assertEquals(set([self.portal.campaign_module, + self.assertEqual(set([self.portal.campaign_module, self.portal.event_module, self.portal.sale_opportunity_module, self.portal.meeting_module, @@ -466,34 +466,34 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): ba.crm]), set(ba.crm.getBusinessApplicationRelatedValueList())) - self.assertEquals('Accounting', + self.assertEqual('Accounting', self.portal.account_module.getBusinessApplicationTitle()) - self.assertEquals('Accounting', + self.assertEqual('Accounting', self.portal.accounting_module.getBusinessApplicationTitle()) - self.assertEquals(set([self.portal.account_module, + self.assertEqual(set([self.portal.account_module, self.portal.accounting_module, ba.accounting]), set(ba.accounting.getBusinessApplicationRelatedValueList())) - self.assertEquals('Trade', + self.assertEqual('Trade', self.portal.sale_order_module.getBusinessApplicationTitle()) - self.assertEquals('Trade', + self.assertEqual('Trade', self.portal.purchase_order_module.getBusinessApplicationTitle()) - self.assertEquals('Trade', + self.assertEqual('Trade', self.portal.sale_trade_condition_module.getBusinessApplicationTitle()) - self.assertEquals('Trade', + self.assertEqual('Trade', self.portal.purchase_trade_condition_module.getBusinessApplicationTitle()) - self.assertEquals('Trade', + self.assertEqual('Trade', self.portal.sale_packing_list_module.getBusinessApplicationTitle()) - self.assertEquals('Trade', + self.assertEqual('Trade', self.portal.purchase_packing_list_module.getBusinessApplicationTitle()) - self.assertEquals('Trade', + self.assertEqual('Trade', self.portal.inventory_module.getBusinessApplicationTitle()) - self.assertEquals('Trade', + self.assertEqual('Trade', self.portal.internal_packing_list_module.getBusinessApplicationTitle()) - self.assertEquals('Trade', + self.assertEqual('Trade', self.portal.returned_sale_packing_list_module.getBusinessApplicationTitle()) - self.assertEquals(set([self.portal.sale_order_module, + self.assertEqual(set([self.portal.sale_order_module, self.portal.purchase_order_module, self.portal.sale_trade_condition_module, self.portal.purchase_trade_condition_module, @@ -505,19 +505,19 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): ba.trade]), set(ba.trade.getBusinessApplicationRelatedValueList())) - self.assertEquals('PDM', + self.assertEqual('PDM', self.portal.service_module.getBusinessApplicationTitle()) - self.assertEquals('PDM', + self.assertEqual('PDM', self.portal.product_module.getBusinessApplicationTitle()) - self.assertEquals('PDM', + self.assertEqual('PDM', self.portal.component_module.getBusinessApplicationTitle()) - self.assertEquals('PDM', + self.assertEqual('PDM', self.portal.transformation_module.getBusinessApplicationTitle()) - self.assertEquals('PDM', + self.assertEqual('PDM', self.portal.sale_supply_module.getBusinessApplicationTitle()) - self.assertEquals('PDM', + self.assertEqual('PDM', self.portal.purchase_supply_module.getBusinessApplicationTitle()) - self.assertEquals(set([self.portal.service_module, + self.assertEqual(set([self.portal.service_module, self.portal.product_module, self.portal.component_module, self.portal.transformation_module, @@ -534,7 +534,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): account_list = self.getBusinessConfigurationObjectList(business_configuration, 'Account') self.assertNotEquals(len(account_list), 0) for account in account_list: - self.assertEquals('validated', account.getValidationState()) + self.assertEqual('validated', account.getValidationState()) # all accounts have a financial section set correctly self.assertNotEquals(None, account.getFinancialSectionValue()) # all accounts have a gap correctly @@ -590,7 +590,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): validation_state="validated") self.assertTrue(len(rule_list) > 0) - self.assertEquals(int(rule_template.getVersion(0)) + 1, + self.assertEqual(int(rule_template.getVersion(0)) + 1, int(rule_list[-1].getVersion(0))) result = self.getBusinessConfigurationObjectList(business_configuration, @@ -608,79 +608,79 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): business_process_list = \ self.getBusinessConfigurationObjectList(business_configuration, 'Business Process') - self.assertEquals(len(business_process_list), 1) + self.assertEqual(len(business_process_list), 1) business_process = business_process_list[0] - self.assertEquals("default_erp5_business_process", + self.assertEqual("default_erp5_business_process", business_process.getReference()) - self.assertEquals("Default Trade Business Process", + self.assertEqual("Default Trade Business Process", business_process.getTitle()) order_path = getattr(business_process, "order_path", None) self.assertNotEquals(order_path, None) - self.assertEquals(order_path.getEfficiency(), 1.0) - self.assertEquals(order_path.getTradePhase(), 'trade/order') - self.assertEquals(order_path.getTradeDate(), 'trade_phase/trade/order') - self.assertEquals(order_path.getTestMethodId(), None) + self.assertEqual(order_path.getEfficiency(), 1.0) + self.assertEqual(order_path.getTradePhase(), 'trade/order') + self.assertEqual(order_path.getTradeDate(), 'trade_phase/trade/order') + self.assertEqual(order_path.getTestMethodId(), None) delivery_path = getattr(business_process, "delivery_path", None) self.assertNotEquals(delivery_path, None) - self.assertEquals(delivery_path.getEfficiency(), 1.0) - self.assertEquals(delivery_path.getTradePhase(), 'trade/delivery') - self.assertEquals(delivery_path.getTradeDate(), 'trade_phase/trade/order') - self.assertEquals(delivery_path.getTestMethodId(), None) + self.assertEqual(delivery_path.getEfficiency(), 1.0) + self.assertEqual(delivery_path.getTradePhase(), 'trade/delivery') + self.assertEqual(delivery_path.getTradeDate(), 'trade_phase/trade/order') + self.assertEqual(delivery_path.getTestMethodId(), None) invoicing_path = getattr(business_process, "invoicing_path", None) self.assertNotEquals(invoicing_path, None) - self.assertEquals(invoicing_path.getEfficiency(), 1.0) - self.assertEquals(invoicing_path.getTradePhase(), 'trade/invoicing') - self.assertEquals(invoicing_path.getTradeDate(), 'trade_phase/trade/delivery') - self.assertEquals(invoicing_path.getTestMethodId(), None) + self.assertEqual(invoicing_path.getEfficiency(), 1.0) + self.assertEqual(invoicing_path.getTradePhase(), 'trade/invoicing') + self.assertEqual(invoicing_path.getTradeDate(), 'trade_phase/trade/delivery') + self.assertEqual(invoicing_path.getTestMethodId(), None) tax_path = getattr(business_process, "tax_path", None) self.assertNotEquals(tax_path, None) - self.assertEquals(tax_path.getEfficiency(), 1.0) - self.assertEquals(tax_path.getTradePhase(), 'trade/tax') - self.assertEquals(tax_path.getTradeDate(), 'trade_phase/trade/invoicing') - self.assertEquals(tax_path.getTestMethodId(), None) + self.assertEqual(tax_path.getEfficiency(), 1.0) + self.assertEqual(tax_path.getTradePhase(), 'trade/tax') + self.assertEqual(tax_path.getTradeDate(), 'trade_phase/trade/invoicing') + self.assertEqual(tax_path.getTestMethodId(), None) accounting_credit_path = getattr(business_process, "accounting_credit_path", None) self.assertNotEquals(accounting_credit_path, None) - self.assertEquals(accounting_credit_path.getEfficiency(), -1.0) - self.assertEquals(accounting_credit_path.getTradePhase(), 'trade/accounting') - self.assertEquals(accounting_credit_path.getTradeDate(), 'trade_phase/trade/invoicing') - self.assertEquals(accounting_credit_path.getSource(), "account_module/receivable") - self.assertEquals(accounting_credit_path.getDestination(), "account_module/payable") + self.assertEqual(accounting_credit_path.getEfficiency(), -1.0) + self.assertEqual(accounting_credit_path.getTradePhase(), 'trade/accounting') + self.assertEqual(accounting_credit_path.getTradeDate(), 'trade_phase/trade/invoicing') + self.assertEqual(accounting_credit_path.getSource(), "account_module/receivable") + self.assertEqual(accounting_credit_path.getDestination(), "account_module/payable") accounting_debit_path = getattr(business_process, "accounting_debit_path", None) self.assertNotEquals(accounting_debit_path, None) - self.assertEquals(accounting_debit_path.getEfficiency(), 1.0) - self.assertEquals(accounting_debit_path.getTradePhase(), 'trade/accounting') - self.assertEquals(accounting_debit_path.getTradeDate(), 'trade_phase/trade/invoicing') - self.assertEquals(accounting_debit_path.getSource(), "account_module/sales") - self.assertEquals(accounting_debit_path.getDestination(), "account_module/purchase") + self.assertEqual(accounting_debit_path.getEfficiency(), 1.0) + self.assertEqual(accounting_debit_path.getTradePhase(), 'trade/accounting') + self.assertEqual(accounting_debit_path.getTradeDate(), 'trade_phase/trade/invoicing') + self.assertEqual(accounting_debit_path.getSource(), "account_module/sales") + self.assertEqual(accounting_debit_path.getDestination(), "account_module/purchase") order_link = getattr(business_process, "order_link", None) self.assertNotEquals(order_link, None) #self.assertTrue(order_link.getDeliverable()) - self.assertEquals(order_link.getSuccessor(), "trade_state/trade/ordered") - self.assertEquals(order_link.getPredecessor(),None) - self.assertEquals(order_link.getCompletedStateList(),["confirmed"]) - self.assertEquals(order_link.getFrozenState(), None) - self.assertEquals(order_link.getDeliveryBuilder(), None) - self.assertEquals(order_link.getTradePhase(),'trade/order') + self.assertEqual(order_link.getSuccessor(), "trade_state/trade/ordered") + self.assertEqual(order_link.getPredecessor(),None) + self.assertEqual(order_link.getCompletedStateList(),["confirmed"]) + self.assertEqual(order_link.getFrozenState(), None) + self.assertEqual(order_link.getDeliveryBuilder(), None) + self.assertEqual(order_link.getTradePhase(),'trade/order') deliver_link = getattr(business_process, "deliver_link", None) self.assertNotEquals(deliver_link, None) #self.assertTrue(deliver_link.getDeliverable()) - self.assertEquals(deliver_link.getSuccessor(),"trade_state/trade/delivered") - self.assertEquals(deliver_link.getPredecessor(),"trade_state/trade/ordered") - self.assertEquals(deliver_link.getCompletedStateList(),['delivered','started','stopped']) - self.assertEquals(deliver_link.getFrozenStateList(),['delivered','stopped']) - self.assertEquals(deliver_link.getTradePhase(),'trade/delivery') + self.assertEqual(deliver_link.getSuccessor(),"trade_state/trade/delivered") + self.assertEqual(deliver_link.getPredecessor(),"trade_state/trade/ordered") + self.assertEqual(deliver_link.getCompletedStateList(),['delivered','started','stopped']) + self.assertEqual(deliver_link.getFrozenStateList(),['delivered','stopped']) + self.assertEqual(deliver_link.getTradePhase(),'trade/delivery') - self.assertEquals(deliver_link.getDeliveryBuilderList(), + self.assertEqual(deliver_link.getDeliveryBuilderList(), ["portal_deliveries/sale_packing_list_builder", "portal_deliveries/internal_packing_list_builder", "portal_deliveries/purchase_packing_list_builder"]) @@ -688,39 +688,39 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): invoice_link = getattr(business_process, "invoice_link", None) self.assertNotEquals(invoice_link, None) #self.assertFalse(invoice_link.getDeliverable()) - self.assertEquals(invoice_link.getSuccessor(),"trade_state/trade/invoiced") - self.assertEquals(invoice_link.getPredecessor(),"trade_state/trade/delivered") - self.assertEquals(invoice_link.getCompletedStateList(), + self.assertEqual(invoice_link.getSuccessor(),"trade_state/trade/invoiced") + self.assertEqual(invoice_link.getPredecessor(),"trade_state/trade/delivered") + self.assertEqual(invoice_link.getCompletedStateList(), ['confirmed','delivered','started','stopped']) - self.assertEquals(invoice_link.getFrozenStateList(),['delivered','stopped']) - self.assertEquals(invoice_link.getTradePhase(),'trade/invoicing') + self.assertEqual(invoice_link.getFrozenStateList(),['delivered','stopped']) + self.assertEqual(invoice_link.getTradePhase(),'trade/invoicing') - self.assertEquals(invoice_link.getDeliveryBuilderList(), + self.assertEqual(invoice_link.getDeliveryBuilderList(), ["portal_deliveries/purchase_invoice_builder", "portal_deliveries/sale_invoice_builder"]) tax_link = getattr(business_process, "tax_link", None) self.assertNotEquals(tax_link, None) #self.assertFalse(tax_link.getDeliverable()) - self.assertEquals(tax_link.getSuccessor(),"trade_state/trade/invoiced") - self.assertEquals(tax_link.getPredecessor(),"trade_state/trade/invoiced") - self.assertEquals(tax_link.getCompletedStateList(), + self.assertEqual(tax_link.getSuccessor(),"trade_state/trade/invoiced") + self.assertEqual(tax_link.getPredecessor(),"trade_state/trade/invoiced") + self.assertEqual(tax_link.getCompletedStateList(), ['confirmed','delivered','started','stopped']) - self.assertEquals(tax_link.getFrozenStateList(),['delivered','stopped']) - self.assertEquals(tax_link.getTradePhase(),'trade/tax') + self.assertEqual(tax_link.getFrozenStateList(),['delivered','stopped']) + self.assertEqual(tax_link.getTradePhase(),'trade/tax') - self.assertEquals(tax_link.getDeliveryBuilderList(), + self.assertEqual(tax_link.getDeliveryBuilderList(), ["portal_deliveries/purchase_invoice_transaction_trade_model_builder", "portal_deliveries/sale_invoice_transaction_trade_model_builder"]) account_link = getattr(business_process, "account_link", None) self.assertNotEquals(account_link, None) #self.assertFalse(account_link.getDeliverable()) - self.assertEquals(account_link.getSuccessor(),"trade_state/trade/accounted") - self.assertEquals(account_link.getPredecessor(),"trade_state/trade/invoiced") - self.assertEquals(account_link.getCompletedStateList(),['delivered','started','stopped']) - self.assertEquals(account_link.getFrozenStateList(),['delivered','stopped']) - self.assertEquals(account_link.getTradePhase(), 'trade/accounting') + self.assertEqual(account_link.getSuccessor(),"trade_state/trade/accounted") + self.assertEqual(account_link.getPredecessor(),"trade_state/trade/invoiced") + self.assertEqual(account_link.getCompletedStateList(),['delivered','started','stopped']) + self.assertEqual(account_link.getFrozenStateList(),['delivered','stopped']) + self.assertEqual(account_link.getTradePhase(), 'trade/accounting') self.assertSameSet(account_link.getDeliveryBuilderList(), ["portal_deliveries/purchase_invoice_transaction_builder", @@ -729,14 +729,14 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): pay_link = getattr(business_process, "pay_link", None) self.assertNotEquals(pay_link, None) #self.assertFalse(pay_link.getDeliverable()) - self.assertEquals(pay_link.getTradePhase(), 'trade/payment') - self.assertEquals(pay_link.getSuccessor(), None) - self.assertEquals(pay_link.getPredecessor(),"trade_state/trade/accounted") - self.assertEquals(pay_link.getCompletedStateList(), + self.assertEqual(pay_link.getTradePhase(), 'trade/payment') + self.assertEqual(pay_link.getSuccessor(), None) + self.assertEqual(pay_link.getPredecessor(),"trade_state/trade/accounted") + self.assertEqual(pay_link.getCompletedStateList(), ['confirmed','delivered','started','stopped']) - self.assertEquals(pay_link.getFrozenStateList(),['delivered','stopped']) + self.assertEqual(pay_link.getFrozenStateList(),['delivered','stopped']) - self.assertEquals(pay_link.getDeliveryBuilderList(), + self.assertEqual(pay_link.getDeliveryBuilderList(), ["portal_deliveries/payment_transaction_builder"]) def stepCheckAccountingPeriod(self, sequence=None, sequence_list=None, **kw): @@ -750,12 +750,12 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): organisation = organisation_list[0] period_list = organisation.contentValues(portal_type='Accounting Period') - self.assertEquals(1, len(period_list)) + self.assertEqual(1, len(period_list)) period = period_list[0] - self.assertEquals('started', period.getSimulationState()) - self.assertEquals(DateTime(2008, 1, 1), period.getStartDate()) - self.assertEquals(DateTime(2008, 12, 31), period.getStopDate()) - self.assertEquals('2008', period.getShortTitle()) + self.assertEqual('started', period.getSimulationState()) + self.assertEqual(DateTime(2008, 1, 1), period.getStartDate()) + self.assertEqual(DateTime(2008, 12, 31), period.getStopDate()) + self.assertEqual('2008', period.getShortTitle()) # security on this period has been initialised for username in self.accountant_username_list: @@ -770,25 +770,25 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): sale_trade_condition_list = \ self.getBusinessConfigurationObjectList(business_configuration, 'Sale Trade Condition') - self.assertEquals(len(sale_trade_condition_list), 1) + self.assertEqual(len(sale_trade_condition_list), 1) sale_trade_condition = sale_trade_condition_list[0] - self.assertEquals("General Sale Trade Condition", + self.assertEqual("General Sale Trade Condition", sale_trade_condition.getTitle()) - self.assertEquals("STC-General", sale_trade_condition.getReference()) + self.assertEqual("STC-General", sale_trade_condition.getReference()) # Trade condition does not need dates - self.assertEquals(None, sale_trade_condition.getEffectiveDate()) - self.assertEquals(None, sale_trade_condition.getExpirationDate()) + self.assertEqual(None, sale_trade_condition.getEffectiveDate()) + self.assertEqual(None, sale_trade_condition.getExpirationDate()) # Check relation with Business Process business_process_list = \ self.getBusinessConfigurationObjectList(business_configuration, 'Business Process') - self.assertEquals(len(business_process_list), 1) + self.assertEqual(len(business_process_list), 1) business_process = business_process_list[0] - self.assertEquals(business_process, + self.assertEqual(business_process, sale_trade_condition.getSpecialiseValue()) # Check relation with Organisation @@ -797,8 +797,8 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): 'Organisation') organisation = organisation_list[0] - self.assertEquals(organisation, sale_trade_condition.getSourceValue()) - self.assertEquals(organisation, + self.assertEqual(organisation, sale_trade_condition.getSourceValue()) + self.assertEqual(organisation, sale_trade_condition.getSourceSectionValue()) # Check relation with Currency @@ -806,7 +806,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): self.getBusinessConfigurationObjectList(business_configuration, 'Currency') currency = currency_list[0] - self.assertEquals(currency.getRelativeUrl(), + self.assertEqual(currency.getRelativeUrl(), sale_trade_condition.getPriceCurrency()) def stepCheckPurchaseTradeCondition(self, sequence=None, sequence_list=None, **kw): @@ -817,25 +817,25 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): purchase_trade_condition_list = \ self.getBusinessConfigurationObjectList(business_configuration, 'Purchase Trade Condition') - self.assertEquals(len(purchase_trade_condition_list), 1) + self.assertEqual(len(purchase_trade_condition_list), 1) purchase_trade_condition = purchase_trade_condition_list[0] - self.assertEquals("General Purchase Trade Condition", + self.assertEqual("General Purchase Trade Condition", purchase_trade_condition.getTitle()) - self.assertEquals("PTC-General", purchase_trade_condition.getReference()) + self.assertEqual("PTC-General", purchase_trade_condition.getReference()) # Trade condition does not need dates - self.assertEquals(None, purchase_trade_condition.getEffectiveDate()) - self.assertEquals(None, purchase_trade_condition.getExpirationDate()) + self.assertEqual(None, purchase_trade_condition.getEffectiveDate()) + self.assertEqual(None, purchase_trade_condition.getExpirationDate()) # Check relation with Business Process business_process_list = \ self.getBusinessConfigurationObjectList(business_configuration, 'Business Process') - self.assertEquals(len(business_process_list), 1) + self.assertEqual(len(business_process_list), 1) business_process = business_process_list[0] - self.assertEquals(business_process, + self.assertEqual(business_process, purchase_trade_condition.getSpecialiseValue()) # Check relation with Organisation @@ -844,9 +844,9 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): 'Organisation') organisation = organisation_list[0] - self.assertEquals(organisation, + self.assertEqual(organisation, purchase_trade_condition.getDestinationValue()) - self.assertEquals(organisation, + self.assertEqual(organisation, purchase_trade_condition.getDestinationSectionValue()) # Check relation with Currency @@ -854,7 +854,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): self.getBusinessConfigurationObjectList(business_configuration, 'Currency') currency = currency_list[0] - self.assertEquals(currency.getRelativeUrl(), + self.assertEqual(currency.getRelativeUrl(), purchase_trade_condition.getPriceCurrency()) @expectedFailure @@ -885,13 +885,13 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): self.tic() # inventories of that resource are index in grams - self.assertEquals(3010, + self.assertEqual(3010, self.portal.portal_simulation.getCurrentInventory( resource_uid=resource.getUid(), node_uid=node.getUid())) # converted inventory also works - self.assertEquals(3.01, + self.assertEqual(3.01, self.portal.portal_simulation.getCurrentInventory( quantity_unit='mass/kilogram', resource_uid=resource.getUid(), @@ -909,17 +909,17 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): inventory = portal.portal_types['Inventory'] sale_packing_list = portal.portal_types['Sale Packing List'] sale_packing_list_line = portal.portal_types['Sale Packing List Line'] - self.assertEquals(True, + self.assertEqual(True, 'TradeOrderLine' in sale_packing_list_line.getTypePropertySheetList()) - self.assertEquals(True, + self.assertEqual(True, 'TradeOrder' in purchase_order.getTypePropertySheetList()) - self.assertEquals(True, + self.assertEqual(True, 'TradeOrderLine' in purchase_order_line.getTypePropertySheetList()) - self.assertEquals(True, + self.assertEqual(True, 'TradeOrder' in sale_order.getTypePropertySheetList()) - self.assertEquals(True, + self.assertEqual(True, 'TradeOrderLine' in sale_order_line.getTypePropertySheetList()) - self.assertEquals(True, + self.assertEqual(True, 'InventoryConstraint' in inventory.getTypePropertySheetList()) @@ -939,7 +939,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): business_process_list = \ self.getBusinessConfigurationObjectList(business_configuration, 'Business Process') - self.assertEquals(len(business_process_list), 1) + self.assertEqual(len(business_process_list), 1) business_process = business_process_list[0] destination_decision = portal.portal_catalog.getResultValue( @@ -976,41 +976,41 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin): self.tic() # stepPlanSaleOrders - self.assertEquals(order.getSimulationState(), 'draft') + self.assertEqual(order.getSimulationState(), 'draft') order.plan() self.tic() - self.assertEquals(order.getSimulationState(), 'planned') + self.assertEqual(order.getSimulationState(), 'planned') # stepOrderSaleOrders order.order() self.tic() - self.assertEquals(order.getSimulationState(), 'ordered') + self.assertEqual(order.getSimulationState(), 'ordered') # stepConfirmSaleOrders order.confirm() self.tic() - self.assertEquals(order.getSimulationState(), 'confirmed') + self.assertEqual(order.getSimulationState(), 'confirmed') # stepCheckSaleOrderSimulation causality_list = order.getCausalityRelatedValueList(portal_type='Applied Rule') - self.assertEquals(len(causality_list), 1) + self.assertEqual(len(causality_list), 1) applied_rule = causality_list[0] - self.assertEquals(applied_rule.getPortalType(), 'Applied Rule') + self.assertEqual(applied_rule.getPortalType(), 'Applied Rule') rule = applied_rule.getSpecialiseValue() self.assertNotEquals(rule, None) - self.assertEquals(rule.getReference(), 'default_order_rule') - self.assertEquals(applied_rule.objectCount(), 1) + self.assertEqual(rule.getReference(), 'default_order_rule') + self.assertEqual(applied_rule.objectCount(), 1) simulation_movement = applied_rule.objectValues()[0] - self.assertEquals(simulation_movement.getPortalType(), + self.assertEqual(simulation_movement.getPortalType(), 'Simulation Movement') - self.assertEquals(simulation_movement.getQuantity(), 1.0) - self.assertEquals(simulation_movement.getResourceValue(), resource) + self.assertEqual(simulation_movement.getQuantity(), 1.0) + self.assertEqual(simulation_movement.getResourceValue(), resource) self.assertNotEquals(simulation_movement.getCausality(), None) - self.assertEquals(simulation_movement.getDestinationDecisionValue(), + self.assertEqual(simulation_movement.getDestinationDecisionValue(), destination_decision) - self.assertEquals(simulation_movement.getDestinationAdministrationValue(), + self.assertEqual(simulation_movement.getDestinationAdministrationValue(), destination_administration) @@ -1165,9 +1165,9 @@ class TestConsultingConfiguratorWorkflow(StandardConfigurationMixin): """ Check if Confire Categories step was showed """ response_dict = sequence.get("response_dict") if 'command' in response_dict: - self.assertEquals('show', response_dict['command']) - self.assertEquals(None, response_dict['previous']) - self.assertEquals('Configure Categories', response_dict['next']) + self.assertEqual('show', response_dict['command']) + self.assertEqual(None, response_dict['previous']) + self.assertEqual('Configure Categories', response_dict['next']) self.assertCurrentStep('Your Categories', response_dict) def stepSetupCategoriesConfiguratorItem(self, sequence=None, sequence_list=None, **kw): @@ -1180,9 +1180,9 @@ class TestConsultingConfiguratorWorkflow(StandardConfigurationMixin): """ Check if Configure Roles step was showed """ response_dict = sequence.get("response_dict") if 'command' in response_dict: - self.assertEquals('show', response_dict['command']) - self.assertEquals('Configure Roles', response_dict['next']) - self.assertEquals('Previous', response_dict['previous']) + self.assertEqual('show', response_dict['command']) + self.assertEqual('Configure Roles', response_dict['next']) + self.assertEqual('Previous', response_dict['previous']) self.assertCurrentStep('Your roles settings', response_dict) def stepCheckCategoriesConfiguratorItem(self, sequence=None, sequence_list=None, **kw): @@ -1192,14 +1192,14 @@ class TestConsultingConfiguratorWorkflow(StandardConfigurationMixin): categories_spreadsheet_configuration_save = business_configuration['3'] categories_spreadsheet_configuration_item =\ categories_spreadsheet_configuration_save['1'] - self.assertEquals('Categories Spreadsheet Configurator Item', + self.assertEqual('Categories Spreadsheet Configurator Item', categories_spreadsheet_configuration_item.getPortalType()) spreadsheet = categories_spreadsheet_configuration_item\ .getConfigurationSpreadsheet() self.assertNotEquals(None, spreadsheet) - self.assertEquals('Embedded File', spreadsheet.getPortalType()) - self.failUnless(spreadsheet.hasData()) + self.assertEqual('Embedded File', spreadsheet.getPortalType()) + self.assertTrue(spreadsheet.hasData()) def stepSetupRolesConfiguratorItem(self, sequence=None, sequence_list=None, **kw): """ Load the Roles """ @@ -1212,7 +1212,7 @@ class TestConsultingConfiguratorWorkflow(StandardConfigurationMixin): response_dict = sequence.get("response_dict") TestLiveConfiguratorWorkflowMixin.stepCheckConfigureOrganisationForm( self, sequence, sequence_list, **kw) - self.assertEquals('Previous', response_dict['previous']) + self.assertEqual('Previous', response_dict['previous']) def stepSetupOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw): """ Create one Organisation with French information """ @@ -1227,28 +1227,28 @@ class TestConsultingConfiguratorWorkflow(StandardConfigurationMixin): business_configuration = sequence.get("business_configuration") # last one: a step for what the client selected organisation_config_save = business_configuration['5'] - self.assertEquals(1, len(organisation_config_save.contentValues())) + self.assertEqual(1, len(organisation_config_save.contentValues())) # first item: configuration of our organisation organisation_config_item = organisation_config_save['1'] - self.assertEquals(organisation_config_item.getPortalType(), + self.assertEqual(organisation_config_item.getPortalType(), 'Organisation Configurator Item') # this organisation configurator items contains all properties that the # orgnanisation will have. - self.assertEquals(organisation_config_item.getDefaultAddressCity(), + self.assertEqual(organisation_config_item.getDefaultAddressCity(), 'LILLE') - self.assertEquals(organisation_config_item.getDefaultAddressRegion(), + self.assertEqual(organisation_config_item.getDefaultAddressRegion(), 'europe/western_europe/france') - self.assertEquals(organisation_config_item.getDefaultEmailText(), + self.assertEqual(organisation_config_item.getDefaultEmailText(), 'me@example.com') - self.assertEquals('01234567890', + self.assertEqual('01234567890', organisation_config_item.getDefaultTelephoneTelephoneNumber()) configuration_save_list = business_configuration.contentValues( portal_type="Configuration Save") - self.assertEquals(5, len(configuration_save_list)) + self.assertEqual(5, len(configuration_save_list)) link_list = business_configuration.contentValues(portal_type="Link") - self.assertEquals(0, len(link_list)) + self.assertEqual(0, len(link_list)) def stepCheckMultiplePersonConfigurationItem(self, sequence=None, sequence_list=None, **kw): """ @@ -1261,47 +1261,47 @@ class TestConsultingConfiguratorWorkflow(StandardConfigurationMixin): person_business_configuration_item =\ person_business_configuration_save['1'] - self.assertEquals('Person Configurator Item', + self.assertEqual('Person Configurator Item', person_business_configuration_item.getPortalType()) - self.assertEquals('Person', + self.assertEqual('Person', person_business_configuration_item.getFirstName()) - self.assertEquals('Creator', + self.assertEqual('Creator', person_business_configuration_item.getLastName()) - self.assertEquals(self.person_creator_reference, + self.assertEqual(self.person_creator_reference, person_business_configuration_item.getReference()) - self.assertEquals('person_creator', + self.assertEqual('person_creator', person_business_configuration_item.getPassword()) - self.assertEquals('hr/manager', + self.assertEqual('hr/manager', person_business_configuration_item.getFunction()) person_business_configuration_item =\ person_business_configuration_save['2'] - self.assertEquals('Person Configurator Item', + self.assertEqual('Person Configurator Item', person_business_configuration_item.getPortalType()) - self.assertEquals('Person', + self.assertEqual('Person', person_business_configuration_item.getFirstName()) - self.assertEquals('Assignee', + self.assertEqual('Assignee', person_business_configuration_item.getLastName()) - self.assertEquals(self.person_assignee_reference, + self.assertEqual(self.person_assignee_reference, person_business_configuration_item.getReference()) - self.assertEquals('person_assignee', + self.assertEqual('person_assignee', person_business_configuration_item.getPassword()) - self.assertEquals('af/accounting/manager', + self.assertEqual('af/accounting/manager', person_business_configuration_item.getFunction()) person_business_configuration_item =\ person_business_configuration_save['3'] - self.assertEquals('Person Configurator Item', + self.assertEqual('Person Configurator Item', person_business_configuration_item.getPortalType()) - self.assertEquals('Person', + self.assertEqual('Person', person_business_configuration_item.getFirstName()) - self.assertEquals('Assignor', + self.assertEqual('Assignor', person_business_configuration_item.getLastName()) - self.assertEquals(self.person_assignor_reference, + self.assertEqual(self.person_assignor_reference, person_business_configuration_item.getReference()) - self.assertEquals('person_assignor', + self.assertEqual('person_assignor', person_business_configuration_item.getPassword()) - self.assertEquals('sales/manager', + self.assertEqual('sales/manager', person_business_configuration_item.getFunction()) def test_consulting_workflow(self): @@ -1466,7 +1466,7 @@ class TestStandardConfiguratorWorkflow(StandardConfigurationMixin): response_dict = sequence.get("response_dict") TestLiveConfiguratorWorkflowMixin.stepCheckConfigureOrganisationForm( self, sequence, sequence_list, **kw) - self.assertEquals(None, response_dict['previous']) + self.assertEqual(None, response_dict['previous']) def stepCheckOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw): """ Check if configuration key was created fine """ @@ -1476,31 +1476,31 @@ class TestStandardConfiguratorWorkflow(StandardConfigurationMixin): # last one: a step for what the client selected organisation_config_save = business_configuration['5'] - self.assertEquals(2, len(organisation_config_save.contentValues())) + self.assertEqual(2, len(organisation_config_save.contentValues())) # first item: configuration of our organisation organisation_config_item = organisation_config_save['1'] - self.assertEquals(organisation_config_item.getPortalType(), + self.assertEqual(organisation_config_item.getPortalType(), 'Organisation Configurator Item') # this organisation configurator items contains all properties that the # orgnanisation will have. - self.assertEquals(organisation_config_item.getDefaultAddressCity(), + self.assertEqual(organisation_config_item.getDefaultAddressCity(), default_address_city) - self.assertEquals(organisation_config_item.getDefaultAddressRegion(), + self.assertEqual(organisation_config_item.getDefaultAddressRegion(), default_address_region) - self.assertEquals(organisation_config_item.getDefaultEmailText(), + self.assertEqual(organisation_config_item.getDefaultEmailText(), 'me@example.com') - self.assertEquals('01234567890', + self.assertEqual('01234567890', organisation_config_item.getDefaultTelephoneTelephoneNumber()) # we also create a category for our group category_config_item = organisation_config_save['2'] - self.assertEquals(category_config_item.getPortalType(), + self.assertEqual(category_config_item.getPortalType(), 'Category Configurator Item') - self.assertEquals(category_config_item.getTitle(), + self.assertEqual(category_config_item.getTitle(), 'My Organisation') - self.assertEquals(5, len(business_configuration.contentValues(portal_type="Configuration Save"))) - self.assertEquals(0, len(business_configuration.contentValues(portal_type="Link"))) + self.assertEqual(5, len(business_configuration.contentValues(portal_type="Configuration Save"))) + self.assertEqual(0, len(business_configuration.contentValues(portal_type="Link"))) def stepCheckMultiplePersonConfigurationItem(self, sequence=None, sequence_list=None, **kw): """ @@ -1513,33 +1513,33 @@ class TestStandardConfiguratorWorkflow(StandardConfigurationMixin): person_business_configuration_item =\ person_business_configuration_save['1'] - self.assertEquals('Person Configurator Item', + self.assertEqual('Person Configurator Item', person_business_configuration_item.getPortalType()) - self.assertEquals('Sales', + self.assertEqual('Sales', person_business_configuration_item.getFirstName()) - self.assertEquals('Manager', + self.assertEqual('Manager', person_business_configuration_item.getLastName()) - self.assertEquals(self.sales_manager_reference, + self.assertEqual(self.sales_manager_reference, person_business_configuration_item.getReference()) - self.assertEquals('sales_manager', + self.assertEqual('sales_manager', person_business_configuration_item.getPassword()) - self.assertEquals('sales/manager', + self.assertEqual('sales/manager', person_business_configuration_item.getFunction()) # ... person_business_configuration_item =\ person_business_configuration_save['3'] - self.assertEquals('Person Configurator Item', + self.assertEqual('Person Configurator Item', person_business_configuration_item.getPortalType()) - self.assertEquals('Accounting', + self.assertEqual('Accounting', person_business_configuration_item.getFirstName()) - self.assertEquals('Agent', + self.assertEqual('Agent', person_business_configuration_item.getLastName()) - self.assertEquals(self.accounting_agent_reference, + self.assertEqual(self.accounting_agent_reference, person_business_configuration_item.getReference()) - self.assertEquals('accounting_agent', + self.assertEqual('accounting_agent', person_business_configuration_item.getPassword()) - self.assertEquals('af/accounting/agent', + self.assertEqual('af/accounting/agent', person_business_configuration_item.getFunction()) ########################################## diff --git a/bt5/erp5_configurator_standard/bt/revision b/bt5/erp5_configurator_standard/bt/revision index 38017008e6..0552576c87 100644 --- a/bt5/erp5_configurator_standard/bt/revision +++ b/bt5/erp5_configurator_standard/bt/revision @@ -1 +1 @@ -668 \ No newline at end of file +669 \ No newline at end of file diff --git a/bt5/erp5_configurator_ung/TestTemplateItem/portal_components/test.erp5.testUNGConfigurationWorkflow.py b/bt5/erp5_configurator_ung/TestTemplateItem/portal_components/test.erp5.testUNGConfigurationWorkflow.py index 0814e1cfc7..1e8f3ef7c9 100644 --- a/bt5/erp5_configurator_ung/TestTemplateItem/portal_components/test.erp5.testUNGConfigurationWorkflow.py +++ b/bt5/erp5_configurator_ung/TestTemplateItem/portal_components/test.erp5.testUNGConfigurationWorkflow.py @@ -135,13 +135,13 @@ class TestUNGConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): """ Check if organisation was created fine """ business_configuration = sequence.get("business_configuration") organisation_config_save = business_configuration['3'] - self.assertEquals(organisation_config_save.getTitle(), + self.assertEqual(organisation_config_save.getTitle(), "My Organisation") - self.assertEquals(1, len(organisation_config_save.contentValues())) + self.assertEqual(1, len(organisation_config_save.contentValues())) organisation_config_item = organisation_config_save['1'] - self.assertEquals(organisation_config_item.getPortalType(), + self.assertEqual(organisation_config_item.getPortalType(), 'Organisation Configurator Item') - self.assertEquals(organisation_config_item.getDefaultEmailText(), + self.assertEqual(organisation_config_item.getDefaultEmailText(), 'me@example.com') def stepSetupUserAccountNumberThree(self, sequence=None, sequence_list=None, **kw): @@ -161,9 +161,9 @@ class TestUNGConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): """ Check the preference form """ response_dict = sequence.get("response_dict") if 'command' in response_dict: - self.assertEquals('show', response_dict['command']) - self.assertEquals('Previous', response_dict['previous']) - self.assertEquals('Configure ERP5 Preferences', response_dict['next']) + self.assertEqual('show', response_dict['command']) + self.assertEqual('Previous', response_dict['previous']) + self.assertEqual('Configure ERP5 Preferences', response_dict['next']) self.assertCurrentStep('UNG Preferences', response_dict) def stepSetupPreferenceConfigurationBrazil(self, sequence=None, sequence_list=None, **kw): @@ -187,35 +187,35 @@ class TestUNGConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): business_configuration = sequence.get("business_configuration") person_config_save = business_configuration["5"] person_config_item = person_config_save["1"] - self.assertEquals(person_config_item.getReference(), "person_creator") + self.assertEqual(person_config_item.getReference(), "person_creator") person_config_item = person_config_save["2"] - self.assertEquals(person_config_item.getReference(), "person_assignee") + self.assertEqual(person_config_item.getReference(), "person_assignee") person_config_item = person_config_save["3"] - self.assertEquals(person_config_item.getReference(), "person_assignor") + self.assertEqual(person_config_item.getReference(), "person_assignor") def stepCheckMultipleUserAccountThreeFrance(self, sequence=None, sequence_list=None, **kw): """ Check if the users were created correctly """ business_configuration = sequence.get("business_configuration") person_config_save = business_configuration["5"] person_config_item = person_config_save["1"] - self.assertEquals(person_config_item.getReference(), "french_creator") + self.assertEqual(person_config_item.getReference(), "french_creator") person_config_item = person_config_save["2"] - self.assertEquals(person_config_item.getReference(), "french_assignee") + self.assertEqual(person_config_item.getReference(), "french_assignee") person_config_item = person_config_save["3"] - self.assertEquals(person_config_item.getReference(), "french_assignor") + self.assertEqual(person_config_item.getReference(), "french_assignor") def stepCheckConfigureInstallationForm(self, sequence=None, sequence_list=None, **kw): """ Check the installation form """ response_dict = sequence.get("response_dict") - self.assertEquals('show', response_dict['command']) + self.assertEqual('show', response_dict['command']) def stepCheckSystemPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw): """ Check System Preference""" system_preference = self.portal.portal_catalog.getResultValue(portal_type="System Preference") conversion_dict = _getConversionServerDict() - self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(), + self.assertEqual(system_preference.getPreferredOoodocServerPortNumber(), conversion_dict['port']) - self.assertEquals(system_preference.getPreferredOoodocServerAddress(), + self.assertEqual(system_preference.getPreferredOoodocServerAddress(), conversion_dict['hostname']) def stepCheckUserPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw): @@ -223,15 +223,15 @@ class TestUNGConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): portal_catalog = self.portal.portal_catalog preference = portal_catalog.getResultValue(portal_type="Preference", title='Preference for Person Assignor') - self.assertEquals(preference.getPreferenceState(), "enabled") + self.assertEqual(preference.getPreferenceState(), "enabled") preference = portal_catalog.getResultValue(portal_type="Preference", title='Preference for Person Assignee') - self.assertEquals(preference.getPreferenceState(), "enabled") + self.assertEqual(preference.getPreferenceState(), "enabled") preference = portal_catalog.getResultValue(portal_type="Preference", title='Preference for Person Creator') - self.assertEquals(preference.getPreferenceState(), "enabled") + self.assertEqual(preference.getPreferenceState(), "enabled") preference = self.portal.portal_preferences.ung_preference - self.assertEquals(preference.getPreferenceState(), "global") + self.assertEqual(preference.getPreferenceState(), "global") def _stepCheckWebSiteRoles(self): """ Check permission of Web Site with normal user """ @@ -240,8 +240,8 @@ class TestUNGConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): self.tic() self.changeSkin("UNGDoc") result_list = self.portal.web_site_module.ung.WebSection_getWebPageObjectList() - self.assertEquals(len(result_list), 1) - self.assertEquals(result_list[0].getTitle(), "Web Page") + self.assertEqual(len(result_list), 1) + self.assertEqual(result_list[0].getTitle(), "Web Page") new_object = self.portal.web_page_module.newContent(portal_type="Web Page") new_object.edit(title="New") new_object = self.portal.web_page_module.newContent(portal_type="Web Table") @@ -252,18 +252,18 @@ class TestUNGConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): kw = {"portal_type": "Web Page", "title": "New"} self.changeSkin("UNGDoc") result_list = self.portal.web_site_module.ung.WebSection_getWebPageObjectList(**kw) - self.assertEquals(len(result_list), 1) - self.assertEquals(result_list[0].getPortalType(), "Web Page") + self.assertEqual(len(result_list), 1) + self.assertEqual(result_list[0].getPortalType(), "Web Page") kw["portal_type"] = "Web Illustration" self.changeSkin("UNGDoc") result_list = self.portal.web_site_module.ung.WebSection_getWebPageObjectList(**kw) - self.assertEquals(len(result_list), 1) - self.assertEquals(result_list[0].getPortalType(), "Web Illustration") + self.assertEqual(len(result_list), 1) + self.assertEqual(result_list[0].getPortalType(), "Web Illustration") kw["portal_type"] = "Web Table" self.changeSkin("UNGDoc") result_list = self.portal.web_site_module.ung.WebSection_getWebPageObjectList(**kw) - self.assertEquals(len(result_list), 1) - self.assertEquals(result_list[0].getPortalType(), "Web Table") + self.assertEqual(len(result_list), 1) + self.assertEqual(result_list[0].getPortalType(), "Web Table") def _stepCheckKnowledgePadRole(self): """ Check if Knowledge Pad is configured correctly """ @@ -277,9 +277,9 @@ class TestUNGConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): self.portal.web_site_module.ung.WebSection_addGadgetList(gadget_id) self.tic() box_list = pad.contentValues() - self.assertEquals(len(box_list), 1) + self.assertEqual(len(box_list), 1) knowledge_box = box_list[0] - self.assertEquals(pad.getPublicationSection(), 'web_site_module/ung') + self.assertEqual(pad.getPublicationSection(), 'web_site_module/ung') self.assertTrue(knowledge_box.getSpecialiseValue().getId() == gadget_id) def _stepCheckCreateNewEvent(self): @@ -303,10 +303,10 @@ class TestUNGConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin): portal.event_module.EventModule_createNewEvent() self.tic() event = portal.portal_catalog.getResultValue(portal_type="Note") - self.assertEquals(event.getDescription(), "testUNG Sample") + self.assertEqual(event.getDescription(), "testUNG Sample") start_date = event.getStartDate() - self.assertEquals(start_date.month(), 2) - self.assertEquals(start_date.minute(), 12) + self.assertEqual(start_date.month(), 2) + self.assertEqual(start_date.minute(), 12) class TestUNGConfiguratorWorkflowFranceLanguage(TestUNGConfiguratorWorkflowMixin): @@ -361,34 +361,34 @@ class TestUNGConfiguratorWorkflowFranceLanguage(TestUNGConfiguratorWorkflowMixin """ Check if UNG Web Site is published and your language""" ung_web_site = self.portal.web_site_module.ung portal_catalog = self.portal.portal_catalog - self.assertEquals(ung_web_site.getValidationState(), + self.assertEqual(ung_web_site.getValidationState(), "published") - self.assertEquals(ung_web_site.getDefaultAvailableLanguage(), + self.assertEqual(ung_web_site.getDefaultAvailableLanguage(), "fr") person = portal_catalog.getResultValue(portal_type="Person", reference="french_creator") - self.assertEquals(person.getValidationState(), 'validated') - self.assertEquals(person.getFirstName(), 'Person') - self.assertEquals(person.getLastName(), 'Creator') + self.assertEqual(person.getValidationState(), 'validated') + self.assertEqual(person.getFirstName(), 'Person') + self.assertEqual(person.getLastName(), 'Creator') assignment = person.contentValues(portal_type="Assignment")[0] - self.assertEquals(assignment.getValidationState(), "open") - self.assertEquals(assignment.getFunction(), "ung_user") + self.assertEqual(assignment.getValidationState(), "open") + self.assertEqual(assignment.getFunction(), "ung_user") person = portal_catalog.getResultValue(portal_type="Person", reference="french_assignee") - self.assertEquals(person.getValidationState(), 'validated') - self.assertEquals(person.getFirstName(), 'Person') - self.assertEquals(person.getLastName(), 'Assignee') + self.assertEqual(person.getValidationState(), 'validated') + self.assertEqual(person.getFirstName(), 'Person') + self.assertEqual(person.getLastName(), 'Assignee') assignment = person.contentValues(portal_type="Assignment")[0] - self.assertEquals(assignment.getValidationState(), "open") - self.assertEquals(assignment.getFunction(), "ung_user") + self.assertEqual(assignment.getValidationState(), "open") + self.assertEqual(assignment.getFunction(), "ung_user") person = portal_catalog.getResultValue(portal_type="Person", reference="french_assignor") - self.assertEquals(person.getValidationState(), 'validated') - self.assertEquals(person.getFirstName(), 'Person') - self.assertEquals(person.getLastName(), 'Assignor') + self.assertEqual(person.getValidationState(), 'validated') + self.assertEqual(person.getFirstName(), 'Person') + self.assertEqual(person.getLastName(), 'Assignor') assignment = person.contentValues(portal_type="Assignment")[0] - self.assertEquals(assignment.getValidationState(), "open") - self.assertEquals(assignment.getFunction(), "ung_user") + self.assertEqual(assignment.getValidationState(), "open") + self.assertEqual(assignment.getFunction(), "ung_user") def stepCheckWebSiteRoles(self, sequence=None, sequence_list=None, **kw): """ Check permission of Web Site with normal user """ @@ -456,34 +456,34 @@ class TestUNGConfiguratorWorkflowBrazilLanguage(TestUNGConfiguratorWorkflowMixin """ Check if UNG Web Site is published and your language """ ung_web_site = self.portal.web_site_module.ung portal_catalog = self.portal.portal_catalog - self.assertEquals(ung_web_site.getValidationState(), + self.assertEqual(ung_web_site.getValidationState(), "published") - self.assertEquals(ung_web_site.getDefaultAvailableLanguage(), + self.assertEqual(ung_web_site.getDefaultAvailableLanguage(), "pt-BR") person = portal_catalog.getResultValue(portal_type="Person", reference="person_creator") - self.assertEquals(person.getValidationState(), 'validated') - self.assertEquals(person.getFirstName(), 'Person') - self.assertEquals(person.getLastName(), 'Creator') + self.assertEqual(person.getValidationState(), 'validated') + self.assertEqual(person.getFirstName(), 'Person') + self.assertEqual(person.getLastName(), 'Creator') assignment = person.contentValues(portal_type="Assignment")[0] - self.assertEquals(assignment.getValidationState(), "open") - self.assertEquals(assignment.getFunction(), "ung_user") + self.assertEqual(assignment.getValidationState(), "open") + self.assertEqual(assignment.getFunction(), "ung_user") person = portal_catalog.getResultValue(portal_type="Person", reference="person_assignee") - self.assertEquals(person.getValidationState(), 'validated') - self.assertEquals(person.getFirstName(), 'Person') - self.assertEquals(person.getLastName(), 'Assignee') + self.assertEqual(person.getValidationState(), 'validated') + self.assertEqual(person.getFirstName(), 'Person') + self.assertEqual(person.getLastName(), 'Assignee') assignment = person.contentValues(portal_type="Assignment")[0] - self.assertEquals(assignment.getValidationState(), "open") - self.assertEquals(assignment.getFunction(), "ung_user") + self.assertEqual(assignment.getValidationState(), "open") + self.assertEqual(assignment.getFunction(), "ung_user") person = portal_catalog.getResultValue(portal_type="Person", reference="person_assignor") - self.assertEquals(person.getValidationState(), 'validated') - self.assertEquals(person.getFirstName(), 'Person') - self.assertEquals(person.getLastName(), 'Assignor') + self.assertEqual(person.getValidationState(), 'validated') + self.assertEqual(person.getFirstName(), 'Person') + self.assertEqual(person.getLastName(), 'Assignor') assignment = person.contentValues(portal_type="Assignment")[0] - self.assertEquals(assignment.getValidationState(), "open") - self.assertEquals(assignment.getFunction(), "ung_user") + self.assertEqual(assignment.getValidationState(), "open") + self.assertEqual(assignment.getFunction(), "ung_user") def stepCheckWebSiteRoles(self, sequence=None, sequence_list=None, **kw): """ Check permission of Web Site with normal user """ diff --git a/bt5/erp5_configurator_ung/bt/revision b/bt5/erp5_configurator_ung/bt/revision index b2412e34df..4e9e288487 100644 --- a/bt5/erp5_configurator_ung/bt/revision +++ b/bt5/erp5_configurator_ung/bt/revision @@ -1 +1 @@ -62 \ No newline at end of file +63 \ No newline at end of file diff --git a/bt5/erp5_egov/TestTemplateItem/portal_components/test.erp5.TestEGovMixin.py b/bt5/erp5_egov/TestTemplateItem/portal_components/test.erp5.TestEGovMixin.py index ccde637980..dcf7a26d53 100644 --- a/bt5/erp5_egov/TestTemplateItem/portal_components/test.erp5.TestEGovMixin.py +++ b/bt5/erp5_egov/TestTemplateItem/portal_components/test.erp5.TestEGovMixin.py @@ -344,10 +344,10 @@ class TestEGovMixin(SecurityTestCase): self.portal, workflow_list=['egov_universal_workflow', 'egov_anonymous_workflow']) self.assertNotEquals(worklist_dict, {}) - self.assertEquals(worklist_dict.has_key(portal_type), True) + self.assertEqual(worklist_dict.has_key(portal_type), True) portal_type_dict = worklist_dict[portal_type] - self.assertEquals(portal_type_dict.has_key(validation_state), True) - self.assertEquals(portal_type_dict[validation_state]['count'], count) + self.assertEqual(portal_type_dict.has_key(validation_state), True) + self.assertEqual(portal_type_dict[validation_state]['count'], count) # relog with previous user if previous_user in ('Anonymous User', 'ERP5TypeTestCase'): diff --git a/bt5/erp5_egov/bt/revision b/bt5/erp5_egov/bt/revision index 4f1a32f190..96e4f13f48 100644 --- a/bt5/erp5_egov/bt/revision +++ b/bt5/erp5_egov/bt/revision @@ -1 +1 @@ -765 \ No newline at end of file +766 \ No newline at end of file diff --git a/bt5/erp5_forum_tutorial/TestTemplateItem/portal_components/test.erp5.testDiscussionThread.py b/bt5/erp5_forum_tutorial/TestTemplateItem/portal_components/test.erp5.testDiscussionThread.py index 48687d2a5d..9d5dd31c72 100644 --- a/bt5/erp5_forum_tutorial/TestTemplateItem/portal_components/test.erp5.testDiscussionThread.py +++ b/bt5/erp5_forum_tutorial/TestTemplateItem/portal_components/test.erp5.testDiscussionThread.py @@ -70,16 +70,16 @@ class TestDiscussionThread(SecurityTestCase): thread_posts = thread.objectValues() # thread should have only one post - self.assertEquals(len(thread_posts), 1) + self.assertEqual(len(thread_posts), 1) # that unique post should have the right content - self.assertEquals(thread_posts[0].getTextContent(), thread_content) + self.assertEqual(thread_posts[0].getTextContent(), thread_content) # Check that the thread is inserted in the forum module - self.assertEquals(thread.getParentValue().getRelativeUrl(), self.forum_module.getRelativeUrl()) + self.assertEqual(thread.getParentValue().getRelativeUrl(), self.forum_module.getRelativeUrl()) # the thread should have been published - self.assertEquals(thread.getValidationState(), 'public') + self.assertEqual(thread.getValidationState(), 'public') reply_content='Can we add a reply?' post = thread.DiscussionThreadModule_addReply( @@ -98,10 +98,10 @@ class TestDiscussionThread(SecurityTestCase): # original thread and reply: # thread should have two posts - self.assertEquals(len(thread_posts), 2) + self.assertEqual(len(thread_posts), 2) # Check that post was inserted in thread - self.assertEquals(post.getParentValue().getRelativeUrl(), thread.getRelativeUrl()) + self.assertEqual(post.getParentValue().getRelativeUrl(), thread.getRelativeUrl()) def testSpyCannotAccessButVisitorCan(self): """ @@ -131,7 +131,7 @@ class TestDiscussionThread(SecurityTestCase): (self.portal.getId(), thread.getRelativeUrl()), 'visitor:visitor' ) - self.assertEquals(response.getStatus(), HTTP_OK) + self.assertEqual(response.getStatus(), HTTP_OK) def testVisitorCannotPost(self): """ @@ -201,4 +201,4 @@ class TestDiscussionThread(SecurityTestCase): (self.portal.getId(), thread.getRelativeUrl()), 'another_forum_user:another_forum_user' ) - self.assertEquals(response.getStatus(), HTTP_OK) + self.assertEqual(response.getStatus(), HTTP_OK) diff --git a/bt5/erp5_forum_tutorial/bt/revision b/bt5/erp5_forum_tutorial/bt/revision index f11c82a4cb..9a037142aa 100644 --- a/bt5/erp5_forum_tutorial/bt/revision +++ b/bt5/erp5_forum_tutorial/bt/revision @@ -1 +1 @@ -9 \ No newline at end of file +10 \ No newline at end of file diff --git a/bt5/erp5_ingestion/TestTemplateItem/portal_components/test.erp5.testLiveIngestion.py b/bt5/erp5_ingestion/TestTemplateItem/portal_components/test.erp5.testLiveIngestion.py index 87d5a4cd15..bffae0bce5 100644 --- a/bt5/erp5_ingestion/TestTemplateItem/portal_components/test.erp5.testLiveIngestion.py +++ b/bt5/erp5_ingestion/TestTemplateItem/portal_components/test.erp5.testLiveIngestion.py @@ -109,9 +109,9 @@ class TestIngestion(ERP5TypeLiveTestCase): filename = 'any_file.txt' document = self.contributeFileWithUrl(script_id, filename=filename) self.tic() - self.assertEquals(document.getPortalType(), 'Text') - self.assertEquals(document.getFilename(), filename) - self.assertEquals(document.getContentType(), 'text/plain') + self.assertEqual(document.getPortalType(), 'Text') + self.assertEqual(document.getFilename(), filename) + self.assertEqual(document.getContentType(), 'text/plain') self.assertTrue(document.hasData()) def test_02_contributeTextFileWithExplicitExtensionfromUrl(self): @@ -122,9 +122,9 @@ class TestIngestion(ERP5TypeLiveTestCase): script_id = 'ERP5Site_getTextFile.txt' document = self.contributeFileWithUrl(script_id) self.tic() - self.assertEquals(document.getPortalType(), 'Text') - self.assertEquals(document.getFilename(), script_id) - self.assertEquals(document.getContentType(), 'text/plain') + self.assertEqual(document.getPortalType(), 'Text') + self.assertEqual(document.getFilename(), script_id) + self.assertEqual(document.getContentType(), 'text/plain') self.assertTrue(document.hasData()) def test_03_textFileWithExplicitExtensionWithoutContentTypefromUrl(self): @@ -134,9 +134,9 @@ class TestIngestion(ERP5TypeLiveTestCase): script_id = 'ERP5Site_getTextFileWithoutContentType.txt' document = self.contributeFileWithUrl(script_id) self.tic() - self.assertEquals(document.getPortalType(), 'Text') - self.assertEquals(document.getFilename(), script_id) - self.assertEquals(document.getContentType(), 'text/plain') + self.assertEqual(document.getPortalType(), 'Text') + self.assertEqual(document.getFilename(), script_id) + self.assertEqual(document.getContentType(), 'text/plain') self.assertTrue(document.hasData()) def test_04_contributeTextFileWithFilenameAndRedirectionfromUrl(self): @@ -147,9 +147,9 @@ class TestIngestion(ERP5TypeLiveTestCase): filename = 'any_file.txt' document = self.contributeFileWithUrl(script_id, filename=filename) self.tic() - self.assertEquals(document.getPortalType(), 'Text') - self.assertEquals(document.getFilename(), filename) - self.assertEquals(document.getContentType(), 'text/plain') + self.assertEqual(document.getPortalType(), 'Text') + self.assertEqual(document.getFilename(), filename) + self.assertEqual(document.getContentType(), 'text/plain') self.assertTrue(document.hasData()) def test_05_contributeTextFileWithoutFilenameButHTMLContentType(self): @@ -160,8 +160,8 @@ class TestIngestion(ERP5TypeLiveTestCase): script_id = 'ERP5Site_getTextFileWithoutFileNameButHTMLContentType' document = self.contributeFileWithUrl(script_id) self.tic() - self.assertEquals(document.getPortalType(), 'Web Page') - self.assertEquals(document.getFilename(), script_id) - self.assertEquals(document.getContentType(), 'text/html') + self.assertEqual(document.getPortalType(), 'Web Page') + self.assertEqual(document.getFilename(), script_id) + self.assertEqual(document.getContentType(), 'text/html') self.assertTrue(document.hasData()) diff --git a/bt5/erp5_ingestion/bt/revision b/bt5/erp5_ingestion/bt/revision index c663e4d093..2d73b5e3ba 100644 --- a/bt5/erp5_ingestion/bt/revision +++ b/bt5/erp5_ingestion/bt/revision @@ -1 +1 @@ -151 \ No newline at end of file +152 \ No newline at end of file diff --git a/bt5/erp5_paypal_secure_payment/TestTemplateItem/portal_components/test.erp5.testERP5PaypalSecurePayment.py b/bt5/erp5_paypal_secure_payment/TestTemplateItem/portal_components/test.erp5.testERP5PaypalSecurePayment.py index e04279569f..bb5f84d891 100644 --- a/bt5/erp5_paypal_secure_payment/TestTemplateItem/portal_components/test.erp5.testERP5PaypalSecurePayment.py +++ b/bt5/erp5_paypal_secure_payment/TestTemplateItem/portal_components/test.erp5.testERP5PaypalSecurePayment.py @@ -84,7 +84,7 @@ business=<tal:block tal:replace='here/service_username'/> } try: result = self.service.navigate(page_template=pt_id, paypal_dict=paypal_dict) - self.assertEquals(result, """key=return value=http://ipn/ + self.assertEqual(result, """key=return value=http://ipn/ link=http://paypal/ business=business@sample.com""") finally: diff --git a/bt5/erp5_paypal_secure_payment/bt/revision b/bt5/erp5_paypal_secure_payment/bt/revision index 9a037142aa..9d607966b7 100644 --- a/bt5/erp5_paypal_secure_payment/bt/revision +++ b/bt5/erp5_paypal_secure_payment/bt/revision @@ -1 +1 @@ -10 \ No newline at end of file +11 \ No newline at end of file diff --git a/bt5/erp5_research_item/TestTemplateItem/portal_components/test.erp5.testResearchItemSummaryReport.py b/bt5/erp5_research_item/TestTemplateItem/portal_components/test.erp5.testResearchItemSummaryReport.py index 980f70557d..308366aba0 100644 --- a/bt5/erp5_research_item/TestTemplateItem/portal_components/test.erp5.testResearchItemSummaryReport.py +++ b/bt5/erp5_research_item/TestTemplateItem/portal_components/test.erp5.testResearchItemSummaryReport.py @@ -87,8 +87,8 @@ class TestResearchItemSummaryReport(TestTaskReportingMixin): def getDataResult(result): data_list = [] column_id_list = [x[0] for x in result.column_list] - self.assertEquals(column_id_list[0], "source_title") - self.assertEquals(column_id_list[-1], "total") + self.assertEqual(column_id_list[0], "source_title") + self.assertEqual(column_id_list[-1], "total") column_id_list.pop(0) column_id_list.pop(-1) column_id_list.sort() @@ -108,7 +108,7 @@ class TestResearchItemSummaryReport(TestTaskReportingMixin): at_date = DateTime("2014/01/01") result = callReport() # Initially we should have only one line for an empty total - self.assertEquals((["Worker", "Total"], + self.assertEqual((["Worker", "Total"], [["Total", None]]), getDataResult(result)) @@ -119,7 +119,7 @@ class TestResearchItemSummaryReport(TestTaskReportingMixin): source='person_module/Person_1', ) result = callReport() - self.assertEquals((["Worker", "undefined", "Total"], + self.assertEqual((["Worker", "undefined", "Total"], [["Person_1", 3, 3], ["Total", 3, 3]]), getDataResult(result)) @@ -132,7 +132,7 @@ class TestResearchItemSummaryReport(TestTaskReportingMixin): line_aggregate_relative_url='research_item_module/Item_1', ) result = callReport() - self.assertEquals((["Worker", "undefined", "Item_1", "Total"], + self.assertEqual((["Worker", "undefined", "Item_1", "Total"], [["Person_1", 3, None, 3], ["Person_2", None, 5.2, 5.2], ["Total", 3, 5.2, 8.2]]), @@ -158,7 +158,7 @@ class TestResearchItemSummaryReport(TestTaskReportingMixin): line_aggregate_relative_url='research_item_module/Item_2', ) result = callReport() - self.assertEquals((["Worker", "undefined", "Item_1", "Item_2", "Total"], + self.assertEqual((["Worker", "undefined", "Item_1", "Item_2", "Total"], [["Person_1", 3, None, 1.7, 4.7], ["Person_2", None, 7.6, 0.9, 8.5], ["Total", 3, 7.6, 2.6, 13.2]]), diff --git a/bt5/erp5_research_item/bt/revision b/bt5/erp5_research_item/bt/revision index 301160a930..f11c82a4cb 100644 --- a/bt5/erp5_research_item/bt/revision +++ b/bt5/erp5_research_item/bt/revision @@ -1 +1 @@ -8 \ No newline at end of file +9 \ No newline at end of file diff --git a/bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py b/bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py index 12317685a6..821e441ff0 100644 --- a/bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py +++ b/bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py @@ -88,7 +88,7 @@ class TestRunMyDoc(ERP5TypeTestCase): document = website.WebSection_getDocumentValue(test_page_reference) self.assertNotEquals(None, document) - self.assertEquals(document.getRelativeUrl(), + self.assertEqual(document.getRelativeUrl(), test_page.getRelativeUrl()) def test_Zuite_uploadScreenShot(self): @@ -127,15 +127,15 @@ class TestRunMyDoc(ERP5TypeTestCase): self.assertNotEquals(None, self.portal.Zuite_uploadScreenshot(image_upload, web_page_reference)) - self.assertEquals(None, + self.assertEqual(None, self.portal.Zuite_uploadScreenshot(image_upload, image_reference)) self.tic() # The right image were updated. image_upload.seek(0) - self.assertEquals(image_page_2.getData(), image_upload.read().decode("base64")) - self.assertEquals(image_page_2.getFilename(), image_reference + '.png') - self.assertEquals(image_page.getData(), '') + self.assertEqual(image_page_2.getData(), image_upload.read().decode("base64")) + self.assertEqual(image_page_2.getFilename(), image_reference + '.png') + self.assertEqual(image_page.getData(), '') def test_viewSeleniumTest(self): """ @@ -226,7 +226,7 @@ class TestRunMyDoc(ERP5TypeTestCase): test_page = self.portal.test_page_module.newContent(title="TEST", reference='TESTPAGEREFERENCE', text_content=test_page_html) - self.assertEquals(test_page.TestPage_viewSeleniumTest(), expected_test_html % + self.assertEqual(test_page.TestPage_viewSeleniumTest(), expected_test_html % ("ERP5TypeTestCase", "")) self.tic() @@ -240,7 +240,7 @@ class TestRunMyDoc(ERP5TypeTestCase): expected_html = expected_test_html % ("ERP5TypeTestCase", "") - self.assertEquals(zptest._text, expected_html.strip()) + self.assertEqual(zptest._text, expected_html.strip()) expected_test_html = u"""<html> <head> @@ -301,7 +301,7 @@ class TestRunMyDoc(ERP5TypeTestCase): self.portal.REQUEST['user'] = "toto" self.portal.REQUEST['password'] = "toto" - self.assertEquals(test_page.TestPage_viewSeleniumTest(REQUEST=self.portal.REQUEST), + self.assertEqual(test_page.TestPage_viewSeleniumTest(REQUEST=self.portal.REQUEST), expected_test_html % ("http://toto.com", "toto", "toto")) self.tic() test_page.TestPage_runSeleniumTest() @@ -314,4 +314,4 @@ class TestRunMyDoc(ERP5TypeTestCase): expected_html = expected_test_html % ("http://toto.com", "toto", "toto") - self.assertEquals(zptest._text, expected_html.strip()) + self.assertEqual(zptest._text, expected_html.strip()) diff --git a/bt5/erp5_run_my_doc/bt/revision b/bt5/erp5_run_my_doc/bt/revision index 8c0474e323..d7765fe47e 100644 --- a/bt5/erp5_run_my_doc/bt/revision +++ b/bt5/erp5_run_my_doc/bt/revision @@ -1 +1 @@ -69 \ No newline at end of file +70 \ No newline at end of file diff --git a/bt5/erp5_safeimage/TestTemplateItem/portal_components/test.erp5.testSafeImage.py b/bt5/erp5_safeimage/TestTemplateItem/portal_components/test.erp5.testSafeImage.py index de376b436f..9930b8129d 100644 --- a/bt5/erp5_safeimage/TestTemplateItem/portal_components/test.erp5.testSafeImage.py +++ b/bt5/erp5_safeimage/TestTemplateItem/portal_components/test.erp5.testSafeImage.py @@ -99,20 +99,20 @@ class TestSafeImage(ERP5TypeTestCase): self.tic() self.assertNotEqual(tile,None) image_property = getattr(tile, "ImageProperties.xml", None) - self.assertEquals(image_property.getData(), + self.assertEqual(image_property.getData(), """<IMAGE_PROPERTIES WIDTH="660" HEIGHT="495" NUMTILES="9" NUMIMAGES="1" VERSION="1.8" TILESIZE="256" />""") self.assertNotEqual(image_property, None) - self.assertEquals("Embedded File", image_property.getPortalType()) + self.assertEqual("Embedded File", image_property.getPortalType()) image_group = getattr(tile, "TileGroup0", None) self.assertNotEquals(image_group, None) - self.assertEquals("Image Tile Group",image_group.getPortalType()) + self.assertEqual("Image Tile Group",image_group.getPortalType()) splitted_image_list = image_group.objectValues(portal_type="Image") - self.assertEquals(set(['0-0-0','1-0-0','1-1-0','2-0-0','2-0-1','2-1-0','2-1-1','2-2-0','2-2-1']), + self.assertEqual(set(['0-0-0','1-0-0','1-1-0','2-0-0','2-0-1','2-1-0','2-1-1','2-2-0','2-2-1']), set([x.getId() for x in splitted_image_list])) for x in splitted_image_list: self.assertTrue(x.hasData()) - self.assertEquals(123,image_group['0-0-0'].getHeight()) - self.assertEquals(165,image_group['0-0-0'].getWidth()) + self.assertEqual(123,image_group['0-0-0'].getHeight()) + self.assertEqual(165,image_group['0-0-0'].getWidth()) def test_03_CreateTileImageTransformed(self): """" @@ -129,24 +129,24 @@ class TestSafeImage(ERP5TypeTestCase): self.tic() self.assertNotEqual(tile_transformed,None) image_property = getattr(tile_transformed, "ImageProperties.xml", None) - self.assertEquals(image_property.getData(), + self.assertEqual(image_property.getData(), """<IMAGE_PROPERTIES WIDTH="660" HEIGHT="495" NUMTILES="9" NUMIMAGES="1" VERSION="1.8" TILESIZE="256" />""") self.assertNotEqual(image_property, None) - self.assertEquals("Embedded File", image_property.getPortalType()) + self.assertEqual("Embedded File", image_property.getPortalType()) image_transform = getattr(tile_transformed, "TransformFile.txt", None) self.assertTrue(image_transform.getData().split()[1],'2-0-0') self.assertNotEqual(image_transform, None) - self.assertEquals("Embedded File", image_transform.getPortalType()) + self.assertEqual("Embedded File", image_transform.getPortalType()) image_group = getattr(tile_transformed, "TileGroup0", None) self.assertNotEquals(image_group, None) - self.assertEquals("Image Tile Group",image_group.getPortalType()) + self.assertEqual("Image Tile Group",image_group.getPortalType()) splitted_image_list = image_group.objectValues(portal_type="Image") - self.assertEquals(set(['0-0-0','1-0-0','1-1-0','2-0-0','2-0-1','2-1-0','2-1-1','2-2-0','2-2-1']), + self.assertEqual(set(['0-0-0','1-0-0','1-1-0','2-0-0','2-0-1','2-1-0','2-1-1','2-2-0','2-2-1']), set([x.getId() for x in splitted_image_list])) for x in splitted_image_list: self.assertTrue(x.hasData()) - self.assertEquals(123,image_group['0-0-0'].getHeight()) - self.assertEquals(165,image_group['0-0-0'].getWidth()) + self.assertEqual(123,image_group['0-0-0'].getHeight()) + self.assertEqual(165,image_group['0-0-0'].getWidth()) if getattr(self.image_module,'testTileTransformed',None) is not None: self.image_module.manage_delObjects(ids=['testTileTransformed']) transaction.commit() diff --git a/bt5/erp5_safeimage/bt/revision b/bt5/erp5_safeimage/bt/revision index 3f10ffe7a4..19c7bdba7b 100644 --- a/bt5/erp5_safeimage/bt/revision +++ b/bt5/erp5_safeimage/bt/revision @@ -1 +1 @@ -15 \ No newline at end of file +16 \ No newline at end of file diff --git a/bt5/erp5_social_contracts/TestTemplateItem/portal_components/test.erp5.testERP5SocialContracts.py b/bt5/erp5_social_contracts/TestTemplateItem/portal_components/test.erp5.testERP5SocialContracts.py index 310db5fcbf..0126556992 100644 --- a/bt5/erp5_social_contracts/TestTemplateItem/portal_components/test.erp5.testERP5SocialContracts.py +++ b/bt5/erp5_social_contracts/TestTemplateItem/portal_components/test.erp5.testERP5SocialContracts.py @@ -57,18 +57,18 @@ class TestERP5SocialContracts(ERP5TypeTestCase): self.tic() def test_getChildCount(self): - self.assertEquals(0, self.person_1.Person_getChildCount()) + self.assertEqual(0, self.person_1.Person_getChildCount()) self.person_2.setNaturalParentValue(self.person_1) self.tic() - self.assertEquals(1, self.person_1.Person_getChildCount()) + self.assertEqual(1, self.person_1.Person_getChildCount()) - self.assertEquals(1, self.person_1.Person_getChildCount(max_age=1000)) - self.assertEquals(0, self.person_1.Person_getChildCount(max_age=2)) + self.assertEqual(1, self.person_1.Person_getChildCount(max_age=1000)) + self.assertEqual(0, self.person_1.Person_getChildCount(max_age=2)) def test_SocialContract(self): - self.assertEquals(0, self.person_1.Person_getPartnerCount()) + self.assertEqual(0, self.person_1.Person_getPartnerCount()) contract_1 = self.portal.social_contract_module.newContent( portal_type='Social Contract', social_contract_type='marriage', @@ -76,7 +76,7 @@ class TestERP5SocialContracts(ERP5TypeTestCase): contract_1.setDestinationValueList((self.person_1, self.person_2)) contract_1.validate() self.tic() - self.assertEquals(1, self.person_1.Person_getPartnerCount()) + self.assertEqual(1, self.person_1.Person_getPartnerCount()) contract_2 = self.portal.social_contract_module.newContent( portal_type='Social Contract', @@ -86,19 +86,19 @@ class TestERP5SocialContracts(ERP5TypeTestCase): contract_2.validate() self.tic() - self.assertEquals(2, self.person_1.Person_getPartnerCount()) + self.assertEqual(2, self.person_1.Person_getPartnerCount()) # you can specify a date - self.assertEquals(1, + self.assertEqual(1, self.person_1.Person_getPartnerCount(at_date=DateTime(3000, 1, 2))) # you can restrict to some social contracts types only - self.assertEquals(1, self.person_1.Person_getPartnerCount( + self.assertEqual(1, self.person_1.Person_getPartnerCount( valid_social_contract_type_list=('marriage', ))) # only validated social contracts are used contract_1.invalidate() - self.assertEquals(1, self.person_1.Person_getPartnerCount()) + self.assertEqual(1, self.person_1.Person_getPartnerCount()) def test_suite(): diff --git a/bt5/erp5_social_contracts/bt/revision b/bt5/erp5_social_contracts/bt/revision index d99e90eb96..8580e7b684 100644 --- a/bt5/erp5_social_contracts/bt/revision +++ b/bt5/erp5_social_contracts/bt/revision @@ -1 +1 @@ -29 \ No newline at end of file +30 \ No newline at end of file diff --git a/bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py b/bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py index a8255e3fcb..a6de7376fe 100644 --- a/bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py +++ b/bt5/erp5_test_result/TestTemplateItem/portal_components/test.erp5.testTaskDistribution.py @@ -92,11 +92,11 @@ class TestTaskDistribution(ERP5TypeTestCase): def test_01_createTestNode(self): test_node = self._createTestNode()[0] - self.assertEquals(test_node.getPortalType(), "Test Node") + self.assertEqual(test_node.getPortalType(), "Test Node") def test_02_createTestSuite(self): test_suite, = self._createTestSuite() - self.assertEquals(test_suite.getPortalType(), "Test Suite") + self.assertEqual(test_suite.getPortalType(), "Test Suite") def _callOptimizeAlarm(self): self.portal.portal_alarms.task_distributor_alarm_optimize.activeSense() @@ -105,14 +105,14 @@ class TestTaskDistribution(ERP5TypeTestCase): def test_03_startTestSuiteWithOneTestNode(self): config_list = json.loads(self.distributor.startTestSuite( title="COMP32-Node1")) - self.assertEquals([], config_list) + self.assertEqual([], config_list) self._createTestSuite(quantity=3) self.tic() self._callOptimizeAlarm() config_list = json.loads(self.distributor.startTestSuite( title="COMP32-Node1")) - self.assertEquals(3, len(config_list)) - self.assertEquals(set(['B0','B1','B2']), + self.assertEqual(3, len(config_list)) + self.assertEqual(set(['B0','B1','B2']), set([x['test_suite'] for x in config_list])) def test_04_startTestSuiteWithTwoTestNode(self): @@ -124,14 +124,14 @@ class TestTaskDistribution(ERP5TypeTestCase): title="COMP32-Node1")) config_list = json.loads(self.distributor.startTestSuite( title="COMP32-Node2")) - self.assertEquals([], config_list) + self.assertEqual([], config_list) self._createTestSuite(quantity=2) self.tic() self._callOptimizeAlarm() def checkConfigListForTestNode(test_node_title): config_list = json.loads(self.distributor.startTestSuite( title=test_node_title)) - self.assertEquals(1, len(config_list)) + self.assertEqual(1, len(config_list)) return (test_node_title, set([x['test_suite'] for x in config_list])) config1 = checkConfigListForTestNode("COMP32-Node1") config2 = checkConfigListForTestNode("COMP32-Node2") @@ -164,26 +164,26 @@ class TestTaskDistribution(ERP5TypeTestCase): We will check the method createTestResult of task distribution tool """ test_result_path, revision = self._createTestResult() - self.assertEquals("r0=a,r1=a", revision) + self.assertEqual("r0=a,r1=a", revision) self.assertTrue(test_result_path.startswith("test_result_module/")) # If we ask again with another revision, we should get with previous # revision next_test_result_path, next_revision = self._createTestResult( revision="r0=a,r1=b", node_title="Node1") - self.assertEquals(revision, next_revision) - self.assertEquals(next_test_result_path, test_result_path) + self.assertEqual(revision, next_revision) + self.assertEqual(next_test_result_path, test_result_path) # Check if test result object is well created test_result = self.getPortalObject().unrestrictedTraverse(test_result_path) - self.assertEquals("Test Result", test_result.getPortalType()) - self.assertEquals(0, len(test_result.objectValues( + self.assertEqual("Test Result", test_result.getPortalType()) + self.assertEqual(0, len(test_result.objectValues( portal_type="Test Result Line"))) # now check that if we pass list of test, new lines will be created next_test_result_path, next_revision = self._createTestResult( test_list=['testFoo', 'testBar']) - self.assertEquals(next_test_result_path, test_result_path) + self.assertEqual(next_test_result_path, test_result_path) line_list = test_result.objectValues(portal_type="Test Result Line") - self.assertEquals(2, len(line_list)) - self.assertEquals(set(['testFoo', 'testBar']), set([x.getTitle() for x + self.assertEqual(2, len(line_list)) + self.assertEqual(set(['testFoo', 'testBar']), set([x.getTitle() for x in line_list])) def test_06_startStopUnitTest(self): @@ -197,7 +197,7 @@ class TestTaskDistribution(ERP5TypeTestCase): next_line_url, next_test = self.tool.startUnitTest(test_result_path) # first launch, we have no time optimisations, so tests are # launched in the given order - self.assertEquals(['testFoo', 'testBar'], [test, next_test]) + self.assertEqual(['testFoo', 'testBar'], [test, next_test]) status_dict = {} self.tool.stopUnitTest(line_url, status_dict) self.tool.stopUnitTest(next_line_url, status_dict) @@ -213,31 +213,31 @@ class TestTaskDistribution(ERP5TypeTestCase): next_line.duration = line.duration + 1 # So if we launch another unit test, it will process first the # one wich is the slowest - self.assertEquals("stopped", test_result.getSimulationState()) + self.assertEqual("stopped", test_result.getSimulationState()) self.tic() next_test_result_path, revision = self._createTestResult( test_list=['testFoo', 'testBar'], revision="r0=a,r1=b") self.assertNotEquals(next_test_result_path, test_result_path) line_url, test = self.tool.startUnitTest(next_test_result_path) next_line_url, next_test = self.tool.startUnitTest(next_test_result_path) - self.assertEquals(['testBar', 'testFoo'], [test, next_test]) + self.assertEqual(['testBar', 'testFoo'], [test, next_test]) def test_07_reportTaskFailure(self): test_result_path, revision = self._createTestResult(node_title="Node0") test_result_path, revision = self._createTestResult(node_title="Node1") test_result = self.getPortalObject().unrestrictedTraverse(test_result_path) - self.assertEquals("started", test_result.getSimulationState()) + self.assertEqual("started", test_result.getSimulationState()) node_list = test_result.objectValues(portal_type="Test Result Node", sort_on=[("title", "ascending")]) def checkNodeState(first_state, second_state): - self.assertEquals([("Node0", first_state), ("Node1", second_state)], + self.assertEqual([("Node0", first_state), ("Node1", second_state)], [(x.getTitle(), x.getSimulationState()) for x in node_list]) checkNodeState("started", "started") self.tool.reportTaskFailure(test_result_path, {}, "Node0") - self.assertEquals("started", test_result.getSimulationState()) + self.assertEqual("started", test_result.getSimulationState()) checkNodeState("failed", "started") self.tool.reportTaskFailure(test_result_path, {}, "Node1") - self.assertEquals("failed", test_result.getSimulationState()) + self.assertEqual("failed", test_result.getSimulationState()) checkNodeState("failed", "failed") def test_08_checkWeCanNotCreateTwoTestResultInParallel(self): @@ -250,7 +250,7 @@ class TestTaskDistribution(ERP5TypeTestCase): node_title="Node0", tic=0) next_test_result_path, revision = self._createTestResult( node_title="Node1", tic=0) - self.assertEquals(test_result_path, next_test_result_path) + self.assertEqual(test_result_path, next_test_result_path) def _checkCreateTestResultAndAllowRestart(self, tic=False): test_result_path, revision = self._createTestResult(test_list=["testFoo"]) @@ -260,8 +260,8 @@ class TestTaskDistribution(ERP5TypeTestCase): if tic: self.tic() test_result = self.getPortalObject().unrestrictedTraverse(test_result_path) - self.assertEquals("stopped", test_result.getSimulationState()) - self.assertEquals(None, self._createTestResult(test_list=["testFoo"])) + self.assertEqual("stopped", test_result.getSimulationState()) + self.assertEqual(None, self._createTestResult(test_list=["testFoo"])) next_test_result_path, next_revision = self._createTestResult( test_list=["testFoo"], allow_restart=True) self.assertTrue(next_test_result_path != test_result_path) @@ -290,7 +290,7 @@ class TestTaskDistribution(ERP5TypeTestCase): self.tic() self._callOptimizeAlarm() for test_node, aggregate_list in args: - self.assertEquals(set(test_node.getAggregateList()), + self.assertEqual(set(test_node.getAggregateList()), set(aggregate_list), "incorrect aggregate for %r, got %r instead of %r" % \ (test_node.getTitle(), test_node.getAggregateList(), aggregate_list)) @@ -458,14 +458,14 @@ class TestTaskDistribution(ERP5TypeTestCase): def test_13_startTestSuiteWithOneTestNodeAndPerformanceDistributor(self): config_list = json.loads(self.performance_distributor.startTestSuite( title="COMP32-Node1")) - self.assertEquals([], config_list) + self.assertEqual([], config_list) self._createTestSuite(quantity=2, specialise_value=self.performance_distributor) self.tic() self._callOptimizeAlarm() config_list = json.loads(self.performance_distributor.startTestSuite( title="COMP32-Node1")) - self.assertEquals(2, len(config_list)) - self.assertEquals(set(['test suite 1-COMP32-Node1', + self.assertEqual(2, len(config_list)) + self.assertEqual(set(['test suite 1-COMP32-Node1', 'test suite 2-COMP32-Node1']), set([x['test_suite_title'] for x in config_list])) diff --git a/bt5/erp5_test_result/bt/revision b/bt5/erp5_test_result/bt/revision index 1c5fd036ef..99bc3d5186 100644 --- a/bt5/erp5_test_result/bt/revision +++ b/bt5/erp5_test_result/bt/revision @@ -1 +1 @@ -252 \ No newline at end of file +253 \ No newline at end of file diff --git a/bt5/erp5_upgrader/TestTemplateItem/portal_components/test.erp5.testLiveUpgrader.py b/bt5/erp5_upgrader/TestTemplateItem/portal_components/test.erp5.testLiveUpgrader.py index 064fa85e0c..e196d1d9ba 100644 --- a/bt5/erp5_upgrader/TestTemplateItem/portal_components/test.erp5.testLiveUpgrader.py +++ b/bt5/erp5_upgrader/TestTemplateItem/portal_components/test.erp5.testLiveUpgrader.py @@ -92,26 +92,26 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase): 'alarm_tool_configuration_list' ) signature = self.portal.ERP5Site_getUpgraderSignature() - self.assertEquals(sorted(signature_key_list), sorted(signature.keys())) + self.assertEqual(sorted(signature_key_list), sorted(signature.keys())) def test_StandardUpgraderSignature(self): """ Test default behaviours provided by default ERP5Site_getUpgraderSignature """ signature = self.portal.ERP5Site_getUpgraderSignature() # By default we do not recatalog the instance - self.assertEquals(signature['recatalog'], False) + self.assertEqual(signature['recatalog'], False) # By default we do not upgrade manually the workflow - self.assertEquals(signature['workflow_chain_dict'], None) + self.assertEqual(signature['workflow_chain_dict'], None) # By Default we do not upgrade Catalog Filters - self.assertEquals(signature['catalog_filter_dict'], None) + self.assertEqual(signature['catalog_filter_dict'], None) # By Default there is no extra properties to set. - self.assertEquals(signature['erp5_site_property_dict'], {}) + self.assertEqual(signature['erp5_site_property_dict'], {}) # Do not enable alarms by default - self.assertEquals(signature['alarm_tool_configuration_list'], ()) + self.assertEqual(signature['alarm_tool_configuration_list'], ()) # By default we upgrade software, products, bt5 and so on. self.assertTrue(signature['alarm_dict']["bt5_upgrader"]) @@ -144,14 +144,14 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase): 'ERP5Site_getUpgraderSignature', "item=None", "return " + str(signature_code)) self.commit() - self.assertEquals(self.portal.ERP5Site_getUpgraderSignature(), signature_code) - self.assertEquals(self.portal.ERP5Site_upgradeObjectList(), []) + self.assertEqual(self.portal.ERP5Site_getUpgraderSignature(), signature_code) + self.assertEqual(self.portal.ERP5Site_upgradeObjectList(), []) test_object = self.portal.portal_categories.newContent(id=self.upgrade_object_test_id, portal_type="Base Category") - self.assertEquals(test_object.getValidationState(), 'embedded') + self.assertEqual(test_object.getValidationState(), 'embedded') self.assertNotEquals(self.portal.ERP5Site_upgradeObjectList(), []) self.assertNotEquals(self.portal.ERP5Site_upgradeObjectList(upgrade="1"), []) - self.assertEquals(test_object.getValidationState(), 'published') + self.assertEqual(test_object.getValidationState(), 'published') def testUpgradeObjectClass(self): """ @@ -169,9 +169,9 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase): 'ERP5Site_getUpgraderSignature', "item=None", "return " + str(signature_code)) self.commit() - self.assertEquals(self.portal.ERP5Site_getUpgraderSignature(), signature_code) + self.assertEqual(self.portal.ERP5Site_getUpgraderSignature(), signature_code) # Nothing to upgrade - self.assertEquals(self.portal.ERP5Site_upgradeObjectClass(), []) + self.assertEqual(self.portal.ERP5Site_upgradeObjectClass(), []) # Create one broken object gadget = self.portal.portal_gadgets.newContent(portal_type="Gadget", @@ -189,10 +189,10 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase): self.commit() self.assertNotEquals(self.portal.ERP5Site_upgradeObjectClass(), []) - self.assertEquals(self.portal.ERP5Site_upgradeObjectClass(upgrade=1), + self.assertEqual(self.portal.ERP5Site_upgradeObjectClass(upgrade=1), [(gadget.getRelativeUrl(), 'ERP5 Gadget')]) self.tic() - self.assertEquals(self.portal.ERP5Site_upgradeObjectClass(), []) + self.assertEqual(self.portal.ERP5Site_upgradeObjectClass(), []) def test_UpgradeGlobalPropertyList(self): """ @@ -206,16 +206,16 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase): 'ERP5Site_getUpgraderSignature', "item=None", "return " + str(signature_code)) self.commit() - self.assertEquals(self.portal.ERP5Site_getUpgraderSignature(), signature_code) - self.assertEquals(self.portal.ERP5Site_upgradeGlobalPropertyList(), + self.assertEqual(self.portal.ERP5Site_getUpgraderSignature(), signature_code) + self.assertEqual(self.portal.ERP5Site_upgradeGlobalPropertyList(), ["Upgrade Required for Global Properties."]) - self.assertEquals(["Upgrade Executed for Global Properties (erp5_site_global_id)."], + self.assertEqual(["Upgrade Executed for Global Properties (erp5_site_global_id)."], self.portal.ERP5Site_upgradeGlobalPropertyList(upgrade=1)) self.tic() - self.assertEquals(self.portal.ERP5Site_upgradeGlobalPropertyList(), []) - self.assertEquals(getattr(self.portal, 'erp5_site_global_id', None), + self.assertEqual(self.portal.ERP5Site_upgradeGlobalPropertyList(), []) + self.assertEqual(getattr(self.portal, 'erp5_site_global_id', None), self.upgrade_object_test_id) def test_UpgradeWorkflowChain(self): @@ -230,23 +230,23 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase): "return " + str(signature_code)) self.commit() - self.assertEquals(self.portal.ERP5Site_upgradeWorkflowChain(), []) + self.assertEqual(self.portal.ERP5Site_upgradeWorkflowChain(), []) original_person_chain = workflow_dict["chain_Person"] # Modify installed workflow chain. workflow_dict["chain_Person"] = '' workflow_tool.manage_changeWorkflows(default_chain = '', props = workflow_dict) - self.assertEquals(workflow_tool.getWorkflowChainDict()["chain_Person"], + self.assertEqual(workflow_tool.getWorkflowChainDict()["chain_Person"], "") - self.assertEquals(self.portal.ERP5Site_upgradeWorkflowChain(), + self.assertEqual(self.portal.ERP5Site_upgradeWorkflowChain(), ["Upgrade Required for Workflow Chain."]) - self.assertEquals(self.portal.ERP5Site_upgradeWorkflowChain(upgrade=1), + self.assertEqual(self.portal.ERP5Site_upgradeWorkflowChain(upgrade=1), ["Upgrade Executed for Workflow Chain."]) self.tic() - self.assertEquals(self.portal.ERP5Site_upgradeWorkflowChain(),[]) - self.assertEquals(workflow_tool.getWorkflowChainDict()["chain_Person"], + self.assertEqual(self.portal.ERP5Site_upgradeWorkflowChain(),[]) + self.assertEqual(workflow_tool.getWorkflowChainDict()["chain_Person"], original_person_chain) def test_RunVerificationScriptDontRaise(self): @@ -261,9 +261,9 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase): "return ['A']") failure = self.portal.ERP5Site_runVerificationScript("ERP5Site_raise") - self.failUnless("Script ERP5Site_raise fail to run" in failure, + self.assertTrue("Script ERP5Site_raise fail to run" in failure, "'Script ERP5Site_raise fail to run not' in %s" % failure) - self.assertEquals('ERP5Site_return : \n - A ', + self.assertEqual('ERP5Site_return : \n - A ', self.portal.ERP5Site_runVerificationScript("ERP5Site_return")) def test_UpgradePortalTypePropertySheet(self): @@ -275,13 +275,13 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase): 'ERP5Site_getUpgraderSignature', "item=None", "return " + str(signature_code)) self.commit() - self.assertEquals(self.portal.ERP5Site_getUpgraderSignature(), signature_code) - self.assertEquals(self.portal.ERP5Site_upgradePortalTypePropertySheet(), + self.assertEqual(self.portal.ERP5Site_getUpgraderSignature(), signature_code) + self.assertEqual(self.portal.ERP5Site_upgradePortalTypePropertySheet(), ["Person doesn't has Account associated."]) - self.assertEquals(self.portal.ERP5Site_upgradePortalTypePropertySheet(upgrade=1), + self.assertEqual(self.portal.ERP5Site_upgradePortalTypePropertySheet(upgrade=1), ["Associate PropertySheet Account into Portal Type Person."]) self.tic() - self.assertEquals(self.portal.ERP5Site_upgradePortalTypePropertySheet(), []) + self.assertEqual(self.portal.ERP5Site_upgradePortalTypePropertySheet(), []) def test_recreateActivities(self): @@ -306,5 +306,5 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase): self.tic() self.assertFalse(object_to_test.hasActivity(method_id="ERP5Site_testRecreateActivityScript")) self.assertFalse(self.portal.portal_activities.hasActivity(method_id='ERP5Site_clearActivities')) - self.assertEquals(object_to_test.getProperty('custom_property_without_meaning'), + self.assertEqual(object_to_test.getProperty('custom_property_without_meaning'), 'I was there') diff --git a/bt5/erp5_upgrader/bt/revision b/bt5/erp5_upgrader/bt/revision index 73623d101c..1fb8d9e69e 100644 --- a/bt5/erp5_upgrader/bt/revision +++ b/bt5/erp5_upgrader/bt/revision @@ -1 +1 @@ -600 \ No newline at end of file +601 \ No newline at end of file diff --git a/bt5/erp5_web_shacache/TestTemplateItem/portal_components/test.erp5.testShaCache.py b/bt5/erp5_web_shacache/TestTemplateItem/portal_components/test.erp5.testShaCache.py index 264347affc..7ac9be1bf5 100644 --- a/bt5/erp5_web_shacache/TestTemplateItem/portal_components/test.erp5.testShaCache.py +++ b/bt5/erp5_web_shacache/TestTemplateItem/portal_components/test.erp5.testShaCache.py @@ -90,11 +90,11 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase): document = self.portal.portal_catalog.getResultValue(reference=self.key) self.assertNotEqual(None, document) - self.assertEquals(self.key, document.getTitle()) - self.assertEquals(self.key, document.getReference()) - self.assertEquals(self.data, document.getData()) - self.assertEquals('application/octet-stream', document.getContentType()) - self.assertEquals('Published', document.getValidationStateTitle()) + self.assertEqual(self.key, document.getTitle()) + self.assertEqual(self.key, document.getReference()) + self.assertEqual(self.data, document.getData()) + self.assertEqual('application/octet-stream', document.getContentType()) + self.assertEqual('Published', document.getValidationStateTitle()) def test_get_file(self): """ @@ -111,7 +111,7 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase): result, data = self.getFile() self.assertEqual(result, httplib.OK) - self.assertEquals(data, self.data) + self.assertEqual(data, self.data) def test_put_file_twice(self): """ @@ -120,17 +120,17 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase): self.postFile() self.tic() document = self.portal.portal_catalog.getResultValue(reference=self.key) - self.assertEquals('published', document.getValidationState()) + self.assertEqual('published', document.getValidationState()) self.postFile() self.tic() - self.assertEquals(2, self.portal.portal_catalog.countResults( + self.assertEqual(2, self.portal.portal_catalog.countResults( reference=self.key)[0][0]) document2 = self.portal.portal_catalog.getResultValue(reference=self.key, sort_on=(('uid', 'ASC'),)) - self.assertEquals('published', document2.getValidationState()) - self.assertEquals('archived', document.getValidationState()) + self.assertEqual('published', document2.getValidationState()) + self.assertEqual('archived', document.getValidationState()) def test_put_file_twice_no_tic(self): self.postFile() diff --git a/bt5/erp5_web_shacache/bt/revision b/bt5/erp5_web_shacache/bt/revision index 8c0474e323..d7765fe47e 100644 --- a/bt5/erp5_web_shacache/bt/revision +++ b/bt5/erp5_web_shacache/bt/revision @@ -1 +1 @@ -69 \ No newline at end of file +70 \ No newline at end of file diff --git a/bt5/erp5_web_shadir/TestTemplateItem/portal_components/test.erp5.testShaDir.py b/bt5/erp5_web_shadir/TestTemplateItem/portal_components/test.erp5.testShaDir.py index dbbf35b791..e6450bd953 100644 --- a/bt5/erp5_web_shadir/TestTemplateItem/portal_components/test.erp5.testShaDir.py +++ b/bt5/erp5_web_shadir/TestTemplateItem/portal_components/test.erp5.testShaDir.py @@ -101,20 +101,20 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase): # Asserting Data Set data_set = self.portal.portal_catalog.getResultValue( reference=self.key) - self.assertEquals(self.key, data_set.getReference()) - self.assertEquals('published', data_set.getValidationState()) + self.assertEqual(self.key, data_set.getReference()) + self.assertEqual('published', data_set.getValidationState()) # Asserting Document document = self.portal.portal_catalog.getResultValue( reference=self.sha512sum) - self.assertEquals(self.sha512sum, document.getTitle()) - self.assertEquals(self.sha512sum, document.getReference()) - self.assertEquals(self.data, document.getData()) - self.assertEquals(data_set, document.getFollowUpValue()) - self.assertEquals(str(self.expiration_date), + self.assertEqual(self.sha512sum, document.getTitle()) + self.assertEqual(self.sha512sum, document.getReference()) + self.assertEqual(self.data, document.getData()) + self.assertEqual(data_set, document.getFollowUpValue()) + self.assertEqual(str(self.expiration_date), str(document.getExpirationDate())) - self.assertEquals('application/json', document.getContentType()) - self.assertEquals('Published', document.getValidationStateTitle()) + self.assertEqual('application/json', document.getContentType()) + self.assertEqual('Published', document.getValidationStateTitle()) def test_get_information(self): """ @@ -129,8 +129,8 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase): information_list = json.loads(data) - self.assertEquals(1, len(information_list)) - self.assertEquals(json.dumps(information_list[0]), self.data) + self.assertEqual(1, len(information_list)) + self.assertEqual(json.dumps(information_list[0]), self.data) def test_post_information_more_than_once(self): """ @@ -160,8 +160,8 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase): self.assertEqual(result, httplib.OK) information_list = json.loads(data) - self.assertEquals(1, len(information_list)) - self.assertEquals(json.dumps(information_list[0]), self.data) + self.assertEqual(1, len(information_list)) + self.assertEqual(json.dumps(information_list[0]), self.data) def test_post_information_more_than_once_no_tic(self): """ @@ -198,8 +198,8 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase): self.assertEqual(result, httplib.OK) information_list = json.loads(data) - self.assertEquals(1, len(information_list)) - self.assertEquals(json.dumps(information_list[0]), self.data) + self.assertEqual(1, len(information_list)) + self.assertEqual(json.dumps(information_list[0]), self.data) def test_get_information_from_different_data_set(self): """ @@ -229,19 +229,19 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase): self.postInformation(key_2, data_2) self.tic() - self.assertEquals(2, len(self.portal.data_set_module)) - self.assertEquals(2, len(self.portal.document_module)) + self.assertEqual(2, len(self.portal.data_set_module)) + self.assertEqual(2, len(self.portal.document_module)) result, document = self.getInformation() - self.assertEquals(1, len(json.loads(document))) + self.assertEqual(1, len(json.loads(document))) result, document2 = self.getInformation(key_2) - self.assertEquals(1, len(json.loads(document2))) + self.assertEqual(1, len(json.loads(document2))) self.postInformation() self.tic() - self.assertEquals(2, len(self.portal.data_set_module)) - self.assertEquals(3, len(self.portal.document_module)) + self.assertEqual(2, len(self.portal.data_set_module)) + self.assertEqual(3, len(self.portal.document_module)) result, document3 = self.getInformation() - self.assertEquals(1, len(json.loads(document3))) + self.assertEqual(1, len(json.loads(document3))) diff --git a/bt5/erp5_web_shadir/bt/revision b/bt5/erp5_web_shadir/bt/revision index aa92725341..780fea92d2 100644 --- a/bt5/erp5_web_shadir/bt/revision +++ b/bt5/erp5_web_shadir/bt/revision @@ -1 +1 @@ -76 \ No newline at end of file +77 \ No newline at end of file diff --git a/bt5/erp5_web_ung_role/TestTemplateItem/portal_components/test.erp5.testUNGSecurity.py b/bt5/erp5_web_ung_role/TestTemplateItem/portal_components/test.erp5.testUNGSecurity.py index 556fcb6eec..8bc2516075 100644 --- a/bt5/erp5_web_ung_role/TestTemplateItem/portal_components/test.erp5.testUNGSecurity.py +++ b/bt5/erp5_web_ung_role/TestTemplateItem/portal_components/test.erp5.testUNGSecurity.py @@ -66,13 +66,13 @@ class TestUNGSecurity(ERP5TypeTestCase): to create and edit document in UNG""" self.login("ung_user") web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page") - self.assertEquals(web_page, None) + self.assertEqual(web_page, None) self.changeSkin("UNGDoc") self.portal.ERP5Site_createNewWebDocument("web_page_template") self.tic() web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page") - self.assertEquals(web_page.getReference(), "default-Web.Page.Reference") - self.assertEquals(len(self.portal.web_page_module.searchFolder()), 1) + self.assertEqual(web_page.getReference(), "default-Web.Page.Reference") + self.assertEqual(len(self.portal.web_page_module.searchFolder()), 1) def testShareDocument(self): """Test the document sharing between erp5 users""" @@ -91,28 +91,28 @@ class TestUNGSecurity(ERP5TypeTestCase): web_table.setReference("share-Web.Table") self.tic() self.login("ung_user2") - self.assertEquals(len(self.portal.web_page_module.searchFolder()), 0) + self.assertEqual(len(self.portal.web_page_module.searchFolder()), 0) ung_web_site = self.portal.web_site_module.ung self.changeSkin("UNGDoc") web_table = ung_web_site.ERP5Site_userFollowUpWebPage("share-Web.Table") self.tic() self.assertNotEquals(web_table.getFollowUpList(), []) - self.assertEquals(len(self.portal.web_page_module.searchFolder()), 1) + self.assertEqual(len(self.portal.web_page_module.searchFolder()), 1) web_table = self.portal.web_page_module.searchFolder()[0] - self.assertEquals(web_table.getPortalType(), "Web Table") + self.assertEqual(web_table.getPortalType(), "Web Table") self.login("ERP5TypeTestCase") - self.assertEquals(web_table.getFollowUpValue().getFirstName(), "Gabriel") + self.assertEqual(web_table.getFollowUpValue().getFirstName(), "Gabriel") def testBase_updateCalendarEventListWithERP5User(self): """ Test script Base_updateCalendarEventList with erp5 user""" self.logout() self.changeSkin("UNGDoc") - self.assertEquals('{"events": []}', + self.assertEqual('{"events": []}', self.portal.Base_updateCalendarEventList("list")) self.login("ung_user") self.changeSkin("UNGDoc") event_list = json.loads(self.portal.Base_updateCalendarEventList("list")) - self.assertEquals(event_list.get("events"), []) + self.assertEqual(event_list.get("events"), []) event = self.portal.event_module.newContent(portal_type="Note") event.setStartDate(DateTime()) event.setStopDate(DateTime()+1) @@ -120,7 +120,7 @@ class TestUNGSecurity(ERP5TypeTestCase): self.changeSkin("UNGDoc") event_dict = json.loads(self.portal.Base_updateCalendarEventList("list")) event_list = event_dict.get("events") - self.assertEquals(event_list[0][-2], "Note") + self.assertEqual(event_list[0][-2], "Note") form_dict = dict(CalendarStartTime=DateTime().strftime("%m/%d/%Y %H:%M"), CalendarEndTime=DateTime().strftime("%m/%d/%Y %H:%M"), CalendarTitle="One Sample", @@ -130,7 +130,7 @@ class TestUNGSecurity(ERP5TypeTestCase): self.portal.Base_updateCalendarEventList("add") self.tic() web_message = self.portal.portal_catalog.getResultValue(portal_type="Web Message") - self.assertEquals(web_message.getTitle(), "One Sample") + self.assertEqual(web_message.getTitle(), "One Sample") self.portal.REQUEST.form.clear() form_dict = dict(CalendarStartTime=DateTime().strftime("%m/%d/%Y %H:%M"), CalendarEndTime=DateTime().strftime("%m/%d/%Y %H:%M"), @@ -140,7 +140,7 @@ class TestUNGSecurity(ERP5TypeTestCase): self.changeSkin("UNGDoc") self.portal.Base_updateCalendarEventList("update") self.tic() - self.assertEquals(web_message.getTitle(), "Buy Coffee") + self.assertEqual(web_message.getTitle(), "Buy Coffee") self.portal.REQUEST.form.clear() form_dict = dict(title=web_message.getTitle(), id=web_message.getId()) @@ -149,7 +149,7 @@ class TestUNGSecurity(ERP5TypeTestCase): self.portal.Base_updateCalendarEventList("remove") self.tic() web_message = self.portal.portal_catalog.getResultValue(portal_type="Web Message") - self.assertEquals(web_message, None) + self.assertEqual(web_message, None) def testERPSite_createUNGUser(self): """Test if is possible create one user as Anonymous user""" @@ -163,8 +163,8 @@ class TestUNGSecurity(ERP5TypeTestCase): self.tic() self.login("ERP5TypeTestCase") person = self.portal.portal_catalog.getResultValue(portal_type="Person") - self.assertEquals(person.getLastName(), "My Last Name") - self.assertEquals(person.getValidationState(), "validated") + self.assertEqual(person.getLastName(), "My Last Name") + self.assertEqual(person.getValidationState(), "validated") def testBase_getPreferencePathList(self): """Test if with normal user the paths of preference objects are returned correctly""" @@ -177,11 +177,11 @@ class TestUNGSecurity(ERP5TypeTestCase): self.login("ung_user") self.changeSkin("UNGDoc") preference_dict = json.loads(self.portal.Base_getPreferencePathList()) - self.assertEquals(preference_dict, {u'preference': u'portal_preferences/1'}) + self.assertEqual(preference_dict, {u'preference': u'portal_preferences/1'}) self.login("ung_user2") self.changeSkin("UNGDoc") preference_dict = json.loads(self.portal.Base_getPreferencePathList()) - self.assertEquals(preference_dict, {u'preference': u'portal_preferences/2'}) + self.assertEqual(preference_dict, {u'preference': u'portal_preferences/2'}) def testWebPage_shareDocument(self): """ """ @@ -190,11 +190,11 @@ class TestUNGSecurity(ERP5TypeTestCase): self.portal.ERP5Site_createNewWebDocument("web_page_template") self.tic() web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page") - self.assertEquals(web_page.getValidationState(), "draft") + self.assertEqual(web_page.getValidationState(), "draft") self.changeSkin("UNGDoc") response = web_page.WebPage_shareDocument() self.tic() - self.assertEquals(response, "".join((self.portal.absolute_url(), + self.assertEqual(response, "".join((self.portal.absolute_url(), "/?key=", web_page.getReference()))) - self.assertEquals(web_page.getValidationState(), "shared") + self.assertEqual(web_page.getValidationState(), "shared") diff --git a/bt5/erp5_web_ung_role/bt/revision b/bt5/erp5_web_ung_role/bt/revision index 7c091989d0..c24b6ae77d 100644 --- a/bt5/erp5_web_ung_role/bt/revision +++ b/bt5/erp5_web_ung_role/bt/revision @@ -1 +1 @@ -37 \ No newline at end of file +38 \ No newline at end of file diff --git a/bt5/erp5_web_ung_theme/TestTemplateItem/portal_components/test.erp5.testUNG.py b/bt5/erp5_web_ung_theme/TestTemplateItem/portal_components/test.erp5.testUNG.py index 667142aade..d312057cd1 100644 --- a/bt5/erp5_web_ung_theme/TestTemplateItem/portal_components/test.erp5.testUNG.py +++ b/bt5/erp5_web_ung_theme/TestTemplateItem/portal_components/test.erp5.testUNG.py @@ -62,7 +62,7 @@ class TestUNG(ERP5TypeTestCase): self.portal.ERP5Site_createNewWebDocument(template) self.tic() web_page_search = web_page_module.searchFolder(**kw) - self.assertEquals(1, len(web_page_search)) + self.assertEqual(1, len(web_page_search)) def getTitleListToBySubjectDomain(self): parent = self.portal.portal_domains.ung_domain.by_subject @@ -103,10 +103,10 @@ class TestUNG(ERP5TypeTestCase): web_table = self.portal.web_page_module.newContent(portal_type="Web Table") web_table.Base_changeWorkflowState("publish_action") self.tic() - self.assertEquals(web_table.getValidationState(), "published") + self.assertEqual(web_table.getValidationState(), "published") self.changeSkin("UNGDoc") web_table.Base_changeWorkflowState("reject_action") - self.assertEquals(web_table.getValidationState(), "draft") + self.assertEqual(web_table.getValidationState(), "draft") def testWebPage_getUNGIcon(self): """Test if the paths are returned correctly""" @@ -115,11 +115,11 @@ class TestUNG(ERP5TypeTestCase): web_illustration = self.portal.web_page_module.newContent(portal_type="Web Illustration") self.tic() self.changeSkin("UNGDoc") - self.assertEquals(web_page.WebPage_getUNGIcon(), + self.assertEqual(web_page.WebPage_getUNGIcon(), "<img src='ung_images/document.gif'/>") - self.assertEquals(web_table.WebPage_getUNGIcon(), + self.assertEqual(web_table.WebPage_getUNGIcon(), "<img src='ung_images/table.jpg'/>") - self.assertEquals(web_illustration.WebPage_getUNGIcon(), + self.assertEqual(web_illustration.WebPage_getUNGIcon(), "<img src='ung_images/svg.png'/>") def testWebSection_deleteObjectList(self): @@ -132,13 +132,13 @@ class TestUNG(ERP5TypeTestCase): self.changeSkin("UNGDoc") self.portal.WebSection_deleteObjectList() self.tic() - self.assertEquals(web_page.getValidationState(), "deleted") + self.assertEqual(web_page.getValidationState(), "deleted") self.portal.REQUEST.set("uids", [web_page.getUid(),]) self.tic() self.changeSkin("UNGDoc") self.portal.WebSection_deleteObjectList() self.tic() - self.assertEquals(len(self.portal.portal_catalog(relative_url=relative_url)), 0) + self.assertEqual(len(self.portal.portal_catalog(relative_url=relative_url)), 0) web_page = web_page_module.newContent(portal_type="Web Page") web_table = web_page_module.newContent(portal_type="Web Table") web_illustration = web_page_module.newContent(portal_type="Web Illustration") @@ -153,9 +153,9 @@ class TestUNG(ERP5TypeTestCase): self.changeSkin("UNGDoc") self.portal.web_site_module.ung.WebSection_deleteObjectList() self.tic() - self.assertEquals(web_page.getValidationState(), "deleted") - self.assertEquals(web_table.getValidationState(), "deleted") - self.assertEquals(web_illustration.getValidationState(), "deleted") + self.assertEqual(web_page.getValidationState(), "deleted") + self.assertEqual(web_table.getValidationState(), "deleted") + self.assertEqual(web_illustration.getValidationState(), "deleted") self.portal.REQUEST.set("uids", uid_list) id_list = [web_page.getId(), web_table.getId(), @@ -188,14 +188,14 @@ class TestUNG(ERP5TypeTestCase): self.portal.ERP5Site_userFollowUpWebPage("new.Web-Page") self.tic() self.login("ERP5TypeTestCase") - self.assertEquals("ung_new_user", web_page.getFollowUpValue().getReference()) + self.assertEqual("ung_new_user", web_page.getFollowUpValue().getReference()) self.login("ung_new_user2") self.changeSkin("UNGDoc") self.portal.ERP5Site_userFollowUpWebPage("new.Web-Page") self.tic() self.login("ERP5TypeTestCase") reference_list = [user.getReference() for user in web_page.getFollowUpValueList()] - self.assertEquals(["ung_new_user", "ung_new_user2"], + self.assertEqual(["ung_new_user", "ung_new_user2"], sorted(reference_list)) def testWebSection_getGadgetPathList(self): @@ -206,8 +206,8 @@ class TestUNG(ERP5TypeTestCase): url = gadget.get("image_url").split("?")[0] url = url.replace("/default_image", "") catalog_result = self.portal.portal_catalog(relative_url=url) - self.assertEquals(len(catalog_result), 1) - self.assertEquals(catalog_result[0].getTitle(), gadget.get('title')) + self.assertEqual(len(catalog_result), 1) + self.assertEqual(catalog_result[0].getTitle(), gadget.get('title')) def testEventModule_createNewEvent(self): """Test if script creates correctly a new event""" @@ -232,10 +232,10 @@ class TestUNG(ERP5TypeTestCase): event = portal.portal_catalog.getResultValue( portal_type="Note", title='Buy Phone' ) - self.assertEquals(event.getDescription(), "testUNG Sample") + self.assertEqual(event.getDescription(), "testUNG Sample") start_date = event.getStartDate() - self.assertEquals(start_date.month(), 2) - self.assertEquals(start_date.minute(), 12) + self.assertEqual(start_date.month(), 2) + self.assertEqual(start_date.minute(), 12) def testWebPage_setSubjectList(self): """Test if string is inserted as subjects in object correctly""" @@ -245,13 +245,13 @@ class TestUNG(ERP5TypeTestCase): web_table.WebPage_setSubjectList("VPN") self.tic() subject_list = web_table.getSubjectList() - self.assertEquals(["VPN"], subject_list) + self.assertEqual(["VPN"], subject_list) self.changeSkin("UNGDoc") web_table.WebPage_setSubjectList("VPN,ERP5") self.tic() self.changeSkin("UNGDoc") subject_list = web_table.getSubjectList() - self.assertEquals(["ERP5", "VPN"], sorted(subject_list)) + self.assertEqual(["ERP5", "VPN"], sorted(subject_list)) def testWebSection_getDocumentUrl(self): """Test if script used to generated custom url to listbox works @@ -273,7 +273,7 @@ class TestUNG(ERP5TypeTestCase): """Test script used to manage events in UNG Calendar """ self.changeSkin('UNGDoc') event_dict = json.loads(self.portal.Base_updateCalendarEventList("list")) - self.assertEquals(event_dict.get("events"), []) + self.assertEqual(event_dict.get("events"), []) event = self.portal.event_module.newContent(portal_type="Note") event.setStartDate(DateTime()) event.setStopDate(DateTime()+1) @@ -281,7 +281,7 @@ class TestUNG(ERP5TypeTestCase): self.changeSkin("UNGDoc") event_dict = json.loads(self.portal.Base_updateCalendarEventList("list")) event_list = event_dict.get("events") - self.assertEquals(event_list[0][-2], "Note") + self.assertEqual(event_list[0][-2], "Note") form_dict = dict(CalendarStartTime=DateTime().strftime("%m/%d/%Y %H:%M"), CalendarEndTime=DateTime().strftime("%m/%d/%Y %H:%M"), CalendarTitle="One Sample", @@ -290,7 +290,7 @@ class TestUNG(ERP5TypeTestCase): self.portal.Base_updateCalendarEventList("add") self.tic() web_message = self.portal.portal_catalog.getResultValue(portal_type="Web Message") - self.assertEquals(web_message.getTitle(), "One Sample") + self.assertEqual(web_message.getTitle(), "One Sample") self.portal.REQUEST.form.clear() form_dict = dict(CalendarStartTime=DateTime().strftime("%m/%d/%Y %H:%M"), CalendarEndTime=DateTime().strftime("%m/%d/%Y %H:%M"), @@ -300,17 +300,17 @@ class TestUNG(ERP5TypeTestCase): self.changeSkin("UNGDoc") self.portal.Base_updateCalendarEventList("update") self.tic() - self.assertEquals(web_message.getTitle(), "Buy Coffee") + self.assertEqual(web_message.getTitle(), "Buy Coffee") form_dict["event_portal_type"] = "Note" self.portal.REQUEST.form.update(form_dict) self.changeSkin("UNGDoc") self.portal.Base_updateCalendarEventList("update") self.tic() web_message = self.portal.portal_catalog.getResultValue(portal_type="Web Message") - self.assertEquals(web_message, None) + self.assertEqual(web_message, None) note = self.portal.portal_catalog.getResultValue(portal_type="Note", title="Buy Coffee") - self.assertEquals(note.getTitle(), "Buy Coffee") + self.assertEqual(note.getTitle(), "Buy Coffee") self.portal.REQUEST.form.clear() form_dict = dict(title=note.getTitle(), id=note.getId()) @@ -320,7 +320,7 @@ class TestUNG(ERP5TypeTestCase): self.tic() note = self.portal.portal_catalog.getResultValue(portal_type="Note", title="Buy Coffee") - self.assertEquals(note, None) + self.assertEqual(note, None) self.portal.REQUEST.form.clear() start_date = DateTime() end_date = DateTime() + 1 @@ -334,12 +334,12 @@ class TestUNG(ERP5TypeTestCase): self.tic() letter = self.portal.portal_catalog.getResultValue(portal_type="Letter", title="Another Sample") - self.assertEquals(letter.getPortalType(), "Letter") - self.assertEquals(letter.getTitle(), "Another Sample") - self.assertEquals(letter.getStartDate().hour(), start_date.hour()) - self.assertEquals(letter.getStartDate().day(), start_date.day()) - self.assertEquals(letter.getStopDate().hour(), end_date.hour()) - self.assertEquals(letter.getStopDate().day(), end_date.day()) + self.assertEqual(letter.getPortalType(), "Letter") + self.assertEqual(letter.getTitle(), "Another Sample") + self.assertEqual(letter.getStartDate().hour(), start_date.hour()) + self.assertEqual(letter.getStartDate().day(), start_date.day()) + self.assertEqual(letter.getStopDate().hour(), end_date.hour()) + self.assertEqual(letter.getStopDate().day(), end_date.day()) self.portal.REQUEST.form.clear() form_dict = dict(title="Change only the Title of Sample", event_id=letter.getId()) @@ -349,13 +349,13 @@ class TestUNG(ERP5TypeTestCase): self.tic() letter = self.portal.portal_catalog.getResultValue(portal_type="Letter", title="Another Sample") - self.assertEquals(letter, None) + self.assertEqual(letter, None) letter = self.portal.portal_catalog.getResultValue(portal_type="Letter", title="Change only the Title of Sample") - self.assertEquals(letter.getStartDate().hour(), start_date.hour()) - self.assertEquals(letter.getStartDate().day(), start_date.day()) - self.assertEquals(letter.getStopDate().hour(), end_date.hour()) - self.assertEquals(letter.getStopDate().day(), end_date.day()) + self.assertEqual(letter.getStartDate().hour(), start_date.hour()) + self.assertEqual(letter.getStartDate().day(), start_date.day()) + self.assertEqual(letter.getStopDate().hour(), end_date.hour()) + self.assertEqual(letter.getStopDate().day(), end_date.day()) def testERPSite_createUNGUser(self): """Test if script creates an user correctly""" @@ -371,22 +371,22 @@ class TestUNG(ERP5TypeTestCase): self.tic() person = self.portal.portal_catalog.getResultValue(portal_type="Person", reference="ung_user") - self.assertEquals(person.getFirstName(), "UNG") - self.assertEquals(person.getLastName(), "User") - self.assertEquals(person.getValidationState(), "validated") - self.assertEquals(person.getEmail().getPortalType(), "Email") - self.assertEquals(person.getEmailText(), "g@g.com") + self.assertEqual(person.getFirstName(), "UNG") + self.assertEqual(person.getLastName(), "User") + self.assertEqual(person.getValidationState(), "validated") + self.assertEqual(person.getEmail().getPortalType(), "Email") + self.assertEqual(person.getEmailText(), "g@g.com") self.changeSkin("UNGDoc") response = json.loads(self.portal.ERPSite_createUNGUser()) - self.assertEquals(response, None) + self.assertEqual(response, None) def testERP5Site_checkIfUserExistUsingHttpRequest(self): """Test script ERP5Site_checkIfUserExist to simulate the browser request""" script_path = self.portal.web_site_module.ung.getPath() + "/ERP5Site_checkIfUserExist" response = json.loads(self.publish(script_path).getBody()) - self.assertEquals(response, {'response': False}) + self.assertEqual(response, {'response': False}) response = json.loads(self.publish(script_path + "?reference=ung_reference").getBody()) - self.assertEquals(response, {'response': True}) + self.assertEqual(response, {'response': True}) def testERP5Site_checkIfUserExist(self): """Test script ERP5Site_checkIfUserExist""" @@ -400,21 +400,21 @@ class TestUNG(ERP5TypeTestCase): portal.ERPSite_createUNGUser() kw = dict(reference=form_dict["login_name"],) response = json.loads(portal.ERP5Site_checkIfUserExist(**kw)) - self.assertEquals(response.get("response"), False) + self.assertEqual(response.get("response"), False) self.tic() param_list = ["%s=%s" % (key,value) for key, value in kw.iteritems()] self.changeSkin("UNGDoc") response = json.loads(portal.ERP5Site_checkIfUserExist(**kw)) - self.assertEquals(response.get("response"), True) + self.assertEqual(response.get("response"), True) kw = dict(first_name="Not Exist", reference="no_reference", ) self.changeSkin("UNGDoc") response = json.loads(portal.ERP5Site_checkIfUserExist(**kw)) - self.assertEquals(response.get("response"), False) + self.assertEqual(response.get("response"), False) self.login("ung_reference") user = portal.ERP5Site_getAuthenticatedMemberPersonValue() - self.assertEquals(user.getFirstName(), "UNG") + self.assertEqual(user.getFirstName(), "UNG") def testWebSection_addGadgetList(self): """Test if gadgets are added correctly""" @@ -429,7 +429,7 @@ class TestUNG(ERP5TypeTestCase): self.tic() gadget = self.portal.portal_catalog.getResultValue(portal_type="Gadget", validation_state="public") - self.assertEquals(gadget_id_list, gadget.getId()) + self.assertEqual(gadget_id_list, gadget.getId()) self.portal.knowledge_pad_module.deleteContent(id=obj.getId()) self.tic() obj = self.portal.knowledge_pad_module.newContent(portal_type="Knowledge Pad") @@ -448,24 +448,24 @@ class TestUNG(ERP5TypeTestCase): self.changeSkin("UNGDoc") self.portal.web_site_module.ung.WebSection_addGadgetList() self.tic() - self.assertEquals(len(obj.searchFolder()), 2) - self.assertEquals(sorted([x.getSpecialise() for x in obj.searchFolder()]), + self.assertEqual(len(obj.searchFolder()), 2) + self.assertEqual(sorted([x.getSpecialise() for x in obj.searchFolder()]), sorted(path_list)) def testBase_getPreferencePathList(self): """Test if the paths of preference objects are returned correctly""" self.changeSkin('UNGDoc') self.logout() - self.assertEquals(json.loads(self.portal.Base_getPreferencePathList()), None) + self.assertEqual(json.loads(self.portal.Base_getPreferencePathList()), None) self.login("ERP5TypeTestCase") self.changeSkin("UNGDoc") preference_dict = json.loads(self.portal.Base_getPreferencePathList()) - self.assertEquals(preference_dict, {}) + self.assertEqual(preference_dict, {}) self.portal.portal_preferences.ung_preference.enable() self.tic() self.changeSkin("UNGDoc") preference_dict = json.loads(self.portal.Base_getPreferencePathList()) - self.assertEquals(preference_dict["preference"], "portal_preferences/ung_preference") + self.assertEqual(preference_dict["preference"], "portal_preferences/ung_preference") def testWebSection_getWebPageObjectList(self): """Test if the paths of preference objects are returned correctly""" @@ -478,16 +478,16 @@ class TestUNG(ERP5TypeTestCase): kw = {"portal_type": "Web Page"} self.changeSkin('UNGDoc') result_list = self.portal.web_site_module.ung.WebSection_getWebPageObjectList(**kw) - self.assertEquals(len(result_list), 1) - self.assertEquals(result_list[0].getPortalType(), "Web Page") + self.assertEqual(len(result_list), 1) + self.assertEqual(result_list[0].getPortalType(), "Web Page") kw["portal_type"] = "Web Illustration" result_list = self.portal.web_site_module.ung.WebSection_getWebPageObjectList(**kw) - self.assertEquals(len(result_list), 1) - self.assertEquals(result_list[0].getPortalType(), "Web Illustration") + self.assertEqual(len(result_list), 1) + self.assertEqual(result_list[0].getPortalType(), "Web Illustration") kw["portal_type"] = "Web Table" result_list = self.portal.web_site_module.ung.WebSection_getWebPageObjectList(**kw) - self.assertEquals(len(result_list), 1) - self.assertEquals(result_list[0].getPortalType(), "Web Table") + self.assertEqual(len(result_list), 1) + self.assertEqual(result_list[0].getPortalType(), "Web Table") def testWebPage_updateWebDocument(self): """ Test if script load correctly the Web Page with data of one document @@ -511,4 +511,4 @@ class TestUNG(ERP5TypeTestCase): web_page.WebPage_updateWebDocument(document.getPath()) self.tic() self.assertTrue(re.search("\>tiolive\<", web_page.getTextContent()) is not None) - self.assertEquals(web_page.getTitle(), document.getTitle()) + self.assertEqual(web_page.getTitle(), document.getTitle()) diff --git a/bt5/erp5_web_ung_theme/bt/revision b/bt5/erp5_web_ung_theme/bt/revision index 5e801cee88..e04c4148a6 100644 --- a/bt5/erp5_web_ung_theme/bt/revision +++ b/bt5/erp5_web_ung_theme/bt/revision @@ -1 +1 @@ -416 \ No newline at end of file +417 \ No newline at end of file diff --git a/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheExternal.py b/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheExternal.py index 6058f00ca7..5ca767036e 100644 --- a/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheExternal.py +++ b/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheExternal.py @@ -82,18 +82,18 @@ class TestShaCacheExternal(ShaCacheMixin, ShaSecurityMixin, ERP5TypeTestCase): data = result.read() finally: connection.close() - self.assertEquals(self.key, data) - self.assertEquals(httplib.CREATED, result.status) + self.assertEqual(self.key, data) + self.assertEqual(httplib.CREATED, result.status) # Check Document document = self.portal.portal_catalog.getResultValue(portal_type='File', reference=self.key, creation_date=' >= "%s"' % now) self.assertNotEquals(None, document) - self.assertEquals(self.data, document.getData()) - self.assertEquals('File', document.getPortalType()) - self.assertEquals('Published', document.getValidationStateTitle()) - self.assertEquals(self.expected_content_type, document.getContentType()) + self.assertEqual(self.data, document.getData()) + self.assertEqual('File', document.getPortalType()) + self.assertEqual('Published', document.getValidationStateTitle()) + self.assertEqual(self.expected_content_type, document.getContentType()) def test_external_get(self, annonymous=False): """ @@ -112,9 +112,9 @@ class TestShaCacheExternal(ShaCacheMixin, ShaSecurityMixin, ERP5TypeTestCase): data = result.read() finally: connection.close() - self.assertEquals(self.data, data) - self.assertEquals(httplib.OK, result.status) - self.assertEquals(self.expected_content_type, + self.assertEqual(self.data, data) + self.assertEqual(httplib.OK, result.status) + self.assertEqual(self.expected_content_type, result.getheader("content-type")) def test_external_get_anonymous(self): @@ -141,6 +141,6 @@ class TestShaCacheExternal(ShaCacheMixin, ShaSecurityMixin, ERP5TypeTestCase): # to POST resource while begin not authorised # One of UNAUTHORIZED or FORBIDDEN shall be returned # Ref: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4 - # self.assertEquals(httplib.UNAUTHORIZED, result.status) + # self.assertEqual(httplib.UNAUTHORIZED, result.status) # FORBIDDEN seems more suitable for RESTful server... - self.assertEquals(httplib.FORBIDDEN, result.status) + self.assertEqual(httplib.FORBIDDEN, result.status) diff --git a/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheSecurity.py b/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheSecurity.py index 146ba659bf..476d15ca25 100644 --- a/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheSecurity.py +++ b/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheSecurity.py @@ -141,7 +141,7 @@ class TestShaCacheSecurity(ShaCacheMixin, ShaSecurityMixin, SecurityTestCase): document.publishAlive() self.tic() - self.assertEquals('Published Alive', + self.assertEqual('Published Alive', document.getValidationStateTitle()) self.assertUserHaveRoleOnDocument(self.lucas_user, 'Auditor', document) diff --git a/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirExternal.py b/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirExternal.py index 02f7fb8523..f9a4b7582f 100644 --- a/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirExternal.py +++ b/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirExternal.py @@ -83,27 +83,27 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase): data = result.read() finally: connection.close() - self.assertEquals('', data) - self.assertEquals(201, result.status) + self.assertEqual('', data) + self.assertEqual(201, result.status) # Check Data Set data_set = self.portal.portal_catalog.getResultValue( portal_type='Data Set', reference=self.key) self.assertNotEquals(None, data_set) - self.assertEquals('Published', data_set.getValidationStateTitle()) + self.assertEqual('Published', data_set.getValidationStateTitle()) # Check Document document = self.portal.portal_catalog.getResultValue(portal_type='File', reference=self.sha512sum, creation_date=' >= "%s"' % now) self.assertNotEquals(None, document) - self.assertEquals(self.data, document.getData()) - self.assertEquals(str(self.expiration_date), + self.assertEqual(self.data, document.getData()) + self.assertEqual(str(self.expiration_date), str(document.getExpirationDate())) - self.assertEquals(data_set, document.getFollowUpValue()) - self.assertEquals('File', document.getPortalType()) - self.assertEquals('Published', document.getValidationStateTitle()) + self.assertEqual(data_set, document.getFollowUpValue()) + self.assertEqual('File', document.getPortalType()) + self.assertEqual('Published', document.getValidationStateTitle()) def test_external_get(self, annonymous=False): """ @@ -121,9 +121,9 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase): data = result.read() finally: connection.close() - self.assertEquals(json.dumps([json.loads(self.data)]), data) - self.assertEquals(200, result.status) - self.assertEquals(self.content_type, result.getheader("content-type")) + self.assertEqual(json.dumps([json.loads(self.data)]), data) + self.assertEqual(200, result.status) + self.assertEqual(self.content_type, result.getheader("content-type")) def test_external_get_anonymous(self): """ @@ -143,7 +143,7 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase): self.tic() finally: connection.close() - self.assertEquals(302, result.status) + self.assertEqual(302, result.status) def test_external_post_with_wrong_data(self): """ @@ -166,6 +166,6 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase): finally: connection.close() self.assertTrue("Required field 'file' is missing" in data, data) - self.assertEquals(500, result.status) - self.assertEquals('text/html; charset=utf-8', + self.assertEqual(500, result.status) + self.assertEqual('text/html; charset=utf-8', result.getheader("content-type")) diff --git a/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirSecurity.py b/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirSecurity.py index d533adcebe..a2336bf72b 100644 --- a/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirSecurity.py +++ b/bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirSecurity.py @@ -122,7 +122,7 @@ class TestShaDirSecurity(ShaDirMixin, ShaSecurityMixin, SecurityTestCase): data_set.publish() self.tic() - self.assertEquals('Published', data_set.getValidationStateTitle()) + self.assertEqual('Published', data_set.getValidationStateTitle()) self.assertUserHaveRoleOnDocument(self.lucas_user, 'Auditor', data_set) @@ -170,7 +170,7 @@ class TestShaDirSecurity(ShaDirMixin, ShaSecurityMixin, SecurityTestCase): document.publishAlive() self.tic() - self.assertEquals('Published Alive', document.getValidationStateTitle()) + self.assertEqual('Published Alive', document.getValidationStateTitle()) self.assertUserHaveRoleOnDocument(self.lucas_user, 'Auditor', document) def test_user_can_not_view_document_module(self): diff --git a/bt5/networkcache_erp5/bt/revision b/bt5/networkcache_erp5/bt/revision index 1758dddcce..dc7b54ad01 100644 --- a/bt5/networkcache_erp5/bt/revision +++ b/bt5/networkcache_erp5/bt/revision @@ -1 +1 @@ -32 \ No newline at end of file +33 \ No newline at end of file diff --git a/product/CMFActivity/tests/testCMFActivity.py b/product/CMFActivity/tests/testCMFActivity.py index 8bd4c96b82..3664639b81 100644 --- a/product/CMFActivity/tests/testCMFActivity.py +++ b/product/CMFActivity/tests/testCMFActivity.py @@ -136,29 +136,29 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): portal = self.getPortal() organisation = portal.organisation._getOb(self.company_id) organisation._setTitle(self.title1) - self.assertEquals(self.title1,organisation.getTitle()) + self.assertEqual(self.title1,organisation.getTitle()) organisation.activate(activity=activity)._setTitle(self.title2) # Needed so that the message are commited into the queue self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),1) + self.assertEqual(len(message_list),1) portal.portal_activities.manageCancel(organisation.getPhysicalPath(),'_setTitle') # Needed so that the message are removed from the queue self.commit() - self.assertEquals(self.title1,organisation.getTitle()) + self.assertEqual(self.title1,organisation.getTitle()) message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) + self.assertEqual(len(message_list),0) organisation.activate(activity=activity)._setTitle(self.title2) # Needed so that the message are commited into the queue self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),1) + self.assertEqual(len(message_list),1) portal.portal_activities.manageInvoke(organisation.getPhysicalPath(),'_setTitle') # Needed so that the message are removed from the queue self.commit() - self.assertEquals(self.title2,organisation.getTitle()) + self.assertEqual(self.title2,organisation.getTitle()) message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) + self.assertEqual(len(message_list),0) def DeferredSetTitleActivity(self, activity): """ @@ -168,15 +168,15 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): portal = self.getPortal() organisation = portal.organisation._getOb(self.company_id) organisation._setTitle(self.title1) - self.assertEquals(self.title1,organisation.getTitle()) + self.assertEqual(self.title1,organisation.getTitle()) organisation.activate(activity=activity)._setTitle(self.title2) # Needed so that the message are commited into the queue self.commit() - self.assertEquals(self.title1,organisation.getTitle()) + self.assertEqual(self.title1,organisation.getTitle()) portal.portal_activities.tic() - self.assertEquals(self.title2,organisation.getTitle()) + self.assertEqual(self.title2,organisation.getTitle()) message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) + self.assertEqual(len(message_list),0) def CallOnceWithActivity(self, activity): """ @@ -196,27 +196,27 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): Organisation.getFoobar = getFoobar organisation.foobar = 0 organisation._setTitle(self.title1) - self.assertEquals(0,organisation.getFoobar()) + self.assertEqual(0,organisation.getFoobar()) organisation.activate(activity=activity).setFoobar() # Needed so that the message are commited into the queue self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),1) + self.assertEqual(len(message_list),1) portal.portal_activities.tic() - self.assertEquals(1,organisation.getFoobar()) + self.assertEqual(1,organisation.getFoobar()) message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) + self.assertEqual(len(message_list),0) organisation.activate(activity=activity).setFoobar() # Needed so that the message are commited into the queue self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),1) + self.assertEqual(len(message_list),1) portal.portal_activities.manageInvoke(organisation.getPhysicalPath(),'setFoobar') # Needed so that the message are commited into the queue self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) - self.assertEquals(2,organisation.getFoobar()) + self.assertEqual(len(message_list),0) + self.assertEqual(2,organisation.getFoobar()) def TryFlushActivity(self, activity): """ @@ -227,18 +227,18 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): organisation._setTitle(self.title1) organisation.activate(activity=activity)._setTitle(self.title2) organisation.flushActivity(invoke=1) - self.assertEquals(organisation.getTitle(),self.title2) + self.assertEqual(organisation.getTitle(),self.title2) self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) - self.assertEquals(organisation.getTitle(),self.title2) + self.assertEqual(len(message_list),0) + self.assertEqual(organisation.getTitle(),self.title2) # Try again with different commit order organisation._setTitle(self.title1) organisation.activate(activity=activity)._setTitle(self.title2) self.commit() organisation.flushActivity(invoke=1) - self.assertEquals(len(message_list),0) - self.assertEquals(organisation.getTitle(),self.title2) + self.assertEqual(len(message_list),0) + self.assertEqual(organisation.getTitle(),self.title2) self.commit() def TryActivateInsideFlush(self, activity): @@ -257,8 +257,8 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): portal.portal_activities.tic() self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) - self.assertEquals(organisation.getTitle(),self.title2) + self.assertEqual(len(message_list),0) + self.assertEqual(organisation.getTitle(),self.title2) def TryTwoMethods(self, activity): """ @@ -281,9 +281,9 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): portal.portal_activities.tic() self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) - self.assertEquals(organisation.getTitle(),self.title1) - self.assertEquals(organisation.getDescription(),self.title1) + self.assertEqual(len(message_list),0) + self.assertEqual(organisation.getTitle(),self.title1) + self.assertEqual(organisation.getDescription(),self.title1) def TryTwoMethodsAndFlushThem(self, activity): """ @@ -307,9 +307,9 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): portal.portal_activities.tic() self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) - self.assertEquals(organisation.getTitle(),self.title1) - self.assertEquals(organisation.getDescription(),self.title1) + self.assertEqual(len(message_list),0) + self.assertEqual(organisation.getTitle(),self.title1) + self.assertEqual(organisation.getDescription(),self.title1) def TryActivateFlushActivateTic(self, activity,second=None,commit_sub=0): """ @@ -337,9 +337,9 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): portal.portal_activities.tic() self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) - self.assertEquals(organisation.getTitle(),self.title1) - self.assertEquals(organisation.getDescription(),self.title1) + self.assertEqual(len(message_list),0) + self.assertEqual(organisation.getTitle(),self.title1) + self.assertEqual(organisation.getDescription(),self.title1) def TryMessageWithErrorOnActivity(self, activity): """ @@ -355,17 +355,17 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.commit() message_list = portal.portal_activities.getMessageList() LOG('Before MessageWithErrorOnActivityFails, message_list',0,[x.__dict__ for x in message_list]) - self.assertEquals(len(message_list),1) + self.assertEqual(len(message_list),1) portal.portal_activities.tic() # XXX HERE WE SHOULD USE TIME SHIFT IN ORDER TO SIMULATE MULTIPLE TICS # Test if there is still the message after it crashed message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),1) + self.assertEqual(len(message_list),1) portal.portal_activities.manageCancel(organisation.getPhysicalPath(),'crashThisActivity') # Needed so that the message are commited into the queue self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) + self.assertEqual(len(message_list),0) def DeferredSetTitleWithRenamedObject(self, activity): """ @@ -375,11 +375,11 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): portal = self.getPortal() organisation = portal.organisation._getOb(self.company_id) organisation._setTitle(self.title1) - self.assertEquals(self.title1,organisation.getTitle()) + self.assertEqual(self.title1,organisation.getTitle()) organisation.activate(activity=activity)._setTitle(self.title2) # Needed so that the message are commited into the queue self.commit() - self.assertEquals(self.title1,organisation.getTitle()) + self.assertEqual(self.title1,organisation.getTitle()) self.assertRaises(ActivityPendingError,organisation.edit,id=self.company_id2) portal.portal_activities.tic() @@ -391,18 +391,18 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): organisation = portal.organisation._getOb(self.company_id) organisation._setTitle(self.title1) active_process = portal.portal_activities.newActiveProcess() - self.assertEquals(self.title1,organisation.getTitle()) + self.assertEqual(self.title1,organisation.getTitle()) organisation.activate(activity=activity,active_process=active_process).getTitle() # Needed so that the message are commited into the queue self.commit() portal.portal_activities.distribute() portal.portal_activities.tic() - self.assertEquals(self.title1,organisation.getTitle()) + self.assertEqual(self.title1,organisation.getTitle()) result = active_process.getResultList()[0] - self.assertEquals(result.method_id , 'getTitle') - self.assertEquals(result.result , self.title1) + self.assertEqual(result.method_id , 'getTitle') + self.assertEqual(result.result , self.title1) message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),0) + self.assertEqual(len(message_list),0) def TryMethodAfterMethod(self, activity): """ @@ -415,7 +415,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o = portal.organisation._getOb(self.company_id) o.setTitle('a') - self.assertEquals(o.getTitle(), 'a') + self.assertEqual(o.getTitle(), 'a') self.tic() def toto(self, value): @@ -429,7 +429,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o.activate(after_method_id = 'titi', activity = activity).toto('b') o.activate(activity = activity).titi('c') self.tic() - self.assertEquals(o.getTitle(), 'acb') + self.assertEqual(o.getTitle(), 'acb') def TryAfterTag(self, activity): """ @@ -442,13 +442,13 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o = portal.organisation._getOb(self.company_id) o.setTitle('?') - self.assertEquals(o.getTitle(), '?') + self.assertEqual(o.getTitle(), '?') self.tic() o.activate(after_tag = 'toto', activity = activity).setTitle('b') o.activate(tag = 'toto', activity = activity).setTitle('a') self.tic() - self.assertEquals(o.getTitle(), 'b') + self.assertEqual(o.getTitle(), 'b') o.setDefaultActivateParameterDict({'tag': 'toto'}) def titi(self): @@ -457,7 +457,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o.activate(after_tag_and_method_id=('toto', 'setTitle'), activity = activity).titi() o.activate(activity = activity).setTitle('c') self.tic() - self.assertEquals(o.getCorporateName(), 'cd') + self.assertEqual(o.getCorporateName(), 'cd') def TryFlushActivityWithAfterTag(self, activity): """ @@ -471,8 +471,8 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o.setTitle('?') o.setDescription('?') - self.assertEquals(o.getTitle(), '?') - self.assertEquals(o.getDescription(), '?') + self.assertEqual(o.getTitle(), '?') + self.assertEqual(o.getDescription(), '?') self.tic() o.activate(after_tag = 'toto', activity = activity).setDescription('b') @@ -482,12 +482,12 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.assertRaises(ActivityFlushError,tool.manageInvoke,o.getPath(),'setDescription') tool.manageInvoke(o.getPath(),'setTitle') self.commit() - self.assertEquals(o.getTitle(), 'a') - self.assertEquals(o.getDescription(), '?') + self.assertEqual(o.getTitle(), 'a') + self.assertEqual(o.getDescription(), '?') self.tic() - self.assertEquals(len(tool.getMessageList()),0) - self.assertEquals(o.getTitle(), 'a') - self.assertEquals(o.getDescription(), 'b') + self.assertEqual(len(tool.getMessageList()),0) + self.assertEqual(o.getTitle(), 'a') + self.assertEqual(o.getDescription(), 'b') def CheckScheduling(self, activity): """ @@ -500,7 +500,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o = portal.organisation._getOb(self.company_id) o.setTitle('?') - self.assertEquals(o.getTitle(), '?') + self.assertEqual(o.getTitle(), '?') self.tic() def toto(self, s): @@ -513,7 +513,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.commit() o.activate(tag = 'titi', after_tag = 'toto', activity = activity).setTitle('c') self.tic() - self.assertEquals(o.getTitle(), 'cb') + self.assertEqual(o.getTitle(), 'cb') def CheckSchedulingAfterTagList(self, activity): """ @@ -539,7 +539,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.commit() o.activate(after_tag=('A', 'B'), activity=activity).setTitle('last') self.tic() - self.assertEquals(o.getTitle(), 'last') + self.assertEqual(o.getTitle(), 'last') def CheckClearActivities(self, activity, activity_count=1): """ @@ -553,10 +553,10 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): def check(o): message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list), activity_count) + self.assertEqual(len(message_list), activity_count) m = message_list[0] - self.assertEquals(m.object_path, o.getPhysicalPath()) - self.assertEquals(m.method_id, '_setTitle') + self.assertEqual(m.object_path, o.getPhysicalPath()) + self.assertEqual(m.method_id, '_setTitle') o = portal.organisation._getOb(self.company_id) for i in range(activity_count): @@ -570,7 +570,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.tic() - self.assertEquals(o.getTitle(), 'foo') + self.assertEqual(o.getTitle(), 'foo') def CheckCountMessageWithTag(self, activity): """ @@ -587,11 +587,11 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o.activate(tag = 'toto', activity = activity).setTitle('a') self.commit() - self.assertEquals(o.getTitle(), '?') - self.assertEquals(portal_activities.countMessageWithTag('toto'), 1) + self.assertEqual(o.getTitle(), '?') + self.assertEqual(portal_activities.countMessageWithTag('toto'), 1) self.tic() - self.assertEquals(o.getTitle(), 'a') - self.assertEquals(portal_activities.countMessageWithTag('toto'), 0) + self.assertEqual(o.getTitle(), 'a') + self.assertEqual(portal_activities.countMessageWithTag('toto'), 0) def TryConflictErrorsWhileValidating(self, activity): """Try to execute active objects which may throw conflict errors @@ -607,7 +607,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o = organisation_module._getOb(self.company_id) self.commit() self.flushAllActivities(silent = 1, loop_size = 10) - self.assertEquals(len(activity_tool.getMessageList()), 0) + self.assertEqual(len(activity_tool.getMessageList()), 0) # Monkey patch Queue to induce conflict errors artificially. def validate(self, *args, **kwargs): @@ -629,7 +629,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o.activate(activity = activity).getId() self.commit() self.flushAllActivities(silent = 1, loop_size = i + 10) - self.assertEquals(len(activity_tool.getMessageList()), 0) + self.assertEqual(len(activity_tool.getMessageList()), 0) finally: Queue.validate = Queue.original_validate del Queue.original_validate @@ -650,7 +650,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o = organisation_module._getOb(self.company_id) self.commit() self.flushAllActivities(silent = 1, loop_size = 10) - self.assertEquals(len(activity_tool.getMessageList()), 0) + self.assertEqual(len(activity_tool.getMessageList()), 0) from _mysql_exceptions import OperationalError @@ -668,7 +668,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): # Test some range of conflict error occurences. organisation_module.recursiveReindexObject() self.commit() - self.assertEquals(len(activity_tool.getMessageList()), 1) + self.assertEqual(len(activity_tool.getMessageList()), 1) DB.original_query = DB.query DB.query = query portal.portal_activities.distribute() @@ -676,7 +676,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.commit() DB.query = DB.original_query message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),1) + self.assertEqual(len(message_list),1) finally: DB.query = DB.original_query del DB.original_query @@ -690,46 +690,46 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): activity_tool.manageClearActivities(keep=0) self.commit() # First case: creating the same activity twice must only register one. - self.assertEquals(len(activity_tool.getMessageList()), 0) # Sanity check + self.assertEqual(len(activity_tool.getMessageList()), 0) # Sanity check object_a.activate(activity=activity).getId() object_a.activate(activity=activity).getId() self.commit() - self.assertEquals(len(activity_tool.getMessageList()), 1) + self.assertEqual(len(activity_tool.getMessageList()), 1) activity_tool.manageClearActivities(keep=0) self.commit() # Second case: creating activity with same tag must only register one. # This behaviour is actually the same as the no-tag behaviour. - self.assertEquals(len(activity_tool.getMessageList()), 0) # Sanity check + self.assertEqual(len(activity_tool.getMessageList()), 0) # Sanity check object_a.activate(activity=activity, tag='foo').getId() object_a.activate(activity=activity, tag='foo').getId() self.commit() - self.assertEquals(len(activity_tool.getMessageList()), 1) + self.assertEqual(len(activity_tool.getMessageList()), 1) activity_tool.manageClearActivities(keep=0) self.commit() # Third case: creating activities with different tags must register both. - self.assertEquals(len(activity_tool.getMessageList()), 0) # Sanity check + self.assertEqual(len(activity_tool.getMessageList()), 0) # Sanity check object_a.activate(activity=activity, tag='foo').getId() object_a.activate(activity=activity, tag='bar').getId() self.commit() - self.assertEquals(len(activity_tool.getMessageList()), 2) + self.assertEqual(len(activity_tool.getMessageList()), 2) activity_tool.manageClearActivities(keep=0) self.commit() # Fourth case: creating activities on different objects must register # both. - self.assertEquals(len(activity_tool.getMessageList()), 0) # Sanity check + self.assertEqual(len(activity_tool.getMessageList()), 0) # Sanity check object_a.activate(activity=activity).getId() object_b.activate(activity=activity).getId() self.commit() - self.assertEquals(len(activity_tool.getMessageList()), 2) + self.assertEqual(len(activity_tool.getMessageList()), 2) activity_tool.manageClearActivities(keep=0) self.commit() # Fifth case: creating activities with different method must register # both. - self.assertEquals(len(activity_tool.getMessageList()), 0) # Sanity check + self.assertEqual(len(activity_tool.getMessageList()), 0) # Sanity check object_a.activate(activity=activity).getId() object_a.activate(activity=activity).getTitle() self.commit() - self.assertEquals(len(activity_tool.getMessageList()), 2) + self.assertEqual(len(activity_tool.getMessageList()), 2) activity_tool.manageClearActivities(keep=0) self.commit() @@ -1003,7 +1003,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): portal.portal_activities.tic() email = organisation.get('email') # Check if what we did was executed as toto - self.assertEquals(email.getOwnerInfo()['id'],'toto') + self.assertEqual(email.getOwnerInfo()['id'],'toto') def test_59_TryAfterTagWithSQLDict(self, quiet=0, run=run_all_test): # Test if after_tag can be used @@ -1159,9 +1159,9 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.fail('failingMethod should not have been flushed') if len(remaining_messages) != 1: self.fail('Activity tool should have one blocked setTitle activity') - self.assertEquals(remaining_messages[0].activity_kw['after_method_id'], + self.assertEqual(remaining_messages[0].activity_kw['after_method_id'], ['failingMethod']) - self.assertEquals(obj.getTitle(), original_title) + self.assertEqual(obj.getTitle(), original_title) def test_66_TestCountMessageWithTagWithSQLDict(self, quiet=0, run=run_all_test): """ @@ -1201,17 +1201,17 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): # First, index the object. self.commit() self.flushAllActivities(silent=1, loop_size=100) - self.assertEquals(len(activity_tool.getMessageList()), 0) + self.assertEqual(len(activity_tool.getMessageList()), 0) # Insert a failing active object. obj.activate().failingMethod() self.commit() - self.assertEquals(len(activity_tool.getMessageList()), 1) + self.assertEqual(len(activity_tool.getMessageList()), 1) # Just wait for the active object to be abandoned. self.flushAllActivities(silent=1, loop_size=100) - self.assertEquals(len(activity_tool.getMessageList()), 1) - self.assertEquals(activity_tool.getMessageList()[0].processing_node, + self.assertEqual(len(activity_tool.getMessageList()), 1) + self.assertEqual(activity_tool.getMessageList()[0].processing_node, INVOKE_ERROR_STATE) # Make sure that persistent objects are not present in the connection @@ -1223,7 +1223,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): message = activity_tool.getMessageList()[0] activity_tool.manageCancel(message.object_path, message.method_id) self.commit() - self.assertEquals(len(activity_tool.getMessageList()), 0) + self.assertEqual(len(activity_tool.getMessageList()), 0) def test_68_RetryMessageExecution(self, quiet=0): if not quiet: @@ -1360,7 +1360,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): if m.object_path == o1.getPhysicalPath()] self.assertNotEquals(0, len(messages_for_o1)) for m in messages_for_o1: - self.assertEquals(m.activity_kw.get('tag'), 'The Tag') + self.assertEqual(m.activity_kw.get('tag'), 'The Tag') def test_77_FlushAfterMultipleActivate(self, quiet=0, run=run_all_test): @@ -1478,7 +1478,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): Organisation.getFoobar = getFoobar organisation.foobar = 0 - self.assertEquals(0,organisation.getFoobar()) + self.assertEqual(0,organisation.getFoobar()) # Test group_method_id is working without group_id for x in xrange(5): @@ -1486,10 +1486,10 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),5) + self.assertEqual(len(message_list),5) portal.portal_activities.tic() expected = dict(SQLDict=1, SQLQueue=5)[activity] - self.assertEquals(expected, organisation.getFoobar()) + self.assertEqual(expected, organisation.getFoobar()) # Test group_method_id is working with one group_id defined @@ -1498,11 +1498,11 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),5) + self.assertEqual(len(message_list),5) portal.portal_activities.tic() - self.assertEquals(expected * 2, organisation.getFoobar()) + self.assertEqual(expected * 2, organisation.getFoobar()) - self.assertEquals([expected, expected], foobar_list) + self.assertEqual([expected, expected], foobar_list) del foobar_list[:] # Test group_method_id is working with many group_id defined @@ -1517,14 +1517,14 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.commit() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list),20) + self.assertEqual(len(message_list),20) portal.portal_activities.tic() - self.assertEquals(dict(SQLDict=11, SQLQueue=60)[activity], + self.assertEqual(dict(SQLDict=11, SQLQueue=60)[activity], organisation.getFoobar()) - self.assertEquals(dict(SQLDict=[1, 1, 1], SQLQueue=[5, 5, 10])[activity], + self.assertEqual(dict(SQLDict=[1, 1, 1], SQLQueue=[5, 5, 10])[activity], sorted(foobar_list)) message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list), 0) + self.assertEqual(len(message_list), 0) def test_80a_CallWithGroupIdParamaterSQLDict(self, quiet=0, run=run_all_test): """ @@ -1556,7 +1556,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): if m.object_path == o1.getPhysicalPath()] self.assertNotEquals(0, len(messages_for_o1)) for m in messages_for_o1: - self.assertEquals(m.activity_kw.get('tag'), 'The Tag') + self.assertEqual(m.activity_kw.get('tag'), 'The Tag') def test_82_LossOfVolatileAttribute(self, quiet=0, run=run_all_test): """ @@ -1570,7 +1570,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.tic() activity_tool = self.getActivityTool() message_list = activity_tool.getMessageList() - self.assertEquals(len(message_list), 0) + self.assertEqual(len(message_list), 0) def delete_volatiles(): for property_id in activity_tool.__dict__.keys(): if property_id.startswith('_v_'): @@ -1586,7 +1586,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): active_organisation_module.getId() self.commit() message_list = activity_tool.getMessageList() - self.assertEquals(len(message_list), 2) + self.assertEqual(len(message_list), 2) def test_83_ActivityModificationsViaCMFActivityConnectionRolledBackOnErrorSQLDict(self, quiet=0, run=run_all_test): """ @@ -1638,7 +1638,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): obj2.activate(activity='SQLDict', group_method_id=group_method_id).dummy() self.commit() self.flushAllActivities(silent=1, loop_size=100) - self.assertEquals(activity_tool.countMessage(method_id='dummy_activity'), 0) + self.assertEqual(activity_tool.countMessage(method_id='dummy_activity'), 0) finally: delattr(Organisation, 'modifySQLAndFail') delattr(Organisation, 'dummy') @@ -1686,7 +1686,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): obj.activate(activity='SQLQueue').modifySQLAndFail() self.commit() self.flushAllActivities(silent=1, loop_size=100) - self.assertEquals(activity_tool.countMessage(method_id='dummy_activity'), 0) + self.assertEqual(activity_tool.countMessage(method_id='dummy_activity'), 0) finally: delattr(Organisation, 'modifySQLAndFail') @@ -1741,7 +1741,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): obj2.activate(activity='SQLDict', group_method_id=group_method_id).dummy() self.commit() self.flushAllActivities(silent=1, loop_size=100) - self.assertEquals(activity_tool.countMessage(method_id='dummy_activity'), 0) + self.assertEqual(activity_tool.countMessage(method_id='dummy_activity'), 0) finally: delattr(Organisation, 'dummy') activity_tool.__class__.invoke = invoke @@ -1795,7 +1795,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): obj.activate(activity='SQLQueue').dummy() self.commit() self.flushAllActivities(silent=1, loop_size=100) - self.assertEquals(activity_tool.countMessage(method_id='dummy_activity'), 0) + self.assertEqual(activity_tool.countMessage(method_id='dummy_activity'), 0) finally: delattr(Organisation, 'dummy') activity_tool.__class__.invoke = invoke @@ -2020,7 +2020,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.flushAllActivities(silent=1, loop_size=100) finally: transaction.get().__class__.commit = commit - self.assertEquals(activity_tool.countMessage(method_id='dummy_activity'), 0) + self.assertEqual(activity_tool.countMessage(method_id='dummy_activity'), 0) finally: delattr(Organisation, 'modifySQL') @@ -2072,7 +2072,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.flushAllActivities(silent=1, loop_size=100) finally: transaction.get().__class__.commit = commit - self.assertEquals(activity_tool.countMessage(method_id='dummy_activity'), 0) + self.assertEqual(activity_tool.countMessage(method_id='dummy_activity'), 0) finally: delattr(Organisation, 'modifySQL') @@ -2134,7 +2134,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.commit() self.flushAllActivities(silent=1, loop_size=100) self.commit() - self.assertEquals(activity_tool.countMessage(method_id='registerFailingTransactionManager'), 1) + self.assertEqual(activity_tool.countMessage(method_id='registerFailingTransactionManager'), 1) finally: delattr(Organisation, 'registerFailingTransactionManager') @@ -2165,9 +2165,9 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.tic() organisation.activate(activity=activity).changeSkinToNone() self.commit() - self.assertEquals(len(activity_tool.getMessageList()), 1) + self.assertEqual(len(activity_tool.getMessageList()), 1) self.flushAllActivities(silent=1, loop_size=100) - self.assertEquals(len(activity_tool.getMessageList()), 0) + self.assertEqual(len(activity_tool.getMessageList()), 0) finally: delattr(Organisation, 'changeSkinToNone') @@ -2458,7 +2458,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): try: o = self.portal.organisation_module.newContent( portal_type='Organisation', id='test_obj') - self.assertEquals(o.absolute_url(), + self.assertEqual(o.absolute_url(), 'http://test.erp5.org:9080/virtual_root/test_obj') o.activate().checkAbsoluteUrl() @@ -2469,13 +2469,13 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): request.other['PARENTS'] = [self.app] request.setVirtualRoot('') # obviously, the object url is different - self.assertEquals(o.absolute_url(), + self.assertEqual(o.absolute_url(), 'https://anotherhost.erp5.org/%s/organisation_module/test_obj' % self.portal.getId()) # but activities are executed using the previous request information self.flushAllActivities(loop_size=1000) - self.assertEquals(calls, ['http://test.erp5.org:9080/virtual_root/test_obj']) + self.assertEqual(calls, ['http://test.erp5.org:9080/virtual_root/test_obj']) finally: delattr(Organisation, 'checkAbsoluteUrl') @@ -2568,7 +2568,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): # Forcibly restore skin selection, otherwise getMessageList would only # emit a log when retrieving the ZSQLMethod. portal.changeSkin(None) - self.assertEquals(len(activity_tool.getMessageList()), 0) + self.assertEqual(len(activity_tool.getMessageList()), 0) finally: delattr(Organisation, 'firstTest') delattr(Organisation, 'secondTest') @@ -2753,7 +2753,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o.activate(activity='SQLQueue').dummy_counter() self.flushAllActivities() - self.assertEquals(call_count, 10) + self.assertEqual(call_count, 10) finally: SQLQueue.MAX_MESSAGE_LIST_SIZE = old_MAX_MESSAGE_LIST_SIZE del Organisation.dummy_counter @@ -2778,7 +2778,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): getattr(o.activate(activity='SQLDict'), method_name)() self.flushAllActivities() - self.assertEquals(call_count, 10) + self.assertEqual(call_count, 10) finally: SQLDict.MAX_MESSAGE_LIST_SIZE = old_MAX_MESSAGE_LIST_SIZE for i in range(10): @@ -2904,21 +2904,21 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): portal.setPlacelessDefaultReindexParameters(activate_kw=activate_kw, \ **original_reindex_parameters) current_default_reindex_parameters = portal.getPlacelessDefaultReindexParameters() - self.assertEquals({'activate_kw': {'tag': tag}}, \ + self.assertEqual({'activate_kw': {'tag': tag}}, \ current_default_reindex_parameters) person = portal.person_module.newContent(portal_type='Person') self.commit() # as we specified it in setPlacelessDefaultReindexParameters we should have # an activity for this tags - self.assertEquals(1, portal.portal_activities.countMessageWithTag(tag)) + self.assertEqual(1, portal.portal_activities.countMessageWithTag(tag)) self.tic() - self.assertEquals(0, portal.portal_activities.countMessageWithTag(tag)) + self.assertEqual(0, portal.portal_activities.countMessageWithTag(tag)) # restore originals ones portal.setPlacelessDefaultReindexParameters(**original_reindex_parameters) person = portal.person_module.newContent(portal_type='Person') # .. now no messages with this tag should apper - self.assertEquals(0, portal.portal_activities.countMessageWithTag(tag)) + self.assertEqual(0, portal.portal_activities.countMessageWithTag(tag)) def TryNotificationSavedOnEventLogWhenNotifyUserRaises(self, activity): activity_tool = self.getActivityTool() @@ -3032,7 +3032,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): o = organisation_module._getOb(self.company_id) self.commit() self.flushAllActivities(silent = 1, loop_size = 10) - self.assertEquals(len(activity_tool.getMessageList()), 0) + self.assertEqual(len(activity_tool.getMessageList()), 0) class ActivityUnitTestError(Exception): pass activity_unit_test_error = ActivityUnitTestError() @@ -3050,7 +3050,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self._catch_log_errors() o.activate(activity = activity).failingMethod() self.commit() - self.assertEquals(len(activity_tool.getMessageList()), 1) + self.assertEqual(len(activity_tool.getMessageList()), 1) self.flushAllActivities(silent = 1) SiteErrorLog.raising = original_raising self.commit() @@ -3106,7 +3106,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): self.commit() activity_tool.tic() message_list = activity_tool.getMessageList() - self.assertEquals(['doSomething'],[x.method_id for x in message_list]) + self.assertEqual(['doSomething'],[x.method_id for x in message_list]) activity_tool.manageClearActivities(keep=0) finally: SQLQueue.MAX_MESSAGE_LIST_SIZE = old_MAX_MESSAGE_LIST_SIZE @@ -3179,14 +3179,14 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): stdconn.connection_string, ) oldconn = portal.cmf_activity_sql_connection - self.assertEquals(oldconn.meta_type, 'Z MySQL Database Connection') + self.assertEqual(oldconn.meta_type, 'Z MySQL Database Connection') # de-initialize and check that migration of the connection happens # automatically Products.CMFActivity.ActivityTool.is_initialized = False activity_tool.activate(activity='SQLQueue').getId() self.tic() newconn = portal.cmf_activity_sql_connection - self.assertEquals(newconn.meta_type, 'CMFActivity Database Connection') + self.assertEqual(newconn.meta_type, 'CMFActivity Database Connection') def test_connection_installable(self): """ @@ -3208,7 +3208,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): stdconn.connection_string ) newconn = portal.cmf_activity_sql_connection - self.assertEquals(newconn.meta_type, 'CMFActivity Database Connection') + self.assertEqual(newconn.meta_type, 'CMFActivity Database Connection') def test_connection_sortkey(self): """ @@ -3308,7 +3308,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor): c[i].activate(priority=priority, **kw).doSomething() def check(*expected): self.tic() - self.assertEquals(tuple(invoked), expected) + self.assertEqual(tuple(invoked), expected) del invoked[:] invoked = [] def doSomething(self): diff --git a/product/CMFCategory/tests/testCMFCategory.py b/product/CMFCategory/tests/testCMFCategory.py index ddc9c536d9..76d3f26669 100644 --- a/product/CMFCategory/tests/testCMFCategory.py +++ b/product/CMFCategory/tests/testCMFCategory.py @@ -231,20 +231,20 @@ class TestCMFCategory(ERP5TypeTestCase): region_path = 'region/%s' % self.region1 p1 = self.getPersonModule()._getOb(self.id1) p1.setRegion(None) - self.failIf(p1.isMemberOf(region_path)) + self.assertFalse(p1.isMemberOf(region_path)) p1.setRegion(self.region1) - self.failUnless(p1.isMemberOf(region_path)) + self.assertTrue(p1.isMemberOf(region_path)) def test_isAcquiredMemberOf(self): region_path = 'region/%s' % self.region1 p1 = self.getPersonModule()._getOb(self.id1) sub_person = p1._getOb(self.id1) p1.setRegion(None) - self.failIf(p1.isAcquiredMemberOf(region_path)) - self.failIf(sub_person.isAcquiredMemberOf(region_path)) + self.assertFalse(p1.isAcquiredMemberOf(region_path)) + self.assertFalse(sub_person.isAcquiredMemberOf(region_path)) p1.setRegion(self.region1) - self.failUnless(p1.isAcquiredMemberOf(region_path)) - self.failUnless(sub_person.isAcquiredMemberOf(region_path)) + self.assertTrue(p1.isAcquiredMemberOf(region_path)) + self.assertTrue(sub_person.isAcquiredMemberOf(region_path)) def test_04_ReturnNone(self): # Test if we getCategory return None if the cat is '' or None @@ -269,7 +269,7 @@ class TestCMFCategory(ERP5TypeTestCase): p1 = self.getPersonModule()._getOb(self.id1) o1.setRegion(self.region1) p1.setSubordinationValue(o1) - self.failUnless(p1.isMemberOf('region/%s' % self.region1)) + self.assertTrue(p1.isMemberOf('region/%s' % self.region1)) def test_06_ListAcquisition(self): # Test if the acquisition for a single value is working @@ -288,7 +288,7 @@ class TestCMFCategory(ERP5TypeTestCase): p1 = self.getPersonModule()._getOb(self.id1) o1.setRegion(self.region_list) p1.setSubordinationValue(o1) - self.failUnless(p1.isMemberOf('region/%s' % self.region1)) + self.assertTrue(p1.isMemberOf('region/%s' % self.region1)) def test_07_SubordinationValue(self): # Test if an infinite loop of the acquisition for a single value is working @@ -349,7 +349,7 @@ class TestCMFCategory(ERP5TypeTestCase): p1 = self.getPersonModule()._getOb(self.id1) o1 = self.getOrganisationModule()._getOb(self.id1) p1.setSubordinationValue(o1) - self.failUnless(p1.isMemberOf('gender/organisation_module/%s' % self.id1)) + self.assertTrue(p1.isMemberOf('gender/organisation_module/%s' % self.id1)) def test_11_ParentAcquisition(self): # Test if we can use an alternative base category @@ -365,16 +365,16 @@ class TestCMFCategory(ERP5TypeTestCase): p1 = self.getPersonModule()._getOb(self.id1) sub_person = p1._getOb(self.id1) p1.setRegion(self.region1) - self.failUnless(p1.isMemberOf('region/%s' % self.region1)) - self.failUnless(sub_person.isMemberOf('region/%s' % self.region1)) + self.assertTrue(p1.isMemberOf('region/%s' % self.region1)) + self.assertTrue(sub_person.isMemberOf('region/%s' % self.region1)) def test_parentAcquisitionIsMemberOfWithDifferentCategories(self): p1 = self.getPersonModule()._getOb(self.id1) p1.setRegion(self.region1) sub_person = p1._getOb(self.id1) - self.failUnless(p1.isMemberOf('region/%s' % self.region1)) + self.assertTrue(p1.isMemberOf('region/%s' % self.region1)) sub_person.setRegion(self.region2) - self.failUnless(sub_person.isMemberOf('region/%s' % self.region2)) + self.assertTrue(sub_person.isMemberOf('region/%s' % self.region2)) def test_12_GetRelatedValueAndValueList(self): # Test if an infinite loop of the acquisition for a single value is working @@ -408,7 +408,7 @@ class TestCMFCategory(ERP5TypeTestCase): self.assertEqual(west, self.portal.portal_categories.resolveCategory('region/europe/ouest')) self.assertEqual(p1.getRegion(), 'europe/ouest/france') - self.failUnless(p1 in west.getRegionRelatedValueList()) + self.assertTrue(p1 in west.getRegionRelatedValueList()) def test_13b_RenameCategoryUsingCutAndPaste(self): france = self.portal.portal_categories.resolveCategory( @@ -428,7 +428,7 @@ class TestCMFCategory(ERP5TypeTestCase): self.assertEqual(west, self.portal.portal_categories.resolveCategory('region/west')) self.assertEqual(p1.getRegion(), 'west/france') - self.failUnless(p1 in west.getRegionRelatedValueList()) + self.assertTrue(p1 in west.getRegionRelatedValueList()) def test_13c_RenameCategoryUsingCutAndPasteButNotCopy(self): france = self.portal.portal_categories.resolveCategory( @@ -449,8 +449,8 @@ class TestCMFCategory(ERP5TypeTestCase): self.portal.portal_categories.resolveCategory('region/europe/west')) self.assertEqual(p1.getRegion(), 'europe/west/france') # we are not member of the copy - self.failUnless('west/france' not in p1.getRegionList()) - self.failUnless(p1 in west.getRegionRelatedValueList()) + self.assertTrue('west/france' not in p1.getRegionList()) + self.assertTrue(p1 in west.getRegionRelatedValueList()) def test_14_MultiplePortalTypes(self): @@ -469,82 +469,82 @@ class TestCMFCategory(ERP5TypeTestCase): for loop in range(3): org_a.setDestinationValue(pers_a, portal_type='Person') - self.assertEquals( + self.assertEqual( org_a.getDestinationValue(portal_type='Person'), pers_a) - self.assertEquals( + self.assertEqual( org_a.getDestinationValue(portal_type='Organisation'), org_b) - self.assertEquals(len(org_a.getDestinationValueList()), 2) + self.assertEqual(len(org_a.getDestinationValueList()), 2) org_a.setDestinationValue(org_b, portal_type='Organisation') - self.assertEquals( + self.assertEqual( org_a.getDestinationValue(portal_type='Person'), pers_a) - self.assertEquals( + self.assertEqual( org_a.getDestinationValue(portal_type='Organisation'), org_b) - self.assertEquals(len(org_a.getDestinationValueList()), 2) + self.assertEqual(len(org_a.getDestinationValueList()), 2) def test_15_SortChildValues(self): """ Checks on sorting child categories""" pc = self.getCategoriesTool() bc = pc.newContent(portal_type='Base Category', id='sort_test') - self.failUnless(bc is not None) + self.assertTrue(bc is not None) bc.newContent(portal_type='Category', id='1', title='a', int_index=3) bc.newContent(portal_type='Category', id='2', title='b', int_index=1) bc.newContent(portal_type='Category', id='3', title='c', int_index=1) # simple sorting category_list = bc.getCategoryChildValueList(sort_on='title') - self.assertEquals(len(category_list), 3) - self.assertEquals(category_list[0].getId(), '1') - self.assertEquals(category_list[1].getId(), '2') - self.assertEquals(category_list[2].getId(), '3') + self.assertEqual(len(category_list), 3) + self.assertEqual(category_list[0].getId(), '1') + self.assertEqual(category_list[1].getId(), '2') + self.assertEqual(category_list[2].getId(), '3') # reverse sorting category_list = bc.getCategoryChildValueList(sort_on='title', sort_order='reverse') - self.assertEquals(len(category_list), 3) - self.assertEquals(category_list[0].getId(), '3') - self.assertEquals(category_list[1].getId(), '2') - self.assertEquals(category_list[2].getId(), '1') + self.assertEqual(len(category_list), 3) + self.assertEqual(category_list[0].getId(), '3') + self.assertEqual(category_list[1].getId(), '2') + self.assertEqual(category_list[2].getId(), '1') # another reverse sorting category_list = bc.getCategoryChildValueList(sort_on=(('title', 'reverse'),)) - self.assertEquals(len(category_list), 3) - self.assertEquals(category_list[0].getId(), '3') - self.assertEquals(category_list[1].getId(), '2') - self.assertEquals(category_list[2].getId(), '1') + self.assertEqual(len(category_list), 3) + self.assertEqual(category_list[0].getId(), '3') + self.assertEqual(category_list[1].getId(), '2') + self.assertEqual(category_list[2].getId(), '1') # multiple sort parameters category_list = bc.getCategoryChildValueList(sort_on=('int_index', 'title')) - self.assertEquals(len(category_list), 3) - self.assertEquals(category_list[0].getId(), '2') - self.assertEquals(category_list[1].getId(), '3') - self.assertEquals(category_list[2].getId(), '1') + self.assertEqual(len(category_list), 3) + self.assertEqual(category_list[0].getId(), '2') + self.assertEqual(category_list[1].getId(), '3') + self.assertEqual(category_list[2].getId(), '1') # another multiple sort parameters category_list = bc.getCategoryChildValueList(sort_on=(('int_index', 'reverse'), 'title')) - self.assertEquals(len(category_list), 3) - self.assertEquals(category_list[0].getId(), '1') - self.assertEquals(category_list[1].getId(), '2') - self.assertEquals(category_list[2].getId(), '3') + self.assertEqual(len(category_list), 3) + self.assertEqual(category_list[0].getId(), '1') + self.assertEqual(category_list[1].getId(), '2') + self.assertEqual(category_list[2].getId(), '3') def test_16_GetRelatedValues(self): """ Checks on getting related values""" pc = self.getCategoriesTool() bc = pc.newContent(portal_type='Base Category', id='related_value_test') - self.failUnless(bc is not None) + self.assertTrue(bc is not None) self.tic() # A newly created base category should be referred to only by itself value_list = pc.getRelatedValueList(bc) - self.assertEquals(len(value_list), 1) + self.assertEqual(len(value_list), 1) c = bc.newContent(portal_type='Category', id='1') - self.failUnless(c is not None) + self.assertTrue(c is not None) self.tic() value_list = pc.getRelatedValueList(bc) # Now the base category should be referred to by itself and this sub category - self.assertEquals(len(value_list), 2) + self.assertEqual(len(value_list), 2) # This sub category should be referred to only by itself value_list = pc.getRelatedValueList(c) - self.assertEquals(len(value_list), 1) + self.assertEqual(len(value_list), 1) #test _getDefaultRelatedProperty Accessor person = self.portal.person_module.newContent(id='person_test') @@ -552,7 +552,7 @@ class TestCMFCategory(ERP5TypeTestCase): id='organisation_test', destination='person_module/person_test') self.tic() - self.assertEquals(person.getDefaultDestinationRelated(), + self.assertEqual(person.getDefaultDestinationRelated(), 'organisation_module/organisation_test' ) def test_17_CategoriesAndDomainSelection(self): @@ -578,8 +578,8 @@ class TestCMFCategory(ERP5TypeTestCase): http://svn.erp5.org/erp5/trunk/products/CMFCategory/CategoryTool.py?r1=8850&r2=9997 """ europe = self.portal.portal_categories.resolveCategory('region/europe') - self.failUnless('region/europe' in europe.getCategoryList()) - self.failUnless(europe.isMemberOf('region/europe')) + self.assertTrue('region/europe' in europe.getCategoryList()) + self.assertTrue(europe.isMemberOf('region/europe')) def test_19_getCategoryList(self): """ @@ -599,28 +599,28 @@ class TestCMFCategory(ERP5TypeTestCase): self.tic() - self.assertEquals([x.getObject() for x in + self.assertEqual([x.getObject() for x in portal_categories.getCategoryMemberValueList( portal_categories.region.west.france, base_category='region', strict_membership=0, portal_type='Organisation')], [organisation]) - self.assertEquals([x.getObject() for x in + self.assertEqual([x.getObject() for x in portal_categories.getCategoryMemberValueList( portal_categories.region.west.france, base_category='region', strict_membership=1, portal_type='Organisation')], [organisation]) - self.assertEquals([x.getObject() for x in + self.assertEqual([x.getObject() for x in portal_categories.getCategoryMemberValueList( portal_categories.region.west, base_category='region', strict_membership=0, portal_type='Organisation')], [organisation]) - self.assertEquals([x.getObject() for x in + self.assertEqual([x.getObject() for x in portal_categories.getCategoryMemberValueList( portal_categories.region.west, base_category='region', @@ -632,7 +632,7 @@ class TestCMFCategory(ERP5TypeTestCase): base_cat = self.getCategoryTool().newContent(portal_type='Base Category') cat = base_cat.newContent(portal_type='Category', id='the_id', title='The Title') - self.assertEquals([['', ''], ['The Title (the_id)', 'the_id']], + self.assertEqual([['', ''], ['The Title (the_id)', 'the_id']], base_cat.getCategoryChildTitleAndIdItemList()) def test_20_CategoryChildCompactTitleItemList(self): @@ -640,9 +640,9 @@ class TestCMFCategory(ERP5TypeTestCase): base_cat = self.getCategoryTool().newContent(portal_type='Base Category') cat = base_cat.newContent(portal_type='Category', id='the_id', title='The Title', short_title='The T.') - self.assertEquals([['', ''], ['The T.', 'the_id']], + self.assertEqual([['', ''], ['The T.', 'the_id']], base_cat.getCategoryChildCompactTitleItemList()) - self.assertEquals([['', ''], ['The T.', 'the_id']], + self.assertEqual([['', ''], ['The T.', 'the_id']], base_cat.getCategoryChildTranslatedCompactTitleItemList()) def test_21_AcquiredPortalType(self): @@ -653,17 +653,17 @@ class TestCMFCategory(ERP5TypeTestCase): person = self.getPersonModule()[self.id1] person.setTitle('toto') - self.assertEquals(person.getTitle(), 'toto') + self.assertEqual(person.getTitle(), 'toto') order.setDestinationAdministrationValue(person) - self.assertEquals(order.getDestinationAdministrationPersonTitle(), 'toto') + self.assertEqual(order.getDestinationAdministrationPersonTitle(), 'toto') packing_list.setDestinationAdministrationValue(None) packing_list.setOrderValue(None) - self.assertEquals(packing_list.getDestinationAdministrationPersonTitle(), None) + self.assertEqual(packing_list.getDestinationAdministrationPersonTitle(), None) packing_list.setOrderValue(order) - self.assertEquals(packing_list.getDestinationAdministrationPersonTitle(), 'toto') + self.assertEqual(packing_list.getDestinationAdministrationPersonTitle(), 'toto') def test_22_UserFriendlyException(self): """Test message raise if bad use of setter.""" @@ -682,7 +682,7 @@ class TestCMFCategory(ERP5TypeTestCase): try: p1.setCareerSubordination(o1) except Exception, e: - self.failUnless(isinstance(e, TypeError)) + self.assertTrue(isinstance(e, TypeError)) self.assertEqual(e.args[0], 'Category must be of string, tuple of ' 'string or list of string type.') @@ -725,9 +725,9 @@ class TestCMFCategory(ERP5TypeTestCase): c3 = bc.newContent(portal_type='Category', id='3', int_index=20, title='A') # the default ordering is preorder: - self.assertEquals(list(bc.getCategoryChildValueList()), + self.assertEqual(list(bc.getCategoryChildValueList()), [c1, c11, c111, c12, c2, c3]) - self.assertEquals(list(c1.getCategoryChildValueList()), [c11, c111, c12]) + self.assertEqual(list(c1.getCategoryChildValueList()), [c11, c111, c12]) # but this order can be controlled for categories of the same depth, ie. we # can sort each level independantly (this is different from sort_on / @@ -739,21 +739,21 @@ class TestCMFCategory(ERP5TypeTestCase): def sort_func(a, b): return cmp(a.getTitle(), b.getTitle()) # here c1, c2, c3 are sorted by their titles - self.assertEquals(list(bc.getCategoryChildValueList( + self.assertEqual(list(bc.getCategoryChildValueList( local_sort_method=sort_func)), [c3, c2, c1, c11, c111, c12]) # here c11 & c12 are sorted by their titles - self.assertEquals(list(c1.getCategoryChildValueList( + self.assertEqual(list(c1.getCategoryChildValueList( local_sort_method=sort_func)), [c11, c111, c12]) # This can also be done with a local_sort_id, then objects are sorted by # comparing this 'sort_id' property (using getProperty()) # here c1, c2, c3 are sorted by their int_index - self.assertEquals(list(bc.getCategoryChildValueList( + self.assertEqual(list(bc.getCategoryChildValueList( local_sort_id='int_index')), [c1, c12, c11, c111, c3, c2]) # here c11 & c12 are sorted by their titles - self.assertEquals(list(c1.getCategoryChildValueList( + self.assertEqual(list(c1.getCategoryChildValueList( local_sort_id='int_index')), [c12, c11, c111]) # local_sort_id can be a list, in this case document are sorted with the @@ -767,7 +767,7 @@ class TestCMFCategory(ERP5TypeTestCase): c1.setIntIndex(None) c2.setIntIndex(None) # and we sort on int_index then title, we should have this order: - self.assertEquals(list(bc.getCategoryChildValueList( + self.assertEqual(list(bc.getCategoryChildValueList( local_sort_id=['int_index', 'title'])), [c2, c1, c12, c11, c111, c3]) @@ -777,13 +777,13 @@ class TestCMFCategory(ERP5TypeTestCase): bc = pc.newContent(portal_type='Base Category', id='foo') c1 = bc.newContent(portal_type='Category', id='1', title='C') - self.assertEquals([['', ''], ['C', '1']], + self.assertEqual([['', ''], ['C', '1']], bc.getCategoryChildTitleItemList()) - self.assertEquals([['', ''], ['C', '1']], + self.assertEqual([['', ''], ['C', '1']], bc.getCategoryChildTitleItemList(base=0)) - self.assertEquals([['', ''], ['C', 'foo/1']], + self.assertEqual([['', ''], ['C', 'foo/1']], bc.getCategoryChildTitleItemList(base=1)) - self.assertEquals([['', ''], ['C', 'bar/foo/1']], + self.assertEqual([['', ''], ['C', 'bar/foo/1']], bc.getCategoryChildTitleItemList(base='bar')) @@ -793,24 +793,24 @@ class TestCMFCategory(ERP5TypeTestCase): region_url = self.region1 obj.setRegion(region_url) - self.assertEquals([region_url], + self.assertEqual([region_url], pc.getSingleCategoryMembershipList(obj, 'region')) - self.assertEquals([region_url], + self.assertEqual([region_url], pc.getSingleCategoryMembershipList(obj, 'region', portal_type='Category')) - self.assertEquals([], + self.assertEqual([], pc.getSingleCategoryMembershipList(obj, 'region', portal_type='Organisation')) - self.assertEquals(['region/%s' % region_url], + self.assertEqual(['region/%s' % region_url], pc.getSingleCategoryMembershipList(obj, 'region', base=1)) - self.assertEquals([region_url], + self.assertEqual([region_url], pc.getSingleCategoryMembershipList(obj, 'region', checked_permission='View')) noSecurityManager() - self.assertEquals([], + self.assertEqual([], pc.getSingleCategoryMembershipList(obj, 'region', checked_permission='Manage portal')) @@ -825,41 +825,41 @@ class TestCMFCategory(ERP5TypeTestCase): #parent_url = self.portal.person_module.getRelativeUrl() parent_url = parent.getRelativeUrl() - self.assertEquals([], + self.assertEqual([], pc.getSingleCategoryMembershipList(obj, 'parent')) - #self.assertEquals([parent_url], - self.assertEquals([parent], + #self.assertEqual([parent_url], + self.assertEqual([parent], pc.getSingleCategoryMembershipList(obj, 'parent', portal_type='Person Module')) - self.assertEquals([], + self.assertEqual([], pc.getSingleCategoryMembershipList(obj, 'parent', portal_type='Organisation')) - self.assertEquals([], + self.assertEqual([], pc.getSingleCategoryMembershipList(obj, 'parent', base=1)) - #self.assertEquals(['parent/%s' % parent_url], - self.assertEquals([parent], + #self.assertEqual(['parent/%s' % parent_url], + self.assertEqual([parent], pc.getSingleCategoryMembershipList(obj, 'parent', base=1, portal_type='Person Module')) - self.assertEquals([], + self.assertEqual([], pc.getSingleCategoryMembershipList(obj, 'parent', checked_permission='View')) - #self.assertEquals([parent_url], - self.assertEquals([parent], + #self.assertEqual([parent_url], + self.assertEqual([parent], pc.getSingleCategoryMembershipList(obj, 'parent', checked_permission='View', portal_type='Person Module')) noSecurityManager() - self.assertEquals([], + self.assertEqual([], pc.getSingleCategoryMembershipList(obj, 'parent', checked_permission='Manage portal')) - self.assertEquals([], + self.assertEqual([], pc.getSingleCategoryMembershipList(obj, 'parent', checked_permission='Manage portal', portal_type='Person Module')) @@ -875,34 +875,34 @@ class TestCMFCategory(ERP5TypeTestCase): checked_permission = 'View' - self.assertEquals( + self.assertEqual( [['', ''], ['A', '1'], ['B', '2'], ['B1', '2/21']], bc.getCategoryChildTitleItemList(cache=0)) - self.assertEquals( + self.assertEqual( [['', ''], ['A', '1'], ['B', '2'], ['B1', '2/21']], bc.getCategoryChildTitleItemList(checked_permission=checked_permission, cache=0)) b.manage_permission(checked_permission, roles=[], acquire=0) - self.assertEquals( + self.assertEqual( 3, len(bc.getCategoryChildValueList(cache=0))) - self.assertEquals( + self.assertEqual( 1, len(bc.getCategoryChildValueList(checked_permission=checked_permission, cache=0))) - self.assertEquals( + self.assertEqual( ['%s/1' % bc_id, '%s/2' % bc_id, '%s/2/21' % bc_id], bc.getCategoryChildRelativeUrlList()) - self.assertEquals( + self.assertEqual( ['%s/1' % bc_id], bc.getCategoryChildRelativeUrlList(checked_permission=checked_permission)) - self.assertEquals( + self.assertEqual( [['', ''], ['A', '1'], ['B', '2'], ['B1', '2/21']], bc.getCategoryChildTitleItemList(cache=0)) - self.assertEquals( + self.assertEqual( [['', ''], ['A', '1']], bc.getCategoryChildTitleItemList(checked_permission=checked_permission, cache=0)) @@ -926,12 +926,12 @@ class TestCMFCategory(ERP5TypeTestCase): b.manage_permission(checked_permission, roles=['Assignor'], acquire=0) login(self, 'alice') - self.assertEquals( + self.assertEqual( [['', ''], ['A', '1'], ['B', '2'], ['B1', '2/21']], bc.getCategoryChildTitleItemList(checked_permission=checked_permission,)) login(self, 'bob') - self.assertEquals( + self.assertEqual( [['', ''], ['A', '1']], bc.getCategoryChildTitleItemList(checked_permission=checked_permission,)) @@ -942,7 +942,7 @@ class TestCMFCategory(ERP5TypeTestCase): id='first_id') self.tic() bc.setId('new_id') - self.assertEquals('new_id', bc.getId()) + self.assertEqual('new_id', bc.getId()) def test_30_resolveCategory(self): portal = self.getPortal() @@ -973,11 +973,11 @@ class TestCMFCategory(ERP5TypeTestCase): ('sale_order_module/foo/bar/sale_order_module', None), ): obj = category_tool.resolveCategory(relative_url) - self.assertEquals(obj, value) + self.assertEqual(obj, value) obj = category_tool.resolveCategory('order/' + relative_url) - self.assertEquals(obj, value) + self.assertEqual(obj, value) obj = category_tool.resolveCategory('mapping/order/' + relative_url) - self.assertEquals(obj, value) + self.assertEqual(obj, value) def test_31_assert_raise_if_base_category_is_missing(self): #First remove Base Category @@ -1034,14 +1034,14 @@ class TestCMFCategory(ERP5TypeTestCase): person = self.getPersonModule().newContent(portal_type='Person', default_career_subordination_value=organisation) self.assertTrue(organisation.hasRegion()) - self.assertEquals(organisation.getRegion(), 'europe/west') - self.assertEquals(organisation.getRegionList(), ['europe/west']) + self.assertEqual(organisation.getRegion(), 'europe/west') + self.assertEqual(organisation.getRegionList(), ['europe/west']) old_west_region = organisation.getRegionValue() - self.assertEquals(old_west_region.getPortalType(), 'Category') + self.assertEqual(old_west_region.getPortalType(), 'Category') # Check acquired categories - self.assertEquals(person.getRegion(), 'europe/west') - self.assertEquals(person.getRegionList(), ['europe/west']) + self.assertEqual(person.getRegion(), 'europe/west') + self.assertEqual(person.getRegionList(), ['europe/west']) region_base_category = portal_categories.region new_region = region_base_category.newContent(portal_type='Category', @@ -1049,31 +1049,31 @@ class TestCMFCategory(ERP5TypeTestCase): new_region = new_region.newContent(portal_type='Category', id='europe') new_region = new_region.newContent(portal_type='Category', id='west') - self.assertEquals(organisation.getRegion(), 'europe/west') - self.assertEquals(organisation.getRegionList(), ['europe/west']) - self.assertEquals(organisation.getRegionValue().getPortalType(), 'Category') - self.assertEquals(organisation.getRegionValue(), old_west_region) + self.assertEqual(organisation.getRegion(), 'europe/west') + self.assertEqual(organisation.getRegionList(), ['europe/west']) + self.assertEqual(organisation.getRegionValue().getPortalType(), 'Category') + self.assertEqual(organisation.getRegionValue(), old_west_region) - self.assertEquals(person.getRegion(), 'europe/west') - self.assertEquals(person.getRegionList(), ['europe/west']) + self.assertEqual(person.getRegion(), 'europe/west') + self.assertEqual(person.getRegionList(), ['europe/west']) # Let's continue with resource because its ID conflict with # "traversing namespaces" names resource_value = portal_categories.resource.newContent(portal_type='Category', id='id1') organisation.setResource('resource/id1') - self.assertEquals(organisation.getResource(), 'id1') - self.assertEquals(organisation.getResourceValue(), resource_value) - self.assertEquals(organisation.getResourceList(), ['id1']) - self.assertEquals(organisation.getResourceValue(portal_type='Category'), + self.assertEqual(organisation.getResource(), 'id1') + self.assertEqual(organisation.getResourceValue(), resource_value) + self.assertEqual(organisation.getResourceList(), ['id1']) + self.assertEqual(organisation.getResourceValue(portal_type='Category'), resource_value) - self.assertEquals(organisation.getResourceValueList(portal_type='Category'), + self.assertEqual(organisation.getResourceValueList(portal_type='Category'), [resource_value]) # Check other public methods of CategoryTool - self.assertEquals(portal_categories.getCategoryMembershipList(organisation, + self.assertEqual(portal_categories.getCategoryMembershipList(organisation, 'resource', portal_type='Category'), ['id1']) - self.assertEquals(portal_categories.getSingleCategoryMembershipList( + self.assertEqual(portal_categories.getSingleCategoryMembershipList( organisation, 'resource', portal_type='Category'), ['id1']) diff --git a/product/ERP5/tests/testAccessTab.py b/product/ERP5/tests/testAccessTab.py index 38938da0f4..bbce3f8964 100644 --- a/product/ERP5/tests/testAccessTab.py +++ b/product/ERP5/tests/testAccessTab.py @@ -83,7 +83,7 @@ class TestAccessTab(ERP5TypeTestCase): 'renderer': 'ERP5Site_renderViewActionList', 'id': 'browse_tab', 'icon': 'tab_icon/list.png'} - self.assertEquals(tab_info, expected_tab_info) + self.assertEqual(tab_info, expected_tab_info) def checkStatusDict(self): """ Check a script which is used in access tab view """ @@ -91,7 +91,7 @@ class TestAccessTab(ERP5TypeTestCase): expected_status_dict = {'express_mode': 'support_disabled', 'dms_mode': False, 'basic_mode': True} - self.assertEquals(status_dict, expected_status_dict) + self.assertEqual(status_dict, expected_status_dict) def checkInformationDictBasic(self): """ Check a script which is used in the main part in access tab view """ @@ -99,25 +99,25 @@ class TestAccessTab(ERP5TypeTestCase): info_dict = portal.ERP5Site_getCategorizedModuleActionInformationDict() view_list = info_dict['view'] - self.assertEquals(len(view_list), 1) - self.assertEquals(len(view_list[0]), 2) + self.assertEqual(len(view_list), 1) + self.assertEqual(len(view_list[0]), 2) base = view_list[0] (label, menu_list) = base - self.assertEquals(label, 'base') - self.assertEquals(len(menu_list), 2) + self.assertEqual(label, 'base') + self.assertEqual(len(menu_list), 2) organisation_menu = menu_list[0] person_menu = menu_list[1] - self.assertEquals(len(organisation_menu), 2) - self.assertEquals(type(organisation_menu), tuple) - self.assertEquals(len(person_menu), 2) - self.assertEquals(type(person_menu), tuple) + self.assertEqual(len(organisation_menu), 2) + self.assertEqual(type(organisation_menu), tuple) + self.assertEqual(len(person_menu), 2) + self.assertEqual(type(person_menu), tuple) (organisation_label, organisation_url) = organisation_menu (person_label, person_url) = person_menu - self.assertEquals(organisation_label, 'Organisations') - self.assertEquals(person_label, 'Persons') + self.assertEqual(organisation_label, 'Organisations') + self.assertEqual(person_label, 'Persons') def addCurrencyModuleIntoAccessTab(self): """ add currency module into access tab page so that we can @@ -137,19 +137,19 @@ class TestAccessTab(ERP5TypeTestCase): # different when the view is cached. info_dict = portal.ERP5Site_getCategorizedModuleActionInformationDict() view_list = info_dict['view'] - self.assertEquals(len(view_list), 1) - self.assertEquals(len(view_list[0]), 2) + self.assertEqual(len(view_list), 1) + self.assertEqual(len(view_list[0]), 2) base = view_list[0] (label, menu_list) = base - self.assertEquals(len(menu_list), 3) + self.assertEqual(len(menu_list), 3) currency_menu = menu_list[0] - self.assertEquals(len(currency_menu), 2) - self.assertEquals(type(currency_menu), tuple) + self.assertEqual(len(currency_menu), 2) + self.assertEqual(type(currency_menu), tuple) (currency_label, currency_url) = currency_menu - self.assertEquals(currency_label, 'Currencies') + self.assertEqual(currency_label, 'Currencies') self.assertTrue('https' in currency_url[0][1]) def test_01_testAccessTab(self): diff --git a/product/ERP5/tests/testAccounting.py b/product/ERP5/tests/testAccounting.py index 0d48b9d318..3bc8a6e0fc 100644 --- a/product/ERP5/tests/testAccounting.py +++ b/product/ERP5/tests/testAccounting.py @@ -246,22 +246,22 @@ class TestAccounts(AccountingTestCase): def test_AccountValidation(self): # Accounts need a gap category and an account_type category to be valid account = self.portal.account_module.newContent(portal_type='Account') - self.assertEquals(2, len(account.checkConsistency())) + self.assertEqual(2, len(account.checkConsistency())) account.setAccountType('equity') - self.assertEquals(1, len(account.checkConsistency())) + self.assertEqual(1, len(account.checkConsistency())) account.setGap('my_country/my_accounting_standards/1') - self.assertEquals(0, len(account.checkConsistency())) + self.assertEqual(0, len(account.checkConsistency())) def test_AccountWorkflow(self): account = self.portal.account_module.newContent(portal_type='Account') - self.assertEquals('draft', account.getValidationState()) + self.assertEqual('draft', account.getValidationState()) doActionFor = self.portal.portal_workflow.doActionFor self.assertRaises(ValidationFailed, doActionFor, account, 'validate_action') account.setAccountType('equity') account.setGap('my_country/my_accounting_standards/1') doActionFor(account, 'validate_action') - self.assertEquals('validated', account.getValidationState()) + self.assertEqual('validated', account.getValidationState()) def test_isCreditAccount(self): """Tests the 'credit_account' property on account, which was named @@ -269,11 +269,11 @@ class TestAccounts(AccountingTestCase): account = self.portal.account_module.newContent(portal_type='Account') # simulate an old object account.is_credit_account = True - self.failUnless(account.isCreditAccount()) - self.failUnless(account.getProperty('credit_account')) + self.assertTrue(account.isCreditAccount()) + self.assertTrue(account.getProperty('credit_account')) account.setCreditAccount(False) - self.failIf(account.isCreditAccount()) + self.assertFalse(account.isCreditAccount()) class TestTransactionValidation(AccountingTestCase): @@ -632,7 +632,7 @@ class TestTransactionValidation(AccountingTestCase): for line in accounting_transaction.getMovementList(): line.setDestinationSection(None) - self.assertEquals([], accounting_transaction.checkConsistency()) + self.assertEqual([], accounting_transaction.checkConsistency()) self.portal.portal_workflow.doActionFor(accounting_transaction, 'stop_action') def test_NonBalancedAccountingTransactionDifferentSectionOnLines(self): @@ -654,14 +654,14 @@ class TestTransactionValidation(AccountingTestCase): self.assertRaises(ValidationFailed, self.portal.portal_workflow.doActionFor, accounting_transaction, 'stop_action') - self.assertEquals(1, len(accounting_transaction.checkConsistency()), + self.assertEqual(1, len(accounting_transaction.checkConsistency()), accounting_transaction.checkConsistency()) for line in accounting_transaction.getMovementList(): line.setDestinationSectionValue( self.organisation_module.client_2) - self.assertEquals([], accounting_transaction.checkConsistency()) + self.assertEqual([], accounting_transaction.checkConsistency()) self.portal.portal_workflow.doActionFor(accounting_transaction, 'stop_action') def test_NonBalancedAccountingTransactionSectionPersonOnLines(self): @@ -678,7 +678,7 @@ class TestTransactionValidation(AccountingTestCase): # This is not balanced for john smith, but as he is a person, it's not a # problem - self.assertEquals([], accounting_transaction.checkConsistency()) + self.assertEqual([], accounting_transaction.checkConsistency()) self.portal.portal_workflow.doActionFor(accounting_transaction, 'stop_action') def test_AccountingTransactionValidationRefusedWithCategoriesAsSections(self): @@ -722,42 +722,42 @@ class TestTransactionValidation(AccountingTestCase): source_credit=500))) doActionFor = self.portal.portal_workflow.doActionFor - self.assertEquals('draft', accounting_transaction.getSimulationState()) + self.assertEqual('draft', accounting_transaction.getSimulationState()) self.assertTrue(_checkPermission('Modify portal content', accounting_transaction)) doActionFor(accounting_transaction, 'plan_action') - self.assertEquals('planned', accounting_transaction.getSimulationState()) + self.assertEqual('planned', accounting_transaction.getSimulationState()) self.assertTrue(_checkPermission('Modify portal content', accounting_transaction)) doActionFor(accounting_transaction, 'confirm_action') - self.assertEquals('confirmed', accounting_transaction.getSimulationState()) + self.assertEqual('confirmed', accounting_transaction.getSimulationState()) self.assertTrue(_checkPermission('Modify portal content', accounting_transaction)) doActionFor(accounting_transaction, 'start_action') - self.assertEquals('started', accounting_transaction.getSimulationState()) + self.assertEqual('started', accounting_transaction.getSimulationState()) self.assertTrue(_checkPermission('Modify portal content', accounting_transaction)) doActionFor(accounting_transaction, 'stop_action') - self.assertEquals('stopped', accounting_transaction.getSimulationState()) + self.assertEqual('stopped', accounting_transaction.getSimulationState()) self.assertFalse(_checkPermission('Modify portal content', accounting_transaction)) doActionFor(accounting_transaction, 'restart_action') - self.assertEquals('started', accounting_transaction.getSimulationState()) + self.assertEqual('started', accounting_transaction.getSimulationState()) self.assertTrue(_checkPermission('Modify portal content', accounting_transaction)) doActionFor(accounting_transaction, 'stop_action') - self.assertEquals('stopped', accounting_transaction.getSimulationState()) + self.assertEqual('stopped', accounting_transaction.getSimulationState()) self.assertFalse(_checkPermission('Modify portal content', accounting_transaction)) doActionFor(accounting_transaction, 'deliver_action') - self.assertEquals('delivered', accounting_transaction.getSimulationState()) + self.assertEqual('delivered', accounting_transaction.getSimulationState()) self.assertFalse(_checkPermission('Modify portal content', accounting_transaction)) @@ -776,7 +776,7 @@ class TestTransactionValidation(AccountingTestCase): source_asset_credit=600))) section = accounting_transaction.getSourceSectionValue() - self.assertEquals(section.getPriceCurrency(), + self.assertEqual(section.getPriceCurrency(), accounting_transaction.getResource()) # validation is refused @@ -784,7 +784,7 @@ class TestTransactionValidation(AccountingTestCase): self.assertRaises(ValidationFailed, doActionFor, accounting_transaction, 'stop_action') # and the source conversion tab is visible - self.failUnless( + self.assertTrue( accounting_transaction.AccountingTransaction_isSourceCurrencyConvertible()) # if asset price is set to the same value as quantity, validation is @@ -797,7 +797,7 @@ class TestTransactionValidation(AccountingTestCase): else: self.fail('wrong line ?') doActionFor(accounting_transaction, 'stop_action') - self.assertEquals('stopped', accounting_transaction.getSimulationState()) + self.assertEqual('stopped', accounting_transaction.getSimulationState()) def test_UneededDestinationAssetPrice(self): @@ -815,7 +815,7 @@ class TestTransactionValidation(AccountingTestCase): destination_asset_credit=600))) section = accounting_transaction.getDestinationSectionValue() - self.assertEquals(section.getPriceCurrency(), + self.assertEqual(section.getPriceCurrency(), accounting_transaction.getResource()) # validation is refused @@ -823,7 +823,7 @@ class TestTransactionValidation(AccountingTestCase): self.assertRaises(ValidationFailed, doActionFor, accounting_transaction, 'stop_action') # and the destination conversion tab is visible - self.failUnless( + self.assertTrue( accounting_transaction.AccountingTransaction_isDestinationCurrencyConvertible()) # if asset price is set to the same value as quantity, validation is @@ -837,7 +837,7 @@ class TestTransactionValidation(AccountingTestCase): self.fail('wrong line ?') doActionFor(accounting_transaction, 'stop_action') - self.assertEquals('stopped', accounting_transaction.getSimulationState()) + self.assertEqual('stopped', accounting_transaction.getSimulationState()) def test_CancellationAmount(self): accounting_transaction = self._makeOne( @@ -851,7 +851,7 @@ class TestTransactionValidation(AccountingTestCase): cancellation_amount=True ))) - self.assertEquals([], accounting_transaction.checkConsistency()) + self.assertEqual([], accounting_transaction.checkConsistency()) self.portal.portal_workflow.doActionFor(accounting_transaction, 'stop_action') @@ -885,64 +885,64 @@ class TestClosingPeriod(AccountingTestCase): period.AccountingPeriod_createBalanceTransaction( profit_and_loss_account=None) accounting_transaction_list = self.accounting_module.contentValues() - self.assertEquals(3, len(accounting_transaction_list)) + self.assertEqual(3, len(accounting_transaction_list)) balance_transaction_list = self.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(1, len(balance_transaction_list)) + self.assertEqual(1, len(balance_transaction_list)) balance_transaction = balance_transaction_list[0] # this should create a balance with 3 lines, # equity = 500 D # stocks = 400 C # pl = 100 C - self.assertEquals(self.section, + self.assertEqual(self.section, balance_transaction.getDestinationSectionValue()) - self.assertEquals(None, + self.assertEqual(None, balance_transaction.getSourceSection()) - self.assertEquals([period], balance_transaction.getCausalityValueList()) - self.assertEquals(DateTime(2007, 1, 1), + self.assertEqual([period], balance_transaction.getCausalityValueList()) + self.assertEqual(DateTime(2007, 1, 1), balance_transaction.getStartDate()) - self.assertEquals('currency_module/euro', + self.assertEqual('currency_module/euro', balance_transaction.getResource()) - self.assertEquals('delivered', balance_transaction.getSimulationState()) + self.assertEqual('delivered', balance_transaction.getSimulationState()) movement_list = balance_transaction.getMovementList() - self.assertEquals(3, len(movement_list)) + self.assertEqual(3, len(movement_list)) equity_movement_list = [m for m in movement_list if m.getDestinationValue() == self.account_module.equity] - self.assertEquals(1, len(equity_movement_list)) + self.assertEqual(1, len(equity_movement_list)) equity_movement = equity_movement_list[0] - self.assertEquals([], equity_movement.getValueList('resource')) - self.assertEquals([], equity_movement.getValueList('destination_section')) - self.assertEquals(None, equity_movement.getSource()) - self.assertEquals(None, equity_movement.getSourceSection()) - self.assertEquals(None, equity_movement.getDestinationTotalAssetPrice()) - self.assertEquals(None, equity_movement.getSourceTotalAssetPrice()) - self.assertEquals(500., equity_movement.getDestinationDebit()) + self.assertEqual([], equity_movement.getValueList('resource')) + self.assertEqual([], equity_movement.getValueList('destination_section')) + self.assertEqual(None, equity_movement.getSource()) + self.assertEqual(None, equity_movement.getSourceSection()) + self.assertEqual(None, equity_movement.getDestinationTotalAssetPrice()) + self.assertEqual(None, equity_movement.getSourceTotalAssetPrice()) + self.assertEqual(500., equity_movement.getDestinationDebit()) stock_movement_list = [m for m in movement_list if m.getDestinationValue() == self.account_module.stocks] - self.assertEquals(1, len(stock_movement_list)) + self.assertEqual(1, len(stock_movement_list)) stock_movement = stock_movement_list[0] - self.assertEquals([], stock_movement.getValueList('resource')) - self.assertEquals([], stock_movement.getValueList('destination_section')) - self.assertEquals(None, stock_movement.getSource()) - self.assertEquals(None, stock_movement.getSourceSection()) - self.assertEquals(None, stock_movement.getDestinationTotalAssetPrice()) - self.assertEquals(None, stock_movement.getSourceTotalAssetPrice()) - self.assertEquals(400., stock_movement.getDestinationCredit()) + self.assertEqual([], stock_movement.getValueList('resource')) + self.assertEqual([], stock_movement.getValueList('destination_section')) + self.assertEqual(None, stock_movement.getSource()) + self.assertEqual(None, stock_movement.getSourceSection()) + self.assertEqual(None, stock_movement.getDestinationTotalAssetPrice()) + self.assertEqual(None, stock_movement.getSourceTotalAssetPrice()) + self.assertEqual(400., stock_movement.getDestinationCredit()) pl_movement_list = [m for m in movement_list if m.getDestinationValue() is None] - self.assertEquals(1, len(pl_movement_list)) + self.assertEqual(1, len(pl_movement_list)) pl_movement = pl_movement_list[0] - self.assertEquals([], pl_movement.getValueList('resource')) - self.assertEquals([], pl_movement.getValueList('destination_section')) - self.assertEquals(None, pl_movement.getSource()) - self.assertEquals(None, pl_movement.getSourceSection()) - self.assertEquals(None, pl_movement.getDestinationTotalAssetPrice()) - self.assertEquals(None, pl_movement.getSourceTotalAssetPrice()) - self.assertEquals(100., pl_movement.getDestinationCredit()) + self.assertEqual([], pl_movement.getValueList('resource')) + self.assertEqual([], pl_movement.getValueList('destination_section')) + self.assertEqual(None, pl_movement.getSource()) + self.assertEqual(None, pl_movement.getSourceSection()) + self.assertEqual(None, pl_movement.getDestinationTotalAssetPrice()) + self.assertEqual(None, pl_movement.getSourceTotalAssetPrice()) + self.assertEqual(100., pl_movement.getDestinationCredit()) def test_createBalanceOnMirrorSection(self): @@ -977,70 +977,70 @@ class TestClosingPeriod(AccountingTestCase): period.AccountingPeriod_createBalanceTransaction( profit_and_loss_account=pl.getRelativeUrl()) accounting_transaction_list = self.accounting_module.contentValues() - self.assertEquals(3, len(accounting_transaction_list)) + self.assertEqual(3, len(accounting_transaction_list)) balance_transaction_list = self.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(1, len(balance_transaction_list)) + self.assertEqual(1, len(balance_transaction_list)) balance_transaction = balance_transaction_list[0] # this should create a balance with 3 lines, # pl = 300 D # receivable/client1 = 200 C # receivable/client2 = 100 C - self.assertEquals(self.section, + self.assertEqual(self.section, balance_transaction.getDestinationSectionValue()) - self.assertEquals(None, balance_transaction.getSourceSection()) - self.assertEquals(DateTime(2007, 1, 1), + self.assertEqual(None, balance_transaction.getSourceSection()) + self.assertEqual(DateTime(2007, 1, 1), balance_transaction.getStartDate()) - self.assertEquals('currency_module/euro', + self.assertEqual('currency_module/euro', balance_transaction.getResource()) - self.assertEquals('delivered', balance_transaction.getSimulationState()) + self.assertEqual('delivered', balance_transaction.getSimulationState()) movement_list = balance_transaction.getMovementList() - self.assertEquals(3, len(movement_list)) + self.assertEqual(3, len(movement_list)) client1_movement_list = [m for m in movement_list if m.getSourceSectionValue() == organisation_module.client_1] - self.assertEquals(1, len(client1_movement_list)) + self.assertEqual(1, len(client1_movement_list)) client1_movement = client1_movement_list[0] - self.assertEquals([], client1_movement.getValueList('resource')) - self.assertEquals([], client1_movement.getValueList('destination_section')) - self.assertEquals(None, client1_movement.getSource()) - self.assertEquals(self.account_module.receivable, + self.assertEqual([], client1_movement.getValueList('resource')) + self.assertEqual([], client1_movement.getValueList('destination_section')) + self.assertEqual(None, client1_movement.getSource()) + self.assertEqual(self.account_module.receivable, client1_movement.getDestinationValue()) - self.assertEquals(organisation_module.client_1, + self.assertEqual(organisation_module.client_1, client1_movement.getSourceSectionValue()) - self.assertEquals(None, client1_movement.getDestinationTotalAssetPrice()) - self.assertEquals(None, client1_movement.getSourceTotalAssetPrice()) - self.assertEquals(100., client1_movement.getDestinationCredit()) + self.assertEqual(None, client1_movement.getDestinationTotalAssetPrice()) + self.assertEqual(None, client1_movement.getSourceTotalAssetPrice()) + self.assertEqual(100., client1_movement.getDestinationCredit()) client2_movement_list = [m for m in movement_list if m.getSourceSectionValue() == organisation_module.client_2] - self.assertEquals(1, len(client2_movement_list)) + self.assertEqual(1, len(client2_movement_list)) client2_movement = client2_movement_list[0] - self.assertEquals([], client2_movement.getValueList('resource')) - self.assertEquals([], client2_movement.getValueList('destination_section')) - self.assertEquals(None, client2_movement.getSource()) - self.assertEquals(self.account_module.receivable, + self.assertEqual([], client2_movement.getValueList('resource')) + self.assertEqual([], client2_movement.getValueList('destination_section')) + self.assertEqual(None, client2_movement.getSource()) + self.assertEqual(self.account_module.receivable, client2_movement.getDestinationValue()) - self.assertEquals(organisation_module.client_2, + self.assertEqual(organisation_module.client_2, client2_movement.getSourceSectionValue()) - self.assertEquals(None, client2_movement.getDestinationTotalAssetPrice()) - self.assertEquals(None, client2_movement.getSourceTotalAssetPrice()) - self.assertEquals(200., client2_movement.getDestinationCredit()) + self.assertEqual(None, client2_movement.getDestinationTotalAssetPrice()) + self.assertEqual(None, client2_movement.getSourceTotalAssetPrice()) + self.assertEqual(200., client2_movement.getDestinationCredit()) pl_movement_list = [m for m in movement_list if m.getDestinationValue() == pl] - self.assertEquals(1, len(pl_movement_list)) + self.assertEqual(1, len(pl_movement_list)) pl_movement = pl_movement_list[0] - self.assertEquals([], pl_movement.getValueList('resource')) - self.assertEquals(None, pl_movement.getSource()) - self.assertEquals(pl, + self.assertEqual([], pl_movement.getValueList('resource')) + self.assertEqual(None, pl_movement.getSource()) + self.assertEqual(pl, pl_movement.getDestinationValue()) - self.assertEquals(None, + self.assertEqual(None, pl_movement.getSourceSection()) - self.assertEquals(None, pl_movement.getDestinationTotalAssetPrice()) - self.assertEquals(None, pl_movement.getSourceTotalAssetPrice()) - self.assertEquals(300., pl_movement.getDestinationDebit()) + self.assertEqual(None, pl_movement.getDestinationTotalAssetPrice()) + self.assertEqual(None, pl_movement.getSourceTotalAssetPrice()) + self.assertEqual(300., pl_movement.getDestinationDebit()) self.tic() def test_createBalanceOnPayment(self): @@ -1085,10 +1085,10 @@ class TestClosingPeriod(AccountingTestCase): period.AccountingPeriod_createBalanceTransaction( profit_and_loss_account=None) accounting_transaction_list = self.accounting_module.contentValues() - self.assertEquals(3, len(accounting_transaction_list)) + self.assertEqual(3, len(accounting_transaction_list)) balance_transaction_list = self.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(1, len(balance_transaction_list)) + self.assertEqual(1, len(balance_transaction_list)) balance_transaction = balance_transaction_list[0] # this should create a balance with 4 lines, @@ -1097,77 +1097,77 @@ class TestClosingPeriod(AccountingTestCase): # bank/bank2 = 200 D # pl = 200 C - self.assertEquals(self.section, + self.assertEqual(self.section, balance_transaction.getDestinationSectionValue()) - self.assertEquals(None, + self.assertEqual(None, balance_transaction.getSourceSection()) - self.assertEquals([period], balance_transaction.getCausalityValueList()) - self.assertEquals(DateTime(2007, 1, 1), + self.assertEqual([period], balance_transaction.getCausalityValueList()) + self.assertEqual(DateTime(2007, 1, 1), balance_transaction.getStartDate()) - self.assertEquals('currency_module/euro', + self.assertEqual('currency_module/euro', balance_transaction.getResource()) - self.assertEquals('delivered', balance_transaction.getSimulationState()) + self.assertEqual('delivered', balance_transaction.getSimulationState()) movement_list = balance_transaction.getMovementList() - self.assertEquals(4, len(movement_list)) + self.assertEqual(4, len(movement_list)) receivable_movement_list = [m for m in movement_list if m.getDestinationValue() == self.account_module.receivable] - self.assertEquals(1, len(receivable_movement_list)) + self.assertEqual(1, len(receivable_movement_list)) receivable_movement = receivable_movement_list[0] - self.assertEquals([], receivable_movement.getValueList('resource')) - self.assertEquals(None, receivable_movement.getSource()) - self.assertEquals(self.account_module.receivable, + self.assertEqual([], receivable_movement.getValueList('resource')) + self.assertEqual(None, receivable_movement.getSource()) + self.assertEqual(self.account_module.receivable, receivable_movement.getDestinationValue()) - self.assertEquals(self.organisation_module.client_1, + self.assertEqual(self.organisation_module.client_1, receivable_movement.getSourceSectionValue()) - self.assertEquals(None, receivable_movement.getDestinationTotalAssetPrice()) - self.assertEquals(None, receivable_movement.getSourceTotalAssetPrice()) - self.assertEquals(100., receivable_movement.getDestinationDebit()) + self.assertEqual(None, receivable_movement.getDestinationTotalAssetPrice()) + self.assertEqual(None, receivable_movement.getSourceTotalAssetPrice()) + self.assertEqual(100., receivable_movement.getDestinationDebit()) bank1_movement_list = [m for m in movement_list if m.getDestinationPaymentValue() == bank1] - self.assertEquals(1, len(bank1_movement_list)) + self.assertEqual(1, len(bank1_movement_list)) bank1_movement = bank1_movement_list[0] - self.assertEquals([], bank1_movement.getValueList('resource')) - self.assertEquals(None, bank1_movement.getSource()) - self.assertEquals(self.account_module.bank, + self.assertEqual([], bank1_movement.getValueList('resource')) + self.assertEqual(None, bank1_movement.getSource()) + self.assertEqual(self.account_module.bank, bank1_movement.getDestinationValue()) - self.assertEquals(bank1, + self.assertEqual(bank1, bank1_movement.getDestinationPaymentValue()) - self.assertEquals(None, + self.assertEqual(None, bank1_movement.getSourceSectionValue()) - self.assertEquals(None, bank1_movement.getDestinationTotalAssetPrice()) - self.assertEquals(None, bank1_movement.getSourceTotalAssetPrice()) - self.assertEquals(100., bank1_movement.getDestinationCredit()) + self.assertEqual(None, bank1_movement.getDestinationTotalAssetPrice()) + self.assertEqual(None, bank1_movement.getSourceTotalAssetPrice()) + self.assertEqual(100., bank1_movement.getDestinationCredit()) bank2_movement_list = [m for m in movement_list if m.getDestinationPaymentValue() == bank2] - self.assertEquals(1, len(bank2_movement_list)) + self.assertEqual(1, len(bank2_movement_list)) bank2_movement = bank2_movement_list[0] - self.assertEquals([], bank2_movement.getValueList('resource')) - self.assertEquals(None, bank2_movement.getSource()) - self.assertEquals(self.account_module.bank, + self.assertEqual([], bank2_movement.getValueList('resource')) + self.assertEqual(None, bank2_movement.getSource()) + self.assertEqual(self.account_module.bank, bank2_movement.getDestinationValue()) - self.assertEquals(bank2, + self.assertEqual(bank2, bank2_movement.getDestinationPaymentValue()) - self.assertEquals(None, + self.assertEqual(None, bank2_movement.getSourceSectionValue()) - self.assertEquals(None, bank2_movement.getDestinationTotalAssetPrice()) - self.assertEquals(None, bank2_movement.getSourceTotalAssetPrice()) - self.assertEquals(200., bank2_movement.getDestinationDebit()) + self.assertEqual(None, bank2_movement.getDestinationTotalAssetPrice()) + self.assertEqual(None, bank2_movement.getSourceTotalAssetPrice()) + self.assertEqual(200., bank2_movement.getDestinationDebit()) pl_movement_list = [m for m in movement_list if m.getDestination() is None] - self.assertEquals(1, len(pl_movement_list)) + self.assertEqual(1, len(pl_movement_list)) pl_movement = pl_movement_list[0] - self.assertEquals([], pl_movement.getValueList('resource')) - self.assertEquals(None, pl_movement.getSource()) - self.assertEquals(None, pl_movement.getDestination()) - self.assertEquals(None, pl_movement.getDestinationPaymentValue()) - self.assertEquals(None, pl_movement.getSourceSectionValue()) - self.assertEquals(None, pl_movement.getDestinationTotalAssetPrice()) - self.assertEquals(None, pl_movement.getSourceTotalAssetPrice()) - self.assertEquals(200., pl_movement.getDestinationCredit()) + self.assertEqual([], pl_movement.getValueList('resource')) + self.assertEqual(None, pl_movement.getSource()) + self.assertEqual(None, pl_movement.getDestination()) + self.assertEqual(None, pl_movement.getDestinationPaymentValue()) + self.assertEqual(None, pl_movement.getSourceSectionValue()) + self.assertEqual(None, pl_movement.getDestinationTotalAssetPrice()) + self.assertEqual(None, pl_movement.getSourceTotalAssetPrice()) + self.assertEqual(200., pl_movement.getDestinationCredit()) def test_createBalanceOnMirrorSectionMultiCurrency(self): @@ -1210,18 +1210,18 @@ class TestClosingPeriod(AccountingTestCase): period.AccountingPeriod_createBalanceTransaction( profit_and_loss_account=pl.getRelativeUrl()) accounting_transaction_list = self.accounting_module.contentValues() - self.assertEquals(3, len(accounting_transaction_list)) + self.assertEqual(3, len(accounting_transaction_list)) balance_transaction_list = self.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(1, len(balance_transaction_list)) + self.assertEqual(1, len(balance_transaction_list)) balance_transaction = balance_transaction_list[0] - self.assertEquals(self.section, + self.assertEqual(self.section, balance_transaction.getDestinationSectionValue()) - self.assertEquals(None, balance_transaction.getSourceSection()) - self.assertEquals(DateTime(2007, 1, 1), + self.assertEqual(None, balance_transaction.getSourceSection()) + self.assertEqual(DateTime(2007, 1, 1), balance_transaction.getStartDate()) - self.assertEquals('currency_module/euro', + self.assertEqual('currency_module/euro', balance_transaction.getResource()) # this should create a balance with 3 lines, @@ -1231,58 +1231,58 @@ class TestClosingPeriod(AccountingTestCase): accounting_currency_precision = \ self.portal.currency_module.euro.getQuantityPrecision() - self.assertEquals(accounting_currency_precision, 2) + self.assertEqual(accounting_currency_precision, 2) movement_list = balance_transaction.getMovementList() - self.assertEquals(3, len(movement_list)) + self.assertEqual(3, len(movement_list)) client1_movement_list = [m for m in movement_list if m.getSourceSectionValue() == organisation_module.client_1] - self.assertEquals(1, len(client1_movement_list)) + self.assertEqual(1, len(client1_movement_list)) client1_movement = client1_movement_list[0] - self.assertEquals('currency_module/yen', + self.assertEqual('currency_module/yen', client1_movement.getResource()) - self.assertEquals([], client1_movement.getValueList('destination_section')) - self.assertEquals(None, client1_movement.getSource()) - self.assertEquals(self.account_module.receivable, + self.assertEqual([], client1_movement.getValueList('destination_section')) + self.assertEqual(None, client1_movement.getSource()) + self.assertEqual(self.account_module.receivable, client1_movement.getDestinationValue()) - self.assertEquals(organisation_module.client_1, + self.assertEqual(organisation_module.client_1, client1_movement.getSourceSectionValue()) self.assertAlmostEquals(1.1, client1_movement.getDestinationInventoriatedTotalAssetCredit(), accounting_currency_precision) - self.assertEquals(None, client1_movement.getSourceTotalAssetPrice()) - self.assertEquals(100, client1_movement.getDestinationCredit()) + self.assertEqual(None, client1_movement.getSourceTotalAssetPrice()) + self.assertEqual(100, client1_movement.getDestinationCredit()) client2_movement_list = [m for m in movement_list if m.getSourceSectionValue() == organisation_module.client_2] - self.assertEquals(1, len(client2_movement_list)) + self.assertEqual(1, len(client2_movement_list)) client2_movement = client2_movement_list[0] - self.assertEquals('currency_module/usd', + self.assertEqual('currency_module/usd', client2_movement.getResource()) - self.assertEquals([], client2_movement.getValueList('destination_section')) - self.assertEquals(None, client2_movement.getSource()) - self.assertEquals(self.account_module.receivable, + self.assertEqual([], client2_movement.getValueList('destination_section')) + self.assertEqual(None, client2_movement.getSource()) + self.assertEqual(self.account_module.receivable, client2_movement.getDestinationValue()) - self.assertEquals(organisation_module.client_2, + self.assertEqual(organisation_module.client_2, client2_movement.getSourceSectionValue()) self.assertAlmostEquals(2.2, client2_movement.getDestinationInventoriatedTotalAssetCredit(), accounting_currency_precision) - self.assertEquals(None, client2_movement.getSourceTotalAssetPrice()) - self.assertEquals(200., client2_movement.getDestinationCredit()) + self.assertEqual(None, client2_movement.getSourceTotalAssetPrice()) + self.assertEqual(200., client2_movement.getDestinationCredit()) pl_movement_list = [m for m in movement_list if m.getDestinationValue() == pl] - self.assertEquals(1, len(pl_movement_list)) + self.assertEqual(1, len(pl_movement_list)) pl_movement = pl_movement_list[0] - self.assertEquals([], pl_movement.getValueList('resource')) - self.assertEquals(None, pl_movement.getSource()) - self.assertEquals(pl, + self.assertEqual([], pl_movement.getValueList('resource')) + self.assertEqual(None, pl_movement.getSource()) + self.assertEqual(pl, pl_movement.getDestinationValue()) - self.assertEquals(None, + self.assertEqual(None, pl_movement.getSourceSection()) - self.assertEquals(None, pl_movement.getDestinationTotalAssetPrice()) - self.assertEquals(None, pl_movement.getSourceTotalAssetPrice()) + self.assertEqual(None, pl_movement.getDestinationTotalAssetPrice()) + self.assertEqual(None, pl_movement.getSourceTotalAssetPrice()) self.assertAlmostEquals(3.3, pl_movement.getDestinationDebit(), accounting_currency_precision) @@ -1292,7 +1292,7 @@ class TestClosingPeriod(AccountingTestCase): # now check content of stock table q = self.portal.erp5_sql_connection.manage_test # 3 lines, one with quantity 3.3, 2 with quantity 0 - self.assertEquals(1, q( + self.assertEqual(1, q( "SELECT count(*) FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) self.assertAlmostEquals(3.3, q( @@ -1303,22 +1303,22 @@ class TestClosingPeriod(AccountingTestCase): "SELECT quantity FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0], accounting_currency_precision) - self.assertEquals(self.portal.currency_module.euro.getUid(), q( + self.assertEqual(self.portal.currency_module.euro.getUid(), q( "SELECT resource_uid FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) - self.assertEquals(self.section.getUid(), q( + self.assertEqual(self.section.getUid(), q( "SELECT section_uid FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) - self.assertEquals(None, q( + self.assertEqual(None, q( "SELECT mirror_section_uid FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) - self.assertEquals(pl.getUid(), q( + self.assertEqual(pl.getUid(), q( "SELECT node_uid FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) - self.assertEquals(None, q( + self.assertEqual(None, q( "SELECT mirror_node_uid FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) - self.assertEquals(DateTime(2007, 1, 1), q( + self.assertEqual(DateTime(2007, 1, 1), q( "SELECT date FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) @@ -1368,18 +1368,18 @@ class TestClosingPeriod(AccountingTestCase): period.AccountingPeriod_createBalanceTransaction( profit_and_loss_account=pl.getRelativeUrl()) accounting_transaction_list = self.accounting_module.contentValues() - self.assertEquals(3, len(accounting_transaction_list)) + self.assertEqual(3, len(accounting_transaction_list)) balance_transaction_list = self.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(1, len(balance_transaction_list)) + self.assertEqual(1, len(balance_transaction_list)) balance_transaction = balance_transaction_list[0] - self.assertEquals(self.section, + self.assertEqual(self.section, balance_transaction.getDestinationSectionValue()) - self.assertEquals(None, balance_transaction.getSourceSection()) - self.assertEquals(DateTime(2007, 1, 1), + self.assertEqual(None, balance_transaction.getSourceSection()) + self.assertEqual(DateTime(2007, 1, 1), balance_transaction.getStartDate()) - self.assertEquals('currency_module/euro', + self.assertEqual('currency_module/euro', balance_transaction.getResource()) # this should create a balance with 3 lines, @@ -1389,46 +1389,46 @@ class TestClosingPeriod(AccountingTestCase): accounting_currency_precision = \ self.portal.currency_module.euro.getQuantityPrecision() - self.assertEquals(accounting_currency_precision, 2) + self.assertEqual(accounting_currency_precision, 2) movement_list = balance_transaction.getMovementList() - self.assertEquals(3, len(movement_list)) + self.assertEqual(3, len(movement_list)) client1_movement_list = [m for m in movement_list if m.getSourceSectionValue() == organisation_module.client_1] - self.assertEquals(2, len(client1_movement_list)) + self.assertEqual(2, len(client1_movement_list)) yen_movement = [x for x in client1_movement_list if x.getResource() == 'currency_module/yen'][0] - self.assertEquals([], yen_movement.getValueList('destination_section')) - self.assertEquals(None, yen_movement.getSource()) - self.assertEquals(self.account_module.receivable, + self.assertEqual([], yen_movement.getValueList('destination_section')) + self.assertEqual(None, yen_movement.getSource()) + self.assertEqual(self.account_module.receivable, yen_movement.getDestinationValue()) - self.assertEquals(organisation_module.client_1, + self.assertEqual(organisation_module.client_1, yen_movement.getSourceSectionValue()) self.assertAlmostEquals(1.1, yen_movement.getDestinationInventoriatedTotalAssetCredit(), accounting_currency_precision) - self.assertEquals(None, yen_movement.getSourceTotalAssetPrice()) - self.assertEquals(100, yen_movement.getDestinationCredit()) + self.assertEqual(None, yen_movement.getSourceTotalAssetPrice()) + self.assertEqual(100, yen_movement.getDestinationCredit()) dollar_movement = [x for x in client1_movement_list if x.getResource() == 'currency_module/usd'][0] - self.assertEquals([], dollar_movement.getValueList('destination_section')) - self.assertEquals(None, dollar_movement.getSource()) - self.assertEquals(self.account_module.receivable, + self.assertEqual([], dollar_movement.getValueList('destination_section')) + self.assertEqual(None, dollar_movement.getSource()) + self.assertEqual(self.account_module.receivable, dollar_movement.getDestinationValue()) - self.assertEquals(organisation_module.client_1, + self.assertEqual(organisation_module.client_1, dollar_movement.getSourceSectionValue()) self.assertAlmostEquals(2.2, dollar_movement.getDestinationInventoriatedTotalAssetCredit(), accounting_currency_precision) - self.assertEquals(None, dollar_movement.getSourceTotalAssetPrice()) - self.assertEquals(200, dollar_movement.getDestinationCredit()) + self.assertEqual(None, dollar_movement.getSourceTotalAssetPrice()) + self.assertEqual(200, dollar_movement.getDestinationCredit()) self.tic() # now check content of stock table q = self.portal.erp5_sql_connection.manage_test - self.assertEquals(1, q( + self.assertEqual(1, q( "SELECT count(*) FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) self.assertAlmostEquals(3.3, q( @@ -1439,22 +1439,22 @@ class TestClosingPeriod(AccountingTestCase): "SELECT quantity FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0], accounting_currency_precision) - self.assertEquals(self.portal.currency_module.euro.getUid(), q( + self.assertEqual(self.portal.currency_module.euro.getUid(), q( "SELECT resource_uid FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) - self.assertEquals(self.section.getUid(), q( + self.assertEqual(self.section.getUid(), q( "SELECT section_uid FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) - self.assertEquals(None, q( + self.assertEqual(None, q( "SELECT mirror_section_uid FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) - self.assertEquals(pl.getUid(), q( + self.assertEqual(pl.getUid(), q( "SELECT node_uid FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) - self.assertEquals(None, q( + self.assertEqual(None, q( "SELECT mirror_node_uid FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) - self.assertEquals(DateTime(2007, 1, 1), q( + self.assertEqual(DateTime(2007, 1, 1), q( "SELECT date FROM stock WHERE portal_type=" "'Balance Transaction Line'")[0][0]) @@ -1470,9 +1470,9 @@ class TestClosingPeriod(AccountingTestCase): period = self.section.newContent(portal_type='Accounting Period') period.setStartDate(DateTime(2006, 1, 1)) period.setStopDate(DateTime(2006, 12, 31)) - self.assertEquals('draft', period.getSimulationState()) + self.assertEqual('draft', period.getSimulationState()) self.portal.portal_workflow.doActionFor(period, 'start_action') - self.assertEquals('started', period.getSimulationState()) + self.assertEqual('started', period.getSimulationState()) # create a simple transaction in the period accounting_transaction = self._makeOne( @@ -1484,7 +1484,7 @@ class TestClosingPeriod(AccountingTestCase): source_credit=100), dict(source_value=self.account_module.goods_purchase, source_debit=100))) - self.assertEquals(1, len(self.accounting_module)) + self.assertEqual(1, len(self.accounting_module)) pl_account = self.portal.account_module.newContent( portal_type='Account', @@ -1496,30 +1496,30 @@ class TestClosingPeriod(AccountingTestCase): # close the period self.portal.portal_workflow.doActionFor(period, 'stop_action', profit_and_loss_account=pl_account.getRelativeUrl()) - self.assertEquals('stopped', period.getSimulationState()) + self.assertEqual('stopped', period.getSimulationState()) self.tic() # reopen it, then close it got real self.portal.portal_workflow.doActionFor(period, 'restart_action') - self.assertEquals('started', period.getSimulationState()) + self.assertEqual('started', period.getSimulationState()) self.tic() self.portal.portal_workflow.doActionFor(period, 'stop_action', profit_and_loss_account=pl_account.getRelativeUrl()) - self.assertEquals('stopped', period.getSimulationState()) + self.assertEqual('stopped', period.getSimulationState()) self.tic() self.portal.portal_workflow.doActionFor(period, 'deliver_action',) self.tic() - self.assertEquals('delivered', period.getSimulationState()) + self.assertEqual('delivered', period.getSimulationState()) # this created a balance transaction balance_transaction_list = self.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(1, len(balance_transaction_list)) + self.assertEqual(1, len(balance_transaction_list)) balance_transaction = balance_transaction_list[0] # and this transaction must use the account we used in the workflow action. - self.assertEquals(1, len([m for m in + self.assertEqual(1, len([m for m in balance_transaction.getMovementList() if m.getDestinationValue() == pl_account])) @@ -1571,19 +1571,19 @@ class TestClosingPeriod(AccountingTestCase): created_balance_transaction_list = self.portal.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(2, len(created_balance_transaction_list)) + self.assertEqual(2, len(created_balance_transaction_list)) main_section_balance_transaction = [bt for bt in created_balance_transaction_list if bt.getDestinationSectionValue() == self.main_section][0] - self.assertEquals(2, len(main_section_balance_transaction.getMovementList())) - self.assertEquals([], main_section_balance_transaction.checkConsistency()) + self.assertEqual(2, len(main_section_balance_transaction.getMovementList())) + self.assertEqual([], main_section_balance_transaction.checkConsistency()) section_balance_transaction = [bt for bt in created_balance_transaction_list if bt.getDestinationSectionValue() == self.section][0] - self.assertEquals(2, len(section_balance_transaction.getMovementList())) - self.assertEquals([], section_balance_transaction.checkConsistency()) + self.assertEqual(2, len(section_balance_transaction.getMovementList())) + self.assertEqual([], section_balance_transaction.checkConsistency()) self.tic() # we can reindex again @@ -1638,20 +1638,20 @@ class TestClosingPeriod(AccountingTestCase): created_balance_transaction_list = self.portal.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(1, len(created_balance_transaction_list)) + self.assertEqual(1, len(created_balance_transaction_list)) - self.assertEquals(30, stool.getInventory( + self.assertEqual(30, stool.getInventory( section_uid=self.main_section.getUid(), node_uid=pl.getUid())) - self.assertEquals(-30, stool.getInventory( + self.assertEqual(-30, stool.getInventory( section_uid=self.main_section.getUid(), node_uid=self.portal.account_module.payable.getUid())) # Section is not impacted at the moment - self.assertEquals(0, stool.getInventory( + self.assertEqual(0, stool.getInventory( section_uid=self.section.getUid(), node_uid=pl.getUid())) - self.assertEquals(-20, stool.getInventory( + self.assertEqual(-20, stool.getInventory( section_uid=self.section.getUid(), node_uid=self.portal.account_module.payable.getUid())) @@ -1663,20 +1663,20 @@ class TestClosingPeriod(AccountingTestCase): created_balance_transaction_list = self.portal.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(2, len(created_balance_transaction_list)) + self.assertEqual(2, len(created_balance_transaction_list)) # section is now impacted - self.assertEquals(20, stool.getInventory( + self.assertEqual(20, stool.getInventory( section_uid=self.section.getUid(), node_uid=pl.getUid())) - self.assertEquals(-20, stool.getInventory( + self.assertEqual(-20, stool.getInventory( section_uid=self.section.getUid(), node_uid=self.portal.account_module.payable.getUid())) - self.assertEquals(30, stool.getInventory( + self.assertEqual(30, stool.getInventory( section_uid=self.main_section.getUid(), node_uid=pl.getUid())) - self.assertEquals(-30, stool.getInventory( + self.assertEqual(-30, stool.getInventory( section_uid=self.main_section.getUid(), node_uid=self.portal.account_module.payable.getUid())) @@ -1707,7 +1707,7 @@ class TestClosingPeriod(AccountingTestCase): created_balance_transaction_list = self.portal.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(1, len(created_balance_transaction_list)) + self.assertEqual(1, len(created_balance_transaction_list)) # no balance transaction has been created for section def test_SecondAccountingPeriod(self): @@ -1740,7 +1740,7 @@ class TestClosingPeriod(AccountingTestCase): balance_transaction_list = self.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(1, len(balance_transaction_list)) + self.assertEqual(1, len(balance_transaction_list)) balance_transaction1 = balance_transaction_list[0] period2 = self.section.newContent(portal_type='Accounting Period') @@ -1772,35 +1772,35 @@ class TestClosingPeriod(AccountingTestCase): self.accounting_module.contentValues( portal_type='Balance Transaction') if tr != balance_transaction1] - self.assertEquals(1, len(balance_transaction_list)) + self.assertEqual(1, len(balance_transaction_list)) balance_transaction2 = balance_transaction_list[0] - self.assertEquals(DateTime(2008, 1, 1), + self.assertEqual(DateTime(2008, 1, 1), balance_transaction2.getStartDate()) # this should create a balance with 3 lines, # equity = 100 D # payable/client1 = 100 + 300 C # pl = 300 D movement_list = balance_transaction2.getMovementList() - self.assertEquals(3, len(movement_list)) + self.assertEqual(3, len(movement_list)) equity_movement_list = [m for m in movement_list if m.getDestinationValue() == self.account_module.equity] - self.assertEquals(1, len(equity_movement_list)) + self.assertEqual(1, len(equity_movement_list)) equity_movement = equity_movement_list[0] - self.assertEquals(100., equity_movement.getDestinationDebit()) + self.assertEqual(100., equity_movement.getDestinationDebit()) payable_movement_list = [m for m in movement_list if m.getDestinationValue() == self.account_module.payable] - self.assertEquals(1, len(payable_movement_list)) + self.assertEqual(1, len(payable_movement_list)) payable_movement = payable_movement_list[0] - self.assertEquals(400., payable_movement.getDestinationCredit()) + self.assertEqual(400., payable_movement.getDestinationCredit()) pl_movement_list = [m for m in movement_list if m.getDestinationValue() == pl_account] - self.assertEquals(1, len(pl_movement_list)) + self.assertEqual(1, len(pl_movement_list)) pl_movement = pl_movement_list[0] - self.assertEquals(300., pl_movement.getDestinationDebit()) + self.assertEqual(300., pl_movement.getDestinationDebit()) def test_ProfitAndLossUsedInPeriod(self): @@ -1834,21 +1834,21 @@ class TestClosingPeriod(AccountingTestCase): balance_transaction_list = self.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(1, len(balance_transaction_list)) + self.assertEqual(1, len(balance_transaction_list)) balance_transaction = balance_transaction_list[0] balance_transaction.alternateReindexObject() movement_list = balance_transaction.getMovementList() - self.assertEquals(2, len(movement_list)) + self.assertEqual(2, len(movement_list)) pl_movement_list = [m for m in movement_list if m.getDestinationValue() == pl_account] - self.assertEquals(1, len(pl_movement_list)) - self.assertEquals(500, pl_movement_list[0].getDestinationDebit()) + self.assertEqual(1, len(pl_movement_list)) + self.assertEqual(500, pl_movement_list[0].getDestinationDebit()) stock_movement_list = [m for m in movement_list if m.getDestinationValue() == self.account_module.stocks] - self.assertEquals(1, len(stock_movement_list)) - self.assertEquals(500, stock_movement_list[0].getDestinationCredit()) + self.assertEqual(1, len(stock_movement_list)) + self.assertEqual(500, stock_movement_list[0].getDestinationCredit()) self.tic() balance_transaction.reindexObject() @@ -1888,32 +1888,32 @@ class TestClosingPeriod(AccountingTestCase): stool = self.getSimulationTool() # the account 'receivable' has a balance of 100 node_uid = self.account_module.receivable.getUid() - self.assertEquals(100, stool.getInventory( + self.assertEqual(100, stool.getInventory( section_uid=self.section.getUid(), node_uid=node_uid)) - self.assertEquals(100, stool.getInventory( + self.assertEqual(100, stool.getInventory( section_uid=self.section.getUid(), mirror_section_uid=self.organisation_module.client_1.getUid(), node_uid=node_uid)) - self.assertEquals(100, stool.getInventoryAssetPrice( + self.assertEqual(100, stool.getInventoryAssetPrice( section_uid=self.section.getUid(), node_uid=node_uid)) # and only one movement is returned by getMovementHistoryList movement_history_list = stool.getMovementHistoryList( section_uid=self.section.getUid(), node_uid=node_uid) - self.assertEquals(1, len(movement_history_list)) - self.assertEquals([100], [x.total_price for x in movement_history_list]) + self.assertEqual(1, len(movement_history_list)) + self.assertEqual([100], [x.total_price for x in movement_history_list]) # the account 'goods_sales' has a balance of -100 node_uid = self.account_module.goods_sales.getUid() - self.assertEquals(-100, stool.getInventory( + self.assertEqual(-100, stool.getInventory( section_uid=self.section.getUid(), node_uid=node_uid)) # the account 'stocks' has a balance of -100 node_uid = self.account_module.stocks.getUid() - self.assertEquals(-100, stool.getInventory( + self.assertEqual(-100, stool.getInventory( section_uid=self.section.getUid(), node_uid=node_uid)) @@ -1922,7 +1922,7 @@ class TestClosingPeriod(AccountingTestCase): self.tic() # the account 'receivable' still has a balance of 100 node_uid = self.account_module.receivable.getUid() - self.assertEquals(100, stool.getInventory( + self.assertEqual(100, stool.getInventory( section_uid=self.section.getUid(), node_uid=node_uid)) @@ -1937,7 +1937,7 @@ class TestClosingPeriod(AccountingTestCase): return quantity_list # 100 for the transaction, 0 for the balance # because in the balance we put exactly what we have in stock - self.assertEquals(getInventoryQuantityList(), + self.assertEqual(getInventoryQuantityList(), [100]) def setQuantityOnTransaction1(quantity): for line in transaction1.objectValues(): @@ -1952,12 +1952,12 @@ class TestClosingPeriod(AccountingTestCase): # 99 for the transaction, 1 for the balance # because in the balance we have 100, which is 1 more # than actual stock of 99 - self.assertEquals(getInventoryQuantityList(), + self.assertEqual(getInventoryQuantityList(), [1, 99]) setQuantityOnTransaction1(100) # Then finally we check that we have again same thing # as initial conditions - self.assertEquals(getInventoryQuantityList(), + self.assertEqual(getInventoryQuantityList(), [100]) def test_InventoryIndexingNodeDiffOnNode(self): @@ -1990,7 +1990,7 @@ class TestClosingPeriod(AccountingTestCase): stool = self.portal.portal_simulation # the account 'receivable' has a balance of 150 node_uid = self.account_module.receivable.getUid() - self.assertEquals(150, stool.getInventory( + self.assertEqual(150, stool.getInventory( section_uid=self.section.getUid(), node_uid=node_uid)) # movement history list shows 2 movements, the initial with qty 100, and @@ -1998,7 +1998,7 @@ class TestClosingPeriod(AccountingTestCase): # the account 'stocks' has a balance of -100 node_uid = self.account_module.stocks.getUid() - self.assertEquals(-90, stool.getInventory( + self.assertEqual(-90, stool.getInventory( section_uid=self.section.getUid(), node_uid=node_uid)) # we can reindex again @@ -2031,15 +2031,15 @@ class TestClosingPeriod(AccountingTestCase): stool = self.portal.portal_simulation # the account 'receivable' has a balance of 150 + 30 node_uid = self.account_module.receivable.getUid() - self.assertEquals(180, stool.getInventory( + self.assertEqual(180, stool.getInventory( section_uid=self.section.getUid(), node_uid=node_uid)) - self.assertEquals(150, stool.getInventory( + self.assertEqual(150, stool.getInventory( section_uid=self.section.getUid(), mirror_section_uid=self.organisation_module\ .client_1.getUid(), node_uid=node_uid)) - self.assertEquals(30, stool.getInventory( + self.assertEqual(30, stool.getInventory( section_uid=self.section.getUid(), mirror_section_uid=self.organisation_module\ .client_2.getUid(), @@ -2082,7 +2082,7 @@ class TestClosingPeriod(AccountingTestCase): stool = self.portal.portal_simulation # the account 'receivable' has a balance of 100 node_uid = self.account_module.receivable.getUid() - self.assertEquals(100, stool.getInventory( + self.assertEqual(100, stool.getInventory( section_uid=self.section.getUid(), node_uid=node_uid)) # there is one line in getMovementHistoryList: @@ -2090,18 +2090,18 @@ class TestClosingPeriod(AccountingTestCase): section_uid=self.section.getUid(), node_uid=node_uid, sort_on=(('date', 'ASC'), )) - self.assertEquals(2, len(mvt_history_list)) - self.assertEquals(mvt_history_list[1].getObject(), + self.assertEqual(2, len(mvt_history_list)) + self.assertEqual(mvt_history_list[1].getObject(), balance_line) - self.assertEquals([30, 70], [b.total_price for b in mvt_history_list]) + self.assertEqual([30, 70], [b.total_price for b in mvt_history_list]) # There is also one line on payable account node_uid = self.account_module.payable.getUid() mvt_history_list = stool.getMovementHistoryList( section_uid=self.section.getUid(), node_uid=node_uid) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(mvt_history_list[0].getObject(), + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(mvt_history_list[0].getObject(), balance_line2) # we can reindex again @@ -2152,7 +2152,7 @@ class TestClosingPeriod(AccountingTestCase): stool = self.portal.portal_simulation # the account 'receivable' has a balance of 100 + 30 node_uid = self.account_module.receivable.getUid() - self.assertEquals(130, stool.getInventory( + self.assertEqual(130, stool.getInventory( section_uid=self.section.getUid(), node_uid=node_uid,)) # there is one line in getMovementHistoryList: @@ -2160,18 +2160,18 @@ class TestClosingPeriod(AccountingTestCase): section_uid=self.section.getUid(), node_uid=node_uid, sort_on=(('date', 'ASC'), )) - self.assertEquals(3, len(mvt_history_list)) - self.assertEquals(mvt_history_list[2].getObject(), + self.assertEqual(3, len(mvt_history_list)) + self.assertEqual(mvt_history_list[2].getObject(), balance_line) - self.assertEquals([30, 40, 60], [b.total_price for b in mvt_history_list]) + self.assertEqual([30, 40, 60], [b.total_price for b in mvt_history_list]) # There is also one line on payable account node_uid = self.account_module.payable.getUid() mvt_history_list = stool.getMovementHistoryList( section_uid=self.section.getUid(), node_uid=node_uid) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(mvt_history_list[0].getObject(), + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(mvt_history_list[0].getObject(), balance_line2) balance.reindexObject() @@ -2212,10 +2212,10 @@ class TestClosingPeriod(AccountingTestCase): stool = self.portal.portal_simulation # the account 'receivable' has a balance of -100 node_uid = self.account_module.receivable.getUid() - self.assertEquals(-100, stool.getInventory( + self.assertEqual(-100, stool.getInventory( section_uid=self.section.getUid(), node_uid=node_uid)) - self.assertEquals(1, len(stool.getMovementHistoryList( + self.assertEqual(1, len(stool.getMovementHistoryList( section_uid=self.section.getUid(), node_uid=node_uid))) @@ -2236,14 +2236,14 @@ class TestClosingPeriod(AccountingTestCase): balance.reindexObject() self.tic() - self.assertEquals(-150, stool.getInventory( + self.assertEqual(-150, stool.getInventory( section_uid=self.section.getUid(), node_uid=node_uid)) movement_history_list = stool.getMovementHistoryList( section_uid=self.section.getUid(), node_uid=node_uid) - self.assertEquals(2, len(movement_history_list)) - self.assertEquals(sorted([-50, -100]), + self.assertEqual(2, len(movement_history_list)) + self.assertEqual(sorted([-50, -100]), sorted([x.total_quantity for x in movement_history_list])) @@ -2265,20 +2265,20 @@ class TestClosingPeriod(AccountingTestCase): stool = self.portal.portal_simulation # the account 'receivable' has a balance of 100 after 2006/12/31 node_uid = self.account_module.receivable.getUid() - self.assertEquals(100, stool.getInventory( + self.assertEqual(100, stool.getInventory( at_date=DateTime(2006, 12, 31), section_uid=self.section.getUid(), node_uid=node_uid)) - self.assertEquals(1, len(stool.getMovementHistoryList( + self.assertEqual(1, len(stool.getMovementHistoryList( at_date=DateTime(2006, 12, 31), section_uid=self.section.getUid(), node_uid=node_uid))) # and 0 before - self.assertEquals(0, stool.getInventory( + self.assertEqual(0, stool.getInventory( at_date=DateTime(2005, 12, 31), section_uid=self.section.getUid(), node_uid=node_uid)) - self.assertEquals(0, len(stool.getMovementHistoryList( + self.assertEqual(0, len(stool.getMovementHistoryList( at_date=DateTime(2005, 12, 31), section_uid=self.section.getUid(), node_uid=node_uid))) @@ -2302,7 +2302,7 @@ class TestClosingPeriod(AccountingTestCase): stool = self.portal.portal_simulation # the account 'receivable' has a balance of 100 node_uid = self.account_module.receivable.getUid() - self.assertEquals(100, stool.getInventory( + self.assertEqual(100, stool.getInventory( parent_portal_type='Balance Transaction', section_uid=self.section.getUid(), node_uid=node_uid)) @@ -2311,7 +2311,7 @@ class TestClosingPeriod(AccountingTestCase): parent_portal_type='Balance Transaction', section_uid=self.section.getUid(), node_uid=node_uid) - self.assertEquals(1, len(mvt_history_list)) + self.assertEqual(1, len(mvt_history_list)) def test_TemporaryClosing(self): organisation_module = self.organisation_module @@ -2340,18 +2340,18 @@ class TestClosingPeriod(AccountingTestCase): self.tic() - self.assertEquals(100, stool.getInventory( + self.assertEqual(100, stool.getInventory( section_uid=self.section.getUid(), node_uid=self.account_module.receivable.getUid())) - self.assertEquals(-100, stool.getInventory( + self.assertEqual(-100, stool.getInventory( section_uid=self.section.getUid(), node_uid=pl.getUid())) # when period is temporary stopped, a balance transaction is created created_balance_transaction_list = self.portal.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(1, len(created_balance_transaction_list)) + self.assertEqual(1, len(created_balance_transaction_list)) self.portal.portal_workflow.doActionFor( period, 'restart_action' ) @@ -2361,12 +2361,12 @@ class TestClosingPeriod(AccountingTestCase): # when we restart, then this balance transaction is deleted created_balance_transaction_list = self.portal.accounting_module.contentValues( portal_type='Balance Transaction') - self.assertEquals(0, len(created_balance_transaction_list)) + self.assertEqual(0, len(created_balance_transaction_list)) - self.assertEquals(0, stool.getInventory( + self.assertEqual(0, stool.getInventory( section_uid=self.section.getUid(), node_uid=pl.getUid())) - self.assertEquals(100, stool.getInventory( + self.assertEqual(100, stool.getInventory( section_uid=self.section.getUid(), node_uid=self.account_module.receivable.getUid())) @@ -2387,7 +2387,7 @@ class TestAccountingExport(AccountingTestCase): parser.openFromString(ods_data) content_xml = parser.oo_files['content.xml'] # just make sure that we have the correct account name - self.assertEquals( + self.assertEqual( '40 - Payable', self.account_module.payable.Account_getFormattedTitle()) # check that this account name can be found in the content @@ -2428,30 +2428,30 @@ class TestTransactions(AccountingTestCase): accounting_transaction, 'stop_action') # The reference generated for the source section uses the short title from # the accounting period - self.assertEquals('code-2001-1', accounting_transaction.getSourceReference()) + self.assertEqual('code-2001-1', accounting_transaction.getSourceReference()) # This works, because we use # 'AccountingTransaction_getAccountingPeriodForSourceSection' script - self.assertEquals(section_period_2001, accounting_transaction\ + self.assertEqual(section_period_2001, accounting_transaction\ .AccountingTransaction_getAccountingPeriodForSourceSection()) # If no accounting period exists on this side, the transaction date is # used. - self.assertEquals('2001-1', accounting_transaction.getDestinationReference()) + self.assertEqual('2001-1', accounting_transaction.getDestinationReference()) other_transaction = self._makeOne( destination_section_value=self.organisation_module.client_2, start_date=DateTime(2001, 01, 01), stop_date=DateTime(2001, 01, 01)) self.portal.portal_workflow.doActionFor(other_transaction, 'stop_action') - self.assertEquals('code-2001-2', other_transaction.getSourceReference()) - self.assertEquals('2001-1', other_transaction.getDestinationReference()) + self.assertEqual('code-2001-2', other_transaction.getSourceReference()) + self.assertEqual('2001-1', other_transaction.getDestinationReference()) next_year_transaction = self._makeOne( destination_section_value=self.organisation_module.client_1, start_date=DateTime(2002, 01, 01), stop_date=DateTime(2002, 01, 01)) self.portal.portal_workflow.doActionFor(next_year_transaction, 'stop_action') - self.assertEquals('code-2002-1', next_year_transaction.getSourceReference()) - self.assertEquals('2002-1', next_year_transaction.getDestinationReference()) + self.assertEqual('code-2002-1', next_year_transaction.getSourceReference()) + self.assertEqual('2002-1', next_year_transaction.getDestinationReference()) def test_SourceDestinationReferenceGroupAccounting(self): # Check that source reference and destination reference are filled @@ -2479,14 +2479,14 @@ class TestTransactions(AccountingTestCase): accounting_transaction, 'stop_action') # The reference generated for the source section uses the short title from # the accounting period - self.assertEquals('code-2001-1', accounting_transaction.getSourceReference()) + self.assertEqual('code-2001-1', accounting_transaction.getSourceReference()) # This works, because we use # 'AccountingTransaction_getAccountingPeriodForSourceSection' script - self.assertEquals(section_period_2001, accounting_transaction\ + self.assertEqual(section_period_2001, accounting_transaction\ .AccountingTransaction_getAccountingPeriodForSourceSection()) # If no accounting period exists on this side, the transaction date is # used. - self.assertEquals('2001-1', accounting_transaction.getDestinationReference()) + self.assertEqual('2001-1', accounting_transaction.getDestinationReference()) other_section_transaction = self._makeOne( destination_section_value=self.organisation_module.client_2, @@ -2494,8 +2494,8 @@ class TestTransactions(AccountingTestCase): stop_date=DateTime(2001, 01, 01)) self.portal.portal_workflow.doActionFor(other_section_transaction, 'stop_action') # The numbering is shared by all the sections - self.assertEquals('code-2001-2', other_section_transaction.getSourceReference()) - self.assertEquals('2001-1', other_section_transaction.getDestinationReference()) + self.assertEqual('code-2001-2', other_section_transaction.getSourceReference()) + self.assertEqual('2001-1', other_section_transaction.getDestinationReference()) def test_SourceDestinationReferenceSecurity(self): # Check that we don't need specific roles to set source reference and @@ -2517,7 +2517,7 @@ class TestTransactions(AccountingTestCase): self.assertFalse(_checkPermission('Modify portal content', accounting_transaction)) accounting_transaction.stop() - self.assertEquals('code-2001-1', accounting_transaction.getSourceReference()) + self.assertEqual('code-2001-1', accounting_transaction.getSourceReference()) def test_generate_sub_accounting_periods(self): accounting_period_2007 = self.section.newContent( @@ -2530,12 +2530,12 @@ class TestTransactions(AccountingTestCase): frequency='monthly', open_periods=1) sub_period_list = sorted(accounting_period_2007.contentValues(), key=lambda x:x.getStartDate()) - self.assertEquals(12, len(sub_period_list)) + self.assertEqual(12, len(sub_period_list)) first_period = sub_period_list[0] - self.assertEquals(DateTime(2007, 1, 1), first_period.getStartDate()) - self.assertEquals(DateTime(2007, 1, 31), first_period.getStopDate()) - self.assertEquals('2007-01', first_period.getShortTitle()) - self.assertEquals('January', first_period.getTitle()) + self.assertEqual(DateTime(2007, 1, 1), first_period.getStartDate()) + self.assertEqual(DateTime(2007, 1, 31), first_period.getStopDate()) + self.assertEqual('2007-01', first_period.getShortTitle()) + self.assertEqual('January', first_period.getTitle()) def test_SearchableText(self): @@ -2557,14 +2557,14 @@ class TestTransactions(AccountingTestCase): start_date=DateTime(2001, 01, 01), stop_date=DateTime(2001, 12, 31)) - self.assertEquals(self.main_section, + self.assertEqual(self.main_section, self.section.Organisation_getMappingRelatedOrganisation()) - self.assertEquals(self.main_section, + self.assertEqual(self.main_section, self.main_section.Organisation_getMappingRelatedOrganisation()) client = self.organisation_module.client_2 - self.assertEquals(None, client.getGroupValue()) - self.assertEquals(client, + self.assertEqual(None, client.getGroupValue()) + self.assertEqual(client, client.Organisation_getMappingRelatedOrganisation()) @@ -2673,7 +2673,7 @@ class TestTransactions(AccountingTestCase): accounting_transaction.setCausalityValue(invoice) self.portal.portal_workflow.doActionFor(accounting_transaction, 'stop_action') - self.assertEquals('stopped', accounting_transaction.getSimulationState()) + self.assertEqual('stopped', accounting_transaction.getSimulationState()) self.tic() payment = invoice.Invoice_createRelatedPaymentTransaction( @@ -2703,7 +2703,7 @@ class TestTransactions(AccountingTestCase): destination_debit=20),)) self.portal.portal_workflow.doActionFor(accounting_transaction, 'stop_action') - self.assertEquals('stopped', accounting_transaction.getSimulationState()) + self.assertEqual('stopped', accounting_transaction.getSimulationState()) self.tic() payment = invoice.Invoice_createRelatedPaymentTransaction( @@ -2766,19 +2766,19 @@ class TestTransactions(AccountingTestCase): payment=payment_node.getRelativeUrl(), payment_mode='check', batch_mode=1) - self.assertEquals(self.portal.currency_module.usd, + self.assertEqual(self.portal.currency_module.usd, payment.getResourceValue()) line_list = payment.getMovementList() - self.assertEquals(2, len(line_list)) + self.assertEqual(2, len(line_list)) for line in line_list: if line.getSourceValue() == self.account_module.receivable: - self.assertEquals(100, line.getSourceDebit()) + self.assertEqual(100, line.getSourceDebit()) # there's no asset price - self.assertEquals(None, line.getSourceTotalAssetPrice()) + self.assertEqual(None, line.getSourceTotalAssetPrice()) else: - self.assertEquals(self.account_module.bank, line.getSourceValue()) - self.assertEquals(100, line.getSourceCredit()) - self.assertEquals(None, line.getSourceTotalAssetPrice()) + self.assertEqual(self.account_module.bank, line.getSourceValue()) + self.assertEqual(100, line.getSourceCredit()) + self.assertEqual(None, line.getSourceTotalAssetPrice()) # tests for Invoice_getRemainingTotalPayablePrice def test_Invoice_getRemainingTotalPayablePriceDeletedPayment(self): @@ -2818,9 +2818,9 @@ class TestTransactions(AccountingTestCase): cp = accounting_module.manage_copyObjects(ids=[accounting_transaction.getId()]) copy_id = accounting_module.manage_pasteObjects(cp)[0]['new_id'] - self.failIf(accounting_module[copy_id]\ + self.assertFalse(accounting_module[copy_id]\ .line_with_grouping_reference.getGroupingReference()) - self.failIf(accounting_module[copy_id]\ + self.assertFalse(accounting_module[copy_id]\ .line_with_grouping_reference.getGroupingDate()) def test_AccountingTransaction_lineResetGroupingReference(self): @@ -2890,17 +2890,17 @@ class TestTransactions(AccountingTestCase): # reset from the payment line, the invoice line from the same group will be # ungrouped payment_line.AccountingTransactionLine_resetGroupingReference() - self.failIf(payment_line.getGroupingReference()) - self.failIf(payment_line.getGroupingDate()) - self.failIf(invoice_line.getGroupingReference()) - self.failIf(invoice_line.getGroupingDate()) + self.assertFalse(payment_line.getGroupingReference()) + self.assertFalse(payment_line.getGroupingDate()) + self.assertFalse(invoice_line.getGroupingReference()) + self.assertFalse(invoice_line.getGroupingDate()) # other lines are not touched: - self.failUnless(other_account_line.getGroupingReference()) - self.failUnless(other_account_line.getGroupingDate()) - self.failUnless(other_section_line.getGroupingReference()) - self.failUnless(other_section_line.getGroupingDate()) - self.failUnless(other_letter_line.getGroupingDate()) + self.assertTrue(other_account_line.getGroupingReference()) + self.assertTrue(other_account_line.getGroupingDate()) + self.assertTrue(other_section_line.getGroupingReference()) + self.assertTrue(other_section_line.getGroupingDate()) + self.assertTrue(other_letter_line.getGroupingDate()) def test_automatically_setting_grouping_reference(self): invoice = self._makeOne( @@ -2930,33 +2930,33 @@ class TestTransactions(AccountingTestCase): source_credit=100,))) payment_line = payment.line_for_grouping_reference - self.failIf(invoice_line.getGroupingReference()) - self.failIf(invoice_line.getGroupingDate()) - self.failIf(payment_line.getGroupingReference()) - self.failIf(payment_line.getGroupingDate()) + self.assertFalse(invoice_line.getGroupingReference()) + self.assertFalse(invoice_line.getGroupingDate()) + self.assertFalse(payment_line.getGroupingReference()) + self.assertFalse(payment_line.getGroupingDate()) # lines match, they are automatically grouped invoice.stop() - self.failUnless(invoice_line.getGroupingReference()) - self.failUnless(payment_line.getGroupingReference()) + self.assertTrue(invoice_line.getGroupingReference()) + self.assertTrue(payment_line.getGroupingReference()) # the grouping date is set to the latest date of all grouped lines - self.assertEquals(DateTime(2012, 1, 3), invoice_line.getGroupingDate()) - self.assertEquals(DateTime(2012, 1, 3), payment_line.getGroupingDate()) + self.assertEqual(DateTime(2012, 1, 3), invoice_line.getGroupingDate()) + self.assertEqual(DateTime(2012, 1, 3), payment_line.getGroupingDate()) # when restarting, grouping is removed invoice.restart() self.tic() - self.failIf(invoice_line.getGroupingReference()) - self.failIf(invoice_line.getGroupingDate()) - self.failIf(payment_line.getGroupingReference()) - self.failIf(payment_line.getGroupingDate()) + self.assertFalse(invoice_line.getGroupingReference()) + self.assertFalse(invoice_line.getGroupingDate()) + self.assertFalse(payment_line.getGroupingReference()) + self.assertFalse(payment_line.getGroupingDate()) # when stopping again, grouping is set again invoice.stop() - self.failUnless(invoice_line.getGroupingReference()) - self.failUnless(payment_line.getGroupingReference()) - self.assertEquals(DateTime(2012, 1, 3), invoice_line.getGroupingDate()) - self.assertEquals(DateTime(2012, 1, 3), payment_line.getGroupingDate()) + self.assertTrue(invoice_line.getGroupingReference()) + self.assertTrue(payment_line.getGroupingReference()) + self.assertEqual(DateTime(2012, 1, 3), invoice_line.getGroupingDate()) + self.assertEqual(DateTime(2012, 1, 3), payment_line.getGroupingDate()) def test_automatically_setting_grouping_reference_same_group(self): # invoice is for section, payment is for main_section @@ -2995,22 +2995,22 @@ class TestTransactions(AccountingTestCase): source_credit=100,))) payment_line = payment.line_for_grouping_reference - self.failIf(invoice_line.getGroupingReference()) - self.failIf(payment_line.getGroupingReference()) + self.assertFalse(invoice_line.getGroupingReference()) + self.assertFalse(payment_line.getGroupingReference()) # lines match, they are automatically grouped invoice.stop() - self.failUnless(invoice_line.getGroupingReference()) - self.failUnless(payment_line.getGroupingReference()) + self.assertTrue(invoice_line.getGroupingReference()) + self.assertTrue(payment_line.getGroupingReference()) # when restarting, grouping is removed invoice.restart() self.tic() - self.failIf(invoice_line.getGroupingReference()) - self.failIf(payment_line.getGroupingReference()) + self.assertFalse(invoice_line.getGroupingReference()) + self.assertFalse(payment_line.getGroupingReference()) invoice.stop() - self.failUnless(invoice_line.getGroupingReference()) - self.failUnless(payment_line.getGroupingReference()) + self.assertTrue(invoice_line.getGroupingReference()) + self.assertTrue(payment_line.getGroupingReference()) def test_automatically_setting_grouping_reference_only_related(self): invoice = self._makeOne( @@ -3039,12 +3039,12 @@ class TestTransactions(AccountingTestCase): source_credit=100,))) payment_line = payment.line_for_grouping_reference - self.failIf(invoice_line.getGroupingReference()) - self.failIf(payment_line.getGroupingReference()) + self.assertFalse(invoice_line.getGroupingReference()) + self.assertFalse(payment_line.getGroupingReference()) invoice.stop() - self.failIf(invoice_line.getGroupingReference()) - self.failIf(payment_line.getGroupingReference()) + self.assertFalse(invoice_line.getGroupingReference()) + self.assertFalse(payment_line.getGroupingReference()) def test_automatically_setting_grouping_reference_same_section(self): invoice = self._makeOne( @@ -3072,13 +3072,13 @@ class TestTransactions(AccountingTestCase): source_credit=100,))) payment_line = payment.line_for_grouping_reference - self.failIf(invoice_line.getGroupingReference()) - self.failIf(payment_line.getGroupingReference()) + self.assertFalse(invoice_line.getGroupingReference()) + self.assertFalse(payment_line.getGroupingReference()) # different sections, no grouping invoice.stop() - self.failIf(invoice_line.getGroupingReference()) - self.failIf(payment_line.getGroupingReference()) + self.assertFalse(invoice_line.getGroupingReference()) + self.assertFalse(payment_line.getGroupingReference()) def test_automatically_unsetting_grouping_reference_when_cancelling(self): invoice = self._makeOne( @@ -3107,13 +3107,13 @@ class TestTransactions(AccountingTestCase): payment_line = payment.line_for_grouping_reference invoice.stop() - self.failUnless(invoice_line.getGroupingReference()) - self.failUnless(payment_line.getGroupingReference()) + self.assertTrue(invoice_line.getGroupingReference()) + self.assertTrue(payment_line.getGroupingReference()) invoice.cancel() self.tic() - self.failIf(invoice_line.getGroupingReference()) - self.failIf(payment_line.getGroupingReference()) + self.assertFalse(invoice_line.getGroupingReference()) + self.assertFalse(payment_line.getGroupingReference()) def test_automatically_setting_grouping_reference_in_one_invoice(self): # this invoice will group it itself @@ -3153,8 +3153,8 @@ class TestTransactions(AccountingTestCase): destination_value=self.account_module.payable, source_credit=400))) self.assertTrue(accounting_transaction.AccountingTransaction_isSourceView()) - self.assertEquals(500, accounting_transaction.AccountingTransaction_getTotalDebit()) - self.assertEquals(400, accounting_transaction.AccountingTransaction_getTotalCredit()) + self.assertEqual(500, accounting_transaction.AccountingTransaction_getTotalDebit()) + self.assertEqual(400, accounting_transaction.AccountingTransaction_getTotalCredit()) # destination view accounting_transaction = self._makeOne( @@ -3169,8 +3169,8 @@ class TestTransactions(AccountingTestCase): destination_value=self.account_module.payable, destination_credit=400))) self.assertFalse(accounting_transaction.AccountingTransaction_isSourceView()) - self.assertEquals(500, accounting_transaction.AccountingTransaction_getTotalDebit()) - self.assertEquals(400, accounting_transaction.AccountingTransaction_getTotalCredit()) + self.assertEqual(500, accounting_transaction.AccountingTransaction_getTotalDebit()) + self.assertEqual(400, accounting_transaction.AccountingTransaction_getTotalCredit()) # source view, with conversion on our side accounting_transaction = self._makeOne( @@ -3186,8 +3186,8 @@ class TestTransactions(AccountingTestCase): source_asset_credit=40, source_credit=400))) self.assertTrue(accounting_transaction.AccountingTransaction_isSourceView()) - self.assertEquals(50, accounting_transaction.AccountingTransaction_getTotalDebit()) - self.assertEquals(40, accounting_transaction.AccountingTransaction_getTotalCredit()) + self.assertEqual(50, accounting_transaction.AccountingTransaction_getTotalDebit()) + self.assertEqual(40, accounting_transaction.AccountingTransaction_getTotalCredit()) # destination view, with conversion on our side accounting_transaction = self._makeOne( @@ -3204,8 +3204,8 @@ class TestTransactions(AccountingTestCase): destination_asset_credit=40, destination_credit=400))) self.assertFalse(accounting_transaction.AccountingTransaction_isSourceView()) - self.assertEquals(50, accounting_transaction.AccountingTransaction_getTotalDebit()) - self.assertEquals(40, accounting_transaction.AccountingTransaction_getTotalCredit()) + self.assertEqual(50, accounting_transaction.AccountingTransaction_getTotalDebit()) + self.assertEqual(40, accounting_transaction.AccountingTransaction_getTotalCredit()) # source view, with conversion on other side accounting_transaction = self._makeOne( @@ -3221,8 +3221,8 @@ class TestTransactions(AccountingTestCase): destination_asset_credit=40, source_credit=400))) self.assertTrue(accounting_transaction.AccountingTransaction_isSourceView()) - self.assertEquals(500, accounting_transaction.AccountingTransaction_getTotalDebit()) - self.assertEquals(400, accounting_transaction.AccountingTransaction_getTotalCredit()) + self.assertEqual(500, accounting_transaction.AccountingTransaction_getTotalDebit()) + self.assertEqual(400, accounting_transaction.AccountingTransaction_getTotalCredit()) # destination view, with conversion on other side accounting_transaction = self._makeOne( @@ -3239,8 +3239,8 @@ class TestTransactions(AccountingTestCase): source_asset_credit=40, destination_credit=400))) self.assertFalse(accounting_transaction.AccountingTransaction_isSourceView()) - self.assertEquals(500, accounting_transaction.AccountingTransaction_getTotalDebit()) - self.assertEquals(400, accounting_transaction.AccountingTransaction_getTotalCredit()) + self.assertEqual(500, accounting_transaction.AccountingTransaction_getTotalDebit()) + self.assertEqual(400, accounting_transaction.AccountingTransaction_getTotalCredit()) def test_Account_getDestinationSectionItemList(self): organisation1 = self.portal.organisation_module.newContent( @@ -3258,7 +3258,7 @@ class TestTransactions(AccountingTestCase): source_debit=100), dict(source_value=self.portal.account_module.goods_sales, source_credit=100.00))) - self.assertEquals([('', ''), + self.assertEqual([('', ''), ('Organisation 1 (Organisation)', organisation1.getRelativeUrl())], self.portal.Account_getDestinationSectionItemList()) @@ -3421,7 +3421,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): self.getPortal().portal_workflow.doActionFor( accounting_period, 'start_action' ) - self.assertEquals(accounting_period.getSimulationState(), + self.assertEqual(accounting_period.getSimulationState(), 'started') def stepStopAccountingPeriod(self, sequence, **kw): @@ -3432,7 +3432,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): self.getPortal().portal_workflow.doActionFor( accounting_period, 'stop_action', profit_and_loss_account=profit_and_loss_account.getRelativeUrl()) - self.assertEquals(accounting_period.getSimulationState(), + self.assertEqual(accounting_period.getSimulationState(), 'stopped') def stepCheckAccountingPeriodRefusesClosing(self, sequence, **kw): @@ -3447,13 +3447,13 @@ class TestAccountingWithSequences(ERP5TypeTestCase): accounting_period = sequence.get('accounting_period') self.portal.portal_workflow.doActionFor( accounting_period, 'deliver_action', ) - self.assertEquals(accounting_period.getSimulationState(), + self.assertEqual(accounting_period.getSimulationState(), 'delivered') def stepCheckAccountingPeriodDelivered(self, sequence, **kw): """Check the Accounting Period is delivered.""" accounting_period = sequence.get('accounting_period') - self.assertEquals(accounting_period.getSimulationState(), + self.assertEqual(accounting_period.getSimulationState(), 'delivered') def createCurrencies(self): @@ -3534,8 +3534,8 @@ class TestAccountingWithSequences(ERP5TypeTestCase): for account in self.account_list : account.validate() - self.failUnless('Site Error' not in account.view()) - self.assertEquals(account.getValidationState(), 'validated') + self.assertTrue('Site Error' not in account.view()) + self.assertEqual(account.getValidationState(), 'validated') self.tic() def stepCreateAccounts(self, sequence, **kw) : @@ -3682,13 +3682,13 @@ class TestAccountingWithSequences(ERP5TypeTestCase): """Checks invoices are in draft state.""" invoice_list = sequence.get('invoice_list') for invoice in invoice_list: - self.assertEquals(invoice.getSimulationState(), 'draft') + self.assertEqual(invoice.getSimulationState(), 'draft') def stepCheckInvoicesAreStopped(self, sequence, **kw) : """Checks invoices are in stopped state.""" invoice_list = sequence.get('invoice_list') for invoice in invoice_list: - self.assertEquals(invoice.getSimulationState(), 'stopped') + self.assertEqual(invoice.getSimulationState(), 'stopped') def checkAccountBalanceInCurrency(self, section, currency, sequence, **kw) : @@ -3713,7 +3713,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): calculated_balance += ( line.getDestinationDebit() - line.getDestinationCredit()) - self.assertEquals(calculated_balance, + self.assertEqual(calculated_balance, self.getPortal().portal_simulation.getInventory( node_uid = account.getUid(), section_uid = section.getUid(), @@ -3748,7 +3748,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): section == line.getDestinationSectionValue() : calculated_balance += \ line.getDestinationInventoriatedTotalAssetPrice() - self.assertEquals(calculated_balance, + self.assertEqual(calculated_balance, self.getPortal().portal_simulation.getInventoryAssetPrice( node_uid = account.getUid(), section_uid = section.getUid(), @@ -3778,7 +3778,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): portal = self.getPortal() accounting_module = portal.accounting_module - self.failUnless('Site Error' not in accounting_module.view()) + self.assertTrue('Site Error' not in accounting_module.view()) self.assertNotEquals( len(portal.getPortalAccountingMovementTypeList()), 0) self.assertNotEquals( @@ -3789,12 +3789,12 @@ class TestAccountingWithSequences(ERP5TypeTestCase): source_section_value = source_section_value, destination_section_value = destination_section_value, resource_value = resource_value ) - self.failUnless('Site Error' not in accounting_transaction.view()) - self.assertEquals( accounting_transaction.getSourceSectionValue(), + self.assertTrue('Site Error' not in accounting_transaction.view()) + self.assertEqual( accounting_transaction.getSourceSectionValue(), source_section_value ) - self.assertEquals( accounting_transaction.getDestinationSectionValue(), + self.assertEqual( accounting_transaction.getDestinationSectionValue(), destination_section_value ) - self.assertEquals( accounting_transaction.getResourceValue(), + self.assertEqual( accounting_transaction.getResourceValue(), resource_value ) self.assertNotEquals( len(accounting_transaction.allowedContentTypes()), 0) @@ -3805,17 +3805,17 @@ class TestAccountingWithSequences(ERP5TypeTestCase): if line_portal_type in allowed_content_types : line = accounting_transaction.newContent( portal_type = line_portal_type, ) - self.failUnless('Site Error' not in line.view()) + self.assertTrue('Site Error' not in line.view()) # section and resource is acquired from parent transaction. - self.assertEquals( line.getDestinationSectionValue(), + self.assertEqual( line.getDestinationSectionValue(), destination_section_value ) - self.assertEquals( line.getDestinationSectionTitle(), + self.assertEqual( line.getDestinationSectionTitle(), destination_section_title ) - self.assertEquals( line.getSourceSectionValue(), + self.assertEqual( line.getSourceSectionValue(), source_section_value ) - self.assertEquals( line.getSourceSectionTitle(), + self.assertEqual( line.getSourceSectionTitle(), source_section_title ) - self.assertEquals( line.getResourceValue(), + self.assertEqual( line.getResourceValue(), resource_value ) tested_line_portal_type = 1 self.assert_(tested_line_portal_type, ("No lines tested ... " + @@ -3877,8 +3877,8 @@ class TestAccountingWithSequences(ERP5TypeTestCase): source_value=kw.get('income_account', self.income_account), destination_value=kw.get('expense_account', self.expense_account), ) - self.failUnless(income.getSource() != None) - self.failUnless(income.getDestination() != None) + self.assertTrue(income.getSource() != None) + self.assertTrue(income.getDestination() != None) receivable = accounting_transaction.newContent( id='receivable', @@ -3888,12 +3888,12 @@ class TestAccountingWithSequences(ERP5TypeTestCase): self.receivable_account), destination_value=kw.get('payable_account', self.payable_account), ) - self.failUnless(receivable.getSource() != None) - self.failUnless(receivable.getDestination() != None) + self.assertTrue(receivable.getSource() != None) + self.assertTrue(receivable.getDestination() != None) if reindex: self.tic() if check_consistency: - self.failUnless(len(accounting_transaction.checkConsistency()) == 0, + self.assertTrue(len(accounting_transaction.checkConsistency()) == 0, "Check consistency failed : %s" % accounting_transaction.checkConsistency()) return accounting_transaction @@ -3902,14 +3902,14 @@ class TestAccountingWithSequences(ERP5TypeTestCase): method are valid. """ accounting_transaction = self.createAccountingTransaction() - self.assertEquals(self.vendor, accounting_transaction.getSourceSectionValue()) - self.assertEquals(self.client, accounting_transaction.getDestinationSectionValue()) - self.assertEquals(self.EUR, accounting_transaction.getResourceValue()) - self.failUnless(accounting_transaction.AccountingTransaction_isSourceView()) + self.assertEqual(self.vendor, accounting_transaction.getSourceSectionValue()) + self.assertEqual(self.client, accounting_transaction.getDestinationSectionValue()) + self.assertEqual(self.EUR, accounting_transaction.getResourceValue()) + self.assertTrue(accounting_transaction.AccountingTransaction_isSourceView()) self.workflow_tool.doActionFor(accounting_transaction, 'stop_action') - self.assertEquals('stopped', accounting_transaction.getSimulationState()) - self.assertEquals([] , accounting_transaction.checkConsistency()) + self.assertEqual('stopped', accounting_transaction.getSimulationState()) + self.assertEqual([] , accounting_transaction.checkConsistency()) def stepCreateValidAccountingTransaction(self, sequence, sequence_list=None, **kw) : @@ -3952,7 +3952,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): accounting_transaction.setStartDate(old_start_date) accounting_transaction.setStopDate(old_stop_date) self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') - self.assertEquals(accounting_transaction.getSimulationState(), 'stopped') + self.assertEqual(accounting_transaction.getSimulationState(), 'stopped') def stepValidateNoSection(self, sequence, sequence_list=None, **kw) : """Check validation behaviour related to section & mirror_section. @@ -3985,7 +3985,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): line.setDestinationSection(old_destination_section) try: self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') - self.assertEquals(accounting_transaction.getSimulationState(), 'stopped') + self.assertEqual(accounting_transaction.getSimulationState(), 'stopped') except ValidationFailed, err : self.assert_(0, "Validation failed : %s" % err.msg) @@ -4007,7 +4007,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): accounting_transaction.setSourceSection(None) try: self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') - self.assertEquals(accounting_transaction.getSimulationState(), 'stopped') + self.assertEqual(accounting_transaction.getSimulationState(), 'stopped') except ValidationFailed, err : self.assert_(0, "Validation failed : %s" % err.msg) @@ -4038,14 +4038,14 @@ class TestAccountingWithSequences(ERP5TypeTestCase): accounting_transaction = sequence.get('transaction') account = accounting_transaction.getMovementList()[0].getSourceValue() self.getWorkflowTool().doActionFor(account, 'invalidate_action') - self.assertEquals(account.getValidationState(), 'invalidated') + self.assertEqual(account.getValidationState(), 'invalidated') self.assertRaises(ValidationFailed, self.getWorkflowTool().doActionFor, accounting_transaction, 'stop_action') # reopen the account for other tests account.validate() - self.assertEquals(account.getValidationState(), 'validated') + self.assertEqual(account.getValidationState(), 'validated') def stepValidateNoAccounts(self, sequence, sequence_list=None, **kw) : """Simple check that the validation is refused when we do not have @@ -4077,15 +4077,15 @@ class TestAccountingWithSequences(ERP5TypeTestCase): accounting_transaction.newContent( portal_type = self.accounting_transaction_line_portal_type) self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') - self.assertEquals(accounting_transaction.getSimulationState(), 'stopped') - self.assertEquals(line_count, len(accounting_transaction.getMovementList())) + self.assertEqual(accounting_transaction.getSimulationState(), 'stopped') + self.assertEqual(line_count, len(accounting_transaction.getMovementList())) # 0 quantity, but a destination asset price => do not delete the # line accounting_transaction = self.createAccountingTransaction() new_line = accounting_transaction.newContent( portal_type = self.accounting_transaction_line_portal_type) - self.assertEquals(len(accounting_transaction.getMovementList()), 3) + self.assertEqual(len(accounting_transaction.getMovementList()), 3) line_list = accounting_transaction.getMovementList() line_list[0].setDestinationTotalAssetPrice(100) line_list[0]._setCategoryMembership( @@ -4098,7 +4098,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): 'destination', sequence.get('expense_account').getRelativeUrl()) try: self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') - self.assertEquals(accounting_transaction.getSimulationState(), 'stopped') + self.assertEqual(accounting_transaction.getSimulationState(), 'stopped') except ValidationFailed, err : self.assert_(0, "Validation failed : %s" % err.msg) @@ -4143,7 +4143,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): line_list[1].setQuantity(32546787) try: self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') - self.assertEquals(accounting_transaction.getSimulationState(), 'stopped') + self.assertEqual(accounting_transaction.getSimulationState(), 'stopped') except ValidationFailed, err : self.assert_(0, "Validation failed : %s" % err.msg) @@ -4167,7 +4167,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): income_account_found = 1 line.edit( source_value = sequence.get('bank_account'), destination_value = sequence.get('bank_account') ) - self.failUnless(income_account_found) + self.assertTrue(income_account_found) # XXX accounting_transaction = sequence.get('transaction') useBankAccount(accounting_transaction) @@ -4205,7 +4205,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): accounting_transaction.setDestinationPaymentValue(destination_payment_value) try: self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') - self.assertEquals(accounting_transaction.getSimulationState(), 'stopped') + self.assertEqual(accounting_transaction.getSimulationState(), 'stopped') except ValidationFailed, err : self.fail("Validation failed : %s" % err.msg) @@ -4223,7 +4223,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): portal_type=self.accounting_transaction_line_portal_type) self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') - self.assertEquals(len(accounting_transaction.getMovementList()), + self.assertEqual(len(accounting_transaction.getMovementList()), lines_count - empty_lines_count) # we don't remove empty lines if there is only empty lines @@ -4239,7 +4239,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): portal_type=self.accounting_transaction_line_portal_type) lines_count = len(another_accounting_transaction.getMovementList()) self.getWorkflowTool().doActionFor(another_accounting_transaction, 'stop_action') - self.assertEquals(len(another_accounting_transaction.getMovementList()), lines_count) + self.assertEqual(len(another_accounting_transaction.getMovementList()), lines_count) ############################################################################ ## Test Methods ############################################################ @@ -4482,8 +4482,8 @@ class TestAccountingTransactionTemplate(AccountingTestCase): ret = self.accounting_module.Base_doAction( select_action='template %s' % template.getRelativeUrl(), form_id='', cancel_url='') - self.failUnless('Template%20created.' in ret, ret) - self.assertEquals(2, len(self.accounting_module.contentValues())) + self.assertTrue('Template%20created.' in ret, ret) + self.assertEqual(2, len(self.accounting_module.contentValues())) def test_suite(): diff --git a/product/ERP5/tests/testAccountingReports.py b/product/ERP5/tests/testAccountingReports.py index fd410eb8f3..11341545cb 100644 --- a/product/ERP5/tests/testAccountingReports.py +++ b/product/ERP5/tests/testAccountingReports.py @@ -154,23 +154,23 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewJournalReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) # currency is present in the report - self.assertEquals('currency_module/euro', self.portal. + self.assertEqual('currency_module/euro', self.portal. AccountingTransactionModule_viewJournalReport.your_currency.get_value('default')) # precision is set in the REQUEST (so that fields know how to format) precision = self.portal.REQUEST.get('precision') - self.assertEquals(2, precision) + self.assertEqual(2, precision) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 3 transactions, with 3 lines each - self.assertEquals(9, len(data_line_list)) + self.assertEqual(9, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['specific_reference', 'date', 'title', 'parent_reference', 'node_title', 'mirror_section_title', 'debit', 'credit']) @@ -269,18 +269,18 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): # Stat Line stat_line = line_list[-1] - self.failUnless(stat_line.isStatLine()) - self.failIf(stat_line.getColumnProperty('specific_reference')) - self.failIf(stat_line.getColumnProperty('date')) - self.failIf(stat_line.getColumnProperty('title')) - self.failIf(stat_line.getColumnProperty('parent_reference')) - self.failIf(stat_line.getColumnProperty('node_title')) - self.failIf(stat_line.getColumnProperty('mirror_section_title')) + self.assertTrue(stat_line.isStatLine()) + self.assertFalse(stat_line.getColumnProperty('specific_reference')) + self.assertFalse(stat_line.getColumnProperty('date')) + self.assertFalse(stat_line.getColumnProperty('title')) + self.assertFalse(stat_line.getColumnProperty('parent_reference')) + self.assertFalse(stat_line.getColumnProperty('node_title')) + self.assertFalse(stat_line.getColumnProperty('mirror_section_title')) # when printing the report, the field does the rounding, so we can round in # the test - self.assertEquals(717.60, round(stat_line.getColumnProperty('debit'), + self.assertEqual(717.60, round(stat_line.getColumnProperty('debit'), precision)) - self.assertEquals(717.60, round(stat_line.getColumnProperty('credit'), + self.assertEqual(717.60, round(stat_line.getColumnProperty('credit'), precision)) def testJournalTransactionsWithoutThirdParty(self): @@ -300,7 +300,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): source_credit=19.60), dict(source_value=account_module.goods_sales, source_credit=100.00))) - self.assertEquals(None, first.getDestinationSectionValue()) + self.assertEqual(None, first.getDestinationSectionValue()) second = self._makeOne( portal_type='Accounting Transaction', @@ -316,7 +316,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): destination_credit=19.60), dict(destination_value=account_module.goods_sales, destination_credit=100.00))) - self.assertEquals(None, second.getSourceSectionValue()) + self.assertEqual(None, second.getSourceSectionValue()) # set request variables and render @@ -331,20 +331,20 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewJournalReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) # precision is set in the REQUEST (so that fields know how to format) precision = self.portal.REQUEST.get('precision') - self.assertEquals(2, precision) + self.assertEqual(2, precision) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 2 transactions, with 3 lines - self.assertEquals(6, len(data_line_list)) + self.assertEqual(6, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['specific_reference', 'date', 'title', 'parent_reference', 'node_title', 'mirror_section_title', 'debit', 'credit']) @@ -399,17 +399,17 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): # Stat Line stat_line = line_list[-1] - self.failUnless(stat_line.isStatLine()) - self.failIf(stat_line.getColumnProperty('specific_reference')) - self.failIf(stat_line.getColumnProperty('date')) - self.failIf(stat_line.getColumnProperty('title')) - self.failIf(stat_line.getColumnProperty('node_title')) - self.failIf(stat_line.getColumnProperty('mirror_section_title')) + self.assertTrue(stat_line.isStatLine()) + self.assertFalse(stat_line.getColumnProperty('specific_reference')) + self.assertFalse(stat_line.getColumnProperty('date')) + self.assertFalse(stat_line.getColumnProperty('title')) + self.assertFalse(stat_line.getColumnProperty('node_title')) + self.assertFalse(stat_line.getColumnProperty('mirror_section_title')) # when printing the report, the field does the rounding, so we can round in # the test - self.assertEquals(239.20, round(stat_line.getColumnProperty('debit'), + self.assertEqual(239.20, round(stat_line.getColumnProperty('debit'), precision)) - self.assertEquals(239.20, round(stat_line.getColumnProperty('credit'), + self.assertEqual(239.20, round(stat_line.getColumnProperty('credit'), precision)) @@ -462,12 +462,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewJournalReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 1 transactions with 2 lines - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], specific_reference=transaction.getSourceReference(), @@ -487,7 +487,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit=100) # Stat Line - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit=100, credit=100) def testJournalProject(self): @@ -504,15 +504,15 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewJournalReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['specific_reference', 'date', 'title', 'parent_reference', 'node_title', 'mirror_section_title', 'debit', 'credit']) @@ -526,7 +526,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): debit=0, credit=500) stat_line = line_list[-1] - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit=500, credit=500) def createAccountStatementDataSet(self, use_two_bank_accounts=1): @@ -820,24 +820,24 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) # precision is set in the REQUEST (so that fields know how to format) precision = self.portal.REQUEST.get('precision') - self.assertEquals(2, precision) + self.assertEqual(2, precision) # currency is present in the report - self.assertEquals('currency_module/euro', self.portal. + self.assertEqual('currency_module/euro', self.portal. AccountModule_viewAccountStatementReport.your_currency.get_value('default')) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 6 transactions, because 7th is after - self.assertEquals(6, len(data_line_list)) + self.assertEqual(6, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['Movement_getSpecificReference', 'date', 'Movement_getExplanationTitle', 'Movement_getMirrorSectionTitle', 'Movement_getExplanationReference', @@ -903,7 +903,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=0, running_total_price=1700) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], Movement_getSpecificReference=None, date=None, @@ -932,11 +932,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 1 summary line and 4 transactions - self.assertEquals(5, len(data_line_list)) + self.assertEqual(5, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='Previous Balance', @@ -983,7 +983,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=0, running_total_price=1700) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=1900, credit_price=200,) @@ -1006,7 +1006,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] self.assertNotEquals('Previous Balance', @@ -1075,16 +1075,16 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 1 transactions, because 1st is grouped during the period. - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['Movement_getSpecificReference', 'date', 'Movement_getExplanationTitle', 'Movement_getMirrorSectionTitle', 'Movement_getExplanationReference', @@ -1100,7 +1100,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=0, running_total_price=239.20) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], Movement_getSpecificReference=None, date=None, @@ -1131,22 +1131,22 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): 'AccountModule_viewGeneralLedgerReport') # Except the stat, we only have one report section, because Client 1 is # grouped in the period. - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) - self.assertEquals('41 - Receivable (Client 2)', + self.assertEqual('41 - Receivable (Client 2)', report_section_list[0].getTitle()) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # report layout - self.assertEquals(['Movement_getSpecificReference', + self.assertEqual(['Movement_getSpecificReference', 'Movement_getExplanationTitle', 'date', 'Movement_getExplanationTranslatedPortalType', 'Movement_getExplanationReference', 'Movement_getMirrorSectionTitle', 'debit_price', 'credit_price', 'running_total_price'], data_line_list[0].column_id_list) - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='2', Movement_getExplanationTitle='Grouped after period', @@ -1156,7 +1156,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle='Client 2', debit_price=239.20, credit_price=0, running_total_price=239.20, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], Movement_getSpecificReference=None, Movement_getExplanationTitle=None, @@ -1166,12 +1166,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle=None, debit_price=239.20, credit_price=0, ) - self.assertEquals('Total', report_section_list[1].getTitle()) + self.assertEqual('Total', report_section_list[1].getTitle()) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] # report layout - self.assertEquals(['debit_price', 'credit_price'], data_line_list[0].column_id_list) - self.assertEquals(1, len(data_line_list)) + self.assertEqual(['debit_price', 'credit_price'], data_line_list[0].column_id_list) + self.assertEqual(1, len(data_line_list)) # The bottom line remain the same as when showing grouped lines self.checkLineProperties(data_line_list[0], debit_price=358.80, credit_price=0) @@ -1277,10 +1277,10 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') # the report has 4 sections, - self.assertEquals(4, len(report_section_list)) + self.assertEqual(4, len(report_section_list)) # but 2 of them are only titles report_section_list = [r for r in report_section_list if r.form_id] - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) # the first section contains explanation of non grouped lines before the # period @@ -1288,7 +1288,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): data_line_list = [l for l in line_list if l.isDataLine()] # We only have lines for the transaction 1 which is not grouped, and for # transaction 4, which is grouped with lines in the period. - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', date=DateTime(2006, 2, 1), @@ -1303,14 +1303,14 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle='Client 1', debit_price=400, credit_price=0,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=500, credit_price=0) # Second section is for previous balance summary and lines in the period, # ie only transaction 5 line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='Previous Balance', date=DateTime(2006, 2, 25), @@ -1327,7 +1327,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): running_total_price=100, debit_price=0, credit_price=400,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=700, credit_price=600) @@ -1421,17 +1421,17 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') # the report has 4 sections, - self.assertEquals(4, len(report_section_list)) + self.assertEqual(4, len(report_section_list)) # but 2 of them are only titles report_section_list = [r for r in report_section_list if r.form_id] - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) # the first section contains explanation of non grouped lines before the # period line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # We only have line for transactions 1 and 2 which are not grouped - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', date=DateTime(2006, 2, 1), @@ -1446,14 +1446,14 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle='Client 1', debit_price=200, credit_price=0,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=300, credit_price=0) # Second section is for previous balance summary and lines in the period, # transaction 3 and transaction 4 line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(3, len(data_line_list)) + self.assertEqual(3, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='Previous Balance', date=DateTime(2006, 2, 25), @@ -1478,7 +1478,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): running_total_price=500, debit_price=400, credit_price=0,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=700, credit_price=200) def testAccountStatementFromDateDetailedSummaryGroupedAtFromDateCase2(self): @@ -1501,17 +1501,17 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') # the report has 4 sections, - self.assertEquals(4, len(report_section_list)) + self.assertEqual(4, len(report_section_list)) # but 2 of them are only titles report_section_list = [r for r in report_section_list if r.form_id] - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) # the first section contains explanation of non grouped lines before the # period line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # We only have line for transaction 1 which are not grouped - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', date=DateTime(2006, 2, 1), @@ -1519,14 +1519,14 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle='Client 1', debit_price=100, credit_price=0,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=100, credit_price=0) # Second section is for previous balance summary and lines in the period, # transaction 4 line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='Previous Balance', date=DateTime(2006, 2, 26), @@ -1543,7 +1543,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): running_total_price=500, debit_price=400, credit_price=0,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=700, credit_price=200) @@ -1566,12 +1566,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 3 transactions, but only 2 are in the period - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='2', @@ -1591,7 +1591,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=300, running_total_price=-500) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=500) @@ -1629,11 +1629,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='Previous Balance', date=DateTime(2006, 2, 2), @@ -1652,7 +1652,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=0, running_total_price=579) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=600, credit_price=21) def testAccountStatementPeriodDateEqualsFromDate(self): @@ -1690,11 +1690,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(3, len(data_line_list)) + self.assertEqual(3, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='Previous Balance', @@ -1723,7 +1723,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=0, running_total_price=579) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=579, credit_price=0) @@ -1746,11 +1746,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='Previous Balance', date=DateTime(2006, 2, 2), @@ -1769,7 +1769,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=300, running_total_price=-500) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=500) @@ -1792,11 +1792,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(3, len(data_line_list)) + self.assertEqual(3, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', date=DateTime(2005, 12, 31), @@ -1824,7 +1824,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=300, running_total_price=-600) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=600) @@ -1848,15 +1848,15 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) line = data_line_list[0] # mirror section title is not in the list of columns, as a mirror section # is choosen in the dialog - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['Movement_getSpecificReference', 'date', 'Movement_getExplanationTitle', 'Movement_getExplanationReference', 'debit_price', 'credit_price', 'running_total_price']) @@ -1869,7 +1869,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=0, running_total_price=400) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=400, credit_price=0) @@ -1890,10 +1890,10 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='7', @@ -1904,7 +1904,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=0, running_total_price=700) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=700, credit_price=0) @@ -1951,10 +1951,10 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', @@ -1974,7 +1974,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=-200, running_total_price=100) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=-100, credit_price=-200,) @@ -2011,11 +2011,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) - self.assertEquals( + self.assertEqual(2, len(data_line_list)) + self.assertEqual( set([line.getColumnProperty('Movement_getSpecificReference') for line in data_line_list]), set(('Source Reference', 'Destination Reference'))) @@ -2039,7 +2039,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): debit_price=100, credit_price=0,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=0,) @@ -2085,12 +2085,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) - self.assertEquals(data_line_list[0].column_id_list, + self.assertEqual(data_line_list[0].column_id_list, ['Movement_getSpecificReference', 'date', 'Movement_getExplanationTitle', 'section_title', 'Movement_getMirrorSectionTitle', @@ -2117,7 +2117,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=200, running_total_price=-100) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=100, credit_price=200) def testTrialBalance(self): @@ -2139,20 +2139,20 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # currency is present in the report - self.assertEquals('currency_module/euro', self.portal. + self.assertEqual('currency_module/euro', self.portal. AccountModule_viewTrialBalanceReport.your_currency.get_value('default')) # all accounts are present - self.assertEquals( + self.assertEqual( len(self.portal.account_module.contentValues(portal_type='Account')), len(data_line_list)) - self.assertEquals(['node_id', 'node_title', + self.assertEqual(['node_id', 'node_title', 'initial_debit_balance', 'initial_credit_balance', 'debit', 'credit', 'final_debit_balance', 'final_credit_balance', 'final_balance_if_debit', 'final_balance_if_credit'], @@ -2216,7 +2216,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_credit_balance=0, final_balance_if_debit=0, final_balance_if_credit=0) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=0, initial_credit_balance=0, debit=3600, credit=3600, final_debit_balance=3600, final_credit_balance=3600, @@ -2242,13 +2242,13 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(6, len(data_line_list)) + self.assertEqual(6, len(data_line_list)) - self.assertEquals(['node_id', 'node_title', 'mirror_section_title', + self.assertEqual(['node_id', 'node_title', 'mirror_section_title', 'initial_debit_balance', 'initial_credit_balance', 'debit', 'credit', 'final_debit_balance', 'final_credit_balance', 'final_balance_if_debit', 'final_balance_if_credit'], data_line_list[0].column_id_list) @@ -2290,7 +2290,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_debit_balance=0, final_credit_balance=1100, final_balance_if_debit=0, final_balance_if_credit=1100,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=0, initial_credit_balance=0, debit=2100, credit=2100, final_debit_balance=2100, final_credit_balance=2100, @@ -2361,11 +2361,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(5, len(data_line_list)) + self.assertEqual(5, len(data_line_list)) # account are sorted by GAP Id # TODO: sort by "gap normalized path" @@ -2399,7 +2399,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_debit_balance=0, final_credit_balance=50, final_balance_if_debit=0, final_balance_if_credit=50,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=600, initial_credit_balance=600, debit=2150, credit=2150, final_debit_balance=2750, final_credit_balance=2750, @@ -2447,11 +2447,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='40', node_title='Payable', initial_debit_balance=0, @@ -2465,7 +2465,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_debit_balance=200, final_credit_balance=0, final_balance_if_debit=200, final_balance_if_credit=0) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=200, initial_credit_balance=200, debit=0, credit=0, final_debit_balance=200, final_credit_balance=200, @@ -2513,10 +2513,10 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(4, len(data_line_list)) + self.assertEqual(4, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='40', node_title='Payable', mirror_section_title='Client 1', @@ -2542,7 +2542,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_debit_balance=600, final_credit_balance=0, final_balance_if_debit=600, final_balance_if_credit=0) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=1000, initial_credit_balance=1000, debit=0, credit=0, final_debit_balance=1000, final_credit_balance=1000, @@ -2594,11 +2594,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='40', node_title='Payable', initial_debit_balance=400, @@ -2612,7 +2612,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_debit_balance=600, final_credit_balance=400, final_balance_if_debit=200, final_balance_if_credit=0) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=1000, initial_credit_balance=1000, debit=0, credit=0, final_debit_balance=1000, final_credit_balance=1000, @@ -2663,11 +2663,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='40', node_title='Payable', initial_debit_balance=100, @@ -2681,7 +2681,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_debit_balance=0, final_credit_balance=110, final_balance_if_debit=0, final_balance_if_credit=110) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=100, initial_credit_balance=100, debit=10, credit=10, final_debit_balance=110, final_credit_balance=110, @@ -2731,11 +2731,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='40', node_title='Payable', initial_debit_balance=100, @@ -2749,7 +2749,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_debit_balance=0, final_credit_balance=110, final_balance_if_debit=0, final_balance_if_credit=110) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=100, initial_credit_balance=100, debit=10, credit=10, final_debit_balance=110, final_credit_balance=110, @@ -2812,11 +2812,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='40', node_title='Payable', initial_debit_balance=111, @@ -2830,7 +2830,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_debit_balance=200, final_credit_balance=111, final_balance_if_debit=89, final_balance_if_credit=0) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=311, initial_credit_balance=311, debit=0, credit=0, final_debit_balance=311, final_credit_balance=311, @@ -2881,11 +2881,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='40', node_title='Payable', initial_debit_balance=100, initial_credit_balance=0, debit=10, credit=0, @@ -2898,7 +2898,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_debit_balance=0, final_credit_balance=110, final_balance_if_debit=0, final_balance_if_credit=110) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=100, initial_credit_balance=100, debit=10, credit=10, final_debit_balance=110, final_credit_balance=110, @@ -2954,11 +2954,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='40', node_title='Payable', initial_debit_balance=0, @@ -2972,7 +2972,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_debit_balance=0, final_credit_balance=500, final_balance_if_debit=0, final_balance_if_credit=500) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=0, initial_credit_balance=0, debit=500, credit=500, final_debit_balance=500, final_credit_balance=500, @@ -2998,11 +2998,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(4, len(data_line_list)) + self.assertEqual(4, len(data_line_list)) # account are sorted by GAP Id self.checkLineProperties(data_line_list[0], node_id='40', @@ -3029,7 +3029,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_debit_balance=500, final_credit_balance=0, final_balance_if_debit=500, final_balance_if_credit=0,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=0, initial_credit_balance=0, debit=2100, credit=300, final_debit_balance=2100, final_credit_balance=300, @@ -3077,11 +3077,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(4, len(data_line_list)) + self.assertEqual(4, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='40', node_title='Payable', initial_debit_balance=0, @@ -3104,7 +3104,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): # an empty line for style self.checkLineProperties(data_line_list[3], node_title=' ') - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=0, initial_credit_balance=0, debit=1000, credit=1000, final_debit_balance=1000, final_credit_balance=1000, @@ -3130,10 +3130,10 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='41', node_title='Receivable', initial_debit_balance=0, @@ -3147,7 +3147,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_credit_balance=600, final_balance_if_debit=0, final_balance_if_credit=600,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=0, initial_credit_balance=0, debit=600, credit=600, final_debit_balance=600, final_credit_balance=600, @@ -3172,10 +3172,10 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='41', node_title='Receivable', initial_debit_balance=0, @@ -3189,7 +3189,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_credit_balance=500, final_balance_if_debit=0, final_balance_if_credit=500,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=0, initial_credit_balance=0, debit=500, credit=500, final_debit_balance=500, final_credit_balance=500, @@ -3235,10 +3235,10 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='41', node_title='Receivable', initial_debit_balance=0, @@ -3252,7 +3252,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_credit_balance=500, final_balance_if_debit=0, final_balance_if_credit=500,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=0, initial_credit_balance=0, debit=500, credit=500, final_debit_balance=500, final_credit_balance=500, @@ -3278,10 +3278,10 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='41', node_title='Receivable', initial_debit_balance=0, @@ -3295,7 +3295,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_credit_balance=700, final_balance_if_debit=0, final_balance_if_credit=700,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=0, initial_credit_balance=0, debit=700, credit=700, final_debit_balance=700, final_credit_balance=700, @@ -3322,10 +3322,10 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], node_id='41', node_title='Receivable', initial_debit_balance=0, @@ -3339,7 +3339,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): final_credit_balance=300, final_balance_if_debit=0, final_balance_if_credit=300,) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], node_id=None, node_title=None, initial_debit_balance=0, initial_credit_balance=0, debit=300, credit=300, final_debit_balance=300, final_credit_balance=300, @@ -3363,9 +3363,9 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewGeneralLedgerReport') - self.assertEquals(6, len(report_section_list)) + self.assertEqual(6, len(report_section_list)) - self.assertEquals('40 - Payable (Client 1)', + self.assertEqual('40 - Payable (Client 1)', report_section_list[0].getTitle()) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] @@ -3384,18 +3384,18 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section.popReport(self.portal) # currency is present in the report - self.assertEquals('currency_module/euro', self.portal. + self.assertEqual('currency_module/euro', self.portal. AccountModule_viewGeneralLedgerReport.your_currency.get_value('default')) # report layout - self.assertEquals(['Movement_getSpecificReference', + self.assertEqual(['Movement_getSpecificReference', 'Movement_getExplanationTitle', 'date', 'Movement_getExplanationTranslatedPortalType', 'Movement_getExplanationReference', 'Movement_getMirrorSectionTitle', 'debit_price', 'credit_price', 'running_total_price'], data_line_list[0].column_id_list) - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', Movement_getExplanationTitle='Transaction 1', @@ -3414,7 +3414,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle='Client 1', debit_price=200, credit_price=0, running_total_price=100, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], Movement_getSpecificReference=None, Movement_getExplanationTitle=None, @@ -3424,11 +3424,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle=None, debit_price=200, credit_price=100, ) - self.assertEquals('41 - Receivable (Client 1)', + self.assertEqual('41 - Receivable (Client 1)', report_section_list[1].getTitle()) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(5, len(data_line_list)) + self.assertEqual(5, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', Movement_getExplanationTitle='Transaction 1', @@ -3475,7 +3475,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle='Client 1', debit_price=800, credit_price=0, running_total_price=1600, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], Movement_getSpecificReference=None, Movement_getExplanationTitle=None, @@ -3485,11 +3485,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle=None, debit_price=1800, credit_price=200, ) - self.assertEquals('41 - Receivable (Client 2)', + self.assertEqual('41 - Receivable (Client 2)', report_section_list[2].getTitle()) line_list = self.getListBoxLineList(report_section_list[2]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='4', Movement_getExplanationTitle='Transaction 4', @@ -3499,14 +3499,14 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle='Client 2', debit_price=400, credit_price=0, running_total_price=400, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=400, credit_price=0, ) - self.assertEquals('41 - Receivable (John Smith)', + self.assertEqual('41 - Receivable (John Smith)', report_section_list[3].getTitle()) line_list = self.getListBoxLineList(report_section_list[3]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='5', Movement_getExplanationTitle='Transaction 5', @@ -3516,14 +3516,14 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle='John Smith', debit_price=500, credit_price=0, running_total_price=500, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=500, credit_price=0, ) - self.assertEquals('5 - Bank (Bank1)', + self.assertEqual('5 - Bank (Bank1)', report_section_list[4].getTitle()) line_list = self.getListBoxLineList(report_section_list[4]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(5, len(data_line_list)) + self.assertEqual(5, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='3', Movement_getExplanationTitle='Transaction 3', @@ -3570,15 +3570,15 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle='Client 1', debit_price=0, credit_price=800, running_total_price=-2600, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=2600, ) - self.assertEquals('Total', report_section_list[5].getTitle()) + self.assertEqual('Total', report_section_list[5].getTitle()) line_list = self.getListBoxLineList(report_section_list[5]) data_line_list = [l for l in line_list if l.isDataLine()] # report layout - self.assertEquals(['debit_price', 'credit_price'], data_line_list[0].column_id_list) - self.assertEquals(1, len(data_line_list)) + self.assertEqual(['debit_price', 'credit_price'], data_line_list[0].column_id_list) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], debit_price=2900, credit_price=2900) @@ -3600,14 +3600,14 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewGeneralLedgerReport') - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) - self.assertEquals('40 - Payable (Client 1)', + self.assertEqual('40 - Payable (Client 1)', report_section_list[0].getTitle()) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', Movement_getExplanationTitle='Transaction 1', @@ -3626,7 +3626,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle='Client 1', debit_price=200, credit_price=0, running_total_price=100, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], Movement_getSpecificReference=None, Movement_getExplanationTitle=None, @@ -3636,10 +3636,10 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getMirrorSectionTitle=None, debit_price=200, credit_price=100, ) - self.assertEquals('Total', report_section_list[1].getTitle()) + self.assertEqual('Total', report_section_list[1].getTitle()) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], debit_price=200, credit_price=100) def testGeneralLedgerFunction(self): @@ -3658,11 +3658,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewGeneralLedgerReport') - self.assertEquals(3, len(report_section_list)) + self.assertEqual(3, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', Movement_getExplanationTitle='Function a Project 1', @@ -3670,12 +3670,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getExplanationTranslatedPortalType='Sale Invoice Transaction', Movement_getMirrorSectionTitle='Client 1', debit_price=500, credit_price=0, running_total_price=500, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=500, credit_price=0) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', Movement_getExplanationTitle='Function a Project 1', @@ -3683,12 +3683,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getExplanationTranslatedPortalType='Sale Invoice Transaction', Movement_getMirrorSectionTitle='Client 1', debit_price=0, credit_price=500, running_total_price=-500, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=500) line_list = self.getListBoxLineList(report_section_list[2]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], debit_price=500, credit_price=500) def testGeneralLedgerNoProject(self): @@ -3707,11 +3707,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewGeneralLedgerReport') - self.assertEquals(3, len(report_section_list)) + self.assertEqual(3, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='3', Movement_getExplanationTitle='No function no project', @@ -3719,12 +3719,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getExplanationTranslatedPortalType='Sale Invoice Transaction', Movement_getMirrorSectionTitle='Client 1', debit_price=700, credit_price=0, running_total_price=700, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=700, credit_price=0) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='3', Movement_getExplanationTitle='No function no project', @@ -3732,12 +3732,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getExplanationTranslatedPortalType='Sale Invoice Transaction', Movement_getMirrorSectionTitle='Client 1', debit_price=0, credit_price=700, running_total_price=-700, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=700) line_list = self.getListBoxLineList(report_section_list[2]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], debit_price=700, credit_price=700) @@ -3757,11 +3757,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewGeneralLedgerReport') - self.assertEquals(3, len(report_section_list)) + self.assertEqual(3, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', Movement_getExplanationTitle='Function a Project 1', @@ -3769,12 +3769,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getExplanationTranslatedPortalType='Sale Invoice Transaction', Movement_getMirrorSectionTitle='Client 1', debit_price=500, credit_price=0, running_total_price=500, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=500, credit_price=0) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='1', Movement_getExplanationTitle='Function a Project 1', @@ -3782,12 +3782,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getExplanationTranslatedPortalType='Sale Invoice Transaction', Movement_getMirrorSectionTitle='Client 1', debit_price=0, credit_price=500, running_total_price=-500, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=500) line_list = self.getListBoxLineList(report_section_list[2]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], debit_price=500, credit_price=500) def testGeneralLedgerMirrorSectionRole(self): @@ -3806,11 +3806,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewGeneralLedgerReport') - self.assertEquals(3, len(report_section_list)) + self.assertEqual(3, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='2', Movement_getExplanationTitle='Invoice to a supplier', @@ -3818,12 +3818,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getExplanationTranslatedPortalType='Sale Invoice Transaction', Movement_getMirrorSectionTitle='Supplier', debit_price=300, credit_price=0, running_total_price=300, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=300, credit_price=0) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getSpecificReference='2', Movement_getExplanationTitle='Invoice to a supplier', @@ -3831,12 +3831,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): Movement_getExplanationTranslatedPortalType='Sale Invoice Transaction', Movement_getMirrorSectionTitle='Supplier', debit_price=0, credit_price=300, running_total_price=-300, ) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=300) line_list = self.getListBoxLineList(report_section_list[2]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], debit_price=300, credit_price=300) @@ -3919,17 +3919,17 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewOtherPartiesReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) # the role is displayed in parenthesis - self.assertEquals(report_section_list[0].getTitle(), + self.assertEqual(report_section_list[0].getTitle(), 'Client 1 (Client)') # currency is present in the report - self.assertEquals('currency_module/euro', self.portal. + self.assertEqual('currency_module/euro', self.portal. AccountModule_viewOtherPartiesReport.your_currency.get_value('default')) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], Movement_getExplanationTitle='Transaction 1', @@ -4032,8 +4032,8 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): account_module.payable) or\ line.getDestinationValue() in (account_module.receivable, account_module.payable): - self.failUnless(line.getGroupingReference()) - self.failUnless(line.getGroupingDate()) + self.assertTrue(line.getGroupingReference()) + self.assertTrue(line.getGroupingDate()) def test_simple_aged_creditor_report_detailed(self): self.createAgedBalanceDataSet() @@ -4049,11 +4049,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewAgedBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], date=DateTime(2013, 7, 30), @@ -4077,11 +4077,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewAgedBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], mirror_section_title='Client 1', @@ -4102,11 +4102,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewAgedBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], date=DateTime(2013, 7, 30), @@ -4130,11 +4130,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewAgedBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], mirror_section_title='Supplier', @@ -4239,15 +4239,15 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewJournalReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(4, len(data_line_list)) + self.assertEqual(4, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, [ 'specific_reference', 'date', 'title', 'parent_reference', 'function', 'project', 'product_line_translated_title', 'node_title', 'mirror_section_title', 'debit', 'credit']) @@ -4283,7 +4283,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): credit=700) stat_line = line_list[-1] - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit=1500, credit=1500) def testJournalAnalyticsHidden(self): @@ -4298,15 +4298,15 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewJournalReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['specific_reference', 'date', 'title', 'parent_reference', 'node_title', 'mirror_section_title', 'debit', 'credit']) @@ -4321,7 +4321,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): debit=0, credit=1500) stat_line = line_list[-1] - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit=1500, credit=1500) def testAccountStatementAnalyticsShown(self): @@ -4340,14 +4340,14 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(3, len(data_line_list)) + self.assertEqual(3, len(data_line_list)) line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['Movement_getSpecificReference', 'date', 'Movement_getExplanationTitle', 'function', 'project', 'product_line_translated_title', @@ -4378,7 +4378,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): running_total_price=-1500) stat_line = line_list[-1] - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500) def testAccountStatementAnalyticsHidden(self): @@ -4394,14 +4394,14 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewAccountStatementReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['Movement_getSpecificReference', 'date', 'Movement_getExplanationTitle', 'Movement_getMirrorSectionTitle', @@ -4414,7 +4414,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): running_total_price=-1500) stat_line = line_list[-1] - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500) def testGeneralLedgerAnalyticsShown(self): @@ -4432,12 +4432,12 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewGeneralLedgerReport') - self.assertEquals(3, len(report_section_list)) + self.assertEqual(3, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] # FIXME: order of columns is inconsistant in GL and Account Statement - self.assertEquals(['Movement_getSpecificReference', + self.assertEqual(['Movement_getSpecificReference', 'Movement_getExplanationTitle', 'date', 'Movement_getExplanationTranslatedPortalType', 'Movement_getExplanationReference', 'Movement_getMirrorSectionTitle', @@ -4468,13 +4468,13 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): running_total_price=-1500) stat_line = line_list[-1] - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500) line_list = self.getListBoxLineList(report_section_list[2]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], debit_price=1500, credit_price=1500,) @@ -4491,40 +4491,40 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewGeneralLedgerReport') - self.assertEquals(3, len(report_section_list)) + self.assertEqual(3, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(['Movement_getSpecificReference', + self.assertEqual(['Movement_getSpecificReference', 'Movement_getExplanationTitle', 'date', 'Movement_getExplanationTranslatedPortalType', 'Movement_getExplanationReference', 'Movement_getMirrorSectionTitle', 'debit_price', 'credit_price', 'running_total_price'], data_line_list[0].column_id_list) # receivable account - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], debit_price=1500, credit_price=0, running_total_price=1500) stat_line = line_list[-1] - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=1500, credit_price=0) # good sales account line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], debit_price=0, credit_price=1500, running_total_price=-1500) stat_line = line_list[-1] - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500) # summary line_list = self.getListBoxLineList(report_section_list[2]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], debit_price=1500, credit_price=1500,) @@ -4545,13 +4545,13 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) - self.assertEquals(['node_id', 'node_title', 'project_uid', + self.assertEqual(['node_id', 'node_title', 'project_uid', 'initial_debit_balance', 'initial_credit_balance', 'debit', 'credit', 'final_debit_balance', 'final_credit_balance', 'final_balance_if_debit', 'final_balance_if_credit'], data_line_list[0].column_id_list) @@ -4568,7 +4568,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): credit=700, final_debit_balance=0, final_credit_balance=700, final_balance_if_debit=0, final_balance_if_credit=700) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], initial_debit_balance=0, initial_credit_balance=0, debit=0, credit=1500, final_debit_balance=0, final_credit_balance=1500, @@ -4590,13 +4590,13 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) - self.assertEquals(['node_id', 'node_title', 'function_uid', + self.assertEqual(['node_id', 'node_title', 'function_uid', 'initial_debit_balance', 'initial_credit_balance', 'debit', 'credit', 'final_debit_balance', 'final_credit_balance', 'final_balance_if_debit', 'final_balance_if_credit'], data_line_list[0].column_id_list) @@ -4613,7 +4613,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): credit=1200, final_debit_balance=0, final_credit_balance=1200, final_balance_if_debit=0, final_balance_if_credit=1200) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], initial_debit_balance=0, initial_credit_balance=0, debit=0, credit=1500, final_debit_balance=0, final_credit_balance=1500, @@ -4635,13 +4635,13 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(3, len(data_line_list)) + self.assertEqual(3, len(data_line_list)) - self.assertEquals(['node_id', 'node_title', 'function_uid', 'project_uid', + self.assertEqual(['node_id', 'node_title', 'function_uid', 'project_uid', 'initial_debit_balance', 'initial_credit_balance', 'debit', 'credit', 'final_debit_balance', 'final_credit_balance', 'final_balance_if_debit', 'final_balance_if_credit'], data_line_list[0].column_id_list) @@ -4664,7 +4664,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): credit=700, final_debit_balance=0, final_credit_balance=700, final_balance_if_debit=0, final_balance_if_credit=700) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], initial_debit_balance=0, initial_credit_balance=0, debit=0, credit=1500, final_debit_balance=0, final_credit_balance=1500, @@ -4706,13 +4706,13 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountModule_viewTrialBalanceReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) - self.assertEquals(['node_id', 'node_title', 'strict_product_line_uid', + self.assertEqual(['node_id', 'node_title', 'strict_product_line_uid', 'initial_debit_balance', 'initial_credit_balance', 'debit', 'credit', 'final_debit_balance', 'final_credit_balance', 'final_balance_if_debit', 'final_balance_if_credit'], data_line_list[0].column_id_list) @@ -4725,7 +4725,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): # Lines that does not have a product line are not displayed. This is a # technical limitation, we would have to left join to support this. - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], initial_debit_balance=0, initial_credit_balance=0, debit=0, credit=800, final_debit_balance=0, final_credit_balance=800, diff --git a/product/ERP5/tests/testAccountingRules.py b/product/ERP5/tests/testAccountingRules.py index d8448e8026..bcc17468fb 100644 --- a/product/ERP5/tests/testAccountingRules.py +++ b/product/ERP5/tests/testAccountingRules.py @@ -206,7 +206,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): self.tic() invoice_transaction_rule.deleteContent( [x for x in invoice_transaction_rule.objectIds()]) - self.assertEquals(len(invoice_transaction_rule.objectValues()), 0) + self.assertEqual(len(invoice_transaction_rule.objectValues()), 0) self.commit() # and add new content, predicate product_line @@ -249,10 +249,10 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): membership_criterion_category_list = ['destination_region/region/africa'], ) # sanity checks - self.failUnless(predicate_product_notebook != None) - self.failUnless(predicate_product_barebone != None) - self.failUnless(predicate_region_france != None) - self.failUnless(predicate_region_africa != None) + self.assertTrue(predicate_product_notebook != None) + self.assertTrue(predicate_product_barebone != None) + self.assertTrue(predicate_region_france != None) + self.assertTrue(predicate_region_africa != None) predicate_list = invoice_transaction_rule.contentValues( filter = {'portal_type': self.predicate_portal_type}) self.assertEqual(len(predicate_list), 4) @@ -995,7 +995,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): product_notebook_region_france_movement )) # finally check the matching cell is the good one - self.assertEquals(product_notebook_region_france_cell, + self.assertEqual(product_notebook_region_france_cell, invoice_transaction_rule._getMatchingCell( product_notebook_region_france_movement )) self.assertEqual(product_barebone_region_france_cell, @@ -1106,14 +1106,14 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): # inside this movement there are applied rules which specialize # invoice_transaction_rule and trade_model_rule... applied_rule_list = simulation_movement.contentValues() - self.assertEquals( len(applied_rule_list), 2) + self.assertEqual( len(applied_rule_list), 2) # ...but only invoice_transaction_rule is interesting applied_rule = [applied_rule for applied_rule in applied_rule_list if applied_rule.getSpecialiseValue().getPortalType() == 'Invoice Transaction Simulation Rule'][0] - self.assertEquals( applied_rule.getPortalType(), + self.assertEqual( applied_rule.getPortalType(), self.applied_rule_portal_type) - self.assertEquals( applied_rule.getSpecialise(), + self.assertEqual( applied_rule.getSpecialise(), invoice_transaction_rule.getRelativeUrl()) # and in this applied rule, we got simulation movements, @@ -1122,22 +1122,22 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): self.assertEqual( len(simulation_movement_list), 3) rule_movement_found = {} for simulation_movement in simulation_movement_list : - self.assertEquals( simulation_movement.getSourceSection(), + self.assertEqual( simulation_movement.getSourceSection(), vendor.getRelativeUrl()) - self.assertEquals( simulation_movement.getDestinationSection(), + self.assertEqual( simulation_movement.getDestinationSection(), client.getRelativeUrl()) - self.assertEquals( simulation_movement.getResource(), + self.assertEqual( simulation_movement.getResource(), currency.getRelativeUrl()) - self.assertEquals( simulation_movement.getCausalityState(), + self.assertEqual( simulation_movement.getCausalityState(), 'expanded') for rule_movement in invoice_transaction_rule_cell.contentValues() : if simulation_movement.getSource() == rule_movement.getSource() : rule_movement_found[rule_movement.getSource()] = 1 - self.assertEquals(simulation_movement.getQuantity(), + self.assertEqual(simulation_movement.getQuantity(), rule_movement.getQuantity() * invoice_line.getTotalPrice()) - self.assertEquals(simulation_movement.getSourceCredit(), + self.assertEqual(simulation_movement.getSourceCredit(), rule_movement.getSourceCredit() * invoice_line.getTotalPrice()) - self.assertEquals(simulation_movement.getSourceDebit(), + self.assertEqual(simulation_movement.getSourceDebit(), rule_movement.getSourceDebit() * invoice_line.getTotalPrice()) self.assert_(len(rule_movement_found.keys()), 3) sequence.edit( simulation_movement_list = simulation_movement_list ) @@ -1149,7 +1149,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): invoice_line = sequence.get('invoice_line') applied_rule_list = self.getSimulationTool().contentValues() - self.assertEquals(len(applied_rule_list), 1) + self.assertEqual(len(applied_rule_list), 1) simulation_movement_list = [] simulation_movement_quantities = {} simulation_movement_resources = {} @@ -1197,19 +1197,19 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): for simulation_movement in simulation_movement_list : path = simulation_movement.getPath() - self.assertEquals( + self.assertEqual( simulation_movement.getQuantity(), simulation_movement_quantities[path] ) - self.assertEquals( + self.assertEqual( simulation_movement.getResource(), simulation_movement_resources[path] ) - self.assertEquals( + self.assertEqual( (simulation_movement.getSource(), simulation_movement.getDestination()), simulation_movement_paths[path] ) - self.assertEquals( + self.assertEqual( ( simulation_movement.getSourceSection(), simulation_movement.getDestinationSection()), simulation_movement_section_paths[path] @@ -1222,17 +1222,17 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): simulation_movement = invoice_line.getDeliveryRelatedValue() applied_rule_list = simulation_movement.objectValues() # Invoice Transaction Rule and Trade Model Rule - self.assertEquals(2, len(applied_rule_list)) + self.assertEqual(2, len(applied_rule_list)) applied_rule = [x for x in applied_rule_list \ if x.getSpecialiseReference() == \ 'default_invoice_transaction_rule'][0] simulation_movement_list = [x for x in applied_rule.objectValues() \ if x.getSourceTitle() in ('Receivable', 'Payable')] - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) simulation_movement = simulation_movement_list[0] applied_rule_list = simulation_movement.objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) payment_applied_rule = applied_rule_list[0] def stepPlanInvoice(self, sequence, **kw) : @@ -1243,7 +1243,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): invoice, 'plan_action', skip_period_validation=1 ) - self.assertEquals(invoice.getSimulationState(), 'planned') + self.assertEqual(invoice.getSimulationState(), 'planned') def stepConfirmInvoice(self, sequence, **kw) : """ put the invoice in the `confirmed` state, which does nothing specific, @@ -1255,11 +1255,11 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): wf_id = 'accounting_workflow', skip_period_validation = 1 ) - self.assertEquals(invoice.getSimulationState(), 'confirmed') + self.assertEqual(invoice.getSimulationState(), 'confirmed') def stepCheckNoAccountingLinesBuiltYet(self, sequence, **kw) : invoice = sequence.get('invoice') - self.assertEquals(0, len(invoice.getMovementList( + self.assertEqual(0, len(invoice.getMovementList( portal_type=invoice.getPortalAccountingMovementTypeList()))) def stepStartInvoice(self, sequence, **kw) : @@ -1272,7 +1272,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): wf_id = 'accounting_workflow', skip_period_validation = 1 ) - self.assertEquals(invoice.getSimulationState(), 'started') + self.assertEqual(invoice.getSimulationState(), 'started') def stepCheckAccountingLinesCoherantWithSimulation(self, sequence, **kw) : """ checks that accounting lines are created on the sale invoice @@ -1288,29 +1288,29 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): invoice_transaction_line_list = invoice.contentValues( filter = {'portal_type': self.invoice_transaction_line_portal_type}) - self.assertEquals( len(invoice_transaction_line_list), + self.assertEqual( len(invoice_transaction_line_list), len(simulation_movement_list)) simulation_movement_found = {} for invoice_transaction_line in invoice_transaction_line_list : - self.assertEquals( invoice_transaction_line.getSourceSection(), + self.assertEqual( invoice_transaction_line.getSourceSection(), vendor.getRelativeUrl()) - self.assertEquals( invoice_transaction_line.getDestinationSection(), + self.assertEqual( invoice_transaction_line.getDestinationSection(), client.getRelativeUrl()) - self.assertEquals( invoice_transaction_line.getResource(), + self.assertEqual( invoice_transaction_line.getResource(), currency.getRelativeUrl()) for simulation_movement in simulation_movement_list : if simulation_movement.getSource() == \ invoice_transaction_line.getSource() : simulation_movement_found[simulation_movement.getSource()] = 1 - self.assertEquals(simulation_movement.getQuantity(), + self.assertEqual(simulation_movement.getQuantity(), invoice_transaction_line.getQuantity()) - self.assertEquals(simulation_movement.getSourceCredit(), + self.assertEqual(simulation_movement.getSourceCredit(), invoice_transaction_line.getSourceCredit()) - self.assertEquals(simulation_movement.getSourceDebit(), + self.assertEqual(simulation_movement.getSourceDebit(), invoice_transaction_line.getSourceDebit()) - self.assertEquals(simulation_movement.getDelivery(), + self.assertEqual(simulation_movement.getDelivery(), invoice_transaction_line.getRelativeUrl()) self.assert_(len(simulation_movement_found.keys()), 3) @@ -1338,7 +1338,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): invoice_transaction_line_list = invoice.contentValues( filter = {'portal_type': self.invoice_transaction_line_portal_type}) - self.assertEquals(len(invoice_transaction_line_list), 3) + self.assertEqual(len(invoice_transaction_line_list), 3) accounting_lines_layout = { 'income' : (0, 100), @@ -1352,8 +1352,8 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): 'unexepected source_id %s' % invoice_transaction_line.getSourceId()) debit, credit = accounting_lines_layout[ invoice_transaction_line.getSourceId()] - self.assertEquals(debit, invoice_transaction_line.getSourceDebit()) - self.assertEquals(credit, invoice_transaction_line.getSourceCredit()) + self.assertEqual(debit, invoice_transaction_line.getSourceDebit()) + self.assertEqual(credit, invoice_transaction_line.getSourceCredit()) self.assertNotEquals( len(invoice_transaction_line.getDeliveryRelatedValueList( portal_type='Simulation Movement')), 0) @@ -1377,7 +1377,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): payment_transaction_line_list = payment.contentValues( filter = {'portal_type': self.payment_transaction_line_portal_type}) - self.assertEquals(len(payment_transaction_line_list), 2) + self.assertEqual(len(payment_transaction_line_list), 2) accounting_lines_layout = { 'receivable' : (0, 119.60), @@ -1391,8 +1391,8 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): 'unexepected destination_id %s' % payment_transaction_line.getDestinationId()) debit, credit = accounting_lines_layout[ payment_transaction_line.getDestinationId()] - self.assertEquals(debit, payment_transaction_line.getDestinationDebit()) - self.assertEquals(credit, payment_transaction_line.getDestinationCredit()) + self.assertEqual(debit, payment_transaction_line.getDestinationDebit()) + self.assertEqual(credit, payment_transaction_line.getDestinationCredit()) self.assertNotEquals( len(payment_transaction_line.getDeliveryRelatedValueList( portal_type='Simulation Movement')), 0) @@ -1402,8 +1402,8 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): 'unexepected source_id %s' % payment_transaction_line.getSourceId()) debit, credit = accounting_lines_layout[ payment_transaction_line.getSourceId()] - self.assertEquals(debit, payment_transaction_line.getSourceDebit()) - self.assertEquals(credit, payment_transaction_line.getSourceCredit()) + self.assertEqual(debit, payment_transaction_line.getSourceDebit()) + self.assertEqual(credit, payment_transaction_line.getSourceCredit()) self.assertNotEquals( len(payment_transaction_line.getDeliveryRelatedValueList( portal_type='Simulation Movement')), 0) @@ -1432,7 +1432,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): invoice_transaction_line_list = invoice.contentValues( filter = {'portal_type': self.invoice_transaction_line_portal_type}) - self.assertEquals(len(invoice_transaction_line_list), 4) + self.assertEqual(len(invoice_transaction_line_list), 4) accounting_lines_layout = { 'income' : (0, 100), @@ -1444,8 +1444,8 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): for invoice_transaction_line in invoice_transaction_line_list : debit, credit = accounting_lines_layout[ invoice_transaction_line.getSourceId()] - self.assertEquals(debit, invoice_transaction_line.getSourceDebit()) - self.assertEquals(credit, invoice_transaction_line.getSourceCredit()) + self.assertEqual(debit, invoice_transaction_line.getSourceDebit()) + self.assertEqual(credit, invoice_transaction_line.getSourceCredit()) self.assertNotEquals( len(invoice_transaction_line.getDeliveryRelatedValueList( portal_type='Simulation Movement')), 0) @@ -1469,7 +1469,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): payment_transaction_line_list = payment.contentValues( filter = {'portal_type': self.payment_transaction_line_portal_type}) - self.assertEquals(len(payment_transaction_line_list), 2) + self.assertEqual(len(payment_transaction_line_list), 2) accounting_lines_layout = { 'receivable' : (0, 1315.60), @@ -1483,8 +1483,8 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): 'unexepected source_id %s' % payment_transaction_line.getDestinationId()) debit, credit = accounting_lines_layout[ payment_transaction_line.getDestinationId()] - self.assertEquals(debit, payment_transaction_line.getDestinationDebit()) - self.assertEquals(credit, payment_transaction_line.getDestinationCredit()) + self.assertEqual(debit, payment_transaction_line.getDestinationDebit()) + self.assertEqual(credit, payment_transaction_line.getDestinationCredit()) self.assertNotEquals( len(payment_transaction_line.getDeliveryRelatedValueList( portal_type='Simulation Movement')), 0) @@ -1494,8 +1494,8 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): 'unexepected source_id %s' % payment_transaction_line.getSourceId()) debit, credit = accounting_lines_layout[ payment_transaction_line.getSourceId()] - self.assertEquals(debit, payment_transaction_line.getSourceDebit()) - self.assertEquals(credit, payment_transaction_line.getSourceCredit()) + self.assertEqual(debit, payment_transaction_line.getSourceDebit()) + self.assertEqual(credit, payment_transaction_line.getSourceCredit()) self.assertNotEquals( len(payment_transaction_line.getDeliveryRelatedValueList( portal_type='Simulation Movement')), 0) @@ -1529,7 +1529,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): self.tic() # nothing should have changed - self.assertEquals(accounting_transaction_count, + self.assertEqual(accounting_transaction_count, len(self.getAccountingModule().objectIds())) for transaction in self.getAccountingModule().objectValues() : @@ -1537,7 +1537,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): for accounting_line in transaction.objectValues() : if accounting_line.getPortalType() != \ self.invoice_line_portal_type : - self.assertEquals( + self.assertEqual( transaction_dict[accounting_line.getId()], accounting_line.getTotalQuantity()) @@ -1549,19 +1549,19 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): portal_type = self.applied_rule_portal_type, ) - self.assertEquals( + self.assertEqual( 1, len(applied_rule_list) ) applied_rule = applied_rule_list[0] - self.assertEquals( + self.assertEqual( 'default_invoice_rule', applied_rule.getSpecialiseReference() ) - self.assertEquals( + self.assertEqual( # reduntant? invoice.getRelativeUrl(), applied_rule.getCausality() @@ -1569,7 +1569,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): simulation_movement_list = applied_rule.objectValues() - self.assertEquals( + self.assertEqual( 1, len(simulation_movement_list) ) @@ -1582,37 +1582,37 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): client = sequence.get('client') currency = sequence.get('currency') - self.assertEquals( + self.assertEqual( resource.getRelativeUrl(), simulation_movement.getResource() ) - self.assertEquals( + self.assertEqual( currency.getRelativeUrl(), simulation_movement.getPriceCurrency() ) - self.assertEquals( + self.assertEqual( vendor.getRelativeUrl(), simulation_movement.getSourceSection() ) - self.assertEquals( + self.assertEqual( client.getRelativeUrl(), simulation_movement.getDestinationSection() ) - self.assertEquals( + self.assertEqual( invoice_line.getRelativeUrl(), simulation_movement.getDelivery() ) - self.assertEquals( + self.assertEqual( 10, simulation_movement.getQuantity() ) - self.assertEquals( + self.assertEqual( 10, simulation_movement.getPrice() ) diff --git a/product/ERP5/tests/testAccounting_l10n_fr_m9.py b/product/ERP5/tests/testAccounting_l10n_fr_m9.py index 79ab0838ca..8c4c48844a 100644 --- a/product/ERP5/tests/testAccounting_l10n_fr_m9.py +++ b/product/ERP5/tests/testAccounting_l10n_fr_m9.py @@ -133,9 +133,9 @@ class TestAccounting_l10n_M9(ERP5TypeTestCase): def test_AccountingPlanInstallation(self): """Tests that the accounting plan is well installed.""" - self.failUnless('m9' in self.category_tool.gap.fr.objectIds()) + self.assertTrue('m9' in self.category_tool.gap.fr.objectIds()) self.assertNotEquals(0, len(self.category_tool.gap.fr.m9.objectIds())) - self.failUnless('gap/fr/m9' in [x[1] for x in + self.assertTrue('gap/fr/m9' in [x[1] for x in self.portal.account_module.AccountModule_getAvailableGapList()]) def test_SimpleTransmissionSheet(self): @@ -146,14 +146,14 @@ class TestAccounting_l10n_M9(ERP5TypeTestCase): transmission_sheet_module = self.getInvoiceTransmissionSheetModule() transmission_sheet = transmission_sheet_module.newContent( portal_type=self.invoice_transmission_sheet_portal_type) - self.assertEquals(transmission_sheet.getValidationState(), 'draft') + self.assertEqual(transmission_sheet.getValidationState(), 'draft') # add an invoice to the transamission sheet invoice.setAggregateValue(transmission_sheet) invoice.recursiveImmediateReindexObject() self.getWorkflowTool().doActionFor( transmission_sheet, 'emit_action') - self.assertEquals(transmission_sheet.getValidationState(), + self.assertEqual(transmission_sheet.getValidationState(), 'new') def test_TransmissionSheetEmitRefusedIfNoInvoice(self): @@ -162,49 +162,49 @@ class TestAccounting_l10n_M9(ERP5TypeTestCase): transmission_sheet_module = self.getInvoiceTransmissionSheetModule() transmission_sheet = transmission_sheet_module.newContent( portal_type=self.invoice_transmission_sheet_portal_type) - self.assertEquals(transmission_sheet.getValidationState(), 'draft') + self.assertEqual(transmission_sheet.getValidationState(), 'draft') self.assertRaises(ValidationFailed, self.getWorkflowTool().doActionFor, transmission_sheet, 'emit_action') def checkAccountTypeConsistency(self, account, fixit=1): - self.assertEquals(1, len([x for x in account.checkConsistency(fixit=1) + self.assertEqual(1, len([x for x in account.checkConsistency(fixit=1) if x.class_name.find('Account Type Constraint')>=0])) def test_AccountTypeConstaintForExpense(self): account = self._getAccount('account', gap='fr/m9/6/60/602/6022/60225', account_type='expense') - self.assertEquals([], account.checkConsistency()) + self.assertEqual([], account.checkConsistency()) def test_AccountTypeConstaintFixForExpense(self): account = self._getAccount('account', gap='fr/m9/6/60/602/6022/60225', account_type='equity') self.checkAccountTypeConsistency(account) - self.assertEquals('expense', account.getAccountType()) + self.assertEqual('expense', account.getAccountType()) def test_AccountTypeConstaintForPayable(self): account = self._getAccount('payable_account', gap='fr/m9/4/40', account_type='liability/payable') - self.assertEquals([], account.checkConsistency()) + self.assertEqual([], account.checkConsistency()) def test_AccountTypeConstaintFixForPayable(self): account = self._getAccount('payable_account', gap='fr/m9/4/40', account_type='equity') self.checkAccountTypeConsistency(account) - self.assertEquals('liability/payable', account.getAccountType()) + self.assertEqual('liability/payable', account.getAccountType()) def test_AccountTypeConstaintForClass4(self): # members of class 4 can be payable or receivable account = self._getAccount('class4_account', gap='fr/m9/4/44', account_type='liability/payable') - self.assertEquals([], account.checkConsistency()) + self.assertEqual([], account.checkConsistency()) account.edit(account_type='asset/receivable') - self.assertEquals([], account.checkConsistency()) + self.assertEqual([], account.checkConsistency()) def test_AccountTypeConstaintFixForClass4(self): # members of class 4 can be payable or receivable @@ -212,7 +212,7 @@ class TestAccounting_l10n_M9(ERP5TypeTestCase): gap='fr/m9/4/44', account_type='equity') self.checkAccountTypeConsistency(account) - self.failUnless(account.getAccountType() in ('liability/payable', + self.assertTrue(account.getAccountType() in ('liability/payable', 'asset/receivable')) # Members of gap/fr/m9/4/47 are very specific @@ -221,25 +221,25 @@ class TestAccounting_l10n_M9(ERP5TypeTestCase): account = self._getAccount('4718', gap='fr/m9/4/47/471/4718', ) self.checkAccountTypeConsistency(account) - self.assertEquals('liability/payable', account.getAccountType()) + self.assertEqual('liability/payable', account.getAccountType()) def test_AccountTypeConstaintFixFor4721(self): account = self._getAccount('4721', gap='fr/m9/4/47/472/4721', ) self.checkAccountTypeConsistency(account) - self.assertEquals('asset/receivable', account.getAccountType()) + self.assertEqual('asset/receivable', account.getAccountType()) def test_AccountTypeConstaintFixFor4731(self): account = self._getAccount('4731', gap='fr/m9/4/47/473/4731', ) self.checkAccountTypeConsistency(account) - self.assertEquals('asset/receivable', account.getAccountType()) + self.assertEqual('asset/receivable', account.getAccountType()) def test_AccountTypeConstaintFixFor4735(self): account = self._getAccount('4735', gap='fr/m9/4/47/473/4735', ) self.checkAccountTypeConsistency(account) - self.assertEquals('liability/payable', account.getAccountType()) + self.assertEqual('liability/payable', account.getAccountType()) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testAdvancedInvoicing.py b/product/ERP5/tests/testAdvancedInvoicing.py index fe12765d57..3d7ddae5d5 100644 --- a/product/ERP5/tests/testAdvancedInvoicing.py +++ b/product/ERP5/tests/testAdvancedInvoicing.py @@ -147,7 +147,7 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase): portal_type=self.invoice_portal_type) self.assertNotEquals(invoice, None) invoice.start() - self.assertEquals('started', invoice.getSimulationState()) + self.assertEqual('started', invoice.getSimulationState()) def stepAddInvoiceTransactionLines(self, sequence=None, sequence_list=[]): """ @@ -188,7 +188,7 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase): invoice = packing_list.getCausalityRelatedValue(portal_type=self.invoice_portal_type) self.assertNotEquals(invoice, None) invoice_line_list = invoice.getMovementList() - self.assertEquals(1, len(invoice_line_list)) + self.assertEqual(1, len(invoice_line_list)) invoice_line = invoice_line_list[0] new_quantity = invoice_line.getQuantity() * 2 invoice_line.setQuantity(new_quantity) @@ -199,7 +199,7 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase): packing_list = sequence.get('packing_list') invoice = packing_list.getCausalityRelatedValue(portal_type=self.invoice_portal_type) builder_list = invoice.getBuilderList() - self.assertEquals(1, len(builder_list)) + self.assertEqual(1, len(builder_list)) divergence_list = invoice.getDivergenceList() for builder in builder_list: builder.solveDivergence(invoice.getRelativeUrl(), @@ -208,43 +208,43 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase): def stepCheckDivergenceOnInvoice(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('packing_list') invoice = packing_list.getCausalityRelatedValue(portal_type=self.invoice_portal_type) - self.assertEquals('solved', invoice.getCausalityState()) + self.assertEqual('solved', invoice.getCausalityState()) new_quantity = sequence.get('invoice_line_doubled_quantity') - self.assertEquals([], invoice.getDivergenceList()) + self.assertEqual([], invoice.getDivergenceList()) invoice_line_list = invoice.getMovementList() - self.assertEquals(1, len(invoice_line_list)) + self.assertEqual(1, len(invoice_line_list)) invoice_line = invoice_line_list[0] - self.assertEquals(new_quantity, invoice_line.getQuantity()) - self.assertEquals(new_quantity, + self.assertEqual(new_quantity, invoice_line.getQuantity()) + self.assertEqual(new_quantity, invoice_line.getDeliveryRelatedValue(portal_type='Simulation Movement' ).getQuantity()) def stepCheckDivergedOnPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('packing_list') - self.assertEquals('diverged', packing_list.getCausalityState()) + self.assertEqual('diverged', packing_list.getCausalityState()) def stepCheckSolvedOnPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('packing_list') - self.assertEquals('solved', packing_list.getCausalityState()) + self.assertEqual('solved', packing_list.getCausalityState()) def stepCheckDivergedQuantityOnInvoice(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('packing_list') invoice = packing_list.getCausalityRelatedValue(portal_type=self.invoice_portal_type) self.assertTrue(invoice.isDivergent()) divergence_list = invoice.getDivergenceList() - self.assertEquals(1, len(divergence_list)) + self.assertEqual(1, len(divergence_list)) divergence = divergence_list[0] - self.assertEquals('quantity', divergence.tested_property) + self.assertEqual('quantity', divergence.tested_property) def stepCheckDivergedQuantityOnPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('packing_list') divergence_list = packing_list.getDivergenceList() - self.assertEquals(1, len(divergence_list)) + self.assertEqual(1, len(divergence_list)) divergence = divergence_list[0] - self.assertEquals('quantity', divergence.tested_property) + self.assertEqual('quantity', divergence.tested_property) def stepAdoptPrevisionOnPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('packing_list') @@ -259,7 +259,7 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase): divergence_list = invoice.getDivergenceList() builder_list = invoice.getBuilderList() - self.assertEquals(1, len(builder_list)) + self.assertEqual(1, len(builder_list)) for builder in builder_list: builder.solveDivergence(invoice.getRelativeUrl(), divergence_to_adopt_list=divergence_list) @@ -272,15 +272,15 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase): sequence_list.play(self, quiet=quiet) packing_list = sequence.get('packing_list') - self.assertEquals('solved', packing_list.getCausalityState()) + self.assertEqual('solved', packing_list.getCausalityState()) invoice = packing_list.getCausalityRelatedValue() - self.assertEquals(self.invoice_portal_type, invoice.getPortalType()) - self.assertEquals('solved', invoice.getCausalityState()) - self.assertEquals([], invoice.getDivergenceList()) + self.assertEqual(self.invoice_portal_type, invoice.getPortalType()) + self.assertEqual('solved', invoice.getCausalityState()) + self.assertEqual([], invoice.getDivergenceList()) invoice_transaction = invoice.getCausalityRelatedValue() self.assertNotEquals(invoice_transaction, None) - self.assertEquals('solved', invoice_transaction.getCausalityState()) + self.assertEqual('solved', invoice_transaction.getCausalityState()) def test_AcceptQuantityDivergenceOnInvoiceWithStoppedPackingList(self, quiet=quiet, run=RUN_ALL_TESTS): """Accept divergence with stopped packing list""" @@ -308,8 +308,8 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase): sequence_list.play(self, quiet=quiet) packing_list = sequence.get('packing_list') - self.assertEquals([], packing_list.getDivergenceList()) - self.assertEquals('solved', packing_list.getCausalityState()) + self.assertEqual([], packing_list.getDivergenceList()) + self.assertEqual('solved', packing_list.getCausalityState()) def test_AdoptQuantityDivergenceOnInvoiceLineWithStoppedPackingList(self, quiet=quiet, run=RUN_ALL_TESTS): @@ -333,19 +333,19 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase): sequence_list.play(self, quiet=quiet) packing_list = sequence.get('packing_list') invoice = packing_list.getCausalityRelatedValue() - self.assertEquals([], invoice.getDivergenceList()) - self.assertEquals('solved', invoice.getCausalityState()) + self.assertEqual([], invoice.getDivergenceList()) + self.assertEqual('solved', invoice.getCausalityState()) - self.assertEquals(1, + self.assertEqual(1, len(invoice.getMovementList(portal_type=self.invoice_line_portal_type))) invoice_line = invoice.getMovementList(portal_type=self.invoice_line_portal_type)[0] - self.assertEquals(99.0, invoice_line.getQuantity()) - self.assertEquals(555.0, invoice_line.getPrice()) - self.assertEquals(99.0, + self.assertEqual(99.0, invoice_line.getQuantity()) + self.assertEqual(555.0, invoice_line.getPrice()) + self.assertEqual(99.0, invoice_line.getDeliveryRelatedValue(portal_type='Simulation Movement' ).getQuantity()) - self.assertEquals([], packing_list.getDivergenceList()) - self.assertEquals('solved', packing_list.getCausalityState()) + self.assertEqual([], packing_list.getDivergenceList()) + self.assertEqual('solved', packing_list.getCausalityState()) def test_PackingListEditAndInvoiceRule(self, quiet=quiet, run=RUN_ALL_TESTS): """ @@ -444,7 +444,7 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice): if invoice_transaction.getSimulationState() in state_list: invoice_transaction_line_list = invoice_transaction.contentValues( portal_type=self.invoice_transaction_line_portal_type) - self.assertEquals(3, len(invoice_transaction_line_list)) + self.assertEqual(3, len(invoice_transaction_line_list)) for line_id, line_source, line_dest, line_ratio in \ self.transaction_line_definition_list: @@ -456,7 +456,7 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice): else: self.fail('No line found that matches %s' % line_id) resource_precision = line.getResourceValue().getQuantityPrecision() - self.assertEquals(round(line.getQuantity(), resource_precision), + self.assertEqual(round(line.getQuantity(), resource_precision), round(expected_price * line_ratio, resource_precision)) def stepRemoveDateMovementGroupForAdvancedTransactionBuilder(self, sequence=None, sequence_list=None, **kw): @@ -947,7 +947,7 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice): self.portal.portal_workflow.doActionFor(invoice, 'confirm_action') # We could generate a better reference here. - self.assertEquals('1', invoice.getReference()) + self.assertEqual('1', invoice.getReference()) def test_10_ManuallyAddedMovements(self, quiet=quiet, run=RUN_ALL_TESTS): """ @@ -1070,8 +1070,8 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice): sequence_list.play(self, quiet=quiet) packing_list = sequence.get('packing_list') invoice = packing_list.getCausalityRelatedValue(portal_type=self.invoice_portal_type) - self.assertEquals('solved', packing_list.getCausalityState()) - self.assertEquals('solved', invoice.getCausalityState()) + self.assertEqual('solved', packing_list.getCausalityState()) + self.assertEqual('solved', invoice.getCausalityState()) class TestAdvancedPurchaseInvoice(TestAdvancedInvoice): """Tests for purchase invoice. @@ -1132,7 +1132,7 @@ class TestAdvancedPurchaseInvoice(TestAdvancedInvoice): packing_list.setReady() packing_list.start() packing_list.stop() - self.assertEquals('stopped', packing_list.getSimulationState()) + self.assertEqual('stopped', packing_list.getSimulationState()) self.commit() @@ -1201,9 +1201,9 @@ class TestWorkflow(SecurityTestCase): def test_autoplanned(self): sale_invoice = self.portal.getDefaultModule('Sale Invoice').newContent(portal_type='Sale Invoice') - self.assertEquals(sale_invoice.getSimulationState(), 'draft') + self.assertEqual(sale_invoice.getSimulationState(), 'draft') sale_invoice.autoPlan() - self.assertEquals(sale_invoice.getSimulationState(), 'auto_planned') + self.assertEqual(sale_invoice.getSimulationState(), 'auto_planned') # other as anonymous username = self.other.getReference() diff --git a/product/ERP5/tests/testAlarm.py b/product/ERP5/tests/testAlarm.py index 6ea32d87d8..f98d963610 100644 --- a/product/ERP5/tests/testAlarm.py +++ b/product/ERP5/tests/testAlarm.py @@ -117,11 +117,11 @@ class TestAlarm(ERP5TypeTestCase): now = DateTime() date = addToDate(now,day=1) alarm.setPeriodicityStartDate(date) - self.assertEquals(alarm.getAlarmDate(), None) + self.assertEqual(alarm.getAlarmDate(), None) alarm.setEnabled(True) - self.assertEquals(alarm.getAlarmDate(), date) + self.assertEqual(alarm.getAlarmDate(), date) alarm.setNextAlarmDate(current_date=now) # This should not do change the alarm date - self.assertEquals(alarm.getAlarmDate(),date) + self.assertEqual(alarm.getAlarmDate(),date) def test_03_EveryHour(self, quiet=0, run=run_all_test): if not run: return @@ -136,20 +136,20 @@ class TestAlarm(ERP5TypeTestCase): alarm.setPeriodicityHourFrequency(1) self.tic() alarm.setNextAlarmDate(current_date=now) - self.assertEquals(alarm.getAlarmDate(), date) + self.assertEqual(alarm.getAlarmDate(), date) LOG(message + ' now :',0,now) now = addToDate(now,day=2) LOG(message + ' now :',0,now) alarm.setNextAlarmDate(current_date=now) next_date = addToDate(date,hour=1) - self.assertEquals(alarm.getAlarmDate(),next_date) + self.assertEqual(alarm.getAlarmDate(),next_date) now = addToDate(now,hour=1,minute=5) alarm.setNextAlarmDate(current_date=now) next_date = addToDate(next_date,hour=1) - self.assertEquals(alarm.getAlarmDate(),next_date) + self.assertEqual(alarm.getAlarmDate(),next_date) # check if manual invoking does not break getAlarmDate() result. alarm.activeSense() - self.assertEquals(alarm.getAlarmDate(),next_date) + self.assertEqual(alarm.getAlarmDate(),next_date) def test_04_Every3Hours(self, quiet=0, run=run_all_test): if not run: return @@ -166,17 +166,17 @@ class TestAlarm(ERP5TypeTestCase): alarm.setPeriodicityHourFrequency(3) self.tic() alarm.setNextAlarmDate(current_date=now) - self.assertEquals(alarm.getAlarmDate(),date) + self.assertEqual(alarm.getAlarmDate(),date) LOG(message + ' now :',0,now) now = addToDate(now,day=2) LOG(message + ' now :',0,now) alarm.setNextAlarmDate(current_date=now) next_date = addToDate(date,hour=3) - self.assertEquals(alarm.getAlarmDate(),next_date) + self.assertEqual(alarm.getAlarmDate(),next_date) now = addToDate(now,hour=3,minute=7,second=4) alarm.setNextAlarmDate(current_date=now) next_date = addToDate(next_date,hour=3) - self.assertEquals(alarm.getAlarmDate(),next_date) + self.assertEqual(alarm.getAlarmDate(),next_date) def test_05_SomeHours(self, quiet=0, run=run_all_test): if not run: return @@ -195,13 +195,13 @@ class TestAlarm(ERP5TypeTestCase): alarm.setPeriodicityStartDate(now) alarm.setPeriodicityHourList(hour_list) self.tic() - self.assertEquals(alarm.getAlarmDate(),right_first_date) + self.assertEqual(alarm.getAlarmDate(),right_first_date) alarm.setNextAlarmDate(current_date=right_first_date) - self.assertEquals(alarm.getAlarmDate(),right_second_date) + self.assertEqual(alarm.getAlarmDate(),right_second_date) alarm.setNextAlarmDate(current_date=right_second_date) - self.assertEquals(alarm.getAlarmDate(),right_third_date) + self.assertEqual(alarm.getAlarmDate(),right_third_date) alarm.setNextAlarmDate(current_date=right_third_date) - self.assertEquals(alarm.getAlarmDate(),right_fourth_date) + self.assertEqual(alarm.getAlarmDate(),right_fourth_date) def test_06_EveryDayOnce(self, quiet=0, run=run_all_test): if not run: return @@ -219,11 +219,11 @@ class TestAlarm(ERP5TypeTestCase): alarm.setPeriodicityDayFrequency(1) alarm.setPeriodicityHourList((10,)) self.tic() - self.assertEquals(alarm.getAlarmDate(),right_first_date) + self.assertEqual(alarm.getAlarmDate(),right_first_date) alarm.setNextAlarmDate(current_date=right_first_date) - self.assertEquals(alarm.getAlarmDate(),right_second_date) + self.assertEqual(alarm.getAlarmDate(),right_second_date) alarm.setNextAlarmDate(current_date=right_second_date) - self.assertEquals(alarm.getAlarmDate(),right_third_date) + self.assertEqual(alarm.getAlarmDate(),right_third_date) def test_07_Every3DaysSomeHours(self, quiet=0, run=run_all_test): """- every 3 days at 14 and 15 and 17""" @@ -242,13 +242,13 @@ class TestAlarm(ERP5TypeTestCase): alarm.setPeriodicityDayFrequency(3) alarm.setPeriodicityHourList((14,15,17)) self.tic() - self.assertEquals(alarm.getAlarmDate(),right_first_date) + self.assertEqual(alarm.getAlarmDate(),right_first_date) alarm.setNextAlarmDate(current_date=right_first_date) - self.assertEquals(alarm.getAlarmDate(),right_second_date) + self.assertEqual(alarm.getAlarmDate(),right_second_date) alarm.setNextAlarmDate(current_date=right_second_date) - self.assertEquals(alarm.getAlarmDate(),right_third_date) + self.assertEqual(alarm.getAlarmDate(),right_third_date) alarm.setNextAlarmDate(current_date=right_third_date) - self.assertEquals(alarm.getAlarmDate(),right_fourth_date) + self.assertEqual(alarm.getAlarmDate(),right_fourth_date) def test_07a_Every4DaysSomeHours(self, quiet=0, run=run_all_test): """- every 4 days at 14 and 15 and 17""" @@ -268,15 +268,15 @@ class TestAlarm(ERP5TypeTestCase): alarm.setPeriodicityDayFrequency(4) alarm.setPeriodicityHourList((14,15,17)) self.tic() - self.assertEquals(alarm.getAlarmDate(),right_first_date) + self.assertEqual(alarm.getAlarmDate(),right_first_date) alarm.setNextAlarmDate(current_date=right_first_date) - self.assertEquals(alarm.getAlarmDate(),right_second_date) + self.assertEqual(alarm.getAlarmDate(),right_second_date) alarm.setNextAlarmDate(current_date=right_second_date) - self.assertEquals(alarm.getAlarmDate(),right_third_date) + self.assertEqual(alarm.getAlarmDate(),right_third_date) alarm.setNextAlarmDate(current_date=right_third_date) - self.assertEquals(alarm.getAlarmDate(),right_fourth_date) + self.assertEqual(alarm.getAlarmDate(),right_fourth_date) alarm.setNextAlarmDate(current_date=right_fourth_date) - self.assertEquals(alarm.getAlarmDate(),right_fifth_date) + self.assertEqual(alarm.getAlarmDate(),right_fifth_date) def test_08_SomeWeekDaysSomeHours(self, quiet=0, run=run_all_test): """- every monday and friday, at 6 and 15""" @@ -304,9 +304,9 @@ class TestAlarm(ERP5TypeTestCase): """ for date in args[:-1]: LOG('checkDate, checking date...:',0,date) - self.assertEquals(alarm.getAlarmDate(),date) + self.assertEqual(alarm.getAlarmDate(),date) alarm.setNextAlarmDate(current_date=date) - self.assertEquals(alarm.getAlarmDate(),args[-1]) + self.assertEqual(alarm.getAlarmDate(),args[-1]) def test_09_SomeMonthDaysSomeHours(self, quiet=0, run=run_all_test): """- every 1st and 15th every month, at 12 and 14""" @@ -379,17 +379,17 @@ class TestAlarm(ERP5TypeTestCase): alarm.setPeriodicityMinuteFrequency(5) self.tic() alarm.setNextAlarmDate(current_date=now) - self.assertEquals(alarm.getAlarmDate(),date) + self.assertEqual(alarm.getAlarmDate(),date) LOG(message + ' now :',0,now) now = addToDate(now,day=2) LOG(message + ' now :',0,now) alarm.setNextAlarmDate(current_date=now) next_date = addToDate(date,minute=5) - self.assertEquals(alarm.getAlarmDate(),next_date) + self.assertEqual(alarm.getAlarmDate(),next_date) now = addToDate(now,minute=5,second=14) alarm.setNextAlarmDate(current_date=now) next_date = addToDate(next_date,minute=5) - self.assertEquals(alarm.getAlarmDate(),next_date) + self.assertEqual(alarm.getAlarmDate(),next_date) def test_13_EveryMinute(self, quiet=0, run=run_all_test): if not run: return @@ -404,7 +404,7 @@ class TestAlarm(ERP5TypeTestCase): alarm.setPeriodicityMinuteFrequency(1) self.tic() alarm.setNextAlarmDate(current_date=date) - self.assertEquals(alarm.getAlarmDate(),date) + self.assertEqual(alarm.getAlarmDate(),date) def test_14_NewActiveProcess(self, quiet=0, run=run_all_test): if not run: return @@ -414,10 +414,10 @@ class TestAlarm(ERP5TypeTestCase): LOG('Testing... ',0,message) alarm = self.newAlarm(enabled=True) active_process = alarm.newActiveProcess() - self.assertEquals('Active Process', active_process.getPortalType()) - self.assertEquals(alarm, active_process.getCausalityValue()) + self.assertEqual('Active Process', active_process.getPortalType()) + self.assertEqual(alarm, active_process.getCausalityValue()) self.tic() - self.assertEquals(active_process, alarm.getLastActiveProcess()) + self.assertEqual(active_process, alarm.getLastActiveProcess()) def test_15_FailedAlarmsDoNotBlockFutureAlarms(self, quiet=0, run=run_all_test): if not run: return @@ -437,7 +437,7 @@ class TestAlarm(ERP5TypeTestCase): self.tic() now = DateTime() alarm.setActiveSenseMethodId(sense_method_id) - self.assertEquals(alarm.isActive(), 0) + self.assertEqual(alarm.isActive(), 0) alarm.activeSense() self.commit() try: @@ -447,9 +447,9 @@ class TestAlarm(ERP5TypeTestCase): else: raise Exception, 'Tic did not raise though activity was supposed to fail' # Check that the alarm is not considered active, although there is a remaining activity. - self.assertEquals(alarm.hasActivity(), 1) - self.assertEquals(alarm.isActive(), 0) - self.assertEquals(alarm.getLastActiveProcess(), None) + self.assertEqual(alarm.hasActivity(), 1) + self.assertEqual(alarm.isActive(), 0) + self.assertEqual(alarm.getLastActiveProcess(), None) # Make the sense method succeed and leave a trace self.getPortal().portal_skins[skin_folder_id][sense_method_id].ZPythonScript_edit('*args,**kw', 'context.newActiveProcess()') alarm.activeSense() @@ -484,12 +484,12 @@ class TestAlarm(ERP5TypeTestCase): date = addToDate(now, day=1) alarm.setPeriodicityStartDate(date) self.tic() - self.assertEquals(alarm.getAlarmDate(), date) + self.assertEqual(alarm.getAlarmDate(), date) # This should not do change the alarm date alarm.setNextAlarmDate(current_date=now) self.tic() - self.assertEquals(alarm.getAlarmDate(), date) + self.assertEqual(alarm.getAlarmDate(), date) # Delete the alarm a_tool = self.getAlarmTool() @@ -500,7 +500,7 @@ class TestAlarm(ERP5TypeTestCase): sql_connection = self.getSQLConnection() sql = 'select * from alarm where uid=%s' % alarm_uid result = sql_connection.manage_test(sql) - self.assertEquals(0, len(result)) + self.assertEqual(0, len(result)) def test_17_tic(self, quiet=0, run=run_all_test): """ @@ -538,7 +538,7 @@ class TestAlarm(ERP5TypeTestCase): self.tic() alarm_tool.tic() self.tic() - self.assertEquals(alarm.getDescription(), 'a') + self.assertEqual(alarm.getDescription(), 'a') def test_18_alarm_activities_execution_order(self, quiet=0, run=run_all_test): """ @@ -567,7 +567,7 @@ class TestAlarm(ERP5TypeTestCase): alarm.activeSense() self.commit() messages_list = self.getActivityTool().getMessageList() - self.assertEquals(2, len(messages_list)) + self.assertEqual(2, len(messages_list)) expected_tag = alarm.getRelativeUrl() + '_0' # check tags after activeSense for m in messages_list: @@ -622,8 +622,8 @@ class TestAlarm(ERP5TypeTestCase): user = uf.getUserById('normal').__of__(uf) # Check the pre-conditions. - self.assertEquals(alarm.getProperty('bogus', None), None) - self.assertEquals(alarm.getEnabled(), False) + self.assertEqual(alarm.getProperty('bogus', None), None) + self.assertEqual(alarm.getEnabled(), False) sm = getSecurityManager() newSecurityManager(None, user) @@ -634,7 +634,7 @@ class TestAlarm(ERP5TypeTestCase): # Non-managers must not be able to invoke the automatic fixation. setSecurityManager(sm) alarm.setEnabled(True) - self.assertEquals(alarm.getEnabled(), True) + self.assertEqual(alarm.getEnabled(), True) newSecurityManager(None, user) self.assertRaises(Unauthorized, alarm.activeSense, fixit=1) @@ -645,38 +645,38 @@ class TestAlarm(ERP5TypeTestCase): alarm.activeSense() self.tic() - self.assertEquals(alarm.getProperty('bogus', None), correct_answer) + self.assertEqual(alarm.getProperty('bogus', None), correct_answer) alarm.setProperty('bogus', None) - self.assertEquals(alarm.getProperty('bogus', None), None) + self.assertEqual(alarm.getProperty('bogus', None), None) newSecurityManager(None, user) alarm.activeSense() self.tic() - self.assertEquals(alarm.getProperty('bogus', None), correct_answer) + self.assertEqual(alarm.getProperty('bogus', None), correct_answer) setSecurityManager(sm) alarm.setProperty('bogus', None) # Check that Manager can invoke an alarm freely. alarm.activeSense(fixit=1) self.tic() - self.assertEquals(alarm.getProperty('bogus', None), correct_answer) + self.assertEqual(alarm.getProperty('bogus', None), correct_answer) alarm.setProperty('bogus', None) - self.assertEquals(alarm.getProperty('bogus', None), None) + self.assertEqual(alarm.getProperty('bogus', None), None) alarm.setEnabled(False) - self.assertEquals(alarm.getEnabled(), False) + self.assertEqual(alarm.getEnabled(), False) alarm.activeSense() self.tic() - self.assertEquals(alarm.getProperty('bogus', None), correct_answer) + self.assertEqual(alarm.getProperty('bogus', None), correct_answer) alarm.setProperty('bogus', None) - self.assertEquals(alarm.getProperty('bogus', None), None) + self.assertEqual(alarm.getProperty('bogus', None), None) alarm.activeSense(fixit=1) self.tic() - self.assertEquals(alarm.getProperty('bogus', None), correct_answer) + self.assertEqual(alarm.getProperty('bogus', None), correct_answer) alarm.setProperty('bogus', None) - self.assertEquals(alarm.getProperty('bogus', None), None) + self.assertEqual(alarm.getProperty('bogus', None), None) def test_20_UndefinedPeriodicityStartDate(self, quiet=0, run=run_all_test): """ @@ -691,14 +691,14 @@ class TestAlarm(ERP5TypeTestCase): # Test sanity check. self.assertEqual(alarm.getPeriodicityStartDate(), None) # Actual test. - self.assertEquals(alarm.getAlarmDate(), None) + self.assertEqual(alarm.getAlarmDate(), None) def test_21_AlarmCatalogPresence(self): """Check that alarm date is properly stored in catalog upon first reindexation""" date = DateTime().earliestTime() alarm = self.newAlarm(enabled=True, periodicity_start_date=date) self.tic() - self.assertEquals(alarm.getAlarmDate(), date) + self.assertEqual(alarm.getAlarmDate(), date) alarm_list = alarm.Alarm_zGetAlarmDate(uid=alarm.getUid()) self.assertEqual(1, len(alarm_list)) catalog_alarm_date = alarm_list[0].alarm_date @@ -711,7 +711,7 @@ class TestAlarm(ERP5TypeTestCase): self.tic() alarm.recursiveReindexObject() self.tic() - self.assertEquals(alarm.getAlarmDate(), date) + self.assertEqual(alarm.getAlarmDate(), date) alarm_list = alarm.Alarm_zGetAlarmDate(uid=alarm.getUid()) self.assertEqual(1, len(alarm_list)) catalog_alarm_date = alarm_list[0].alarm_date diff --git a/product/ERP5/tests/testAmount.py b/product/ERP5/tests/testAmount.py index b5012db106..d6c60749ee 100644 --- a/product/ERP5/tests/testAmount.py +++ b/product/ERP5/tests/testAmount.py @@ -129,7 +129,7 @@ class TestAmount(ERP5TypeTestCase): """ amount = sequence.get('amount') vpd = amount.getVariationPropertyDict() - self.assertEquals(vpd, {}) + self.assertEqual(vpd, {}) def stepCheckEmptySetVariationPropertyDict(self, sequence=None, sequence_list=None, **kw): @@ -161,7 +161,7 @@ class TestAmount(ERP5TypeTestCase): self.failIfDifferentSet(vpd.keys(), sequence.get('variation_property_dict').keys()) for key in vpd.keys(): - self.assertEquals(vpd[key], sequence.get('variation_property_dict')[key]) + self.assertEqual(vpd[key], sequence.get('variation_property_dict')[key]) def stepSetWrongVariationPropertyDict(self, sequence=None, sequence_list=None, **kw): @@ -263,261 +263,261 @@ class TestMovement(ERP5TypeTestCase): def testQuantity(self): mvt = self._makeOne() mvt.setQuantity(10) - self.assertEquals(10, mvt.getQuantity()) - self.assertEquals(0, mvt.getTotalPrice()) + self.assertEqual(10, mvt.getQuantity()) + self.assertEqual(0, mvt.getTotalPrice()) mvt.edit(quantity=20) - self.assertEquals(20, mvt.getQuantity()) + self.assertEqual(20, mvt.getQuantity()) def testPrice(self): mvt = self._makeOne() - self.assertEquals(None, mvt.getPrice()) + self.assertEqual(None, mvt.getPrice()) mvt.setPrice(10) - self.assertEquals(10, mvt.getPrice()) - self.assertEquals(0, mvt.getTotalPrice()) + self.assertEqual(10, mvt.getPrice()) + self.assertEqual(0, mvt.getTotalPrice()) mvt.setQuantity(1) - self.assertEquals(10, mvt.getTotalPrice()) + self.assertEqual(10, mvt.getTotalPrice()) def testSourceDebit(self): mvt = self._makeOne() mvt.setSourceDebit(10) - self.assertEquals(10, mvt.getSourceDebit()) - self.assertEquals(0, mvt.getSourceCredit()) - self.assertEquals(-10, mvt.getQuantity()) + self.assertEqual(10, mvt.getSourceDebit()) + self.assertEqual(0, mvt.getSourceCredit()) + self.assertEqual(-10, mvt.getQuantity()) mvt.edit(source_debit=20) - self.assertEquals(20, mvt.getSourceDebit()) - self.assertEquals(0, mvt.getSourceCredit()) - self.assertEquals(-20, mvt.getQuantity()) + self.assertEqual(20, mvt.getSourceDebit()) + self.assertEqual(0, mvt.getSourceCredit()) + self.assertEqual(-20, mvt.getQuantity()) def testSourceCredit(self): mvt = self._makeOne() mvt.setSourceCredit(10) - self.assertEquals(0, mvt.getSourceDebit()) - self.assertEquals(10, mvt.getSourceCredit()) - self.assertEquals(10, mvt.getQuantity()) + self.assertEqual(0, mvt.getSourceDebit()) + self.assertEqual(10, mvt.getSourceCredit()) + self.assertEqual(10, mvt.getQuantity()) mvt.edit(source_credit=20) - self.assertEquals(0, mvt.getSourceDebit()) - self.assertEquals(20, mvt.getSourceCredit()) - self.assertEquals(20, mvt.getQuantity()) + self.assertEqual(0, mvt.getSourceDebit()) + self.assertEqual(20, mvt.getSourceCredit()) + self.assertEqual(20, mvt.getQuantity()) def testSourceDebitCredit(self): mvt = self._makeOne() mvt.setSourceCredit(10) mvt.edit(source_credit=0, source_debit=10) - self.assertEquals(10, mvt.getSourceDebit()) - self.assertEquals(0, mvt.getSourceCredit()) - self.assertEquals(-10, mvt.getQuantity()) + self.assertEqual(10, mvt.getSourceDebit()) + self.assertEqual(0, mvt.getSourceCredit()) + self.assertEqual(-10, mvt.getQuantity()) def testDestinationDebit(self): mvt = self._makeOne() mvt.setDestinationDebit(10) - self.assertEquals(10, mvt.getDestinationDebit()) - self.assertEquals(0, mvt.getDestinationCredit()) - self.assertEquals(10, mvt.getQuantity()) + self.assertEqual(10, mvt.getDestinationDebit()) + self.assertEqual(0, mvt.getDestinationCredit()) + self.assertEqual(10, mvt.getQuantity()) mvt.edit(destination_debit=20) - self.assertEquals(20, mvt.getDestinationDebit()) - self.assertEquals(0, mvt.getDestinationCredit()) - self.assertEquals(20, mvt.getQuantity()) + self.assertEqual(20, mvt.getDestinationDebit()) + self.assertEqual(0, mvt.getDestinationCredit()) + self.assertEqual(20, mvt.getQuantity()) def testDestinationCredit(self): mvt = self._makeOne() mvt.setDestinationCredit(10) - self.assertEquals(0, mvt.getDestinationDebit()) - self.assertEquals(10, mvt.getDestinationCredit()) - self.assertEquals(-10, mvt.getQuantity()) + self.assertEqual(0, mvt.getDestinationDebit()) + self.assertEqual(10, mvt.getDestinationCredit()) + self.assertEqual(-10, mvt.getQuantity()) mvt.edit(destination_credit=20) - self.assertEquals(0, mvt.getDestinationDebit()) - self.assertEquals(20, mvt.getDestinationCredit()) - self.assertEquals(-20, mvt.getQuantity()) + self.assertEqual(0, mvt.getDestinationDebit()) + self.assertEqual(20, mvt.getDestinationCredit()) + self.assertEqual(-20, mvt.getQuantity()) def testDestinationDebitCredit(self): mvt = self._makeOne() mvt.setDestinationCredit(10) mvt.edit(destination_credit=0, destination_debit=10) - self.assertEquals(10, mvt.getDestinationDebit()) - self.assertEquals(0, mvt.getDestinationCredit()) - self.assertEquals(10, mvt.getQuantity()) + self.assertEqual(10, mvt.getDestinationDebit()) + self.assertEqual(0, mvt.getDestinationCredit()) + self.assertEqual(10, mvt.getQuantity()) def testSourceAssetCredit(self): mvt = self._makeOne() mvt.edit(source_asset_credit=100) - self.assertEquals(100, mvt.getSourceAssetCredit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetDebit()) - self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetCredit()) - self.assertEquals(-100, mvt.getSourceInventoriatedTotalAssetPrice()) + self.assertEqual(100, mvt.getSourceAssetCredit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(0, mvt.getSourceInventoriatedTotalAssetDebit()) + self.assertEqual(100, mvt.getSourceInventoriatedTotalAssetCredit()) + self.assertEqual(-100, mvt.getSourceInventoriatedTotalAssetPrice()) # reset and set quantity instead mvt.edit(source_asset_credit=None, source_credit=200) - self.assertEquals(0.0, mvt.getSourceAssetCredit()) - self.assertEquals(200, mvt.getSourceCredit()) + self.assertEqual(0.0, mvt.getSourceAssetCredit()) + self.assertEqual(200, mvt.getSourceCredit()) def testSourceAssetDebit(self): mvt = self._makeOne() mvt.edit(source_asset_debit=100) - self.assertEquals(100, mvt.getSourceAssetDebit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetDebit()) - self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetCredit()) - self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetPrice()) + self.assertEqual(100, mvt.getSourceAssetDebit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(100, mvt.getSourceInventoriatedTotalAssetDebit()) + self.assertEqual(0, mvt.getSourceInventoriatedTotalAssetCredit()) + self.assertEqual(100, mvt.getSourceInventoriatedTotalAssetPrice()) # reset and set quantity instead mvt.edit(source_asset_debit=None, source_debit=200) - self.assertEquals(0.0, mvt.getSourceAssetDebit()) - self.assertEquals(200, mvt.getSourceDebit()) + self.assertEqual(0.0, mvt.getSourceAssetDebit()) + self.assertEqual(200, mvt.getSourceDebit()) def testEditSourceAssetDebitAndCredit(self): mvt = self._makeOne() mvt.edit(source_asset_debit=100, source_asset_credit=None) - self.assertEquals(100, mvt.getSourceAssetDebit()) + self.assertEqual(100, mvt.getSourceAssetDebit()) mvt.edit(source_asset_debit=None, source_asset_credit=100) - self.assertEquals(100, mvt.getSourceAssetCredit()) + self.assertEqual(100, mvt.getSourceAssetCredit()) mvt.edit(source_asset_debit=100, source_asset_credit='') - self.assertEquals(100, mvt.getSourceAssetDebit()) + self.assertEqual(100, mvt.getSourceAssetDebit()) mvt.edit(source_asset_debit='', source_asset_credit=100) - self.assertEquals(100, mvt.getSourceAssetCredit()) + self.assertEqual(100, mvt.getSourceAssetCredit()) def testDestinationAssetCredit(self): mvt = self._makeOne() mvt.edit(destination_asset_credit=100) - self.assertEquals(100, mvt.getDestinationAssetCredit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetDebit()) - self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetCredit()) - self.assertEquals(-100, mvt.getDestinationInventoriatedTotalAssetPrice()) + self.assertEqual(100, mvt.getDestinationAssetCredit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(0, mvt.getDestinationInventoriatedTotalAssetDebit()) + self.assertEqual(100, mvt.getDestinationInventoriatedTotalAssetCredit()) + self.assertEqual(-100, mvt.getDestinationInventoriatedTotalAssetPrice()) # reset and set quantity instead mvt.edit(destination_asset_credit=None, destination_credit=200) - self.assertEquals(0.0, mvt.getDestinationAssetCredit()) - self.assertEquals(200, mvt.getDestinationCredit()) + self.assertEqual(0.0, mvt.getDestinationAssetCredit()) + self.assertEqual(200, mvt.getDestinationCredit()) def testDestinationAssetDebit(self): mvt = self._makeOne() mvt.edit(destination_asset_debit=100) - self.assertEquals(100, mvt.getDestinationAssetDebit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetDebit()) - self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetCredit()) - self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetPrice()) + self.assertEqual(100, mvt.getDestinationAssetDebit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(100, mvt.getDestinationInventoriatedTotalAssetDebit()) + self.assertEqual(0, mvt.getDestinationInventoriatedTotalAssetCredit()) + self.assertEqual(100, mvt.getDestinationInventoriatedTotalAssetPrice()) # reset and set quantity instead mvt.edit(destination_asset_debit=None, destination_debit=200) - self.assertEquals(0.0, mvt.getDestinationAssetDebit()) - self.assertEquals(200, mvt.getDestinationDebit()) + self.assertEqual(0.0, mvt.getDestinationAssetDebit()) + self.assertEqual(200, mvt.getDestinationDebit()) def testEditDestinationAssetDebitAndCredit(self): mvt = self._makeOne() mvt.edit(destination_asset_debit=100, destination_asset_credit=None) - self.assertEquals(100, mvt.getDestinationAssetDebit()) + self.assertEqual(100, mvt.getDestinationAssetDebit()) mvt.edit(destination_asset_debit=None, destination_asset_credit=100) - self.assertEquals(100, mvt.getDestinationAssetCredit()) + self.assertEqual(100, mvt.getDestinationAssetCredit()) mvt.edit(destination_asset_debit=100, destination_asset_credit='') - self.assertEquals(100, mvt.getDestinationAssetDebit()) + self.assertEqual(100, mvt.getDestinationAssetDebit()) mvt.edit(destination_asset_debit='', destination_asset_credit=100) - self.assertEquals(100, mvt.getDestinationAssetCredit()) + self.assertEqual(100, mvt.getDestinationAssetCredit()) def testCancellationAmountGetDestinationCredit(self): mvt = self._makeOne() mvt.setCancellationAmount(True) mvt.setQuantity(10) - self.assertEquals(mvt.getQuantity(), 10) - self.assertEquals(mvt.getDestinationDebit(), 0) - self.assertEquals(mvt.getDestinationCredit(), -10) + self.assertEqual(mvt.getQuantity(), 10) + self.assertEqual(mvt.getDestinationDebit(), 0) + self.assertEqual(mvt.getDestinationCredit(), -10) def testCancellationAmountGetDestinationDebit(self): mvt = self._makeOne() mvt.setCancellationAmount(True) mvt.setQuantity(-10) - self.assertEquals(mvt.getQuantity(), -10) - self.assertEquals(mvt.getDestinationDebit(), -10) - self.assertEquals(mvt.getDestinationCredit(), 0) + self.assertEqual(mvt.getQuantity(), -10) + self.assertEqual(mvt.getDestinationDebit(), -10) + self.assertEqual(mvt.getDestinationCredit(), 0) def testCancellationAmountGetSourceCredit(self): mvt = self._makeOne() mvt.setCancellationAmount(True) mvt.setQuantity(-10) - self.assertEquals(mvt.getQuantity(), -10) - self.assertEquals(mvt.getSourceDebit(), 0) - self.assertEquals(mvt.getSourceCredit(), -10) + self.assertEqual(mvt.getQuantity(), -10) + self.assertEqual(mvt.getSourceDebit(), 0) + self.assertEqual(mvt.getSourceCredit(), -10) def testCancellationAmountGetSourceDebit(self): mvt = self._makeOne() mvt.setCancellationAmount(True) mvt.setQuantity(10) - self.assertEquals(mvt.getQuantity(), 10) - self.assertEquals(mvt.getSourceDebit(), -10) - self.assertEquals(mvt.getSourceCredit(), 0) + self.assertEqual(mvt.getQuantity(), 10) + self.assertEqual(mvt.getSourceDebit(), -10) + self.assertEqual(mvt.getSourceCredit(), 0) def testCancellationAmountSetDestinationCredit(self): mvt = self._makeOne() mvt.setDestinationCredit(-10) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(mvt.getDestinationDebit(), 0) - self.assertEquals(mvt.getDestinationCredit(), -10) + self.assertEqual(mvt.getDestinationDebit(), 0) + self.assertEqual(mvt.getDestinationCredit(), -10) mvt.setDestinationCredit(10) self.assertFalse(mvt.isCancellationAmount()) - self.assertEquals(mvt.getDestinationDebit(), 0) - self.assertEquals(mvt.getDestinationCredit(), 10) + self.assertEqual(mvt.getDestinationDebit(), 0) + self.assertEqual(mvt.getDestinationCredit(), 10) def testCancellationAmountSetDestinationDebit(self): mvt = self._makeOne() mvt.setDestinationDebit(-10) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(mvt.getDestinationDebit(), -10) - self.assertEquals(mvt.getDestinationCredit(), 0) + self.assertEqual(mvt.getDestinationDebit(), -10) + self.assertEqual(mvt.getDestinationCredit(), 0) mvt.setDestinationDebit(10) self.assertFalse(mvt.isCancellationAmount()) - self.assertEquals(mvt.getDestinationDebit(), 10) - self.assertEquals(mvt.getDestinationCredit(), 0) + self.assertEqual(mvt.getDestinationDebit(), 10) + self.assertEqual(mvt.getDestinationCredit(), 0) def testCancellationAmountSetDestinationDebitCredit(self): mvt = self._makeOne() mvt.edit(destination_debit=-10, destination_credit=0) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(mvt.getDestinationDebit(), -10) - self.assertEquals(mvt.getDestinationCredit(), 0) + self.assertEqual(mvt.getDestinationDebit(), -10) + self.assertEqual(mvt.getDestinationCredit(), 0) mvt.edit(destination_debit=-10, destination_credit=None) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(mvt.getDestinationDebit(), -10) - self.assertEquals(mvt.getDestinationCredit(), 0) + self.assertEqual(mvt.getDestinationDebit(), -10) + self.assertEqual(mvt.getDestinationCredit(), 0) def testCancellationAmountSetSourceCredit(self): mvt = self._makeOne() mvt.setSourceCredit(-10) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(mvt.getSourceDebit(), 0) - self.assertEquals(mvt.getSourceCredit(), -10) + self.assertEqual(mvt.getSourceDebit(), 0) + self.assertEqual(mvt.getSourceCredit(), -10) mvt.setSourceCredit(10) self.assertFalse(mvt.isCancellationAmount()) - self.assertEquals(mvt.getSourceDebit(), 0) - self.assertEquals(mvt.getSourceCredit(), 10) + self.assertEqual(mvt.getSourceDebit(), 0) + self.assertEqual(mvt.getSourceCredit(), 10) def testCancellationAmountSetSourceDebit(self): mvt = self._makeOne() mvt.setSourceDebit(-10) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(mvt.getSourceDebit(), -10) - self.assertEquals(mvt.getSourceCredit(), 0) + self.assertEqual(mvt.getSourceDebit(), -10) + self.assertEqual(mvt.getSourceCredit(), 0) mvt.setSourceDebit(10) self.assertFalse(mvt.isCancellationAmount()) - self.assertEquals(mvt.getSourceDebit(), 10) - self.assertEquals(mvt.getSourceCredit(), 0) + self.assertEqual(mvt.getSourceDebit(), 10) + self.assertEqual(mvt.getSourceCredit(), 0) def testCancellationAmountSetSourceDebitCredit(self): mvt = self._makeOne() mvt.edit(source_debit=-10, source_credit=0) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(mvt.getSourceDebit(), -10) - self.assertEquals(mvt.getSourceCredit(), 0) + self.assertEqual(mvt.getSourceDebit(), -10) + self.assertEqual(mvt.getSourceCredit(), 0) mvt.edit(source_debit=-10, source_credit=None) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(mvt.getSourceDebit(), -10) - self.assertEquals(mvt.getSourceCredit(), 0) + self.assertEqual(mvt.getSourceDebit(), -10) + self.assertEqual(mvt.getSourceCredit(), 0) class TestAccountingTransactionLine(TestMovement): @@ -548,168 +548,168 @@ class TestAccountingTransactionLine(TestMovement): def testPrice(self): # price is always 1 for accounting transactions lines mvt = self._makeOne() - self.assertEquals(1, mvt.getPrice()) + self.assertEqual(1, mvt.getPrice()) def testQuantity(self): mvt = self._makeOne() mvt.setQuantity(10) - self.assertEquals(10, mvt.getQuantity()) - # self.assertEquals(None, mvt.getTotalPrice()) + self.assertEqual(10, mvt.getQuantity()) + # self.assertEqual(None, mvt.getTotalPrice()) # ... not with Accounting Transaction Lines, because price is 1 mvt.edit(quantity=20) - self.assertEquals(20, mvt.getQuantity()) + self.assertEqual(20, mvt.getQuantity()) def testDefautSourceTotalAssetDebit(self): mvt = self._makeOne() mvt.edit(source_debit=100) - self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetDebit()) - self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetCredit()) - self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetPrice()) - self.assertEquals(None, mvt.getSourceTotalAssetPrice()) - self.assertEquals(None, mvt.getDestinationTotalAssetPrice()) - self.assertEquals(0.0, mvt.getSourceAssetDebit()) - self.assertEquals(0.0, mvt.getSourceAssetCredit()) + self.assertEqual(100, mvt.getSourceInventoriatedTotalAssetDebit()) + self.assertEqual(0, mvt.getSourceInventoriatedTotalAssetCredit()) + self.assertEqual(100, mvt.getSourceInventoriatedTotalAssetPrice()) + self.assertEqual(None, mvt.getSourceTotalAssetPrice()) + self.assertEqual(None, mvt.getDestinationTotalAssetPrice()) + self.assertEqual(0.0, mvt.getSourceAssetDebit()) + self.assertEqual(0.0, mvt.getSourceAssetCredit()) def testDefautSourceTotalAssetCredit(self): mvt = self._makeOne() mvt.edit(source_credit=100) - self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetDebit()) - self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetCredit()) - self.assertEquals(-100, mvt.getSourceInventoriatedTotalAssetPrice()) - self.assertEquals(None, mvt.getSourceTotalAssetPrice()) - self.assertEquals(None, mvt.getDestinationTotalAssetPrice()) - self.assertEquals(0.0, mvt.getSourceAssetDebit()) - self.assertEquals(0.0, mvt.getSourceAssetCredit()) + self.assertEqual(0, mvt.getSourceInventoriatedTotalAssetDebit()) + self.assertEqual(100, mvt.getSourceInventoriatedTotalAssetCredit()) + self.assertEqual(-100, mvt.getSourceInventoriatedTotalAssetPrice()) + self.assertEqual(None, mvt.getSourceTotalAssetPrice()) + self.assertEqual(None, mvt.getDestinationTotalAssetPrice()) + self.assertEqual(0.0, mvt.getSourceAssetDebit()) + self.assertEqual(0.0, mvt.getSourceAssetCredit()) def testDefautDestinationTotalAssetDebit(self): mvt = self._makeOne() mvt.edit(destination_debit=100) - self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetDebit()) - self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetCredit()) - self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetPrice()) - self.assertEquals(None, mvt.getSourceTotalAssetPrice()) - self.assertEquals(None, mvt.getDestinationTotalAssetPrice()) - self.assertEquals(0.0, mvt.getDestinationAssetDebit()) - self.assertEquals(0.0, mvt.getDestinationAssetCredit()) + self.assertEqual(100, mvt.getDestinationInventoriatedTotalAssetDebit()) + self.assertEqual(0, mvt.getDestinationInventoriatedTotalAssetCredit()) + self.assertEqual(100, mvt.getDestinationInventoriatedTotalAssetPrice()) + self.assertEqual(None, mvt.getSourceTotalAssetPrice()) + self.assertEqual(None, mvt.getDestinationTotalAssetPrice()) + self.assertEqual(0.0, mvt.getDestinationAssetDebit()) + self.assertEqual(0.0, mvt.getDestinationAssetCredit()) def testDefautDestinationTotalAssetCredit(self): mvt = self._makeOne() mvt.edit(destination_credit=100) - self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetDebit()) - self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetCredit()) - self.assertEquals(-100, mvt.getDestinationInventoriatedTotalAssetPrice()) - self.assertEquals(None, mvt.getSourceTotalAssetPrice()) - self.assertEquals(None, mvt.getDestinationTotalAssetPrice()) - self.assertEquals(0.0, mvt.getDestinationAssetDebit()) - self.assertEquals(0.0, mvt.getDestinationAssetCredit()) + self.assertEqual(0, mvt.getDestinationInventoriatedTotalAssetDebit()) + self.assertEqual(100, mvt.getDestinationInventoriatedTotalAssetCredit()) + self.assertEqual(-100, mvt.getDestinationInventoriatedTotalAssetPrice()) + self.assertEqual(None, mvt.getSourceTotalAssetPrice()) + self.assertEqual(None, mvt.getDestinationTotalAssetPrice()) + self.assertEqual(0.0, mvt.getDestinationAssetDebit()) + self.assertEqual(0.0, mvt.getDestinationAssetCredit()) def testSourceAssetCredit(self): mvt = self._makeOne() mvt.edit(source_asset_credit=100) - self.assertEquals(100, mvt.getSourceAssetCredit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetDebit()) - self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetCredit()) - self.assertEquals(-100, mvt.getSourceInventoriatedTotalAssetPrice()) + self.assertEqual(100, mvt.getSourceAssetCredit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(0, mvt.getSourceInventoriatedTotalAssetDebit()) + self.assertEqual(100, mvt.getSourceInventoriatedTotalAssetCredit()) + self.assertEqual(-100, mvt.getSourceInventoriatedTotalAssetPrice()) # reset and set quantity instead mvt.edit(source_asset_credit=None, source_credit=200) - self.assertEquals(0.0, mvt.getSourceAssetCredit()) - self.assertEquals(200, mvt.getSourceCredit()) + self.assertEqual(0.0, mvt.getSourceAssetCredit()) + self.assertEqual(200, mvt.getSourceCredit()) # this is only true for Accounting Transaction Line: - self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetDebit()) - self.assertEquals(200, mvt.getSourceInventoriatedTotalAssetCredit()) - self.assertEquals(-200, mvt.getSourceInventoriatedTotalAssetPrice()) + self.assertEqual(0, mvt.getSourceInventoriatedTotalAssetDebit()) + self.assertEqual(200, mvt.getSourceInventoriatedTotalAssetCredit()) + self.assertEqual(-200, mvt.getSourceInventoriatedTotalAssetPrice()) def testSourceAssetDebit(self): mvt = self._makeOne() mvt.edit(source_asset_debit=100) - self.assertEquals(100, mvt.getSourceAssetDebit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetDebit()) - self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetCredit()) - self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetPrice()) + self.assertEqual(100, mvt.getSourceAssetDebit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(100, mvt.getSourceInventoriatedTotalAssetDebit()) + self.assertEqual(0, mvt.getSourceInventoriatedTotalAssetCredit()) + self.assertEqual(100, mvt.getSourceInventoriatedTotalAssetPrice()) # reset and set quantity instead mvt.edit(source_asset_debit=None, source_debit=200) - self.assertEquals(0.0, mvt.getSourceAssetDebit()) - self.assertEquals(200, mvt.getSourceDebit()) + self.assertEqual(0.0, mvt.getSourceAssetDebit()) + self.assertEqual(200, mvt.getSourceDebit()) # this is only true for Accounting Transaction Line: - self.assertEquals(200, mvt.getSourceInventoriatedTotalAssetDebit()) - self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetCredit()) - self.assertEquals(200, mvt.getSourceInventoriatedTotalAssetPrice()) + self.assertEqual(200, mvt.getSourceInventoriatedTotalAssetDebit()) + self.assertEqual(0, mvt.getSourceInventoriatedTotalAssetCredit()) + self.assertEqual(200, mvt.getSourceInventoriatedTotalAssetPrice()) def testDestinationAssetCredit(self): mvt = self._makeOne() mvt.edit(destination_asset_credit=100) - self.assertEquals(100, mvt.getDestinationAssetCredit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetDebit()) - self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetCredit()) - self.assertEquals(-100, mvt.getDestinationInventoriatedTotalAssetPrice()) + self.assertEqual(100, mvt.getDestinationAssetCredit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(0, mvt.getDestinationInventoriatedTotalAssetDebit()) + self.assertEqual(100, mvt.getDestinationInventoriatedTotalAssetCredit()) + self.assertEqual(-100, mvt.getDestinationInventoriatedTotalAssetPrice()) # reset and set quantity instead mvt.edit(destination_asset_credit=None, destination_credit=200) - self.assertEquals(0.0, mvt.getDestinationAssetCredit()) - self.assertEquals(200, mvt.getDestinationCredit()) + self.assertEqual(0.0, mvt.getDestinationAssetCredit()) + self.assertEqual(200, mvt.getDestinationCredit()) # this is only true for Accounting Transaction Line: - self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetDebit()) - self.assertEquals(200, mvt.getDestinationInventoriatedTotalAssetCredit()) - self.assertEquals(-200, mvt.getDestinationInventoriatedTotalAssetPrice()) + self.assertEqual(0, mvt.getDestinationInventoriatedTotalAssetDebit()) + self.assertEqual(200, mvt.getDestinationInventoriatedTotalAssetCredit()) + self.assertEqual(-200, mvt.getDestinationInventoriatedTotalAssetPrice()) def testDestinationAssetDebit(self): mvt = self._makeOne() mvt.edit(destination_asset_debit=100) - self.assertEquals(100, mvt.getDestinationAssetDebit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetDebit()) - self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetCredit()) - self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetPrice()) + self.assertEqual(100, mvt.getDestinationAssetDebit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(100, mvt.getDestinationInventoriatedTotalAssetDebit()) + self.assertEqual(0, mvt.getDestinationInventoriatedTotalAssetCredit()) + self.assertEqual(100, mvt.getDestinationInventoriatedTotalAssetPrice()) # reset and set quantity instead mvt.edit(destination_asset_debit=None, destination_debit=200) - self.assertEquals(0.0, mvt.getDestinationAssetDebit()) - self.assertEquals(200, mvt.getDestinationDebit()) + self.assertEqual(0.0, mvt.getDestinationAssetDebit()) + self.assertEqual(200, mvt.getDestinationDebit()) # this is only true for Accounting Transaction Line: - self.assertEquals(200, mvt.getDestinationInventoriatedTotalAssetDebit()) - self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetCredit()) - self.assertEquals(200, mvt.getDestinationInventoriatedTotalAssetPrice()) + self.assertEqual(200, mvt.getDestinationInventoriatedTotalAssetDebit()) + self.assertEqual(0, mvt.getDestinationInventoriatedTotalAssetCredit()) + self.assertEqual(200, mvt.getDestinationInventoriatedTotalAssetPrice()) def testDestinationAssetDebitCancellation(self): mvt = self._makeOne() mvt.edit(destination_asset_debit=-100) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(-100, mvt.getDestinationAssetDebit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(-100, mvt.getDestinationInventoriatedTotalAssetDebit()) - self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetCredit()) - self.assertEquals(-100, mvt.getDestinationInventoriatedTotalAssetPrice()) + self.assertEqual(-100, mvt.getDestinationAssetDebit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(-100, mvt.getDestinationInventoriatedTotalAssetDebit()) + self.assertEqual(0, mvt.getDestinationInventoriatedTotalAssetCredit()) + self.assertEqual(-100, mvt.getDestinationInventoriatedTotalAssetPrice()) def testDestinationAssetCreditCancellation(self): mvt = self._makeOne() mvt.edit(destination_asset_credit=-100) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(-100, mvt.getDestinationAssetCredit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(-100, mvt.getDestinationInventoriatedTotalAssetCredit()) - self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetDebit()) - self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetPrice()) + self.assertEqual(-100, mvt.getDestinationAssetCredit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(-100, mvt.getDestinationInventoriatedTotalAssetCredit()) + self.assertEqual(0, mvt.getDestinationInventoriatedTotalAssetDebit()) + self.assertEqual(100, mvt.getDestinationInventoriatedTotalAssetPrice()) def testSourceAssetDebitCancellation(self): mvt = self._makeOne() mvt.edit(source_asset_debit=-100) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(-100, mvt.getSourceAssetDebit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(-100, mvt.getSourceInventoriatedTotalAssetDebit()) - self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetCredit()) - self.assertEquals(-100, mvt.getSourceInventoriatedTotalAssetPrice()) + self.assertEqual(-100, mvt.getSourceAssetDebit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(-100, mvt.getSourceInventoriatedTotalAssetDebit()) + self.assertEqual(0, mvt.getSourceInventoriatedTotalAssetCredit()) + self.assertEqual(-100, mvt.getSourceInventoriatedTotalAssetPrice()) def testSourceAssetCreditCancellation(self): mvt = self._makeOne() mvt.edit(source_asset_credit=-100) self.assertTrue(mvt.isCancellationAmount()) - self.assertEquals(-100, mvt.getSourceAssetCredit()) - self.assertEquals(0, mvt.getQuantity()) - self.assertEquals(-100, mvt.getSourceInventoriatedTotalAssetCredit()) - self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetDebit()) - self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetPrice()) + self.assertEqual(-100, mvt.getSourceAssetCredit()) + self.assertEqual(0, mvt.getQuantity()) + self.assertEqual(-100, mvt.getSourceInventoriatedTotalAssetCredit()) + self.assertEqual(0, mvt.getSourceInventoriatedTotalAssetDebit()) + self.assertEqual(100, mvt.getSourceInventoriatedTotalAssetPrice()) def test_suite(): diff --git a/product/ERP5/tests/testApparelModel.py b/product/ERP5/tests/testApparelModel.py index 6c25e27f3c..21bc77346f 100644 --- a/product/ERP5/tests/testApparelModel.py +++ b/product/ERP5/tests/testApparelModel.py @@ -145,7 +145,7 @@ class TestApparelModel(ERP5TypeTestCase): # check the cells have been copied cell_list = apparel_model.contentValues(portal_type = 'Mapped Value') - self.assertEquals(len(cell_list), 2) + self.assertEqual(len(cell_list), 2) acrylique = apparel_model.getCell( 'composition/acrylique', diff --git a/product/ERP5/tests/testApparelTransformation.py b/product/ERP5/tests/testApparelTransformation.py index 2b7325156b..a0938061e2 100644 --- a/product/ERP5/tests/testApparelTransformation.py +++ b/product/ERP5/tests/testApparelTransformation.py @@ -623,7 +623,7 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase): (expected_amount_list_len, actual_amount_list_len, expected['id']) # Check the number of aggregated components - self.assertEquals(actual_amount_list_len, expected_amount_list_len, + self.assertEqual(actual_amount_list_len, expected_amount_list_len, error_msg) # Check quantity for each component @@ -644,7 +644,7 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase): 'amount.categories : %s)' % \ (e_price, a_price, a_amount.getResource(), expected['id'], a_amount.getCategoryList()) - self.failIf(error, error_msg) + self.assertFalse(error, error_msg) # Check duration for each component a_duration = a_amount.getDuration() @@ -663,14 +663,14 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase): (e_duration, a_duration, a_amount.getResource(), expected['id'], a_amount.getCategoryList()) - self.failIf(error, error_msg) + self.assertFalse(error, error_msg) # Check global quantity total_price = aggregated_amount_list.getTotalPrice() error_msg = 'Total price for AggregatedAmountList differs between ' \ 'expected (%s) and aggregated (%s) (%s)' % \ (total_price, expected['total'], expected['id']) - self.assertEquals(round(total_price, 10), round(expected['total'], 10), + self.assertEqual(round(total_price, 10), round(expected['total'], 10), error_msg) # Check global duration @@ -691,7 +691,7 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase): LOG('TEST ERROR :', 0, error_msg) # XXX Is it alright to exit this test with an error without raising # anything? - # self.failIf(error, error_msg) + # self.assertFalse(error, error_msg) def test_01_getAggregatedAmountList(self): diff --git a/product/ERP5/tests/testBPMCore.py b/product/ERP5/tests/testBPMCore.py index 79f1e415af..dac46604f1 100644 --- a/product/ERP5/tests/testBPMCore.py +++ b/product/ERP5/tests/testBPMCore.py @@ -389,16 +389,16 @@ class TestBPMImplementation(TestBPMDummyDeliveryMovementMixin): business_link = self.createBusinessLink() business_link.setSourceValue(source_node) business_link.setSourceSectionValue(source_section_node) - self.assertEquals([source_node], business_link.getSourceValueList()) - self.assertEquals([source_node.getRelativeUrl()], business_link.getSourceList()) - self.assertEquals(source_node.getRelativeUrl(), + self.assertEqual([source_node], business_link.getSourceValueList()) + self.assertEqual([source_node.getRelativeUrl()], business_link.getSourceList()) + self.assertEqual(source_node.getRelativeUrl(), business_link.getSource(default='something')) def test_EmptyBusinessLinkStandardCategoryAccessProvider(self): business_link = self.createBusinessLink() - self.assertEquals(None, business_link.getSourceValue()) - self.assertEquals(None, business_link.getSource()) - self.assertEquals('something', + self.assertEqual(None, business_link.getSourceValue()) + self.assertEqual(None, business_link.getSource()) + self.assertEqual('something', business_link.getSource(default='something')) def test_BusinessPathDynamicCategoryAccessProvider(self): @@ -412,8 +412,8 @@ class TestBPMImplementation(TestBPMDummyDeliveryMovementMixin): context_movement = self.createMovement() context_movement.setSourceValue(source_node) context_movement.setSourceSectionValue(source_section_node) - self.assertEquals(None, business_path.getSourceValue()) - self.assertEquals([source_node.getRelativeUrl()], + self.assertEqual(None, business_path.getSourceValue()) + self.assertEqual([source_node.getRelativeUrl()], business_path.getArrowCategoryDict(context=context_movement)['source']) def test_BusinessPathDynamicCategoryAccessProviderBusinessLinkPrecedence(self): @@ -427,8 +427,8 @@ class TestBPMImplementation(TestBPMDummyDeliveryMovementMixin): context_movement = self.createMovement() context_movement.setSourceValue(movement_node) - self.assertEquals(path_node, business_path.getSourceValue()) - self.assertEquals([path_node.getRelativeUrl()], + self.assertEqual(path_node, business_path.getSourceValue()) + self.assertEqual([path_node.getRelativeUrl()], business_path.getArrowCategoryDict(context=context_movement)['source']) def test_BusinessPathDynamicCategoryAccessProviderEmptyMovement(self): @@ -436,7 +436,7 @@ class TestBPMImplementation(TestBPMDummyDeliveryMovementMixin): business_path.setSourceMethodId('TradeModelPath_getDefaultSourceList') context_movement = self.createMovement() - self.assertEquals(None, business_path.getSourceValue()) + self.assertEqual(None, business_path.getSourceValue()) self.assertFalse(business_path.getArrowCategoryDict(context=context_movement).has_key('source')) def test_BusinessState_getRemainingTradePhaseList(self): @@ -465,14 +465,14 @@ class TestBPMImplementation(TestBPMDummyDeliveryMovementMixin): trade_phase = category_tool.trade_phase.default - self.assertEquals([trade_phase.delivery, + self.assertEqual([trade_phase.delivery, trade_phase.invoicing], business_process.getRemainingTradePhaseList( business_process.order)) - self.assertEquals([trade_phase.invoicing], + self.assertEqual([trade_phase.invoicing], business_process.getRemainingTradePhaseList( business_process.deliver)) - self.assertEquals([], + self.assertEqual([], business_process.getRemainingTradePhaseList( business_process.invoice)) @@ -492,7 +492,7 @@ class TestBPMImplementation(TestBPMDummyDeliveryMovementMixin): self.tic() def checkExpectedDates(explanation, start_date, stop_date, delay_mode=None): - self.assertEquals( + self.assertEqual( self.business_process.getExpectedTradeModelPathStartAndStopDate( explanation, self.delivery_path, delay_mode=delay_mode), (start_date, stop_date)) @@ -545,17 +545,17 @@ class TestBPMImplementation(TestBPMDummyDeliveryMovementMixin): self.tic() def checkIsBusinessLinkBuildable(explanation, business_link, value): - self.assertEquals(self.business_process.isBusinessLinkBuildable( + self.assertEqual(self.business_process.isBusinessLinkBuildable( explanation, business_link), value) # in the beginning only order related movements shall be buildable checkIsBusinessLinkBuildable(self.order, self.delivery_link, True) - self.assertEquals(self.delivery_simulation_movement.isBuildable(), True) - self.assertEquals(self.split_delivery_simulation_movement.isBuildable(), True) + self.assertEqual(self.delivery_simulation_movement.isBuildable(), True) + self.assertEqual(self.split_delivery_simulation_movement.isBuildable(), True) checkIsBusinessLinkBuildable(self.order, self.invoice_link, False) - self.assertEquals(self.invoicing_simulation_movement.isBuildable(), False) - self.assertEquals(self.split_invoicing_simulation_movement.isBuildable(), + self.assertEqual(self.invoicing_simulation_movement.isBuildable(), False) + self.assertEqual(self.split_invoicing_simulation_movement.isBuildable(), False) # add delivery @@ -576,14 +576,14 @@ class TestBPMImplementation(TestBPMDummyDeliveryMovementMixin): # delivery_link (for delivery) is not buildable - delivery is already # built for those movements checkIsBusinessLinkBuildable(self.order, self.delivery_link, True) - self.assertEquals(self.split_delivery_simulation_movement.isBuildable(), True) + self.assertEqual(self.split_delivery_simulation_movement.isBuildable(), True) checkIsBusinessLinkBuildable(delivery, self.delivery_link, False) checkIsBusinessLinkBuildable(delivery, self.invoice_link, False) - self.assertEquals(self.delivery_simulation_movement.isBuildable(), False) - self.assertEquals(self.invoicing_simulation_movement.isBuildable(), False) + self.assertEqual(self.delivery_simulation_movement.isBuildable(), False) + self.assertEqual(self.invoicing_simulation_movement.isBuildable(), False) checkIsBusinessLinkBuildable(self.order, self.invoice_link, False) - self.assertEquals(self.split_invoicing_simulation_movement.isBuildable(), False) + self.assertEqual(self.split_invoicing_simulation_movement.isBuildable(), False) # put delivery in simulation state configured on path (and this state is # available directly on movements) @@ -605,14 +605,14 @@ class TestBPMImplementation(TestBPMDummyDeliveryMovementMixin): # split movement for invoicing is not buildable - no proper delivery # related for previous path checkIsBusinessLinkBuildable(self.order, self.delivery_link, True) - self.assertEquals(self.invoicing_simulation_movement.isBuildable(), True) + self.assertEqual(self.invoicing_simulation_movement.isBuildable(), True) checkIsBusinessLinkBuildable(delivery, self.invoice_link, True) checkIsBusinessLinkBuildable(self.order, self.invoice_link, False) checkIsBusinessLinkBuildable(delivery, self.invoice_link, True) checkIsBusinessLinkBuildable(delivery, self.delivery_link, False) - self.assertEquals(self.delivery_simulation_movement.isBuildable(), False) - self.assertEquals(self.split_invoicing_simulation_movement.isBuildable(), + self.assertEqual(self.delivery_simulation_movement.isBuildable(), False) + self.assertEqual(self.split_invoicing_simulation_movement.isBuildable(), False) def test_isCompleted(self): diff --git a/product/ERP5/tests/testBase.py b/product/ERP5/tests/testBase.py index 769e802a21..e0db062428 100644 --- a/product/ERP5/tests/testBase.py +++ b/product/ERP5/tests/testBase.py @@ -171,7 +171,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): """ object_instance = sequence.get('object_instance') current_title = sequence.get('current_title') - self.assertEquals(object_instance.getTitle(), current_title) + self.assertEqual(object_instance.getTitle(), current_title) def stepSetDifferentTitleValueWithEdit(self, sequence=None, sequence_list=None, **kw): @@ -197,10 +197,10 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): method_id_list = [x.method_id for x in message_list] # XXX FIXME: how many activities should be created normally ? # Sometimes it's one, sometimes 2... - self.failUnless(len(message_list) > 0) - self.failUnless(len(message_list) < 3) + self.assertTrue(len(message_list) > 0) + self.assertTrue(len(message_list) < 3) for method_id in method_id_list: - self.failUnless(method_id in ["immediateReindexObject", + self.assertTrue(method_id in ["immediateReindexObject", "recursiveImmediateReindexObject"]) def stepSetSameTitleValueWithEdit(self, sequence=None, sequence_list=None, @@ -218,7 +218,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): """ portal = self.getPortal() message_list = portal.portal_activities.getMessageList() - self.assertEquals(len(message_list), 0) + self.assertEqual(len(message_list), 0) def test_01_areActivitiesWellLaunchedByPropertyEdit(self, quiet=quiet, run=run_all_test): @@ -301,7 +301,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): """ object_instance = sequence.get('object_instance') current_group_value = sequence.get('current_group_value') - self.assertEquals(object_instance.getGroupValue(), current_group_value) + self.assertEqual(object_instance.getGroupValue(), current_group_value) def stepSetDifferentGroupValueWithEdit(self, sequence=None, sequence_list=None, **kw): @@ -585,7 +585,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): Check if a not defined property is stored on the object_instance. """ object_instance = sequence.get('object_instance') - self.assertEquals(self.not_defined_property_value, + self.assertEqual(self.not_defined_property_value, getattr(object_instance, self.not_defined_property_id)) def stepCheckGetNotDefinedProperty(self, sequence=None, @@ -594,7 +594,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): Check getProperty with a not defined property. """ object_instance = sequence.get('object_instance') - self.assertEquals(self.not_defined_property_value, + self.assertEqual(self.not_defined_property_value, object_instance.getProperty(self.not_defined_property_id)) def stepCheckObjectPortalType(self, sequence=None, @@ -604,7 +604,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): """ object_instance = sequence.get('object_instance') object_instance.getPortalType() - self.assertEquals(self.object_portal_type, + self.assertEqual(self.object_portal_type, object_instance.getPortalType()) def stepCreateTempObject(self, sequence=None, sequence_list=None, **kw): @@ -665,7 +665,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): """ object_instance = sequence.get('object_instance') object_instance.getPortalType() - self.assertEquals(self.temp_class, + self.assertEqual(self.temp_class, object_instance.getPortalType()) def stepSetObjectDefinedProperty(self, sequence=None, @@ -683,7 +683,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): Check if a defined property is stored on the object_instance. """ object_instance = sequence.get('object_instance') - self.assertEquals(self.defined_property_value, + self.assertEqual(self.defined_property_value, getattr(object_instance, self.defined_property_id)) def stepCheckGetDefinedProperty(self, sequence=None, @@ -692,7 +692,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): Check getProperty with a defined property. """ object_instance = sequence.get('object_instance') - self.assertEquals(self.defined_property_value, + self.assertEqual(self.defined_property_value, object_instance.getProperty(self.defined_property_id)) def stepSetObjectNotRelatedProperty(self, sequence=None, @@ -711,7 +711,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): Check if a defined property is stored on the object_instance. """ object_instance = sequence.get('object_instance') - self.assertEquals(self.not_related_to_temp_object_property_value, + self.assertEqual(self.not_related_to_temp_object_property_value, getattr(object_instance, self.not_related_to_temp_object_property_id)) @@ -721,7 +721,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): Check getProperty with a defined property. """ object_instance = sequence.get('object_instance') - self.assertEquals(self.not_related_to_temp_object_property_value, + self.assertEqual(self.not_related_to_temp_object_property_value, object_instance.getProperty( self.not_related_to_temp_object_property_id)) @@ -756,9 +756,9 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): """ object_instance = sequence.get('object_instance') object_instance.edit(title='toto') - self.assertEquals(object_instance.getTitle(),'toto') + self.assertEqual(object_instance.getTitle(),'toto') object_instance.edit(title='tutu') - self.assertEquals(object_instance.getTitle(),'tutu') + self.assertEqual(object_instance.getTitle(),'tutu') def stepSetEditProperty(self, sequence=None, sequence_list=None, **kw): @@ -821,7 +821,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): """ object_instance = sequence.get('object_instance') tales_expression = sequence.get('tales_expression') - self.assertEquals(object_instance.getAcquisitionPortalTypeList(evaluate=0), + self.assertEqual(object_instance.getAcquisitionPortalTypeList(evaluate=0), tales_expression) def stepSetGoodTalesExpression(self, sequence=None, @@ -864,10 +864,10 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): obj = module.newContent(portal_type=portal_type) # XXX title is an empty string by default, but it's still unsure wether it # should be None or '' - self.assertEquals(obj.title, '') - self.assertEquals(obj.getProperty("title"), obj.getId()) - self.assertEquals(obj._baseGetTitle(), obj.getId()) - self.assertEquals(obj.getTitle(), obj.getId()) + self.assertEqual(obj.title, '') + self.assertEqual(obj.getProperty("title"), obj.getId()) + self.assertEqual(obj._baseGetTitle(), obj.getId()) + self.assertEqual(obj.getTitle(), obj.getId()) def test_09_setPropertyDefinedProperty(self, quiet=quiet, run=run_all_test): """Test for setProperty on Base, when the property is defined. @@ -879,11 +879,11 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): obj = module.newContent(portal_type=portal_type) title = 'Object title' obj.setProperty('title', title) - self.assertEquals(obj.getProperty('title'), title) + self.assertEqual(obj.getProperty('title'), title) obj.setProperty('title', title) - self.assertEquals(obj.getProperty('title'), title) + self.assertEqual(obj.getProperty('title'), title) obj.edit(title=title) - self.assertEquals(obj.getProperty('title'), title) + self.assertEqual(obj.getProperty('title'), title) def test_10_setPropertyNotDefinedProperty(self, quiet=quiet, run=run_all_test): @@ -897,11 +897,11 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): property_value = 'Object title' property_name = 'a_dummy_not_exising_property' obj.setProperty(property_name, property_value) - self.assertEquals(obj.getProperty(property_name), property_value) + self.assertEqual(obj.getProperty(property_name), property_value) obj.setProperty(property_name, property_value) - self.assertEquals(obj.getProperty(property_name), property_value) + self.assertEqual(obj.getProperty(property_name), property_value) obj.edit(**{property_name: property_value}) - self.assertEquals(obj.getProperty(property_name), property_value) + self.assertEqual(obj.getProperty(property_name), property_value) def test_11_setPropertyPropertyDefinedOnInstance(self, quiet=quiet, run=run_all_test): @@ -931,7 +931,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): from Products.ERP5Type.Document import newTempOrganisation tmp_object = newTempOrganisation(portal, "a_wonderful_id") tmp_object.edit(title='new title') - self.assertEquals('new title', tmp_object.getTitle()) + self.assertEqual('new title', tmp_object.getTitle()) def test_13_aqDynamicWithNonExistentWorkflow(self, quiet=quiet, run=run_all_test): """Test if _aq_dynamic still works even if an associated workflow @@ -1063,21 +1063,21 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): """Test getViewPermissionOwner method behaviour""" portal = self.getPortal() obj = portal.organisation_module.newContent(portal_type='Organisation') - self.assertEquals(self.username, obj.getViewPermissionOwner()) + self.assertEqual(self.username, obj.getViewPermissionOwner()) def test_getViewPermissionOwnerNoOwnerLocalRole(self): # the actual owner doesn't have Owner local role portal = self.getPortal() obj = portal.organisation_module.newContent(portal_type='Organisation') obj.manage_delLocalRoles(self.username) - self.assertEquals(self.username, obj.getViewPermissionOwner()) + self.assertEqual(self.username, obj.getViewPermissionOwner()) def test_getViewPermissionOwnerNoViewPermission(self): # the owner cannot view the object portal = self.getPortal() obj = portal.organisation_module.newContent(portal_type='Organisation') obj.manage_permission('View', [], 0) - self.assertEquals(None, obj.getViewPermissionOwner()) + self.assertEqual(None, obj.getViewPermissionOwner()) def test_Member_Base_download(self): # tests that members can download files @@ -1101,10 +1101,10 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): basic = '%s:' % self.username response = self.publish('%s/Base_download' % file_document.getPath(), basic=basic) - self.assertEquals(file_document.getData(), response.body) - self.assertEquals('text/plain', + self.assertEqual(file_document.getData(), response.body) + self.assertEqual('text/plain', response.getHeader('content-type').split(';')[0]) - self.assertEquals('attachment; filename="%s"' % os.path.basename(__file__), + self.assertEqual('attachment; filename="%s"' % os.path.basename(__file__), response.getHeader('content-disposition')) def test_getTypeBasedMethod(self): @@ -1187,9 +1187,9 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): self.getPortal().person_module.newContent(portal_type='Person', title='translate_table_test') self.tic() - self.assertEquals(1, len(self.getPortal().portal_catalog( + self.assertEqual(1, len(self.getPortal().portal_catalog( portal_type='Person', title='translate_table_test'))) - self.assertEquals(1, len(self.getPortal().portal_catalog( + self.assertEqual(1, len(self.getPortal().portal_catalog( translated_portal_type='Person', title='translate_table_test'))) def test_TemporaryObjectPublicMethodListForAnonymous(self): @@ -1244,7 +1244,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): person.isIndexable = 0 self.tic() self.assertFalse(person.isIndexable) - self.assertEquals(0, len(self.portal.portal_catalog(uid=person.getUid()))) + self.assertEqual(0, len(self.portal.portal_catalog(uid=person.getUid()))) @skip("isIndexable is not designed to work like tested here, this test \ must be rewritten once we know how to handle correctly templates") @@ -1254,7 +1254,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): person = self.portal.person_module.newContent(portal_type='Person') self.tic() self.assertTrue(person.isIndexable) - self.assertEquals(1, len(self.portal.portal_catalog(uid=person.getUid()))) + self.assertEqual(1, len(self.portal.portal_catalog(uid=person.getUid()))) # edit() will register a reindex activity because isIndexable is # not yet False when edit() is called. @@ -1262,7 +1262,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): person.isIndexable = 0 self.tic() self.assertFalse(person.isIndexable) - self.assertEquals(0, len(self.portal.portal_catalog(uid=person.getUid()))) + self.assertEqual(0, len(self.portal.portal_catalog(uid=person.getUid()))) @skip("isIndexable is not designed to work like tested here, this test \ must be rewritten once we know how to handle correctly templates") @@ -1272,7 +1272,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): person = self.portal.person_module.newContent(portal_type='Person') self.tic() self.assertTrue(person.isIndexable) - self.assertEquals(1, len(self.portal.portal_catalog(uid=person.getUid()))) + self.assertEqual(1, len(self.portal.portal_catalog(uid=person.getUid()))) # edit() will not register a reindex activity because isIndexable # is already False when edit() is called. @@ -1280,7 +1280,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): person.edit() self.tic() self.assertFalse(person.isIndexable) - self.assertEquals(0, len(self.portal.portal_catalog(uid=person.getUid()))) + self.assertEqual(0, len(self.portal.portal_catalog(uid=person.getUid()))) def test_metaWorkflowTransition(self): """Test Meta Transtion, jump from state to another without explicitely @@ -1288,35 +1288,35 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): """ module = self.portal.person_module person = module.newContent(portal_type='Person') - self.assertEquals(person.getValidationState(), 'draft') + self.assertEqual(person.getValidationState(), 'draft') self.assertFalse(self.portal.portal_workflow.isTransitionPossible(person, 'invalidate')) # test low-level implementation self.portal.portal_workflow.validation_workflow._executeMetaTransition( person, 'invalidated') - self.assertEquals(person.getValidationState(), 'invalidated') + self.assertEqual(person.getValidationState(), 'invalidated') validation_history = person.workflow_history['validation_workflow'] - self.assertEquals(len(validation_history), 2) - self.assertEquals(validation_history[-1]['comment'], + self.assertEqual(len(validation_history), 2) + self.assertEqual(validation_history[-1]['comment'], 'Jump from \'draft\' to \'invalidated\'') person = module.newContent(portal_type='Person') - self.assertEquals(person.getValidationState(), 'draft') + self.assertEqual(person.getValidationState(), 'draft') # test high-level implementation self.portal.portal_workflow._jumpToStateFor(person, 'invalidated') - self.assertEquals(person.getValidationState(), 'invalidated') + self.assertEqual(person.getValidationState(), 'invalidated') person = module.newContent(portal_type='Person') - self.assertEquals(person.getValidationState(), 'draft') + self.assertEqual(person.getValidationState(), 'draft') self.portal.portal_workflow._jumpToStateFor(person, 'invalidated', wf_id='validation_workflow') - self.assertEquals(person.getValidationState(), 'invalidated') + self.assertEqual(person.getValidationState(), 'invalidated') person = module.newContent(portal_type='Person') - self.assertEquals(person.getValidationState(), 'draft') + self.assertEqual(person.getValidationState(), 'draft') self.assertRaises(WorkflowException, self.portal.portal_workflow._jumpToStateFor, person, 'invalidated', wf_id='edit_workflow') - self.assertEquals(person.getValidationState(), 'draft') + self.assertEqual(person.getValidationState(), 'draft') class TestERP5PropertyManager(unittest.TestCase): @@ -1337,17 +1337,17 @@ class TestERP5PropertyManager(unittest.TestCase): ob._setProperty('a_dummy_property', dummy_property_value) # the property appears in property map - self.failUnless('a_dummy_property' in [x['id'] for x in ob.propertyMap()]) + self.assertTrue('a_dummy_property' in [x['id'] for x in ob.propertyMap()]) # the value and can be retrieved using getProperty - self.assertEquals(ob.getProperty('a_dummy_property'), dummy_property_value) + self.assertEqual(ob.getProperty('a_dummy_property'), dummy_property_value) # the value is also stored as a class attribute - self.assertEquals(ob.a_dummy_property, dummy_property_value) + self.assertEqual(ob.a_dummy_property, dummy_property_value) def test_setPropertyExistingProperty(self): """_setProperty raises an error if the property already exists.""" ob = self._makeOne('ob') # make sure that title property exists - self.failUnless('title' in [x['id'] for x in ob.propertyMap()]) + self.assertTrue('title' in [x['id'] for x in ob.propertyMap()]) # trying to call _setProperty will with an existing property raises: # BadRequest: Invalid or duplicate property id: title self.assertRaises(BadRequest, ob._setProperty, 'title', 'property value') @@ -1357,20 +1357,20 @@ class TestERP5PropertyManager(unittest.TestCase): """ ob = self._makeOne('ob') # make sure that title property exists - self.failUnless('title' in [x['id'] for x in ob.propertyMap()]) + self.assertTrue('title' in [x['id'] for x in ob.propertyMap()]) prop_value = 'title value' ob._updateProperty('title', prop_value) - self.assertEquals(ob.getProperty('title'), prop_value) - self.assertEquals(ob.title, prop_value) + self.assertEqual(ob.getProperty('title'), prop_value) + self.assertEqual(ob.title, prop_value) def test_setPropertyTypeInt(self): """You can specify the type of the property in _setProperty""" ob = self._makeOne('ob') dummy_property_value = 3 ob._setProperty('a_dummy_property', dummy_property_value, type='int') - self.assertEquals(['int'], [x['type'] for x in ob.propertyMap() + self.assertEqual(['int'], [x['type'] for x in ob.propertyMap() if x['id'] == 'a_dummy_property']) - self.assertEquals(type(ob.getProperty('a_dummy_property')), type(1)) + self.assertEqual(type(ob.getProperty('a_dummy_property')), type(1)) def test_setPropertyTALESType(self): """ERP5PropertyManager can use TALES Type for properties, TALES will then @@ -1379,7 +1379,7 @@ class TestERP5PropertyManager(unittest.TestCase): ob = self._makeOne('ob') dummy_property_value = 'python: 1+2' ob._setProperty('a_dummy_property', dummy_property_value, type='tales') - self.assertEquals(ob.getProperty('a_dummy_property'), 1+2) + self.assertEqual(ob.getProperty('a_dummy_property'), 1+2) def test_setPropertyTypeDate(self): """You can specify the type of the property in _setProperty""" @@ -1387,50 +1387,50 @@ class TestERP5PropertyManager(unittest.TestCase): from DateTime import DateTime dummy_property_value = DateTime() ob._setProperty('a_dummy_property', dummy_property_value, type='date') - self.assertEquals(['date'], [x['type'] for x in ob.propertyMap() + self.assertEqual(['date'], [x['type'] for x in ob.propertyMap() if x['id'] == 'a_dummy_property']) - self.assertEquals(type(ob.getProperty('a_dummy_property')), type(DateTime())) + self.assertEqual(type(ob.getProperty('a_dummy_property')), type(DateTime())) #Set Property without type argument ob._setProperty('a_second_dummy_property', dummy_property_value) - self.assertEquals(['date'], [x['type'] for x in ob.propertyMap() + self.assertEqual(['date'], [x['type'] for x in ob.propertyMap() if x['id'] == 'a_second_dummy_property']) - self.assertEquals(type(ob.getProperty('a_second_dummy_property')), + self.assertEqual(type(ob.getProperty('a_second_dummy_property')), type(DateTime())) def test_setPropertyTypeLines(self): ob = self._makeOne('ob') ob._setProperty('a_dummy_list_property', ('1', '2'), type='lines') - self.assertEquals(['lines'], [x['type'] for x in ob.propertyMap() + self.assertEqual(['lines'], [x['type'] for x in ob.propertyMap() if x['id'] == 'a_dummy_list_property']) - self.assertEquals(ob.getProperty('a_dummy_list_property'), ('1', '2')) + self.assertEqual(ob.getProperty('a_dummy_list_property'), ('1', '2')) #Set Property without type argument ob._setProperty('a_second_dummy_property_list', ('3', '4')) - self.assertEquals(['lines'], [x['type'] for x in ob.propertyMap() + self.assertEqual(['lines'], [x['type'] for x in ob.propertyMap() if x['id'] == 'a_second_dummy_property_list']) - self.assertEquals(ob.getProperty('a_second_dummy_property_list'), + self.assertEqual(ob.getProperty('a_second_dummy_property_list'), ('3', '4')) # same, but passing a list, not a tuple ob._setProperty('a_third_dummy_property_list', ['5', '6']) - self.assertEquals(['lines'], [x['type'] for x in ob.propertyMap() + self.assertEqual(['lines'], [x['type'] for x in ob.propertyMap() if x['id'] == 'a_third_dummy_property_list']) - self.assertEquals(ob.getProperty('a_third_dummy_property_list'), + self.assertEqual(ob.getProperty('a_third_dummy_property_list'), ('5', '6')) def test_getPropertyNonExistantProps(self): """getProperty return None if the value is not found. """ ob = self._makeOne('ob') - self.assertEquals(ob.getProperty('a_dummy_property'), None) + self.assertEqual(ob.getProperty('a_dummy_property'), None) def test_getPropertyDefaultValue(self): """getProperty accepts a default value, if the property is not defined. """ ob = self._makeOne('ob') - self.assertEquals(ob.getProperty('a_dummy_property', 100), 100) + self.assertEqual(ob.getProperty('a_dummy_property', 100), 100) prop_value = 3 ob._setProperty('a_dummy_property', prop_value) - self.assertEquals(ob.getProperty('a_dummy_property', 100), prop_value) + self.assertEqual(ob.getProperty('a_dummy_property', 100), prop_value) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testBudget.py b/product/ERP5/tests/testBudget.py index c916f9c73d..7b910181f1 100644 --- a/product/ERP5/tests/testBudget.py +++ b/product/ERP5/tests/testBudget.py @@ -79,14 +79,14 @@ class TestBudget(ERP5TypeTestCase): inventory_axis='node_category', variation_base_category='site', ) - self.assertEquals([], budget_model.checkConsistency()) + self.assertEqual([], budget_model.checkConsistency()) def test_simple_create_budget(self): budget = self.portal.budget_module.newContent( portal_type='Budget') budget_line = budget.newContent(portal_type='Budget Line') budget_cell = budget_line.newContent(portal_type='Budget Cell') - self.assertEquals([], budget.checkConsistency()) + self.assertEqual([], budget.checkConsistency()) def test_budget_cell_node_variation_with_aggregate(self): budget_model = self.portal.budget_model_module.newContent( @@ -105,22 +105,22 @@ class TestBudget(ERP5TypeTestCase): portal_type='Budget', specialise_value=budget_model) budget_line = budget.newContent(portal_type='Budget Line') - self.assertEquals(['source'], + self.assertEqual(['source'], budget_line.getVariationBaseCategoryList()) - self.assertEquals( + self.assertEqual( [('Goods Purchase', 'source/account_module/goods_purchase'), ('Fixed Assets', 'source/account_module/fixed_assets')], budget_line.BudgetLine_getVariationRangeCategoryList()) budget_line.setVariationCategoryList( ('source/account_module/goods_purchase',)) - self.assertEquals( + self.assertEqual( ['source/account_module/goods_purchase'], budget_line.getVariationCategoryList()) # This was a budget cell variation, so no criterion is set on budget line - self.assertEquals(budget_line.getMembershipCriterionCategoryList(), []) - self.assertEquals( + self.assertEqual(budget_line.getMembershipCriterionCategoryList(), []) + self.assertEqual( budget_line.getMembershipCriterionBaseCategoryList(), []) @@ -141,20 +141,20 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(1, len(budget_line.contentValues())) + self.assertEqual(1, len(budget_line.contentValues())) budget_cell = budget_line.getCell('source/account_module/goods_purchase') self.assertNotEquals(None, budget_cell) - self.assertEquals(['source/account_module/goods_purchase'], + self.assertEqual(['source/account_module/goods_purchase'], budget_cell.getMembershipCriterionCategoryList()) - self.assertEquals(5, budget_cell.getQuantity()) + self.assertEqual(5, budget_cell.getQuantity()) # there is no budget consumption - self.assertEquals(0, budget_cell.getConsumedBudget()) - self.assertEquals(0, budget_cell.getEngagedBudget()) - self.assertEquals(5, budget_cell.getAvailableBudget()) + self.assertEqual(0, budget_cell.getConsumedBudget()) + self.assertEqual(0, budget_cell.getEngagedBudget()) + self.assertEqual(5, budget_cell.getAvailableBudget()) # there is no budget transfer - self.assertEquals(5, budget_cell.getCurrentBalance()) + self.assertEqual(5, budget_cell.getCurrentBalance()) def test_category_budget_cell_variation(self): @@ -170,7 +170,7 @@ class TestBudget(ERP5TypeTestCase): portal_type='Budget', specialise_value=budget_model) budget_line = budget.newContent(portal_type='Budget Line') - self.assertEquals(['account_type'], + self.assertEqual(['account_type'], budget_line.getVariationBaseCategoryList()) variation_range_category_list = \ @@ -194,7 +194,7 @@ class TestBudget(ERP5TypeTestCase): specialise_value=budget_model) budget_line = budget.newContent(portal_type='Budget Line') - self.assertEquals(['group'], + self.assertEqual(['group'], budget_line.getVariationBaseCategoryList()) variation_range_category_list = \ @@ -204,9 +204,9 @@ class TestBudget(ERP5TypeTestCase): self.assertTrue(['Demo Group', 'group/demo_group'] in variation_range_category_list) budget_line.edit(variation_category_list=['group/demo_group']) - self.assertEquals(['group'], + self.assertEqual(['group'], budget_line.getMembershipCriterionBaseCategoryList()) - self.assertEquals(['group/demo_group'], + self.assertEqual(['group/demo_group'], budget_line.getMembershipCriterionCategoryList()) def test_category_budget_line_and_budget_cell_variation(self): @@ -231,14 +231,14 @@ class TestBudget(ERP5TypeTestCase): specialise_value=budget_model) budget_line = budget.newContent(portal_type='Budget Line') - self.assertEquals(['group', 'account_type'], + self.assertEqual(['group', 'account_type'], budget_line.getVariationBaseCategoryList()) budget_line.edit(variation_category_list=['group/demo_group', 'account_type/expense']) - self.assertEquals(['group'], + self.assertEqual(['group'], budget_line.getMembershipCriterionBaseCategoryList()) - self.assertEquals(['group/demo_group'], + self.assertEqual(['group/demo_group'], budget_line.getMembershipCriterionCategoryList()) form = budget_line.BudgetLine_view @@ -256,11 +256,11 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(1, len(budget_line.contentValues())) + self.assertEqual(1, len(budget_line.contentValues())) budget_cell = budget_line.getCell('account_type/expense') - self.assertEquals(['account_type'], + self.assertEqual(['account_type'], budget_cell.getMembershipCriterionBaseCategoryList()) - self.assertEquals(['account_type/expense'], + self.assertEqual(['account_type/expense'], budget_cell.getMembershipCriterionCategoryList()) @@ -277,7 +277,7 @@ class TestBudget(ERP5TypeTestCase): portal_type='Budget', specialise_value=budget_model) - self.assertEquals(['group'], + self.assertEqual(['group'], budget.getVariationBaseCategoryList()) variation_range_category_list = \ @@ -288,8 +288,8 @@ class TestBudget(ERP5TypeTestCase): # setting this variation on the budget also sets membership budget.edit(variation_category_list=['group/demo_group']) - self.assertEquals('demo_group', budget.getGroup()) - self.assertEquals('Demo Group', budget.getGroupTitle()) + self.assertEqual('demo_group', budget.getGroup()) + self.assertEqual('Demo Group', budget.getGroupTitle()) # consumptions def test_simple_consumption(self): @@ -361,11 +361,11 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(2, len(budget_line.contentValues())) + self.assertEqual(2, len(budget_line.contentValues())) budget_cell = budget_line.getCell('source/account_module/goods_purchase', 'account_type/expense') self.assertNotEquals(None, budget_cell) - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_category=['account_type/expense'], @@ -376,7 +376,7 @@ class TestBudget(ERP5TypeTestCase): budget_cell = budget_line.getCell('source/account_module/fixed_assets', 'account_type/asset') self.assertNotEquals(None, budget_cell) - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_category=['account_type/asset'], @@ -384,7 +384,7 @@ class TestBudget(ERP5TypeTestCase): section_category=['group/demo_group'],), budget_model.getInventoryQueryDict(budget_cell)) - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_category=['account_type/expense', 'account_type/asset'], @@ -416,14 +416,14 @@ class TestBudget(ERP5TypeTestCase): # a confirmed transaction engages budget self.tic() - self.assertEquals(dict(), budget_line.getConsumedBudgetDict()) + self.assertEqual(dict(), budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'account_type/asset'): -100.0, ('source/account_module/goods_purchase', 'account_type/expense'): 100.0}, budget_line.getEngagedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'account_type/asset'): 102.0, ('source/account_module/goods_purchase', 'account_type/expense'): -99.0}, budget_line.getAvailableBudgetDict()) @@ -432,17 +432,17 @@ class TestBudget(ERP5TypeTestCase): # a stopped transaction consumes budget self.tic() - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'account_type/asset'): -100.0, ('source/account_module/goods_purchase', 'account_type/expense'): 100.0}, budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'account_type/asset'): -100.0, ('source/account_module/goods_purchase', 'account_type/expense'): 100.0}, budget_line.getEngagedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'account_type/asset'): 102.0, ('source/account_module/goods_purchase', 'account_type/expense'): -99.0}, budget_line.getAvailableBudgetDict()) @@ -522,9 +522,9 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(2, len(budget_line.contentValues())) + self.assertEqual(2, len(budget_line.contentValues())) - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_category_strict_membership=['account_type/expense', @@ -554,17 +554,17 @@ class TestBudget(ERP5TypeTestCase): self.tic() - self.assertEquals( + self.assertEqual( {('source/budget_special_node/all_other', 'account_type/asset'): -100.0, ('source/account_module/goods_purchase', 'account_type/expense'): 100.0}, budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/budget_special_node/all_other', 'account_type/asset'): -100.0, ('source/account_module/goods_purchase', 'account_type/expense'): 100.0}, budget_line.getEngagedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/budget_special_node/all_other', 'account_type/asset'): 102.0, ('source/account_module/goods_purchase', 'account_type/expense'): -99.0}, budget_line.getAvailableBudgetDict()) @@ -624,22 +624,22 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(2, len(budget_line.contentValues())) + self.assertEqual(2, len(budget_line.contentValues())) class ReferenceQuery: """Helper class to compare queries """ def __eq__(me, query): self.assertTrue(isinstance(query, ComplexQuery)) - self.assertEquals(query.logical_operator, 'or') - self.assertEquals(2, len(query.query_list)) - self.assertEquals(query.query_list[0].kw, {'project_uid': None}) - self.assertEquals(query.query_list[1].kw, + self.assertEqual(query.logical_operator, 'or') + self.assertEqual(2, len(query.query_list)) + self.assertEqual(query.query_list[0].kw, {'project_uid': None}) + self.assertEqual(query.query_list[1].kw, {'project_uid': [self.portal.organisation_module.my_organisation.getUid()]}) return True - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_category_strict_membership=['account_type/expense',], @@ -667,12 +667,12 @@ class TestBudget(ERP5TypeTestCase): self.tic() - self.assertEquals( + self.assertEqual( {('source_project/organisation_module/my_organisation',): 200.0, ('source_project/budget_special_node/none',): -300.0 }, budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source_project/organisation_module/my_organisation',): 200.0, ('source_project/budget_special_node/none',): -300.0 }, budget_line.getEngagedBudgetDict()) @@ -728,17 +728,17 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(1, len(budget_line.contentValues())) + self.assertEqual(1, len(budget_line.contentValues())) class ReferenceQuery: """Helper class to compare queries """ def __eq__(me, query): self.assertTrue(isinstance(query, Query)) - self.assertEquals(query.kw, {'project_uid': None}) + self.assertEqual(query.kw, {'project_uid': None}) return True - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_category_strict_membership=['account_type/expense',], @@ -749,7 +749,7 @@ class TestBudget(ERP5TypeTestCase): budget_model.getInventoryListQueryDict(budget_line)) budget_cell = budget_line.contentValues()[0] - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_category_strict_membership=['account_type/expense',], @@ -775,15 +775,15 @@ class TestBudget(ERP5TypeTestCase): self.tic() - self.assertEquals( + self.assertEqual( {('source_project/budget_special_node/none',): -300.0 }, budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source_project/budget_special_node/none',): -300.0 }, budget_line.getEngagedBudgetDict()) - self.assertEquals(-300, budget_cell.getConsumedBudget()) + self.assertEqual(-300, budget_cell.getConsumedBudget()) def test_none_and_all_others_virtual_nodes_together(self): # tests consumptions, by using "none" and "all other" virtual nodes @@ -843,9 +843,9 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(3, len(budget_line.contentValues())) + self.assertEqual(3, len(budget_line.contentValues())) - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_category_strict_membership=['account_type/expense',], @@ -879,13 +879,13 @@ class TestBudget(ERP5TypeTestCase): self.tic() - self.assertEquals( + self.assertEqual( {('source_project/organisation_module/my_organisation',): 200.0, ('source_project/budget_special_node/all_other',): -80.0, ('source_project/budget_special_node/none',): -120.0 }, budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source_project/organisation_module/my_organisation',): 200.0, ('source_project/budget_special_node/all_other',): -80.0, ('source_project/budget_special_node/none',): -120.0 @@ -957,23 +957,23 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(1, len(budget_line.contentValues())) + self.assertEqual(1, len(budget_line.contentValues())) # At this time there are no consumption, so consumption and definition cell # ranges are all the same. default_cell_range = [['source/account_module/goods_purchase'], ['account_type/asset', 'account_type/expense']] - self.assertEquals(default_cell_range, + self.assertEqual(default_cell_range, budget_line.BudgetLine_asCellRange('cell')) - self.assertEquals(default_cell_range, + self.assertEqual(default_cell_range, budget_line.BudgetLine_asCellRange('consumed')) - self.assertEquals(default_cell_range, + self.assertEqual(default_cell_range, budget_line.BudgetLine_asCellRange('engaged')) - self.assertEquals(default_cell_range, + self.assertEqual(default_cell_range, budget_line.BudgetLine_asCellRange('available')) - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_category_strict_membership=['account_type/expense', @@ -1009,34 +1009,34 @@ class TestBudget(ERP5TypeTestCase): consumption_cell_range = [['source/account_module/goods_purchase', 'source/account_module/fixed_assets'], ['account_type/asset', 'account_type/expense']] - self.assertEquals(default_cell_range, + self.assertEqual(default_cell_range, budget_line.BudgetLine_asCellRange('cell')) - self.assertEquals(consumption_cell_range, + self.assertEqual(consumption_cell_range, budget_line.BudgetLine_asCellRange('consumed')) - self.assertEquals(consumption_cell_range, + self.assertEqual(consumption_cell_range, budget_line.BudgetLine_asCellRange('engaged')) - self.assertEquals(consumption_cell_range, + self.assertEqual(consumption_cell_range, budget_line.BudgetLine_asCellRange('available')) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'account_type/asset'): -100.0, ('source/account_module/goods_purchase', 'account_type/expense'): 100.0}, budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'account_type/asset'): -100.0, ('source/account_module/goods_purchase', 'account_type/expense'): 100.0}, budget_line.getEngagedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'account_type/asset'): 100.0, ('source/account_module/goods_purchase', 'account_type/expense'): -99.0}, budget_line.getAvailableBudgetDict()) cell = budget_line.getCell('source/account_module/goods_purchase', 'account_type/expense') - self.assertEquals(100, cell.getConsumedBudget()) - self.assertEquals(100, cell.getEngagedBudget()) + self.assertEqual(100, cell.getConsumedBudget()) + self.assertEqual(100, cell.getEngagedBudget()) def test_full_consumption_detail_category_variation(self): # tests consumptions, by using "full consumption detail" on a category @@ -1105,7 +1105,7 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(1, len(budget_line.contentValues())) + self.assertEqual(1, len(budget_line.contentValues())) # At this time there are no consumption, so consumption and definition cell # ranges are all the same. @@ -1113,16 +1113,16 @@ class TestBudget(ERP5TypeTestCase): 'source/account_module/fixed_assets'], ['account_type/expense']] - self.assertEquals(default_cell_range, + self.assertEqual(default_cell_range, budget_line.BudgetLine_asCellRange('cell')) - self.assertEquals(default_cell_range, + self.assertEqual(default_cell_range, budget_line.BudgetLine_asCellRange('consumed')) - self.assertEquals(default_cell_range, + self.assertEqual(default_cell_range, budget_line.BudgetLine_asCellRange('engaged')) - self.assertEquals(default_cell_range, + self.assertEqual(default_cell_range, budget_line.BudgetLine_asCellRange('available')) - if 0 :self.assertEquals( + if 0 :self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), #node_category_strict_membership=['account_type/expense', @@ -1160,35 +1160,35 @@ class TestBudget(ERP5TypeTestCase): consumption_cell_range = [['source/account_module/goods_purchase', 'source/account_module/fixed_assets'], ['account_type/asset', 'account_type/expense']] - self.assertEquals(default_cell_range, + self.assertEqual(default_cell_range, budget_line.BudgetLine_asCellRange('cell')) - self.assertEquals(consumption_cell_range, + self.assertEqual(consumption_cell_range, budget_line.BudgetLine_asCellRange('consumed')) - self.assertEquals(consumption_cell_range, + self.assertEqual(consumption_cell_range, budget_line.BudgetLine_asCellRange('engaged')) - self.assertEquals(consumption_cell_range, + self.assertEqual(consumption_cell_range, budget_line.BudgetLine_asCellRange('available')) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'account_type/asset'): -100.0, ('source/account_module/goods_purchase', 'account_type/expense'): 100.0}, budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'account_type/asset'): -100.0, ('source/account_module/goods_purchase', 'account_type/expense'): 100.0}, budget_line.getEngagedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'account_type/asset'): 100.0, ('source/account_module/goods_purchase', 'account_type/expense'): -99.0}, budget_line.getAvailableBudgetDict()) cell = budget_line.getCell('source/account_module/goods_purchase', 'account_type/expense') - self.assertEquals(100, cell.getConsumedBudget()) - self.assertEquals(100, cell.getEngagedBudget()) + self.assertEqual(100, cell.getConsumedBudget()) + self.assertEqual(100, cell.getEngagedBudget()) def test_consumption_movement_category(self): # test for budget consumption using movement category @@ -1266,13 +1266,13 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(2, len(budget_line.contentValues())) + self.assertEqual(2, len(budget_line.contentValues())) product_line_1 = self.portal.portal_categories.product_line['1'] product_line_1_11 = product_line_1['1.1'] product_line_1_12 = product_line_1['1.2'] - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_uid=[self.portal.account_module.goods_purchase.getUid(), @@ -1310,7 +1310,7 @@ class TestBudget(ERP5TypeTestCase): self.tic() - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'product_line/1/1.2'): -100.0, ('source/account_module/goods_purchase', 'product_line/1/1.1'): 100.0, # summary lines are automatically added @@ -1319,7 +1319,7 @@ class TestBudget(ERP5TypeTestCase): }, budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'product_line/1/1.2'): -100.0, ('source/account_module/goods_purchase', 'product_line/1/1.1'): 100.0, ('source/account_module/fixed_assets', 'product_line/1'): -100.0, @@ -1327,7 +1327,7 @@ class TestBudget(ERP5TypeTestCase): }, budget_line.getEngagedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/account_module/fixed_assets', 'product_line/1/1.2'): 100.0, ('source/account_module/goods_purchase', 'product_line/1/1.1'): -98.0, ('source/account_module/fixed_assets', 'product_line/1'): 100.0, @@ -1388,9 +1388,9 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(1, len(budget_line.contentValues())) + self.assertEqual(1, len(budget_line.contentValues())) - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_uid=[self.portal.account_module.goods_purchase.getUid(),], @@ -1419,12 +1419,12 @@ class TestBudget(ERP5TypeTestCase): self.tic() - self.assertEquals( + self.assertEqual( {('group/demo_group/sub1', 'source/account_module/goods_purchase'): 100.0, ('group/demo_group', 'source/account_module/goods_purchase'): 100.0,}, budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('group/demo_group/sub1', 'source/account_module/goods_purchase'): 100.0, ('group/demo_group', 'source/account_module/goods_purchase'): 100.0,}, budget_line.getEngagedBudgetDict()) @@ -1479,9 +1479,9 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(1, len(budget_line.contentValues())) + self.assertEqual(1, len(budget_line.contentValues())) - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), section_category=['group/demo_group/sub1',], @@ -1507,11 +1507,11 @@ class TestBudget(ERP5TypeTestCase): self.tic() - self.assertEquals( + self.assertEqual( {('group/demo_group/sub1', ): 0.0, }, budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('group/demo_group/sub1', ): 0.0, }, budget_line.getEngagedBudgetDict()) @@ -1565,9 +1565,9 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(1, len(budget_line.contentValues())) + self.assertEqual(1, len(budget_line.contentValues())) - self.assertEquals( + self.assertEqual( dict(from_date=DateTime(2000, 1, 1), at_date=DateTime(2000, 12, 31).latestTime(), node_uid=[self.portal.account_module.goods_purchase.getUid(),], @@ -1593,11 +1593,11 @@ class TestBudget(ERP5TypeTestCase): self.tic() - self.assertEquals( + self.assertEqual( {('source/account_module/goods_purchase', ): 100.0, }, budget_line.getConsumedBudgetDict()) - self.assertEquals( + self.assertEqual( {('source/account_module/goods_purchase', ): 100.0, }, budget_line.getEngagedBudgetDict()) @@ -1643,7 +1643,7 @@ class TestBudget(ERP5TypeTestCase): 'source/account_module/goods_purchase', 'source/account_module/fixed_assets', ]) - self.assertEquals({ + self.assertEqual({ 'from_date': None, 'group_by_node': True, 'group_by_section_category': True, @@ -1653,7 +1653,7 @@ class TestBudget(ERP5TypeTestCase): self.portal.account_module.fixed_assets.getUid()], }, budget_model.getInventoryListQueryDict(budget_line)) - self.assertEquals({ + self.assertEqual({ 'from_date': None, 'simulation_state': ('delivered', 'stopped', 'started'), 'transit_simulation_state': ('started', ), @@ -1757,56 +1757,56 @@ class TestBudget(ERP5TypeTestCase): line_list, line_count = budget.Budget_getBudgetConsumptionReportData() # the number of lines, which will be used in the report to set the print # range - self.assertEquals(6, line_count) + self.assertEqual(6, line_count) # number of line can be different from the length of the line list, because # line list is a recursive structure. - self.assertEquals(4, len(line_list)) + self.assertEqual(4, len(line_list)) # first line is for the title of the budget - self.assertEquals('Budget Title', line_list[0]['title']) + self.assertEqual('Budget Title', line_list[0]['title']) self.assertTrue(line_list[0]['is_budget']) # then we have a first level for budget lines - self.assertEquals('Budget Line Title', line_list[1]['title']) + self.assertEqual('Budget Line Title', line_list[1]['title']) self.assertTrue(line_list[1]['is_level_1']) # we can see global consumptions for the budget - self.assertEquals(200, line_list[2]['initial_budget']) - self.assertEquals(200, line_list[2]['current_budget']) - self.assertEquals(100, line_list[2]['consumed_budget']) - self.assertEquals(100, line_list[2]['engaged_budget']) - self.assertEquals(.5, line_list[2]['consumed_ratio']) + self.assertEqual(200, line_list[2]['initial_budget']) + self.assertEqual(200, line_list[2]['current_budget']) + self.assertEqual(100, line_list[2]['consumed_budget']) + self.assertEqual(100, line_list[2]['engaged_budget']) + self.assertEqual(.5, line_list[2]['consumed_ratio']) # the dimensions are reversed in the budget report, so on level 2 we have # the last dimension from cell range, here "account type" - self.assertEquals('Asset', line_list[2]['title']) + self.assertEqual('Asset', line_list[2]['title']) # we can see global consumptions for that summary line - self.assertEquals(200, line_list[2]['initial_budget']) - self.assertEquals(200, line_list[2]['current_budget']) - self.assertEquals(100, line_list[2]['consumed_budget']) - self.assertEquals(100, line_list[2]['engaged_budget']) - self.assertEquals(.5, line_list[2]['consumed_ratio']) + self.assertEqual(200, line_list[2]['initial_budget']) + self.assertEqual(200, line_list[2]['current_budget']) + self.assertEqual(100, line_list[2]['consumed_budget']) + self.assertEqual(100, line_list[2]['engaged_budget']) + self.assertEqual(.5, line_list[2]['consumed_ratio']) # no we have a recursive list, for the next dimension: node. self.assertTrue(isinstance(line_list[3], list)) - self.assertEquals(3, len(line_list[3])) + self.assertEqual(3, len(line_list[3])) # first is again a title XXX why ?? - self.assertEquals('Asset', line_list[3][0]['title']) + self.assertEqual('Asset', line_list[3][0]['title']) # then we have two level 3 cells self.assertTrue(line_list[3][1]['is_level_3']) - self.assertEquals('Goods Purchase', line_list[3][1]['title']) - self.assertEquals(0, line_list[3][1]['initial_budget']) - self.assertEquals(0, line_list[3][1]['current_budget']) - self.assertEquals(0, line_list[3][1]['consumed_budget']) - self.assertEquals(0, line_list[3][1]['engaged_budget']) - self.assertEquals(0, line_list[3][1]['consumed_ratio']) - - self.assertEquals('Fixed Assets', line_list[3][2]['title']) - self.assertEquals(200, line_list[3][2]['initial_budget']) - self.assertEquals(200, line_list[3][2]['current_budget']) - self.assertEquals(100, line_list[3][2]['consumed_budget']) - self.assertEquals(100, line_list[3][2]['engaged_budget']) - self.assertEquals(.5, line_list[3][2]['consumed_ratio']) + self.assertEqual('Goods Purchase', line_list[3][1]['title']) + self.assertEqual(0, line_list[3][1]['initial_budget']) + self.assertEqual(0, line_list[3][1]['current_budget']) + self.assertEqual(0, line_list[3][1]['consumed_budget']) + self.assertEqual(0, line_list[3][1]['engaged_budget']) + self.assertEqual(0, line_list[3][1]['consumed_ratio']) + + self.assertEqual('Fixed Assets', line_list[3][2]['title']) + self.assertEqual(200, line_list[3][2]['initial_budget']) + self.assertEqual(200, line_list[3][2]['current_budget']) + self.assertEqual(100, line_list[3][2]['consumed_budget']) + self.assertEqual(100, line_list[3][2]['engaged_budget']) + self.assertEqual(.5, line_list[3][2]['consumed_ratio']) # validate report ODF from Products.ERP5OOo.tests.utils import Validator @@ -1945,59 +1945,59 @@ class TestBudget(ERP5TypeTestCase): budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(6, len(budget_line.contentValues())) + self.assertEqual(6, len(budget_line.contentValues())) budget_line.BudgetLine_setQuantityOnSummaryCellList() # summary cells have been created: - self.assertEquals(14, len(budget_line.contentValues())) + self.assertEqual(14, len(budget_line.contentValues())) # those cells are aggregating - self.assertEquals(1+2, budget_line.getCell( + self.assertEqual(1+2, budget_line.getCell( 'product_line/1', 'source/account_module/goods_purchase', 'group/demo_group/sub1',).getQuantity()) - self.assertEquals(4+3, budget_line.getCell( + self.assertEqual(4+3, budget_line.getCell( 'product_line/1', 'source/account_module/fixed_assets', 'group/demo_group/sub1',).getQuantity()) - self.assertEquals(1+5, budget_line.getCell( + self.assertEqual(1+5, budget_line.getCell( 'product_line/1/1.1', 'source/account_module/goods_purchase', 'group/demo_group',).getQuantity()) - self.assertEquals(1+2+5, budget_line.getCell( + self.assertEqual(1+2+5, budget_line.getCell( 'product_line/1', 'source/account_module/goods_purchase', 'group/demo_group',).getQuantity()) # the cell that we have modified is erased - self.assertEquals(4, budget_line.getCell( + self.assertEqual(4, budget_line.getCell( 'product_line/1/1.2', 'source/account_module/fixed_assets', 'group/demo_group',).getQuantity()) # test all cells for complete coverage - self.assertEquals(6, budget_line.getCell( + self.assertEqual(6, budget_line.getCell( 'product_line/1/1.1', 'source/account_module/goods_purchase', 'group/demo_group',).getQuantity()) - self.assertEquals(2, budget_line.getCell( + self.assertEqual(2, budget_line.getCell( 'product_line/1/1.2', 'source/account_module/goods_purchase', 'group/demo_group',).getQuantity()) - self.assertEquals(3+4, budget_line.getCell( + self.assertEqual(3+4, budget_line.getCell( 'product_line/1', 'source/account_module/fixed_assets', 'group/demo_group',).getQuantity()) - self.assertEquals(3, budget_line.getCell( + self.assertEqual(3, budget_line.getCell( 'product_line/1/1.1', 'source/account_module/fixed_assets', 'group/demo_group',).getQuantity()) - self.assertEquals(4, budget_line.getCell( + self.assertEqual(4, budget_line.getCell( 'product_line/1/1.2', 'source/account_module/fixed_assets', 'group/demo_group',).getQuantity()) - self.assertEquals(5, budget_line.getCell( + self.assertEqual(5, budget_line.getCell( 'product_line/1', 'source/account_module/goods_purchase', 'group/demo_group/sub2',).getQuantity()) @@ -2008,25 +2008,25 @@ class TestBudget(ERP5TypeTestCase): 'source/account_module/goods_purchase', 'group/demo_group/sub1') self.assertNotEquals(None, budget_cell) - self.assertEquals(2, budget_cell.getQuantity()) + self.assertEqual(2, budget_cell.getQuantity()) budget_cell.setQuantity(6) budget_line.BudgetLine_setQuantityOnSummaryCellList() - self.assertEquals(14, len(budget_line.contentValues())) + self.assertEqual(14, len(budget_line.contentValues())) - self.assertEquals(1+6, budget_line.getCell( + self.assertEqual(1+6, budget_line.getCell( 'product_line/1', 'source/account_module/goods_purchase', 'group/demo_group/sub1',).getQuantity()) - self.assertEquals(4+3, budget_line.getCell( + self.assertEqual(4+3, budget_line.getCell( 'product_line/1', 'source/account_module/fixed_assets', 'group/demo_group/sub1',).getQuantity()) - self.assertEquals(1+5, budget_line.getCell( + self.assertEqual(1+5, budget_line.getCell( 'product_line/1/1.1', 'source/account_module/goods_purchase', 'group/demo_group',).getQuantity()) - self.assertEquals(1+6+5, budget_line.getCell( + self.assertEqual(1+6+5, budget_line.getCell( 'product_line/1', 'source/account_module/goods_purchase', 'group/demo_group',).getQuantity()) @@ -2106,24 +2106,24 @@ class TestBudget(ERP5TypeTestCase): )) budget_line.Base_edit(form_id=form.getId()) - self.assertEquals(1, len(budget_line.contentValues())) + self.assertEqual(1, len(budget_line.contentValues())) budget_line.BudgetLine_setQuantityOnSummaryCellList() - self.assertEquals(3, len(budget_line.contentValues())) + self.assertEqual(3, len(budget_line.contentValues())) budget_cell = budget_line.getCell( 'product_line/1/1.1', 'source/account_module/goods_purchase', 'account_type/asset/cash') self.assertNotEquals(None, budget_cell) - self.assertEquals(1, budget_cell.getQuantity()) + self.assertEqual(1, budget_cell.getQuantity()) budget_cell = budget_line.getCell( 'product_line/1/1.1', 'source/account_module/goods_purchase', 'account_type/asset',) self.assertNotEquals(None, budget_cell) - self.assertEquals(1, budget_cell.getQuantity()) + self.assertEqual(1, budget_cell.getQuantity()) def updateBudgetCellList(self, budget_line, table_list): updateCellList(self.portal, @@ -2244,13 +2244,13 @@ class TestBudget(ERP5TypeTestCase): 'source_section/organisation_module/my_organisation'), None) self.assertNotEquals(None, total_price) - self.assertEquals(500.0, total_price) + self.assertEqual(500.0, total_price) total_price = budget_line.getEngagedBudgetDict().get( ('resource/product_module/demo_product', 'source_section/organisation_module/main_organisation'), None) self.assertNotEquals(None, total_price) - self.assertEquals(1200.0, total_price) + self.assertEqual(1200.0, total_price) # Other TODOs: diff --git a/product/ERP5/tests/testBug.py b/product/ERP5/tests/testBug.py index 3a194689ad..892da2ee3f 100644 --- a/product/ERP5/tests/testBug.py +++ b/product/ERP5/tests/testBug.py @@ -213,9 +213,9 @@ class TestBug(ERP5TypeTestCase): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('dummy <loggedperson@localhost>', mfrom) - self.assertEquals(['person1@localhost'], mto) - self.failUnless(bug.getTitle().replace(" ", "_") in messageText) + self.assertEqual('dummy <loggedperson@localhost>', mfrom) + self.assertEqual(['person1@localhost'], mto) + self.assertTrue(bug.getTitle().replace(" ", "_") in messageText) def stepCheckBugMessageNotification(self, sequence=None, sequence_list=None, **kw): @@ -226,9 +226,9 @@ class TestBug(ERP5TypeTestCase): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('person2@localhost', mfrom) - self.assertEquals(['person1@localhost'], mto) - self.failUnless(bug.getTitle().replace(" ", "_") in messageText) + self.assertEqual('person2@localhost', mfrom) + self.assertEqual(['person1@localhost'], mto) + self.assertTrue(bug.getTitle().replace(" ", "_") in messageText) def stepSetSourceProject(self, sequence=None, sequence_list=None, **kw): """ @@ -289,7 +289,7 @@ class TestBug(ERP5TypeTestCase): check if the message is delivered the bug. """ bug_message = sequence.get('bug_message') - self.assertEquals(bug_message.getSimulationState(), 'delivered') + self.assertEqual(bug_message.getSimulationState(), 'delivered') def stepCheckBugMessage(self, sequence=None, sequence_list=None, **kw): """ @@ -297,9 +297,9 @@ class TestBug(ERP5TypeTestCase): """ bug_message = sequence.get('bug_message') person = sequence.get('person1') - self.assertEquals( [ person ] , bug_message.getDestinationValueList()) - self.failUnless( bug_message.getStartDate() is not None) - #self.assertEquals(bug_message.getSourceValue().getTitle(), 'dummy') + self.assertEqual( [ person ] , bug_message.getDestinationValueList()) + self.assertTrue( bug_message.getStartDate() is not None) + #self.assertEqual(bug_message.getSourceValue().getTitle(), 'dummy') def stepCheckBugMessageNotificationReAssign(self, sequence=None, sequence_list=None, **kw): """ @@ -319,8 +319,8 @@ class TestBug(ERP5TypeTestCase): Create a dummy bug """ bug = sequence.get('bug') - self.assertEquals("#%s" % bug.getId(), bug.getReference()) - #self.assertEquals(bug_message.getSourceTradeValue().getTitle(), 'dummy') + self.assertEqual("#%s" % bug.getId(), bug.getReference()) + #self.assertEqual(bug_message.getSourceTradeValue().getTitle(), 'dummy') def stepCloneAndCheckBug(self, sequence=None, sequence_list=None, **kw): """ @@ -329,8 +329,8 @@ class TestBug(ERP5TypeTestCase): bug_to_clone = sequence.get('bug') self.assertNotEquals(len(bug_to_clone.contentValues()), 0) bug = bug_to_clone.Base_createCloneDocument(batch_mode=1) - self.assertEquals("#%s" % bug.getId(), bug.getReference()) - self.assertEquals(len(bug.contentValues()), 0) + self.assertEqual("#%s" % bug.getId(), bug.getReference()) + self.assertEqual(len(bug.contentValues()), 0) def stepOpenBug(self, sequence=None, sequence_list=None, **kw): """ @@ -338,7 +338,7 @@ class TestBug(ERP5TypeTestCase): """ bug = sequence.get('bug') self.workflow_tool.doActionFor(bug, 'confirm_action', send_event=1) - self.assertEquals(bug.getSimulationState(), 'confirmed') + self.assertEqual(bug.getSimulationState(), 'confirmed') def stepAssignBug(self, sequence=None, sequence_list=None, **kw): """ @@ -346,7 +346,7 @@ class TestBug(ERP5TypeTestCase): """ bug = sequence.get('bug') self.workflow_tool.doActionFor(bug, 'set_ready_action', send_event=1) - self.assertEquals(bug.getSimulationState(), 'ready') + self.assertEqual(bug.getSimulationState(), 'ready') def stepResolveBug(self, sequence=None, sequence_list=None, **kw): """ @@ -354,7 +354,7 @@ class TestBug(ERP5TypeTestCase): """ bug = sequence.get('bug') self.workflow_tool.doActionFor(bug, 'stop_action', send_event=1) - self.assertEquals(bug.getSimulationState(), 'stopped') + self.assertEqual(bug.getSimulationState(), 'stopped') def stepReAssignBug(self, sequence=None, sequence_list=None, **kw): """ @@ -362,7 +362,7 @@ class TestBug(ERP5TypeTestCase): """ bug = sequence.get('bug') self.workflow_tool.doActionFor(bug, 're_assign_action', send_event=1, comment='Re-assign!') - self.assertEquals(bug.getSimulationState(), 'ready') + self.assertEqual(bug.getSimulationState(), 'ready') def stepCloseBug(self, sequence=None, sequence_list=None, **kw): """ @@ -370,7 +370,7 @@ class TestBug(ERP5TypeTestCase): """ bug = sequence.get('bug') self.workflow_tool.doActionFor(bug, 'deliver_action', send_event=1) - self.assertEquals(bug.getSimulationState(), 'delivered') + self.assertEqual(bug.getSimulationState(), 'delivered') def stepCancelBug(self, sequence=None, sequence_list=None, **kw): """ @@ -378,7 +378,7 @@ class TestBug(ERP5TypeTestCase): """ bug = sequence.get('bug') self.workflow_tool.doActionFor(bug, 'cancel_action', send_event=1) - self.assertEquals(bug.getSimulationState(), 'cancelled') + self.assertEqual(bug.getSimulationState(), 'cancelled') def stepSetTestedBug(self, sequence=None, sequence_list=None, **kw): """ @@ -386,7 +386,7 @@ class TestBug(ERP5TypeTestCase): """ bug = sequence.get('bug') bug.setTested(True) - self.assertEquals(bug.getTested(), True) + self.assertEqual(bug.getTested(), True) def stepSetOldClosedDate(self, sequence=None, sequence_list=None, **kw): """ @@ -394,14 +394,14 @@ class TestBug(ERP5TypeTestCase): """ bug = sequence.get('bug') bug.setStopDate(self.datetime - 10) - self.assertEquals(bug.getStopDate().Date(), (self.datetime - 10).Date()) # Check that datetime is fixed + self.assertEqual(bug.getStopDate().Date(), (self.datetime - 10).Date()) # Check that datetime is fixed def stepCheckClosedDate(self, sequence=None, sequence_list=None, **kw): """ Check that the closed date is set as today. """ bug = sequence.get('bug') - self.assertEquals(bug.getStopDate().Date(), self.datetime.Date()) + self.assertEqual(bug.getStopDate().Date(), self.datetime.Date()) ################################## ## Tests @@ -592,12 +592,12 @@ class TestBug(ERP5TypeTestCase): bug_line = bug.newContent(portal_type='Bug Line') cloned_bug_line = bug_line.Base_createCloneDocument(batch_mode=1) self.workflow_tool.doActionFor(bug, 'confirm_action', send_event=1) - self.assertEquals(bug.getSimulationState(), 'confirmed') + self.assertEqual(bug.getSimulationState(), 'confirmed') self.tic() bug.deleteContent(id='2') self.tic() self.workflow_tool.doActionFor(bug, 'stop_action', send_event=1) - self.assertEquals(bug.getSimulationState(), 'stopped') + self.assertEqual(bug.getSimulationState(), 'stopped') def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testBusinessTemplate.py b/product/ERP5/tests/testBusinessTemplate.py index 865e6726e5..53ca32db7b 100644 --- a/product/ERP5/tests/testBusinessTemplate.py +++ b/product/ERP5/tests/testBusinessTemplate.py @@ -207,7 +207,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Define erp5_core as current bt """ core_bt = self.getBusinessTemplate('erp5_core') - self.failIf(core_bt is None) + self.assertFalse(core_bt is None) sequence.edit(current_bt=core_bt) def stepCreateTest(self, sequence=None, **kw): @@ -221,7 +221,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): f = file(file_path, 'w') f.write(test_data) f.close() - self.failUnless(os.path.exists(file_path)) + self.assertTrue(os.path.exists(file_path)) sequence.edit(test_title=test_title, test_path=file_path, test_data=test_data) @@ -232,13 +232,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): def stepRemoveTest(self, sequence=None, **kw): test_path = sequence['test_path'] os.remove(test_path) - self.failIf(os.path.exists(test_path)) + self.assertFalse(os.path.exists(test_path)) def stepCheckTestExists(self, sequence=None, **kw): - self.failIf(not os.path.exists(sequence['test_path'])) + self.assertFalse(not os.path.exists(sequence['test_path'])) def stepCheckTestRemoved(self, sequence=None, **kw): - self.failIf(os.path.exists(sequence['test_path'])) + self.assertFalse(os.path.exists(sequence['test_path'])) def stepCopyCoreBusinessTemplate(self, sequence=None, **kw): """ @@ -246,7 +246,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ template_tool = self.getTemplateTool() core_bt = self.getBusinessTemplate('erp5_core') - self.failIf(core_bt is None) + self.assertFalse(core_bt is None) # make copy copy_data = template_tool.manage_copyObjects(ids=[core_bt.getId()]) ids = template_tool.manage_pasteObjects(copy_data) @@ -267,7 +267,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Build copied core bt """ bt = sequence.get('copy_bt') - self.assertEquals(bt.getTitle(), 'erp5_core') + self.assertEqual(bt.getTitle(), 'erp5_core') bt.build() def stepInstallCopyCoreBusinessTemplate(self, sequence=None, **kw): @@ -275,21 +275,21 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Install copied core bt """ bt = sequence.get('copy_bt') - self.assertEquals(bt.getTitle(), 'erp5_core') - self.assertEquals(bt.getInstallationState(), 'not_installed') + self.assertEqual(bt.getTitle(), 'erp5_core') + self.assertEqual(bt.getInstallationState(), 'not_installed') bt.install() def stepCheckOriginalAndCopyBusinessTemplate(self, sequence=None, **kw): original_bt = sequence.get('current_bt') copy_bt = sequence.get('copy_bt') - self.assertEquals(original_bt.getBuildingState(), 'built') - self.assertEquals(copy_bt.getBuildingState(), 'built') + self.assertEqual(original_bt.getBuildingState(), 'built') + self.assertEqual(copy_bt.getBuildingState(), 'built') for item_name in original_bt._item_name_list: original_obj = getattr(original_bt, item_name) copy_obj = getattr(copy_bt, item_name) - self.failIf(original_obj is None) - self.failIf(copy_obj is None) + self.assertFalse(original_obj is None) + self.assertFalse(copy_obj is None) self.failIfDifferentSet(original_obj.getKeys(), copy_obj.getKeys()) def stepUseExportBusinessTemplate(self, sequence=None, **kw): @@ -330,53 +330,53 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): def stepCheckCatalogPreinstallReturnCatalogMethod(self, sequence=None, **kw): bt = sequence.get('current_bt', None) - self.assertEquals(bt.preinstall(), {'portal_catalog/erp5_mysql_innodb/z_fake_method': ['Modified', 'CatalogMethod']}) + self.assertEqual(bt.preinstall(), {'portal_catalog/erp5_mysql_innodb/z_fake_method': ['Modified', 'CatalogMethod']}) def stepCheckInstalledInstallationState(self, sequence=None, **kw): """ Check if installation state is installed """ bt = sequence.get('current_bt', None) - self.assertEquals(bt.getInstallationState(), 'installed') + self.assertEqual(bt.getInstallationState(), 'installed') def stepCheckNotInstalledInstallationState(self, sequence=None, **kw): """ Check if installation state is not_installed """ bt = sequence.get('current_bt') - self.assertEquals(bt.getInstallationState(), 'not_installed') + self.assertEqual(bt.getInstallationState(), 'not_installed') def stepCheckReplacedInstallationState(self, sequence=None, seqeunce_list=None, **kw): """ Check if installation state is replaced """ bt = sequence.get('current_bt') - self.assertEquals(bt.getInstallationState(), 'replaced') + self.assertEqual(bt.getInstallationState(), 'replaced') def stepCheckModifiedBuildingState(self, sequence=None, **kw): """ Check if the building state is modified. """ bt = sequence.get('current_bt') - self.assertEquals(bt.getBuildingState(), 'modified') + self.assertEqual(bt.getBuildingState(), 'modified') def stepCheckBuiltBuildingState(self, sequence=None, **kw): """ Check if the building state is built. """ bt = sequence.get('current_bt') - self.assertEquals(bt.getBuildingState(), 'built') + self.assertEqual(bt.getBuildingState(), 'built') def stepCheckTools(self, sequence=None, **kw): """ Check presence of tools """ - self.failUnless(self.getCategoryTool() is not None) - self.failUnless(self.getTemplateTool() is not None) - self.failUnless(self.getTypeTool() is not None) - self.failUnless(self.getSkinsTool() is not None) - self.failUnless(self.getCatalogTool() is not None) - self.failUnless(self.getTrashTool() is not None) + self.assertTrue(self.getCategoryTool() is not None) + self.assertTrue(self.getTemplateTool() is not None) + self.assertTrue(self.getTypeTool() is not None) + self.assertTrue(self.getSkinsTool() is not None) + self.assertTrue(self.getCatalogTool() is not None) + self.assertTrue(self.getTrashTool() is not None) def stepCheckSkinsLayers(self, sequence=None, **kw): """ @@ -385,24 +385,24 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): skins_tool = self.getSkinsTool() for skin_name, selection in skins_tool.getSkinPaths(): if skin_name == 'View': - self.failIf('erp5_csv_style' in selection) - self.failIf('erp5_core' not in selection) - self.failIf('erp5_xhtml_style' not in selection) + self.assertFalse('erp5_csv_style' in selection) + self.assertFalse('erp5_core' not in selection) + self.assertFalse('erp5_xhtml_style' not in selection) if skin_name == 'Print': - self.failIf('erp5_xhtml_style' in selection) - self.failIf('erp5_csv_style' in selection) - self.failIf('erp5_core' not in selection) + self.assertFalse('erp5_xhtml_style' in selection) + self.assertFalse('erp5_csv_style' in selection) + self.assertFalse('erp5_core' not in selection) if skin_name == 'CSV': - self.failIf('erp5_xhtml_style' in selection) - self.failIf('erp5_core' not in selection) - self.failIf('erp5_csv_style' not in selection) + self.assertFalse('erp5_xhtml_style' in selection) + self.assertFalse('erp5_core' not in selection) + self.assertFalse('erp5_csv_style' not in selection) def stepCheckNoTrashBin(self, sequence=None, **kw): """ Check if there is no trash bins """ trash = self.getTrashTool() - self.assertEquals(len(trash.objectIds()), 0) + self.assertEqual(len(trash.objectIds()), 0) def stepRemoveAllTrashBins(self, sequence=None, **kw): """ @@ -412,7 +412,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): trash_ids = list(trash.objectIds()) for id in trash_ids: trash.deleteContent(id) - self.failIf(len(trash.objectIds()) > 0) + self.assertFalse(len(trash.objectIds()) > 0) def stepCheckTrashBin(self, sequence=None, **kw): """ @@ -420,9 +420,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ trash = self.getTrashTool() trash_ids = list(trash.objectIds()) - self.assertEquals(len(trash.objectIds()), 1) + self.assertEqual(len(trash.objectIds()), 1) bt_id = sequence.get('import_bt').getId() - self.failUnless(bt_id not in trash_ids[0]) + self.assertTrue(bt_id not in trash_ids[0]) # portal types def stepCreatePortalType(self, sequence=None, **kw): @@ -433,7 +433,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): # create module object portal type object_type = pt.newContent('Geek Object', 'Base Type', type_class='Person') - self.failUnless(object_type is not None) + self.assertTrue(object_type is not None) sequence.edit(object_ptype_id=object_type.getId()) # create module portal type module_type = pt.newContent('Geek Module', 'Base Type', @@ -443,7 +443,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): type_hidden_content_type_list=('Geek Object',), type_base_category_list=('destination',), type_property_sheet_list=('Version',)) - self.failUnless(module_type is not None) + self.assertTrue(module_type is not None) sequence.edit(module_ptype_id=module_type.getId(), module_ptype_filter_content_types=module_type.getTypeFilterContentType(), module_ptype_allowed_content_types=module_type.getTypeAllowedContentTypeList(), @@ -461,11 +461,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ pt = self.getTypeTool() module_type = pt._getOb('Geek Module', None) - self.failUnless(module_type is not None) + self.assertTrue(module_type is not None) module_type.allowed_content_types = list(module_type.allowed_content_types) + ['Geek Module'] module_type.base_category_list = list(module_type.base_category_list) + ['source'] bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) bt.edit(template_portal_type_allowed_content_type=('Geek Module | Geek Module',), template_portal_type_hidden_content_type=(), template_portal_type_base_category=('Geek Module | source',), @@ -480,7 +480,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Add types to business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) ptype_ids = [] ptype_ids.append(sequence.get('object_ptype_id', '')) ptype_ids.append(sequence.get('module_ptype_id', '')) @@ -493,7 +493,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Add duplicated portal type to business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) ptype_ids = [] ptype_ids.append(sequence.get('object_ptype_id', '')) self.assertEqual(len(ptype_ids), 1) @@ -508,9 +508,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): module_id = sequence.get('module_ptype_id') pt.manage_delObjects([module_id, object_id]) module_type = pt._getOb(module_id, None) - self.failUnless(module_type is None) + self.assertTrue(module_type is None) object_type = pt._getOb(object_id, None) - self.failUnless(object_type is None) + self.assertTrue(object_type is None) def stepRemoveFirstAction(self, sequence=None, **kw): pt = self.getTypeTool() @@ -529,7 +529,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): object_id = sequence.get('object_ptype_id') module_id = sequence.get('module_ptype_id') module_type = pt._getOb(module_id, None) - self.failUnless(module_type is not None) + self.assertTrue(module_type is not None) self.assertEqual(module_type.getTypeAllowedContentTypeList(), sequence.get('module_ptype_allowed_content_types')) self.assertEqual(module_type.getTypeHiddenContentTypeList(), @@ -541,7 +541,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): self.assertEqual(module_type.getTypePropertySheetList(), sequence.get('module_ptype_property_sheet_list')) object_type = pt._getOb(object_id, None) - self.failUnless(object_type is not None) + self.assertTrue(object_type is not None) def stepCheckPortalTypeRemoved(self, sequence=None, **kw): """ @@ -551,9 +551,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): object_id = sequence.get('object_ptype_id') module_id = sequence.get('module_ptype_id') module_type = pt._getOb(module_id, None) - self.failUnless(module_type is None) + self.assertTrue(module_type is None) object_type = pt._getOb(object_id, None) - self.failUnless(object_type is None) + self.assertTrue(object_type is None) def stepCheckDuplicatedPortalTypeRemoved(self, sequence=None, **kw): """ @@ -562,14 +562,14 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): pt = self.getTypeTool() object_id = sequence.get('object_ptype_id') object_type = pt._getOb(object_id, None) - self.failUnless(object_type is None) + self.assertTrue(object_type is None) def stepFillPortalTypesFields(self, sequence=None, **kw): """ Fill portal types properties field in business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) bt.getPortalTypesProperties() def stepFillWrongPortalTypesFields(self, sequence=None, **kw): @@ -577,7 +577,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Fill portal types properties field in business template with wrong values """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) bt.getPortalTypesProperties() bt_allowed_content_type_list = list(getattr(self, 'template_portal_type_allowed_content_type', []) or []) bt_allowed_content_type_list.append("Geek Module | BusinessTemplate") @@ -595,14 +595,14 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): n = n + 1 id = "%s_%s" %('geek_module', n) module = portal.newContent(id=id, portal_type='Geek Module') - self.failUnless(module is not None) + self.assertTrue(module is not None) # add a specific permission to module which do not use acquisition module.manage_permission('Copy or Move', ['Assignor'], False) sequence.edit(module_id=module.getId()) module_object_list = [] for i in xrange(10): object = module.newContent(portal_type = 'Geek Object') - self.failUnless(object is not None) + self.assertTrue(object is not None) module_object_list.append(object) sequence.edit(module_object_id_list=module_object_list) @@ -612,7 +612,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ bt = sequence.get('current_bt', None) module_id = sequence.get('module_id', None) - self.failUnless(module_id is not None) + self.assertTrue(module_id is not None) bt.edit(template_module_id_list=[module_id]) def stepCreateModuleObjects(self, sequence=None, **kw): @@ -622,11 +622,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): portal = self.getPortal() module_id = sequence.get('module_id') module = portal._getOb(module_id, None) - self.failUnless(module is not None) + self.assertTrue(module is not None) module_object_list = [] for i in xrange(10): object = module.newContent(portal_type = 'Geek Object') - self.failUnless(object is not None) + self.assertTrue(object is not None) module_object_list.append(object.getId()) sequence.edit(module_object_id_list=module_object_list) @@ -637,7 +637,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): portal = self.getPortal() module_id = sequence.get("module_id") portal.manage_delObjects([module_id]) - self.failIf(portal._getOb(module_id, None) is not None) + self.assertFalse(portal._getOb(module_id, None) is not None) def stepCheckModuleExists(self, sequence=None, **kw): """ @@ -646,7 +646,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): portal = self.getPortal() module_id = sequence.get("module_id") new_module = portal._getOb(module_id, None) - self.failIf(new_module is None) + self.assertFalse(new_module is None) def stepCheckModulePermissions(self, sequence=None, **kw): """ @@ -676,11 +676,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): portal = self.getPortal() module_id = sequence.get('module_id') module = portal._getOb(module_id) - self.failUnless(module is not None) + self.assertTrue(module is not None) object_id_list = sequence.get('module_object_id_list') for object_id in object_id_list: object = module._getOb(object_id, None) - self.failUnless(object is not None) + self.assertTrue(object is not None) def stepCheckModuleObjectsRemoved(self, sequence=None, **kw): """ @@ -689,11 +689,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): portal = self.getPortal() module_id = sequence.get('module_id') module = portal._getOb(module_id) - self.failUnless(module is not None) + self.assertTrue(module is not None) object_id_list = sequence.get('module_object_id_list') for object_id in object_id_list: object = module._getOb(object_id, None) - self.failUnless(object is None) + self.assertTrue(object is None) def stepCheckModuleRemoved(self, sequence=None, **kw): """ @@ -701,7 +701,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ portal = self.getPortal() module_id = sequence.get("module_id") - self.failIf(portal._getOb(module_id, None) is not None) + self.assertFalse(portal._getOb(module_id, None) is not None) # skins folder def stepCreateSkinFolder(self, sequence=None, **kw): @@ -711,7 +711,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ps = self.getSkinsTool() ps.manage_addProduct['OFSP'].manage_addFolder('erp5_geek') skin_folder = ps._getOb('erp5_geek', None) - self.failUnless(skin_folder is not None) + self.assertTrue(skin_folder is not None) sequence.edit(skin_folder_id=skin_folder.getId()) # add skin in layers for skin_name, selection in ps.getSkinPaths(): @@ -727,7 +727,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ps = self.getSkinsTool() ps.manage_addProduct['OFSP'].manage_addFolder('erp5_nerd') skin_folder = ps._getOb('erp5_nerd', None) - self.failUnless(skin_folder is not None) + self.assertTrue(skin_folder is not None) sequence.edit(another_skin_folder_id=skin_folder.getId()) # add skin in layers for skin_name, selection in ps.getSkinPaths(): @@ -743,7 +743,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ps = self.getSkinsTool() ps.manage_addProduct['OFSP'].manage_addFolder('erp5_static') skin_folder = ps._getOb('erp5_static', None) - self.failUnless(skin_folder is not None) + self.assertTrue(skin_folder is not None) sequence.edit(static_skin_folder_id=skin_folder.getId()) # add skin in layers for skin_name, selection in ps.getSkinPaths(): @@ -756,10 +756,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): def stepCreateSkinSubFolder(self, sequence=None, **kw): ps = self.getSkinsTool() skin_folder = ps._getOb('erp5_geek', None) - self.failUnless(skin_folder is not None) + self.assertTrue(skin_folder is not None) skin_folder.manage_addFolder('erp5_subgeek') skin_subfolder = skin_folder._getOb('erp5_subgeek', None) - self.failUnless(skin_subfolder is not None) + self.assertTrue(skin_subfolder is not None) sequence.edit(skin_subfolder_id=skin_subfolder.getId()) def stepCheckSkinSubFolderExists(self, sequence=None, **kw): @@ -769,10 +769,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ps = self.getSkinsTool() skin_id = sequence.get('skin_folder_id') skin_folder = ps._getOb(skin_id, None) - self.failUnless(skin_folder is not None) + self.assertTrue(skin_folder is not None) subskin_id = sequence.get('skin_subfolder_id') skin_subfolder = skin_folder._getOb(subskin_id, None) - self.failUnless(skin_subfolder is not None) + self.assertTrue(skin_subfolder is not None) def stepCreateNewForm(self, sequence=None): """Create a new ERP5 Form in a skin folder.""" @@ -784,12 +784,12 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): addERP5Form(form_id, 'View') form = skin_folder._getOb(form_id, None) self.assertNotEquals(form, None) - self.assertEquals(sorted(form.get_groups(include_empty=1)), + self.assertEqual(sorted(form.get_groups(include_empty=1)), sorted(['left', 'right', 'center', 'bottom', 'hidden'])) addField = form.manage_addProduct['Formulator'].manage_addField addField('my_title', 'Title', 'StringField') field = form.get_field('my_title') - self.assertEquals(form.get_fields_in_group('left'), [field]) + self.assertEqual(form.get_fields_in_group('left'), [field]) group_dict = {} for group in form.get_groups(include_empty=1): id_list = [] @@ -808,12 +808,12 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): addERP5Form(form_id, 'View') form = skin_folder._getOb(form_id, None) self.assertNotEquals(form, None) - self.assertEquals(sorted(form.get_groups(include_empty=1)), + self.assertEqual(sorted(form.get_groups(include_empty=1)), sorted(['left', 'right', 'center', 'bottom', 'hidden'])) addField = form.manage_addProduct['Formulator'].manage_addField addField('my_title', 'Title', 'StringField') field = form.get_field('my_title') - self.assertEquals(form.get_fields_in_group('left'), [field]) + self.assertEqual(form.get_fields_in_group('left'), [field]) group_dict = {} for group in form.get_groups(include_empty=1): id_list = [] @@ -832,7 +832,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): self.assertNotEquals(form, None) skin_folder.manage_delObjects([form_id]) form = skin_folder._getOb(form_id, None) - self.assertEquals(form, None) + self.assertEqual(form, None) def stepAddFormField(self, sequence=None): """Add a field to an ERP5 Form.""" @@ -842,13 +842,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): form_id = sequence.get('form_id') form = skin_folder._getOb(form_id, None) self.assertNotEquals(form, None) - self.assertEquals(sorted(form.get_groups(include_empty=1)), + self.assertEqual(sorted(form.get_groups(include_empty=1)), sorted(['left', 'right', 'center', 'bottom', 'hidden'])) addField = form.manage_addProduct['Formulator'].manage_addField addField('my_reference', 'Reference', 'StringField') form.move_field_group(['my_reference'], 'left', 'right') field = form.get_field('my_reference') - self.assertEquals(form.get_fields_in_group('right'), [field]) + self.assertEqual(form.get_fields_in_group('right'), [field]) group_dict = {} for group in form.get_groups(include_empty=1): id_list = [] @@ -866,7 +866,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): form_title = 'First Form Title' form.title = form_title self.assertNotEquals(form, None) - self.assertEquals(sorted(form.get_groups(include_empty=1)), + self.assertEqual(sorted(form.get_groups(include_empty=1)), sorted(['left', 'right', 'center', 'bottom', 'hidden'])) group_dict = {} for group in form.get_groups(include_empty=1): @@ -892,7 +892,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): self.assertNotEquals(skin_folder, None) form_id = sequence.get('form_id') form = skin_folder._getOb(form_id, None) - self.assertEquals('First Form Title', form.title) + self.assertEqual('First Form Title', form.title) def stepCheckFormIsRemoved(self, sequence=None): """Check the form is exist in erp5_geek.""" @@ -901,7 +901,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): self.assertNotEquals(skin_folder, None) form_id = sequence.get('form_id') form = skin_folder._getOb(form_id, None) - self.assertEquals(form, None) + self.assertEqual(form, None) def stepCheckFormIsNotRemovedFromErp5Nerd(self, sequence=None): """Check the form is not exist in erp5_nerd.""" @@ -935,13 +935,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): form = skin_folder._getOb(form_id, None) self.assertNotEquals(form, None) group_dict = sequence.get('group_dict') - self.assertEquals(sorted(form.get_groups(include_empty=1)), + self.assertEqual(sorted(form.get_groups(include_empty=1)), sorted(group_dict.iterkeys())) for group in group_dict.iterkeys(): id_list = [] for field in form.get_fields_in_group(group): id_list.append(field.getId()) - self.assertEquals(group_dict[group], id_list) + self.assertEqual(group_dict[group], id_list) def stepCheckFieldTitleIsNotRemovedFromErp5Nerd(self, sequence=None): """Check that field title is not removed form erp5_nerd.""" @@ -960,15 +960,15 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ ps = self.getSkinsTool() skin_folder = ps._getOb('erp5_geek', None) - self.failUnless(skin_folder is not None) + self.assertTrue(skin_folder is not None) skin_subfolder = skin_folder._getOb('erp5_subgeek', None) - self.failUnless(skin_subfolder is not None) + self.assertTrue(skin_subfolder is not None) method_id = "z_fake_method" addSQLMethod = skin_subfolder.manage_addProduct['ZSQLMethods'].manage_addZSQLMethod addSQLMethod(id=method_id, title='', connection_id='erp5_sql_connection', arguments='', template='') zsql_method = skin_subfolder._getOb(method_id, None) - self.failUnless(zsql_method is not None) + self.assertTrue(zsql_method is not None) sequence.edit(zsql_method_id = method_id) def stepRemoveSkinFolder(self, sequence=None, **kw): @@ -979,7 +979,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): skin_id = sequence.get('skin_folder_id') ps.manage_delObjects([skin_id]) skin_folder = ps._getOb(skin_id, None) - self.failUnless(skin_folder is None) + self.assertTrue(skin_folder is None) for skin_name, selection in ps.getSkinPaths(): selection = selection.split(',') if skin_id in selection: @@ -993,7 +993,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ps = self.getSkinsTool() skin_id = sequence.get('skin_folder_id') skin_folder = ps._getOb(skin_id, None) - self.failUnless(skin_folder is not None) + self.assertTrue(skin_folder is not None) def stepCheckSkinFolderRemoved(self, sequence=None, **kw): """ @@ -1002,23 +1002,23 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ps = self.getSkinsTool() skin_id = sequence.get('skin_folder_id') skin_folder = ps._getOb(skin_id, None) - self.failUnless(skin_folder is None) + self.assertTrue(skin_folder is None) def stepAddSkinFolderToBusinessTemplate(self, sequence=None, **kw): """ Add skin folder to business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) skin_id = sequence.get('skin_folder_id', '') - self.failIfEqual(skin_id, '') + self.assertNotEqual(skin_id, '') bt.edit(template_skin_id_list=[skin_id]) def stepAddAnotherSkinFolderToBusinessTemplate(self, sequence=None, **kw): bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) skin_id = sequence.get('another_skin_folder_id', '') - self.failIfEqual(skin_id, '') + self.assertNotEqual(skin_id, '') current_skin_id_list = bt.getTemplateSkinIdList() template_skin_id_list = [] template_skin_id_list.extend(current_skin_id_list) @@ -1031,7 +1031,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Add registered selection to business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) bt.edit(template_registered_skin_selection_list = \ ('%s | Foo' % sequence.get('skin_folder_id'), )) @@ -1040,7 +1040,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Add registered selection to business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) bt.edit(template_registered_skin_selection_list = \ ('%s | Foo' % sequence.get('skin_folder_id'), '%s | Bar' % sequence.get('skin_folder_id'),)) @@ -1050,7 +1050,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Add a path to business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) bt.edit(template_path_list=['geek_path',]) # Base Category @@ -1060,7 +1060,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ pc = self.getCategoryTool() base_category = pc.newContent(portal_type = 'Base Category') - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) sequence.edit(bc_id=base_category.getId(),) sequence.edit(base_category_uid=base_category.getUid(),) @@ -1079,7 +1079,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Check that we can find new type name in ctr """ ctr = getattr(self.getPortal(), 'content_type_registry') - self.failUnless(ctr.findTypeName('bzzz.def', None, None) == 'What Not') + self.assertTrue(ctr.findTypeName('bzzz.def', None, None) == 'What Not') def stepAddContentTypeRegistryAsPathToBusinessTemplate(self, sequence=None, **kw): """ @@ -1101,7 +1101,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Check that we can not find new type name in ctr anymore """ ctr = getattr(self.getPortal(), 'content_type_registry') - self.failUnless(ctr.findTypeName('bzzz.def', None, None) is None) + self.assertTrue(ctr.findTypeName('bzzz.def', None, None) is None) def stepAddBaseCategoryToBusinessTemplate(self, sequence=None, **kw): """ @@ -1125,7 +1125,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): bc_id = sequence.get('bc_id') pc.manage_delObjects([bc_id]) base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is None) + self.assertTrue(base_category is None) def stepCheckBaseCategoryExists(self, sequence=None, **kw): """ @@ -1134,7 +1134,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): pc = self.getCategoryTool() bc_id = sequence.get('bc_id') base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) def stepCheckBaseCategoryRemoved(self, sequence=None, **kw): """ @@ -1143,7 +1143,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): pc = self.getCategoryTool() bc_id = sequence.get('bc_id') base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is None) + self.assertTrue(base_category is None) def stepSaveBaseCategoryUid(self, sequence=None, **kw): """ @@ -1172,11 +1172,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): bc_id = sequence.get('bc_id') pc = self.getCategoryTool() base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) category_list = [] for i in xrange(10): category = base_category.newContent(portal_type='Category') - self.failUnless(category is not None) + self.assertTrue(category is not None) category_list.append(category.getId()) sequence.edit(category_id_list=category_list) @@ -1196,11 +1196,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): bc_id = sequence.get('bc_id') pc = self.getCategoryTool() base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) category_id_list = sequence.get('category_id_list') for category_id in category_id_list: category = base_category._getOb(category_id, None) - self.failUnless(category is not None) + self.assertTrue(category is not None) def stepCheckCategoriesRemoved(self, sequence=None, **kw): """ @@ -1209,22 +1209,22 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): bc_id = sequence.get('bc_id') pc = self.getCategoryTool() base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) category_id_list = sequence.get('category_id_list') for category_id in category_id_list: category = base_category._getOb(category_id, None) - self.failUnless(category is None) + self.assertTrue(category is None) def stepRemoveCategories(self, sequence=None, **kw): bc_id = sequence.get('bc_id') pc = self.getCategoryTool() base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) category_id_list = sequence.get('category_id_list') base_category.manage_delObjects(category_id_list) for category_id in category_id_list: category = base_category._getOb(category_id, None) - self.failUnless(category is None) + self.assertTrue(category is None) # sub categories def stepCreateSubCategories(self, sequence=None, **kw): @@ -1234,17 +1234,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): pc = self.getCategoryTool() bc_id = sequence.get('bc_id') base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) cat_id_list = sequence.get('category_id_list') # only use one category cat_id = cat_id_list[0] category = base_category._getOb(cat_id, None) - self.failUnless(category is not None) + self.assertTrue(category is not None) subcategory_list = [] subcategory_uid_dict = {} for i in xrange(10): subcategory = category.newContent(portal_type='Category', title='toto') - self.failUnless(subcategory is not None) + self.assertTrue(subcategory is not None) subcategory_list.append(subcategory.getId()) subcategory_uid_dict[subcategory.getId()] = subcategory.getUid() sequence.edit(subcategory_id_list=subcategory_list, \ @@ -1278,15 +1278,15 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): bc_id = sequence.get('bc_id') pc = self.getCategoryTool() base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) parent_category_id = sequence.get('parent_category_id') category = base_category._getOb(parent_category_id, None) - self.failUnless(category is not None) + self.assertTrue(category is not None) subcategory_id_list = sequence.get('subcategory_id_list') for subcategory_id in subcategory_id_list: subcategory = category._getOb(subcategory_id, None) - self.failUnless(subcategory is not None) - self.assertEquals(subcategory.getTitle(), 'toto') + self.assertTrue(subcategory is not None) + self.assertEqual(subcategory.getTitle(), 'toto') def stepCheckUidSubCategories(self, sequence=None, **kw): """ @@ -1295,7 +1295,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): base_category_id = sequence.get('bc_id') category_tool = self.getCategoryTool() base_category = category_tool._getOb(base_category_id, None) - self.assertEquals(base_category.getUid(), \ + self.assertEqual(base_category.getUid(), \ sequence.get('base_category_uid')) parent_category_id = sequence.get('parent_category_id') category = base_category._getOb(parent_category_id, None) @@ -1303,7 +1303,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): subcategory_uid_dict = sequence.get('subcategory_uid_dict') for subcategory_id in subcategory_id_list: subcategory = category._getOb(subcategory_id, None) - self.assertEquals(subcategory.getUid(), \ + self.assertEqual(subcategory.getUid(), \ subcategory_uid_dict[subcategory_id]) # workflow @@ -1315,7 +1315,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): pw = self.getWorkflowTool() addWorkflowByType(pw, WORKFLOW_TYPE, wf_id) workflow = pw._getOb(wf_id, None) - self.failUnless(workflow is not None) + self.assertTrue(workflow is not None) sequence.edit(workflow_id=workflow.getId()) cbt = pw._chains_by_type props = {} @@ -1332,7 +1332,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): wf_id = 'geek_workflow' pw = self.getWorkflowTool() workflow = pw._getOb(wf_id, None) - self.failUnless(workflow is not None) + self.assertTrue(workflow is not None) cbt = pw._chains_by_type props = {} if cbt is not None: @@ -1379,7 +1379,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): def stepAppendWorkflowToBusinessTemplate(self, sequence=None, **kw): bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) wf_ids = list(bt.getTemplateWorkflowIdList()) wf_ids.append(sequence.get('workflow_id', '')) self.assertEqual(len(wf_ids), 2) @@ -1390,7 +1390,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Add workflow to business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) wf_ids = [] wf_ids.append(sequence.get('workflow_id', '')) self.assertEqual(len(wf_ids), 1) @@ -1398,20 +1398,20 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): def stepAppendWorkflowChainToBusinessTemplate(self, sequence=None, **kw): bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) wf_chain_ids = list(bt.getTemplatePortalTypeWorkflowChainList()) wf_chain_ids.append('Geek Object | %s' % sequence.get('workflow_id', '')) bt.edit(template_portal_type_workflow_chain_list=wf_chain_ids) def stepAddWorkflowChainToBusinessTemplate(self, sequence=None, **kw): bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) wf_chain_ids = ['Geek Object | %s' % sequence.get('workflow_id', '')] bt.edit(template_portal_type_workflow_chain_list=wf_chain_ids) def stepAddRemovedWorkflowChainToBusinessTemplate(self, sequence=None, **kw): bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) wf_chain_ids = ['Geek Object | -%s' % sequence.get('workflow_id', '')] bt.edit(template_portal_type_workflow_chain_list=wf_chain_ids) @@ -1423,7 +1423,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): pw = self.getWorkflowTool() pw.manage_delObjects([wf_id]) workflow = pw._getOb(wf_id, None) - self.failUnless(workflow is None) + self.assertTrue(workflow is None) # remove workflowChain cbt = pw._chains_by_type props = {} @@ -1442,7 +1442,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): wf_id = sequence.get('workflow_id') pw = self.getWorkflowTool() workflow = pw._getOb(wf_id, None) - self.failUnless(workflow is not None) + self.assertTrue(workflow is not None) def stepCheckWorkflowRemoved(self, sequence=None, **kw): """ @@ -1451,7 +1451,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): wf_id = sequence.get('workflow_id') pw = self.getWorkflowTool() workflow = pw._getOb(wf_id, None) - self.failUnless(workflow is None) + self.assertTrue(workflow is None) def stepCheckWorkflowBackup(self, sequence=None, **kw): """ @@ -1557,7 +1557,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): object_id = sequence.get('object_ptype_id') action_id = sequence.get('second_action_id') bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) bt.edit(template_action_path=['%s | %s' %(object_id, action_id)]) # Catalog Method @@ -1567,13 +1567,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ pc = self.getCatalogTool() catalog = pc.getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) method_id = "z_fake_method" addSQLMethod = catalog.manage_addProduct['ZSQLMethods'].manage_addZSQLMethod addSQLMethod(id=method_id, title='', connection_id='erp5_sql_connection', arguments='', template='') zsql_method = catalog._getOb(method_id, None) - self.failUnless(zsql_method is not None) + self.assertTrue(zsql_method is not None) sequence.edit(zsql_method_id = method_id) # set this method in update_object properties of catalog sql_uncatalog_object = list(catalog.sql_uncatalog_object) @@ -1593,13 +1593,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): def stepCreateUpdateCatalogMethod(self, sequence=None, **kw): pc = self.getCatalogTool() catalog = pc.getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) method_id = "z_fake_method" addSQLMethod = catalog.manage_addProduct['ZSQLMethods'].manage_addZSQLMethod addSQLMethod(id=method_id, title='', connection_id='erp5_sql_connection', arguments='', template='') zsql_method = catalog._getOb(method_id, None) - self.failUnless(zsql_method is not None) + self.assertTrue(zsql_method is not None) sequence.edit(zsql_method_id = method_id) # set this method in update_object properties of catalog sql_uncatalog_object = list(catalog.sql_uncatalog_object) @@ -1624,7 +1624,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): addSQLMethod(id=method_id, title='', connection_id='erp5_sql_connection', arguments='', template='') zsql_method = catalog._getOb(method_id, None) - self.failUnless(zsql_method is not None) + self.assertTrue(zsql_method is not None) sequence.edit(another_zsql_method_id = method_id) # set this method in update_object properties of catalog sql_uncatalog_object = list(catalog.sql_uncatalog_object) @@ -1637,25 +1637,25 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): catalog = pc.getSQLCatalog() method_id = sequence.get('zsql_method_id') previous_method = catalog._getOb(method_id,None) - self.assertEquals(previous_method.title,'') + self.assertEqual(previous_method.title,'') previous_method.title='toto' - self.assertEquals(previous_method.title,'toto') + self.assertEqual(previous_method.title,'toto') def stepCheckCatalogMethodChangeKept(self, sequence=None, **kw): pc = self.getCatalogTool() catalog = pc.getSQLCatalog() method_id = sequence.get('zsql_method_id') previous_method = catalog._getOb(method_id,None) - self.assertEquals(previous_method.title,'toto') + self.assertEqual(previous_method.title,'toto') def stepAddCatalogMethodToBusinessTemplate(self, sequence=None, **kw): """ Add catalog method into the business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) method_id = sequence.get('zsql_method_id', None) - self.failUnless(method_id is not None) + self.assertTrue(method_id is not None) pc = self.getCatalogTool() catalog_id = pc.getSQLCatalog().id bt.edit(template_catalog_method_id_list=[catalog_id+'/'+method_id]) @@ -1679,9 +1679,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Add catalog method into the business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) method_id = sequence.get('zsql_method_id', None) - self.failUnless(method_id is not None) + self.assertTrue(method_id is not None) another_method_id = sequence.get('another_zsql_method_id', None) pc = self.getCatalogTool() catalog_id = pc.getSQLCatalog().id @@ -1694,12 +1694,12 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ pc = self.getCatalogTool() catalog = pc.getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) method_id = sequence.get('zsql_method_id', None) zsql_method = catalog._getOb(method_id, None) self.assertNotEqual(zsql_method, None) # check catalog properties - self.failUnless(method_id in catalog.sql_uncatalog_object) + self.assertTrue(method_id in catalog.sql_uncatalog_object) # check filter filter_dict = catalog.filter_dict[method_id] self.assertEqual(filter_dict['filtered'], 1) @@ -1710,12 +1710,12 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): def stepCheckUpdatedCatalogMethodExists(self, sequence=None, **kw): pc = self.getCatalogTool() catalog = pc.getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) method_id = sequence.get('zsql_method_id', None) zsql_method = catalog._getOb(method_id, None) self.assertNotEqual(zsql_method, None) # check catalog properties - self.failUnless(method_id in catalog.sql_uncatalog_object) + self.assertTrue(method_id in catalog.sql_uncatalog_object) # check filter filter_dict = catalog.filter_dict[method_id] self.assertEqual(filter_dict['filtered'], 1) @@ -1729,14 +1729,14 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ pc = self.getCatalogTool() catalog = pc.getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) method_id = sequence.get('zsql_method_id', None) zsql_method = catalog._getOb(method_id, None) - self.failUnless(zsql_method is None) + self.assertTrue(zsql_method is None) # check catalog properties - self.failUnless(method_id not in catalog.sql_uncatalog_object) + self.assertTrue(method_id not in catalog.sql_uncatalog_object) # check filter - self.failUnless(method_id not in catalog.filter_dict.keys()) + self.assertTrue(method_id not in catalog.filter_dict.keys()) def stepRemoveCatalogMethod(self, sequence=None, **kw): """ @@ -1744,20 +1744,20 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ pc = self.getCatalogTool() catalog = pc.getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) method_id = sequence.get('zsql_method_id', None) catalog.manage_delObjects([method_id]) zsql_method = catalog._getOb(method_id, None) - self.failUnless(zsql_method is None) + self.assertTrue(zsql_method is None) # remove catalog properties sql_uncatalog_object = list(catalog.sql_uncatalog_object) sql_uncatalog_object.remove(method_id) sql_uncatalog_object.sort() catalog.sql_uncatalog_object = tuple(sql_uncatalog_object) - self.failUnless(method_id not in catalog.sql_uncatalog_object) + self.assertTrue(method_id not in catalog.sql_uncatalog_object) # remove filter del catalog.filter_dict[method_id] - self.failUnless(method_id not in catalog.filter_dict.keys()) + self.assertTrue(method_id not in catalog.filter_dict.keys()) # Related key, Result key and table, and others def stepCreateKeysAndTable(self, sequence=list, **kw): @@ -1778,91 +1778,91 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): role_key = 'Foo | catalog.owner' local_role_key = 'Bar | catalog.owner' catalog = self.getCatalogTool().getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) # result table if result_table not in catalog.sql_search_tables: sql_search_tables = list(catalog.sql_search_tables) sql_search_tables.append(result_table) sql_search_tables.sort() catalog.sql_search_tables = tuple(sql_search_tables) - self.failUnless(result_table in catalog.sql_search_tables) + self.assertTrue(result_table in catalog.sql_search_tables) # result key if result_key not in catalog.sql_search_result_keys: sql_search_result_keys = list(catalog.sql_search_result_keys) sql_search_result_keys.append(result_key) sql_search_result_keys.sort() catalog.sql_search_result_keys = tuple(sql_search_result_keys) - self.failUnless(result_key in catalog.sql_search_result_keys) + self.assertTrue(result_key in catalog.sql_search_result_keys) # related key if related_key not in catalog.sql_catalog_related_keys: sql_search_related_keys = list(catalog.sql_catalog_related_keys) sql_search_related_keys.append(related_key) sql_search_related_keys.sort() catalog.sql_catalog_related_keys = tuple(sql_search_related_keys) - self.failUnless(related_key in catalog.sql_catalog_related_keys) + self.assertTrue(related_key in catalog.sql_catalog_related_keys) # search keys if search_key not in catalog.sql_catalog_search_keys: sql_catalog_search_keys = list(catalog.sql_catalog_search_keys) sql_catalog_search_keys.append(search_key) sql_catalog_search_keys.sort() catalog.sql_catalog_search_keys = tuple(sql_catalog_search_keys) - self.failUnless(search_key in catalog.sql_catalog_search_keys) + self.assertTrue(search_key in catalog.sql_catalog_search_keys) # keyword keys if keyword_key not in catalog.sql_catalog_keyword_search_keys: sql_catalog_keyword_keys = list(catalog.sql_catalog_keyword_search_keys) sql_catalog_keyword_keys.append(keyword_key) sql_catalog_keyword_keys.sort() catalog.sql_catalog_keyword_search_keys = tuple(sql_catalog_keyword_keys) - self.failUnless(keyword_key in catalog.sql_catalog_keyword_search_keys) + self.assertTrue(keyword_key in catalog.sql_catalog_keyword_search_keys) # full_text keys if full_text_key not in catalog.sql_catalog_full_text_search_keys: sql_catalog_full_text_keys = list(catalog.sql_catalog_full_text_search_keys) sql_catalog_full_text_keys.append(full_text_key) sql_catalog_full_text_keys.sort() catalog.sql_catalog_full_text_search_keys = tuple(sql_catalog_full_text_keys) - self.failUnless(full_text_key in catalog.sql_catalog_full_text_search_keys) + self.assertTrue(full_text_key in catalog.sql_catalog_full_text_search_keys) # request if request_key not in catalog.sql_catalog_request_keys: sql_catalog_request_keys = list(catalog.sql_catalog_request_keys) sql_catalog_request_keys.append(request_key) sql_catalog_request_keys.sort() catalog.sql_catalog_request_keys = tuple(sql_catalog_request_keys) - self.failUnless(request_key in catalog.sql_catalog_request_keys) + self.assertTrue(request_key in catalog.sql_catalog_request_keys) # multivalue if multivalue_key not in catalog.sql_catalog_multivalue_keys: sql_catalog_multivalue_keys = list(catalog.sql_catalog_multivalue_keys) sql_catalog_multivalue_keys.append(multivalue_key) sql_catalog_multivalue_keys.sort() catalog.sql_catalog_multivalue_keys = tuple(sql_catalog_multivalue_keys) - self.failUnless(multivalue_key in catalog.sql_catalog_multivalue_keys) + self.assertTrue(multivalue_key in catalog.sql_catalog_multivalue_keys) # topic keys if topic_key not in catalog.sql_catalog_topic_search_keys: sql_catalog_topic_keys = list(catalog.sql_catalog_topic_search_keys) sql_catalog_topic_keys.append(topic_key) sql_catalog_topic_keys.sort() catalog.sql_catalog_topic_search_keys = tuple(sql_catalog_topic_keys) - self.failUnless(topic_key in catalog.sql_catalog_topic_search_keys) + self.assertTrue(topic_key in catalog.sql_catalog_topic_search_keys) # scriptable keys if scriptable_key not in catalog.sql_catalog_scriptable_keys: sql_catalog_scriptable_keys = list(catalog.sql_catalog_scriptable_keys) sql_catalog_scriptable_keys.append(scriptable_key) sql_catalog_scriptable_keys.sort() catalog.sql_catalog_scriptable_keys = tuple(sql_catalog_scriptable_keys) - self.failUnless(scriptable_key in catalog.sql_catalog_scriptable_keys) + self.assertTrue(scriptable_key in catalog.sql_catalog_scriptable_keys) # role keys if role_key not in catalog.sql_catalog_role_keys: sql_catalog_role_keys = list(catalog.sql_catalog_role_keys) sql_catalog_role_keys.append(role_key) sql_catalog_role_keys.sort() catalog.sql_catalog_role_keys = tuple(sql_catalog_role_keys) - self.failUnless(role_key in catalog.sql_catalog_role_keys) + self.assertTrue(role_key in catalog.sql_catalog_role_keys) # local_role keys if local_role_key not in catalog.sql_catalog_local_role_keys: sql_catalog_local_role_keys = list(catalog.sql_catalog_local_role_keys) sql_catalog_local_role_keys.append(local_role_key) sql_catalog_local_role_keys.sort() catalog.sql_catalog_local_role_keys = tuple(sql_catalog_local_role_keys) - self.failUnless(local_role_key in catalog.sql_catalog_local_role_keys) + self.assertTrue(local_role_key in catalog.sql_catalog_local_role_keys) sequence.edit(related_key=related_key, result_key=result_key, result_table=result_table, search_key=search_key, @@ -1899,11 +1899,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ catalog = self.getCatalogTool().getSQLCatalog() # method related configuration - self.assertEquals(catalog.sql_getitem_by_uid, 'z_getitem_by_uid_2') + self.assertEqual(catalog.sql_getitem_by_uid, 'z_getitem_by_uid_2') # table related configuration - self.failUnless('translation' in catalog.sql_search_tables) + self.assertTrue('translation' in catalog.sql_search_tables) # column related configuration - self.failUnless('catalog.reference' + self.assertTrue('catalog.reference' in catalog.sql_search_result_keys) def stepModifyRelatedKey(self, sequence): @@ -1971,17 +1971,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Remove modification made in stepModifyCatalogConfiguration """ result_key = sequence.get('result_key', None) - self.failUnless(result_key is not None) + self.assertTrue(result_key is not None) result_table = sequence.get('search_table', None) - self.failUnless(result_table is not None) + self.assertTrue(result_table is not None) catalog = self.getCatalogTool().getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) # result key sql_search_result_keys = list(catalog.sql_search_result_keys) sql_search_result_keys.remove(result_key) sql_search_result_keys.sort() catalog.sql_search_result_keys = tuple(sql_search_result_keys) - self.failUnless(result_key not in catalog.sql_search_result_keys) + self.assertTrue(result_key not in catalog.sql_search_result_keys) # search table sql_search_tables = list(catalog.sql_search_tables) sql_search_tables.remove(result_table) @@ -2000,31 +2000,31 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Add some related, result key and tables to Business Temlpate """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) related_key = sequence.get('related_key', None) - self.failUnless(related_key is not None) + self.assertTrue(related_key is not None) result_key = sequence.get('result_key', None) - self.failUnless(result_key is not None) + self.assertTrue(result_key is not None) result_table = sequence.get('result_table', None) - self.failUnless(result_table is not None) + self.assertTrue(result_table is not None) search_key = sequence.get('search_key', None) - self.failUnless(search_key is not None) + self.assertTrue(search_key is not None) keyword_key = sequence.get('keyword_key', None) - self.failUnless(keyword_key is not None) + self.assertTrue(keyword_key is not None) full_text_key = sequence.get('full_text_key', None) - self.failUnless(full_text_key is not None) + self.assertTrue(full_text_key is not None) request_key = sequence.get('request_key', None) - self.failUnless(request_key is not None) + self.assertTrue(request_key is not None) multivalue_key = sequence.get('multivalue_key', None) - self.failUnless(multivalue_key is not None) + self.assertTrue(multivalue_key is not None) topic_key = sequence.get('topic_key', None) - self.failUnless(topic_key is not None) + self.assertTrue(topic_key is not None) scriptable_key = sequence.get('scriptable_key', None) - self.failUnless(scriptable_key is not None) + self.assertTrue(scriptable_key is not None) role_key = sequence.get('role_key', None) - self.failUnless(role_key is not None) + self.assertTrue(role_key is not None) local_role_key = sequence.get('local_role_key', None) - self.failUnless(local_role_key is not None) + self.assertTrue(local_role_key is not None) bt.edit(template_catalog_related_key_list=[related_key], template_catalog_result_key_list=[result_key], @@ -2045,216 +2045,216 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Remove some keys and tables """ related_key = sequence.get('related_key', None) - self.failUnless(related_key is not None) + self.assertTrue(related_key is not None) result_key = sequence.get('result_key', None) - self.failUnless(result_key is not None) + self.assertTrue(result_key is not None) result_table = sequence.get('result_table', None) - self.failUnless(result_table is not None) + self.assertTrue(result_table is not None) search_key = sequence.get('search_key', None) - self.failUnless(search_key is not None) + self.assertTrue(search_key is not None) keyword_key = sequence.get('keyword_key', None) - self.failUnless(keyword_key is not None) + self.assertTrue(keyword_key is not None) full_text_key = sequence.get('full_text_key', None) - self.failUnless(full_text_key is not None) + self.assertTrue(full_text_key is not None) request_key = sequence.get('request_key', None) - self.failUnless(request_key is not None) + self.assertTrue(request_key is not None) multivalue_key = sequence.get('multivalue_key', None) - self.failUnless(multivalue_key is not None) + self.assertTrue(multivalue_key is not None) topic_key = sequence.get('topic_key', None) - self.failUnless(topic_key is not None) + self.assertTrue(topic_key is not None) scriptable_key = sequence.get('scriptable_key', None) - self.failUnless(scriptable_key is not None) + self.assertTrue(scriptable_key is not None) role_key = sequence.get('role_key', None) - self.failUnless(role_key is not None) + self.assertTrue(role_key is not None) local_role_key = sequence.get('local_role_key', None) - self.failUnless(local_role_key is not None) + self.assertTrue(local_role_key is not None) catalog = self.getCatalogTool().getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) # result key sql_search_result_keys = list(catalog.sql_search_result_keys) sql_search_result_keys.remove(result_key) sql_search_result_keys.sort() catalog.sql_search_result_keys = tuple(sql_search_result_keys) - self.failUnless(result_key not in catalog.sql_search_result_keys) + self.assertTrue(result_key not in catalog.sql_search_result_keys) # related key sql_search_related_keys = list(catalog.sql_catalog_related_keys) sql_search_related_keys.remove(related_key) sql_search_related_keys.sort() catalog.sql_catalog_related_keys = tuple(sql_search_related_keys) - self.failUnless(related_key not in catalog.sql_catalog_related_keys) + self.assertTrue(related_key not in catalog.sql_catalog_related_keys) # result table sql_search_tables = list(catalog.sql_search_tables) sql_search_tables.remove(result_table) sql_search_tables.sort() catalog.sql_search_tables = tuple(sql_search_tables) - self.failUnless(result_table not in catalog.sql_search_tables) + self.assertTrue(result_table not in catalog.sql_search_tables) # search keys sql_catalog_search_keys = list(catalog.sql_catalog_search_keys) sql_catalog_search_keys.remove(search_key) sql_catalog_search_keys.sort() catalog.sql_catalog_search_keys = tuple(sql_catalog_search_keys) - self.failUnless(search_key not in catalog.sql_catalog_search_keys) + self.assertTrue(search_key not in catalog.sql_catalog_search_keys) # keyword keys sql_catalog_keyword_keys = list(catalog.sql_catalog_keyword_search_keys) sql_catalog_keyword_keys.remove(keyword_key) sql_catalog_keyword_keys.sort() catalog.sql_catalog_keyword_search_keys = tuple(sql_catalog_keyword_keys) - self.failUnless(keyword_key not in catalog.sql_catalog_keyword_search_keys) + self.assertTrue(keyword_key not in catalog.sql_catalog_keyword_search_keys) # full_text keys sql_catalog_full_text_keys = list(catalog.sql_catalog_full_text_search_keys) sql_catalog_full_text_keys.remove(full_text_key) sql_catalog_full_text_keys.sort() catalog.sql_catalog_full_text_search_keys = tuple(sql_catalog_full_text_keys) - self.failUnless(full_text_key not in catalog.sql_catalog_full_text_search_keys) + self.assertTrue(full_text_key not in catalog.sql_catalog_full_text_search_keys) # request sql_catalog_request_keys = list(catalog.sql_catalog_request_keys) sql_catalog_request_keys.remove(request_key) sql_catalog_request_keys.sort() catalog.sql_catalog_request_keys = tuple(sql_catalog_request_keys) - self.failUnless(request_key not in catalog.sql_catalog_request_keys) + self.assertTrue(request_key not in catalog.sql_catalog_request_keys) # multivalue sql_catalog_multivalue_keys = list(catalog.sql_catalog_multivalue_keys) sql_catalog_multivalue_keys.remove(multivalue_key) sql_catalog_multivalue_keys.sort() catalog.sql_catalog_multivalue_keys = tuple(sql_catalog_multivalue_keys) - self.failUnless(multivalue_key not in catalog.sql_catalog_multivalue_keys) + self.assertTrue(multivalue_key not in catalog.sql_catalog_multivalue_keys) # topic keys sql_catalog_topic_keys = list(catalog.sql_catalog_topic_search_keys) sql_catalog_topic_keys.remove(topic_key) sql_catalog_topic_keys.sort() catalog.sql_catalog_topic_search_keys = tuple(sql_catalog_topic_keys) - self.failUnless(topic_key not in catalog.sql_catalog_topic_search_keys) + self.assertTrue(topic_key not in catalog.sql_catalog_topic_search_keys) # scriptable keys sql_catalog_scriptable_keys = list(catalog.sql_catalog_scriptable_keys) sql_catalog_scriptable_keys.remove(scriptable_key) sql_catalog_scriptable_keys.sort() catalog.sql_catalog_scriptable_keys = tuple(sql_catalog_scriptable_keys) - self.failUnless(scriptable_key not in catalog.sql_catalog_scriptable_keys) + self.assertTrue(scriptable_key not in catalog.sql_catalog_scriptable_keys) # role keys sql_catalog_role_keys = list(catalog.sql_catalog_role_keys) sql_catalog_role_keys.remove(role_key) sql_catalog_role_keys.sort() catalog.sql_catalog_role_keys = tuple(sql_catalog_role_keys) - self.failUnless(role_key not in catalog.sql_catalog_role_keys) + self.assertTrue(role_key not in catalog.sql_catalog_role_keys) # local_role keys sql_catalog_local_role_keys = list(catalog.sql_catalog_local_role_keys) sql_catalog_local_role_keys.remove(local_role_key) sql_catalog_local_role_keys.sort() catalog.sql_catalog_local_role_keys = tuple(sql_catalog_local_role_keys) - self.failUnless(local_role_key not in catalog.sql_catalog_local_role_keys) + self.assertTrue(local_role_key not in catalog.sql_catalog_local_role_keys) def stepCheckKeysAndTableExists(self, sequence=list, **kw): """ Check presence of some keys and tables """ related_key = sequence.get('related_key', None) - self.failUnless(related_key is not None) + self.assertTrue(related_key is not None) result_key = sequence.get('result_key', None) - self.failUnless(result_key is not None) + self.assertTrue(result_key is not None) result_table = sequence.get('result_table', None) - self.failUnless(result_table is not None) + self.assertTrue(result_table is not None) search_key = sequence.get('search_key', None) - self.failUnless(search_key is not None) + self.assertTrue(search_key is not None) keyword_key = sequence.get('keyword_key', None) - self.failUnless(keyword_key is not None) + self.assertTrue(keyword_key is not None) full_text_key = sequence.get('full_text_key', None) - self.failUnless(full_text_key is not None) + self.assertTrue(full_text_key is not None) request_key = sequence.get('request_key', None) - self.failUnless(request_key is not None) + self.assertTrue(request_key is not None) multivalue_key = sequence.get('multivalue_key', None) - self.failUnless(multivalue_key is not None) + self.assertTrue(multivalue_key is not None) topic_key = sequence.get('topic_key', None) - self.failUnless(topic_key is not None) + self.assertTrue(topic_key is not None) scriptable_key = sequence.get('scriptable_key', None) - self.failUnless(scriptable_key is not None) + self.assertTrue(scriptable_key is not None) role_key = sequence.get('role_key', None) - self.failUnless(role_key is not None) + self.assertTrue(role_key is not None) local_role_key = sequence.get('local_role_key', None) - self.failUnless(local_role_key is not None) + self.assertTrue(local_role_key is not None) catalog = self.getCatalogTool().getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) # result key - self.failUnless(result_key in catalog.sql_search_result_keys) + self.assertTrue(result_key in catalog.sql_search_result_keys) # related key - self.failUnless(related_key in catalog.sql_catalog_related_keys) + self.assertTrue(related_key in catalog.sql_catalog_related_keys) # result table - self.failUnless(result_table in catalog.sql_search_tables) + self.assertTrue(result_table in catalog.sql_search_tables) # search key - self.failUnless(search_key in catalog.sql_catalog_search_keys) + self.assertTrue(search_key in catalog.sql_catalog_search_keys) # keyword key - self.failUnless(keyword_key in catalog.sql_catalog_keyword_search_keys) + self.assertTrue(keyword_key in catalog.sql_catalog_keyword_search_keys) # full text key - self.failUnless(full_text_key in catalog.sql_catalog_full_text_search_keys) + self.assertTrue(full_text_key in catalog.sql_catalog_full_text_search_keys) # request key - self.failUnless(request_key in catalog.sql_catalog_request_keys) + self.assertTrue(request_key in catalog.sql_catalog_request_keys) # multivalue key - self.failUnless(multivalue_key in catalog.sql_catalog_multivalue_keys) + self.assertTrue(multivalue_key in catalog.sql_catalog_multivalue_keys) # topic key - self.failUnless(topic_key in catalog.sql_catalog_topic_search_keys) + self.assertTrue(topic_key in catalog.sql_catalog_topic_search_keys) # scriptable key - self.failUnless(scriptable_key in catalog.sql_catalog_scriptable_keys) + self.assertTrue(scriptable_key in catalog.sql_catalog_scriptable_keys) # role key - self.failUnless(role_key in catalog.sql_catalog_role_keys) + self.assertTrue(role_key in catalog.sql_catalog_role_keys) # local_role key - self.failUnless(local_role_key in catalog.sql_catalog_local_role_keys) + self.assertTrue(local_role_key in catalog.sql_catalog_local_role_keys) def stepCheckKeysAndTableRemoved(self, sequence=list, **kw): """ Check non-presence of some keys and tables """ related_key = sequence.get('related_key', None) - self.failUnless(related_key is not None) + self.assertTrue(related_key is not None) result_key = sequence.get('result_key', None) - self.failUnless(result_key is not None) + self.assertTrue(result_key is not None) result_table = sequence.get('result_table', None) - self.failUnless(result_table is not None) + self.assertTrue(result_table is not None) search_key = sequence.get('search_key', None) - self.failUnless(search_key is not None) + self.assertTrue(search_key is not None) keyword_key = sequence.get('keyword_key', None) - self.failUnless(keyword_key is not None) + self.assertTrue(keyword_key is not None) full_text_key = sequence.get('full_text_key', None) - self.failUnless(full_text_key is not None) + self.assertTrue(full_text_key is not None) request_key = sequence.get('request_key', None) - self.failUnless(request_key is not None) + self.assertTrue(request_key is not None) multivalue_key = sequence.get('multivalue_key', None) - self.failUnless(multivalue_key is not None) + self.assertTrue(multivalue_key is not None) topic_key = sequence.get('topic_key', None) - self.failUnless(topic_key is not None) + self.assertTrue(topic_key is not None) scriptable_key = sequence.get('scriptable_key', None) - self.failUnless(scriptable_key is not None) + self.assertTrue(scriptable_key is not None) role_key = sequence.get('role_key', None) - self.failUnless(role_key is not None) + self.assertTrue(role_key is not None) local_role_key = sequence.get('local_role_key', None) - self.failUnless(local_role_key is not None) + self.assertTrue(local_role_key is not None) catalog = self.getCatalogTool().getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) # result key - self.failUnless(result_key not in catalog.sql_search_result_keys) + self.assertTrue(result_key not in catalog.sql_search_result_keys) # related key - self.failUnless(related_key not in catalog.sql_catalog_related_keys) + self.assertTrue(related_key not in catalog.sql_catalog_related_keys) # result table - self.failUnless(result_table not in catalog.sql_search_tables) + self.assertTrue(result_table not in catalog.sql_search_tables) # search key - self.failUnless(search_key not in catalog.sql_catalog_search_keys) + self.assertTrue(search_key not in catalog.sql_catalog_search_keys) # keyword key - self.failUnless(keyword_key not in catalog.sql_catalog_keyword_search_keys) + self.assertTrue(keyword_key not in catalog.sql_catalog_keyword_search_keys) # full text key - self.failUnless(full_text_key not in catalog.sql_catalog_full_text_search_keys) + self.assertTrue(full_text_key not in catalog.sql_catalog_full_text_search_keys) # request key - self.failUnless(request_key not in catalog.sql_catalog_request_keys) + self.assertTrue(request_key not in catalog.sql_catalog_request_keys) # multivalue key - self.failUnless(multivalue_key not in catalog.sql_catalog_multivalue_keys) + self.assertTrue(multivalue_key not in catalog.sql_catalog_multivalue_keys) # topic key - self.failUnless(topic_key not in catalog.sql_catalog_topic_search_keys) + self.assertTrue(topic_key not in catalog.sql_catalog_topic_search_keys) # scriptable key - self.failUnless(scriptable_key not in catalog.sql_catalog_scriptable_keys) + self.assertTrue(scriptable_key not in catalog.sql_catalog_scriptable_keys) # role key - self.failUnless(role_key not in catalog.sql_catalog_role_keys) + self.assertTrue(role_key not in catalog.sql_catalog_role_keys) # local_role key - self.failUnless(local_role_key not in catalog.sql_catalog_local_role_keys) + self.assertTrue(local_role_key not in catalog.sql_catalog_local_role_keys) # Roles def stepCreateRole(self, sequence=None, **kw): @@ -2266,7 +2266,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): role_list = list(p.__ac_roles__) role_list.append(new_role) p.__ac_roles__ = tuple(role_list) - self.failUnless(new_role in p.__ac_roles__) + self.assertTrue(new_role in p.__ac_roles__) sequence.edit(role=new_role) def stepRemoveRole(self, sequence=None, **kw): @@ -2274,21 +2274,21 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Remove a role """ role = sequence.get('role', None) - self.failUnless(role is not None) + self.assertTrue(role is not None) p = self.getPortal() role_list = list(p.__ac_roles__) role_list.remove(role) p.__ac_roles__ = tuple(role_list) - self.failUnless(role not in p.__ac_roles__) + self.assertTrue(role not in p.__ac_roles__) def stepAddRoleToBusinessTemplate(self, sequence=None, **kw): """ Add Role to Business Template """ role = sequence.get('role', None) - self.failUnless(role is not None) + self.assertTrue(role is not None) bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) bt.edit(template_role_list=[role]) def stepCheckRoleExists(self, sequence=None, **kw): @@ -2296,18 +2296,18 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Check presence of role """ role = sequence.get('role', None) - self.failUnless(role is not None) + self.assertTrue(role is not None) p = self.getPortal() - self.failUnless(role in p.__ac_roles__) + self.assertTrue(role in p.__ac_roles__) def stepCheckRoleRemoved(self, sequence=None, **kw): """ Check non-presence of role """ role = sequence.get('role', None) - self.failUnless(role is not None) + self.assertTrue(role is not None) p = self.getPortal() - self.failUnless(role not in p.__ac_roles__) + self.assertTrue(role not in p.__ac_roles__) # Local Roles def stepCreateLocalRoles(self, sequence=None, **kw): @@ -2319,9 +2319,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): p = self.getPortal() module_id = sequence.get('module_id') module = p._getOb(module_id, None) - self.failUnless(module is not None) + self.assertTrue(module is not None) module.__ac_local_roles__ = new_local_roles - self.assertEquals(module.__ac_local_roles__, new_local_roles) + self.assertEqual(module.__ac_local_roles__, new_local_roles) sequence.edit(local_roles=new_local_roles) def stepRemoveLocalRoles(self, sequence=None, **kw): @@ -2331,7 +2331,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): p = self.getPortal() module_id = sequence.get('module_id') module = p._getOb(module_id, None) - self.failUnless(module is not None) + self.assertTrue(module is not None) module.__ac_local_roles__ = {'someone_else': ['Associate']} new_local_roles = sequence.get('local_roles') self.assertNotEquals(module.__ac_local_roles__, new_local_roles) @@ -2342,7 +2342,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ module_id = sequence.get('module_id') bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) bt.edit(template_local_role_list=[module_id]) def stepCheckLocalRolesExists(self, sequence=None, **kw): @@ -2353,14 +2353,14 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): p = self.getPortal() module_id = sequence.get('module_id') module = p._getOb(module_id, None) - self.failUnless(module is not None) - self.assertEquals(module.__ac_local_roles__, new_local_roles) + self.assertTrue(module is not None) + self.assertEqual(module.__ac_local_roles__, new_local_roles) def stepCheckModuleLocalRolesInCatalogBeforeUpdate(self, sequence=None, **kw): p = self.getPortal() module_id = sequence.get('module_id') module = p._getOb(module_id, None) - self.failUnless(module is not None) + self.assertTrue(module is not None) sql = "select distinct roles_and_users.uid as uid, allowedRolesAndUsers as role from catalog, roles_and_users where catalog.security_uid = roles_and_users.uid and catalog.uid=%s" %(module.getUid(),) sql_connection = self.getSQLConnection() result = sql_connection.manage_test(sql) @@ -2372,7 +2372,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): module_id = sequence.get('module_id') before_update_local_roles = sequence.get('local_roles_catalog_result') module = p._getOb(module_id, None) - self.failUnless(module is not None) + self.assertTrue(module is not None) sql = "select distinct roles_and_users.uid as uid, allowedRolesAndUsers as role from catalog, roles_and_users where catalog.security_uid = roles_and_users.uid and catalog.uid=%s" %(module.getUid(),) sql_connection = self.getSQLConnection() result = sql_connection.manage_test(sql) @@ -2387,7 +2387,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): p = self.getPortal() module_id = sequence.get('module_id') module = p._getOb(module_id, None) - self.failUnless(module is not None) + self.assertTrue(module is not None) self.assertNotEquals(module.__ac_local_roles__, new_local_roles) # Document, Property Sheet, Extension And Test @@ -2406,7 +2406,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): f = file(file_path, 'w') f.write(ps_data) f.close() - self.failUnless(os.path.exists(file_path)) + self.assertTrue(os.path.exists(file_path)) sequence.edit(ps_title=ps_title, ps_path=file_path, ps_data=ps_data) def stepAddPropertySheetToBusinessTemplate(self, sequence=None, **kw): @@ -2414,9 +2414,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Add Property Sheet to Business Template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) ps_title = sequence.get('ps_title', None) - self.failUnless(ps_title is not None) + self.assertTrue(ps_title is not None) bt.edit(template_property_sheet_id_list=[ps_title]) def stepCheckPropertySheetMigration(self, sequence=None, **kw): @@ -2424,13 +2424,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Check migration of Property Sheets from the Filesystem to ZODB """ property_sheet_tool = self.getPortalObject().portal_property_sheets - self.failUnless('UnitTest' in property_sheet_tool.objectIds()) + self.assertTrue('UnitTest' in property_sheet_tool.objectIds()) property_list = property_sheet_tool.UnitTest.contentValues() - self.assertEquals(len(property_list), 1) - self.failUnless(property_list[0].getReference() == 'ps_prop1') - self.failUnless(property_list[0].getElementaryType() == 'string') + self.assertEqual(len(property_list), 1) + self.assertTrue(property_list[0].getReference() == 'ps_prop1') + self.assertTrue(property_list[0].getElementaryType() == 'string') def stepRemovePropertySheet(self, sequence=None, sequencer_list=None, **kw): """ @@ -2438,17 +2438,17 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ ps_title = sequence.get('ps_title', None) ps_path = sequence.get('ps_path', None) - self.failUnless(ps_path is not None) - self.failUnless(os.path.exists(ps_path)) + self.assertTrue(ps_path is not None) + self.assertTrue(os.path.exists(ps_path)) os.remove(ps_path) - self.failIf(os.path.exists(ps_path)) + self.assertFalse(os.path.exists(ps_path)) return # Property Sheet will not be installed in file sytem - self.failIf(os.path.exists(ps_path)) + self.assertFalse(os.path.exists(ps_path)) # Property Sheet will be installed in ZODB - self.failUnless(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) + self.assertTrue(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) self.portal.portal_property_sheets.manage_delObjects([ps_title]) - self.failIf(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) + self.assertFalse(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) def stepRemovePropertySheetFromZODB(self, sequence=None, sequencer_list=None, **kw): """ @@ -2456,13 +2456,13 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ ps_title = sequence.get('ps_title', None) ps_path = sequence.get('ps_path', None) - self.failUnless(ps_path is not None) + self.assertTrue(ps_path is not None) # Property Sheet will not be installed in file sytem - self.failIf(os.path.exists(ps_path)) + self.assertFalse(os.path.exists(ps_path)) # Property Sheet will be installed in ZODB - self.failUnless(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) + self.assertTrue(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) self.portal.portal_property_sheets.manage_delObjects([ps_title]) - self.failIf(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) + self.assertFalse(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) def stepCheckPropertySheetExists(self, sequence=None, sequencer_list=None, **kw): """ @@ -2470,27 +2470,27 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ ps_title = sequence.get('ps_title', None) ps_path = sequence.get('ps_path', None) - self.failUnless(ps_path is not None) + self.assertTrue(ps_path is not None) # Property Sheet will not be installed in file sytem - self.failIf(os.path.exists(ps_path)) + self.assertFalse(os.path.exists(ps_path)) # Property Sheet will be installed in ZODB - self.failUnless(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) + self.assertTrue(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) def stepCheckPropertySheetRemoved(self, sequence=None, sequencer_list=None, **kw): """ Check deletion of Property Sheet """ ps_path = sequence.get('ps_path', None) - self.failUnless(ps_path is not None) - self.failIf(os.path.exists(ps_path)) + self.assertTrue(ps_path is not None) + self.assertFalse(os.path.exists(ps_path)) def stepCheckMigratedPropertySheetRemoved(self, sequence=None, **kw): """ Check deletion of migrated Property Sheet """ ps_id = sequence.get('ps_title', None) - self.failIf(ps_id is None) - self.failIf(ps_id in self.getPortalObject().portal_property_sheets.objectIds()) + self.assertFalse(ps_id is None) + self.assertFalse(ps_id in self.getPortalObject().portal_property_sheets.objectIds()) def stepCreateUpdatedPropertySheet(self, sequence=None, **kw): """ @@ -2506,7 +2506,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): f = file(file_path, 'w') f.write(ps_data) f.close() - self.failUnless(os.path.exists(file_path)) + self.assertTrue(os.path.exists(file_path)) sequence.edit(ps_data_u=ps_data) def stepCheckUpdatedPropertySheetExists(self, sequence=None, sequencer_list=None, **kw): @@ -2515,11 +2515,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ ps_title = sequence.get('ps_title', None) ps_path = sequence.get('ps_path', None) - self.failUnless(ps_path is not None) + self.assertTrue(ps_path is not None) # Property Sheet will not be installed in file sytem - self.failIf(os.path.exists(ps_path)) + self.assertFalse(os.path.exists(ps_path)) # Property Sheet will be installed in ZODB - self.failUnless(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) + self.assertTrue(getattr(self.portal.portal_property_sheets, ps_title, None) is not None) # Busines templates def stepImportBusinessTemplate(self, sequence=None, **kw): @@ -2536,8 +2536,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): import_id = "%s_%s" %(import_id, n) template_tool.download(url='file:'+template_path, id=import_id) import_bt = template_tool._getOb(id=import_id) - self.failIf(import_bt is None) - self.assertEquals(import_bt.getPortalType(), 'Business Template') + self.assertFalse(import_bt is None) + self.assertEqual(import_bt.getPortalType(), 'Business Template') sequence.edit(import_bt=import_bt) def stepAddExtraSlashesToTemplatePath(self, sequence=None, **kw): @@ -2627,8 +2627,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ pt = self.getTemplateTool() template = pt.newContent(portal_type='Business Template') - self.failUnless(template.getBuildingState() == 'draft') - self.failUnless(template.getInstallationState() == 'not_installed') + self.assertTrue(template.getBuildingState() == 'draft') + self.assertTrue(template.getInstallationState() == 'not_installed') template.edit(title='geek template', version='1.0', description='bt for unit_test') @@ -2640,8 +2640,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ pt = self.getTemplateTool() template = pt.newContent(portal_type='Business Template') - self.failUnless(template.getBuildingState() == 'draft') - self.failUnless(template.getInstallationState() == 'not_installed') + self.assertTrue(template.getBuildingState() == 'draft') + self.assertTrue(template.getInstallationState() == 'not_installed') template.edit(title='geek template', version='2.0', description='bt for unit_test') @@ -2654,8 +2654,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ pt = self.getTemplateTool() template = pt.newContent(portal_type='Business Template') - self.failUnless(template.getBuildingState() == 'draft') - self.failUnless(template.getInstallationState() == 'not_installed') + self.assertTrue(template.getBuildingState() == 'draft') + self.assertTrue(template.getInstallationState() == 'not_installed') template.edit(title='duplicated geek template', version='1.0', description='bt for unit_test') @@ -2700,7 +2700,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): shutil.rmtree(template_path) template.export(path=template_path, local=1) sequence.edit(template_path=template_path) - self.failUnless(os.path.exists(template_path)) + self.assertTrue(os.path.exists(template_path)) def stepCheckObjectPropertiesInBusinessTemplate(self, sequence=None, **kw): """ @@ -2721,11 +2721,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): if item is not None: for key, data in item._objects.items(): if hasattr(data, '__ac_local_roles__'): - self.failUnless(data.__ac_local_roles__ is None) + self.assertTrue(data.__ac_local_roles__ is None) if hasattr(data, '_owner'): - self.failUnless(data._owner is None) + self.assertTrue(data._owner is None) if hasattr(aq_base(data), 'uid'): - self.failUnless(data.uid is None) + self.assertTrue(data.uid is None) def stepCheckUnindexActivityPresence(self, sequence=None, **kw): """ @@ -2734,7 +2734,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): message_list = [ m for m in self.portal.portal_activities.getMessageList() if m.method_id == 'unindexObject' and m.kw.get('uid') is not None ] - self.assertEquals(len(message_list), 0) + self.assertEqual(len(message_list), 0) def stepCheckFolderReindexActivityPresence(self, sequence=None, **kw): """ @@ -2753,11 +2753,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): category_id_list = sequence.get('category_id_list') portal = self.getPortal() ob = portal.unrestrictedTraverse(path) - self.failUnless(ob is not None) + self.assertTrue(ob is not None) for id_ in category_id_list: cat = ob[id_] catalog_ob_list = [x.getObject() for x in portal.portal_catalog(uid=cat.getUid())] - self.failUnless(len(catalog_ob_list) > 0) + self.assertTrue(len(catalog_ob_list) > 0) def stepSetUpdateToolFlagInBusinessTemplate(self, sequence=None): """ @@ -2776,7 +2776,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): template_tool = self.getTemplateTool() template_tool.manage_delObjects([bt_id]) bt = template_tool._getOb(bt_id, None) - self.failUnless(bt is None) + self.assertTrue(bt is None) def stepUninstallBusinessTemplate(self, sequence=None, **kw): """ @@ -2816,10 +2816,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): def stepRemoveSimulationTool(self, sequence=None, **kw): p = self.getPortal() p.manage_delObjects(['portal_simulation']) - self.failUnless(p._getOb('portal_simulation', None) is None) + self.assertTrue(p._getOb('portal_simulation', None) is None) def stepCheckSimulationToolExists(self, sequence=None, **kw): - self.failUnless(self.getSimulationTool() is not None) + self.assertTrue(self.getSimulationTool() is not None) def stepCheckSubobjectsNotIncluded(self, sequence=None, **kw): """Check subobjects are not included in the base category. @@ -2829,8 +2829,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): # XXX maybe too low level base_category_obj = bt._category_item._objects.get( 'portal_categories/%s' % base_category_id) - self.failUnless(base_category_obj is not None) - self.assertEquals(len(base_category_obj.objectIds()), 0) + self.assertTrue(base_category_obj is not None) + self.assertEqual(len(base_category_obj.objectIds()), 0) def stepCheckInitialRevision(self, sequence=None, **kw): """ Check if revision of a new bt is an empty string @@ -2859,7 +2859,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): bt.checkDependencies() except: missing_dep = True - self.failUnless(not missing_dep) + self.assertTrue(not missing_dep) def stepCheckMissingDependencies(self, sequence=None, **kw): """ Check if bt has missing dependency @@ -2870,7 +2870,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): bt.checkDependencies() except: missing_dep = True - self.failUnless(missing_dep) + self.assertTrue(missing_dep) def stepAddDependency(self, sequence=None, **kw): """ Add a dependency to the business template @@ -2881,8 +2881,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): def stepCreateDependencyBusinessTemplate(self, sequence=None, **kw): pt = self.getTemplateTool() template = pt.newContent(portal_type='Business Template') - self.failUnless(template.getBuildingState() == 'draft') - self.failUnless(template.getInstallationState() == 'not_installed') + self.assertTrue(template.getBuildingState() == 'draft') + self.assertTrue(template.getInstallationState() == 'not_installed') template.edit(title='dependency_bt', version='1.0', description='bt for unit_test') @@ -2957,7 +2957,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): pw = self.getWorkflowTool() addWorkflowByType(pw, WORKFLOW_TYPE, wf_id) workflow = pw._getOb(wf_id, None) - self.failUnless(workflow is not None) + self.assertTrue(workflow is not None) sequence.edit(workflow_id=workflow.getId()) cbt = pw._chains_by_type props = {} @@ -2977,8 +2977,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ pt = self.getTemplateTool() template = pt.newContent(portal_type='Business Template') - self.failUnless(template.getBuildingState() == 'draft') - self.failUnless(template.getInstallationState() == 'not_installed') + self.assertTrue(template.getBuildingState() == 'draft') + self.assertTrue(template.getInstallationState() == 'not_installed') template.edit(title='custom geek template', version='1.0', description='custom bt for unit_test') @@ -3045,7 +3045,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Remove workflow to business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) current_twi = list(bt.getTemplateWorkflowIdList()) current_twi.remove(sequence.get('workflow_id', '')) bt.edit(template_workflow_id_list=current_twi) @@ -3055,7 +3055,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Remove workflow chain to business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) workflow_id = sequence.get('workflow_id', '') new_value = [] workflow_chain_list = list(bt.getTemplatePortalTypeWorkflowChainList()) @@ -3087,7 +3087,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Add type role to business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) ptype_ids = [] ptype_ids.append(sequence.get('object_ptype_id', '')) ptype_ids.append(sequence.get('module_ptype_id', '')) @@ -3132,7 +3132,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): pt = self.getTypeTool() object_id = sequence.get('object_ptype_id') object_type = pt._getOb(object_id, None) - self.failUnless(object_type.title.startswith('Modified ')) + self.assertTrue(object_type.title.startswith('Modified ')) def stepCreateFakeZODBScript(self, sequence=None, **kw): """Create a Script inside portal_skins @@ -3153,7 +3153,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): Add types to business template """ bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) template_skin_id_list = list(bt.getProperty('template_skin_id_list')) template_skin_id_list.append('custom') bt.edit(template_skin_id_list=template_skin_id_list) @@ -3187,18 +3187,18 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): def stepCheckSiteProperty(self, sequence=None, **kw): """Check a site property.""" portal = self.getPortal() - self.assertEquals(portal.getProperty('a_property'), + self.assertEqual(portal.getProperty('a_property'), sequence.get('site_property_value')) def stepCheckSitePropertyRemoved(self, sequence=None, **kw): """Check if a site property is removed.""" portal = self.getPortal() - self.failIf(portal.hasProperty('a_property')) + self.assertFalse(portal.hasProperty('a_property')) def stepAddSitePropertyToBusinessTemplate(self, sequence=None, **kw): """Add a site property into a business template.""" bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) bt.edit(template_site_property_id_list=('a_property',)) def stepCheckSkinSelectionRemoved(self, sequence=None, **kw): @@ -3247,8 +3247,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ ps = self.portal.portal_skins for skin in ps.getSkinSelections(): - self.assertEquals('erp5_core', ps.getSkinPath(skin).split(',')[0]) - self.assertEquals('erp5_geek', ps.getSkinPath(skin).split(',')[1]) + self.assertEqual('erp5_core', ps.getSkinPath(skin).split(',')[0]) + self.assertEqual('erp5_geek', ps.getSkinPath(skin).split(',')[1]) def stepCheckSkinFolderPriorityOff(self, sequence=None, **kw): """ @@ -3256,8 +3256,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): """ ps = self.portal.portal_skins for skin in ps.getSkinSelections(): - self.assertEquals('erp5_geek', ps.getSkinPath(skin).split(',')[0]) - self.assertEquals('erp5_core', ps.getSkinPath(skin).split(',')[1]) + self.assertEqual('erp5_geek', ps.getSkinPath(skin).split(',')[0]) + self.assertEqual('erp5_core', ps.getSkinPath(skin).split(',')[1]) def stepUserDisableSkinFolderPriority(self, sequence=None, **kw): """ @@ -3293,7 +3293,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): 'business_template_skin_layer_priority', 99, type='float') # Make sure it is really set. - self.assertEquals( + self.assertEqual( 99, skin_folder.getProperty('business_template_skin_layer_priority')) def stepUnmodifySkinFolder(self, sequence=None, **kw): @@ -3301,7 +3301,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): skin_id = sequence.get('skin_folder_id') skin_folder = ps._getOb(skin_id, None) skin_folder._delProperty('business_template_skin_layer_priority') - self.assertEquals( + self.assertEqual( None, skin_folder.getProperty('business_template_skin_layer_priority')) def stepCheckModifiedSkinFolderExists(self, sequence=None, **kw): @@ -3311,7 +3311,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): ps = self.getSkinsTool() skin_id = sequence.get('skin_folder_id') skin_folder = ps._getOb(skin_id, None) - self.assertEquals( + self.assertEqual( 99, skin_folder.getProperty('business_template_skin_layer_priority')) def stepCheckDocumentPropertySheetSameName(self, sequence=None, **kw): @@ -3335,7 +3335,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): self.portal.portal_property_sheets.manage_delObjects([sequence['ps_title']]) def stepCheckDraftBuildingState(self, sequence=None, **kw): - self.assertEquals(sequence['current_bt'].getBuildingState(), 'draft') + self.assertEqual(sequence['current_bt'].getBuildingState(), 'draft') def stepSimulateAndCopyPrePropertySheetMigrationBusinessTemplate(self, sequence=None, **kw): portal = self.getPortalObject() @@ -3370,7 +3370,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): # tests def test_Title(self): """Tests the Title of the Template Tool.""" - self.assertEquals('Template Tool', self.getTemplateTool().Title()) + self.assertEqual('Template Tool', self.getTemplateTool().Title()) def test_01_checkNewSite(self): """Test Check New Site""" @@ -5605,7 +5605,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): bt5 = self.getPortal().portal_templates.newContent( portal_type='Business Template', dependency_list=['erp5_core (>= %s)' % erp5_core_version]) - self.assertEquals(None, bt5.checkDependencies()) + self.assertEqual(None, bt5.checkDependencies()) bt5.setDependencyList(['erp5_core (> %s)' % erp5_core_version]) self.assertRaises(BusinessTemplateMissingDependency, bt5.checkDependencies) @@ -6321,7 +6321,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): props['chain_%s' % id] = ','.join(wf_ids) props['chain_Dummy Type'] = 'edit_workflow' pw.manage_changeWorkflows('', props=props) - self.assertEquals(('edit_workflow', ), pw.getChainFor('Dummy Type')) + self.assertEqual(('edit_workflow', ), pw.getChainFor('Dummy Type')) bt = self.portal.portal_templates.newContent( portal_type='Business Template', @@ -6351,7 +6351,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): # portal type template item are exported in their physical location for template_item in ('PortalTypeTemplateItem', 'ActionTemplateItem',): - self.assertEquals(['dummy_type_provider'], + self.assertEqual(['dummy_type_provider'], [os.path.basename(f) for f in glob.glob('%s/%s/*' % (export_dir, template_item))]) new_bt = self.portal.portal_templates.download( @@ -6384,31 +6384,31 @@ class TestBusinessTemplate(BusinessTemplateMixin): dummy_type = types_tool.getTypeInfo('Dummy Type') self.assertNotEquals(None, dummy_type) # all the configuration from the type is still here - self.assertEquals(['Reference'], dummy_type.getTypePropertySheetList()) - self.assertEquals(['source'], dummy_type.getTypeBaseCategoryList()) - self.assertEquals(['Dummy Type'], dummy_type.getTypeAllowedContentTypeList()) - self.assertEquals(['Dummy Type'], dummy_type.getTypeHiddenContentTypeList()) + self.assertEqual(['Reference'], dummy_type.getTypePropertySheetList()) + self.assertEqual(['source'], dummy_type.getTypeBaseCategoryList()) + self.assertEqual(['Dummy Type'], dummy_type.getTypeAllowedContentTypeList()) + self.assertEqual(['Dummy Type'], dummy_type.getTypeHiddenContentTypeList()) action_list = dummy_type.contentValues(portal_type='Action Information') - self.assertEquals(['View'], [action.getTitle() for action in action_list]) - self.assertEquals(['view'], [action.getReference() for action in action_list]) + self.assertEqual(['View'], [action.getTitle() for action in action_list]) + self.assertEqual(['view'], [action.getReference() for action in action_list]) role_list = dummy_type.contentValues(portal_type='Role Information') - self.assertEquals(['Dummy Role Definition'], + self.assertEqual(['Dummy Role Definition'], [role.getTitle() for role in role_list]) - self.assertEquals(('edit_workflow',), pw.getChainFor('Dummy Type')) + self.assertEqual(('edit_workflow',), pw.getChainFor('Dummy Type')) # and our type can be used instance = self.portal.newContent(portal_type='Dummy Type', id='test_document') instance.setSourceReference('OK') - self.assertEquals('OK', instance.getSourceReference()) + self.assertEqual('OK', instance.getSourceReference()) finally: new_bt.uninstall() self.assertNotEquals(None, types_tool.getTypeInfo('Base Category')) - self.assertEquals(None, types_tool.getTypeInfo('Dummy Type')) + self.assertEqual(None, types_tool.getTypeInfo('Dummy Type')) self.assertFalse('dummy_type_provider' in types_tool.type_provider_list) def test_type_provider_2(self): @@ -6498,7 +6498,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): self.tic() # actions are exported in portal_types/ and then the id of the container # tool - self.assertEquals(['portal_actions'], + self.assertEqual(['portal_actions'], [os.path.basename(f) for f in glob.glob('%s/ActionTemplateItem/portal_types/*' % (export_dir, ))]) new_bt = self.portal.portal_templates.download( @@ -6557,12 +6557,12 @@ class TestBusinessTemplate(BusinessTemplateMixin): # after installation, the exported document is replaced with the one from # the business template - self.assertEquals('Exported', self.portal.exported_path.getTitle()) + self.assertEqual('Exported', self.portal.exported_path.getTitle()) # but its uid did not change - self.assertEquals(uid, self.portal.exported_path.getUid()) + self.assertEqual(uid, self.portal.exported_path.getUid()) # and it is still in the catalog self.tic() - self.assertEquals(self.portal.exported_path, + self.assertEqual(self.portal.exported_path, self.portal.portal_catalog.getResultValue(uid=uid)) @expectedFailure @@ -6686,15 +6686,15 @@ class TestBusinessTemplate(BusinessTemplateMixin): new_bt.install() try: role, = object_type.getRoleInformationList() - self.assertEquals(self.portal.portal_categories.local_role_group.Alternate, + self.assertEqual(self.portal.portal_categories.local_role_group.Alternate, role.getLocalRoleGroupValue()) path = self.portal.geek_module['1'] - self.assertEquals(sorted([ + self.assertEqual(sorted([ ('another_group', ['Assignee']), ('group', ['Assignee', 'Assignor']), ]), sorted([item for item in path.__ac_local_roles__.items() if item[1] != ['Owner']])) - self.assertEquals(initial___ac_local_roles_group_id_dict__, + self.assertEqual(initial___ac_local_roles_group_id_dict__, path.__ac_local_roles_group_id_dict__) # make sure we can reindexing the object works path.recursiveImmediateReindexObject() @@ -6747,7 +6747,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): def stepSetVersionPriorityRegisteredSelection(self, sequence=None, **kw): bt = sequence.get('current_bt') - self.failIf(bt is None) + self.assertFalse(bt is None) version_priority_list = ('abc| 1.0', 'def |99.0', @@ -6763,7 +6763,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): def stepUpdateVersionPriorityRegisteredSelection(self, sequence=None, **kw): bt = sequence.get('current_bt') - self.failIf(bt is None) + self.assertFalse(bt is None) version_priority_list = ('erp4', 'abc | 1.0', @@ -6862,8 +6862,8 @@ class TestBusinessTemplate(BusinessTemplateMixin): file_content = getattr(skin_folder, sequence.get('fake_file_id')).data expected_file_content = sequence.get('fake_file_content') - self.assertEquals(file_content, expected_file_content) - self.assertEquals(len(file_content), len(expected_file_content)) + self.assertEqual(file_content, expected_file_content) + self.assertEqual(len(file_content), len(expected_file_content)) def test_text_file_import_export(self): """ @@ -6925,7 +6925,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): for i in range(self.organisation_amount): organisation = organisation_module.newContent( portal_type = 'Organisation') - self.failUnless(organisation is not None) + self.assertTrue(organisation is not None) organisation.setTitle('organisation %d' % (i + 1)) for j in range(self.email_amount): organisation.newContent(id='email%d' % (j+1), @@ -7002,7 +7002,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): def stepAddOrganisationToBusinessTemplate(self, sequence=None, **kw): bt = sequence.get('current_bt', None) - self.failUnless(bt is not None) + self.assertTrue(bt is not None) if bt.getTemplatePathList(): path_list = bt.getTemplatePathList()[:] path_list = path_list + ('organisation_module/**',) @@ -7114,7 +7114,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): f = file(file_path, 'w') f.write(self.document_data) f.close() - self.failUnless(os.path.exists(file_path)) + self.assertTrue(os.path.exists(file_path)) sequence.edit(document_title=self.document_title, document_path=file_path, document_data=self.document_data) @@ -7125,7 +7125,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): f = file(file_path, 'w') f.write(self.document_data_updated) f.close() - self.failUnless(os.path.exists(file_path)) + self.assertTrue(os.path.exists(file_path)) sequence.edit(document_title=self.document_title, document_path=file_path, document_data_updated=self.document_data_updated) @@ -7136,20 +7136,20 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): def stepRemoveDocument(self, sequence=None, **kw): document_path = sequence['document_path'] os.remove(document_path) - self.failIf(os.path.exists(document_path)) + self.assertFalse(os.path.exists(document_path)) def stepCheckDocumentExists(self, sequence=None, **kw): - self.failIf(not os.path.exists(sequence['document_path'])) + self.assertFalse(not os.path.exists(sequence['document_path'])) self.assertEqual(file(sequence['document_path']).read(), sequence['document_data']) def stepCheckUpdatedDocumentExists(self, sequence=None, **kw): - self.failIf(not os.path.exists(sequence['document_path'])) + self.assertFalse(not os.path.exists(sequence['document_path'])) self.assertEqual(file(sequence['document_path']).read(), sequence['document_data_updated']) def stepCheckDocumentRemoved(self, sequence=None, **kw): - self.failIf(os.path.exists(sequence['document_path'])) + self.assertFalse(os.path.exists(sequence['document_path'])) def test_BusinessTemplateWithDocument(self): sequence_list = SequenceList() @@ -7415,9 +7415,9 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): sequence['document_id'], None) self.assertNotEqual(component, None) - self.assertEquals(sorted(list(component.workflow_history)), + self.assertEqual(sorted(list(component.workflow_history)), ['component_validation_workflow', 'edit_workflow']) - self.failIf(len(component.workflow_history['component_validation_workflow']) <= 1) + self.assertFalse(len(component.workflow_history['component_validation_workflow']) <= 1) def stepRemoveZodbDocument(self, sequence=None, **kw): self.getPortalObject().portal_components.deleteContent( @@ -7428,21 +7428,21 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): sequence['document_id'], None) self.assertNotEqual(component, None) - self.assertEquals(component.getValidationState(), 'validated') + self.assertEqual(component.getValidationState(), 'validated') # Only the last Workflow History should have been exported - self.assertEquals(list(component.workflow_history), + self.assertEqual(list(component.workflow_history), ['component_validation_workflow']) validation_state_only_list = [] for validation_dict in list(component.workflow_history['component_validation_workflow']): validation_state_only_list.append(validation_dict.get('validation_state')) - self.assertEquals(validation_state_only_list, ['validated']) + self.assertEqual(validation_state_only_list, ['validated']) def stepCheckZodbDocumentRemoved(self, sequence=None, **kw): component_tool = self.getPortalObject().portal_components - self.failIf(sequence['document_id'] in component_tool.objectIds()) + self.assertFalse(sequence['document_id'] in component_tool.objectIds()) def stepRemoveZodbDocument(self, sequence=None, **kw): self.portal.portal_components.manage_delObjects([sequence['document_id']]) @@ -7467,7 +7467,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): source_code = sequence['document_data'] with open(python_source_code_path) as f: - self.assertEquals(f.read(), source_code) + self.assertEqual(f.read(), source_code) xml_path = base_path + '.xml' self.assertTrue(os.path.exists(xml_path)) @@ -7475,7 +7475,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): first_line = source_code.split('\n', 1)[0] with open(xml_path) as f: for line in f: - self.failIf(first_line in line) + self.assertFalse(first_line in line) def test_BusinessTemplateWithZodbDocument(self): sequence_list = SequenceList() @@ -7609,16 +7609,16 @@ class TestDocumentTemplateItem(BusinessTemplateMixin): component_id = '%s.erp5.%s' % (self.component_id_prefix, sequence.get('document_title')) - self.assertEquals(bt.getProperty(self.template_property), + self.assertEqual(bt.getProperty(self.template_property), [component_id]) component_tool = self.getPortalObject().portal_components - self.failUnless(component_id in component_tool.objectIds()) + self.assertTrue(component_id in component_tool.objectIds()) component = getattr(component_tool, component_id) - self.assertEquals(component.getReference(), sequence['document_title']) - self.assertEquals(component.getTextContent(), sequence['document_data']) - self.assertEquals(component.getPortalType(), self.component_portal_type) + self.assertEqual(component.getReference(), sequence['document_title']) + self.assertEqual(component.getTextContent(), sequence['document_data']) + self.assertEqual(component.getPortalType(), self.component_portal_type) sequence.edit(document_id=component_id) def test_BusinessTemplateWithZodbDocumentMigrated(self): diff --git a/product/ERP5/tests/testCRM.py b/product/ERP5/tests/testCRM.py index a7d60fe2e3..c1eb08f940 100644 --- a/product/ERP5/tests/testCRM.py +++ b/product/ERP5/tests/testCRM.py @@ -94,10 +94,10 @@ class TestCRM(BaseTestCRM): for portal_type in self.portal.getPortalEventTypeList(): event = event_module.newContent(portal_type=portal_type) # quantity on events is 1 by default - self.assertEquals(1, event.getQuantity()) + self.assertEqual(1, event.getQuantity()) # but it can be overriden event.setQuantity(321) - self.assertEquals(321, event.getQuantity()) + self.assertEqual(321, event.getQuantity()) def test_Event_isMovement(self): event_module = self.portal.event_module @@ -164,7 +164,7 @@ class TestCRM(BaseTestCRM): description='New Desc') self.tic() new_event, = ticket.getFollowUpRelatedValueList(portal_type=ptype) - self.assertEquals('stopped', new_event.getSimulationState()) + self.assertEqual('stopped', new_event.getSimulationState()) # outgoing ticket.Ticket_newEvent(direction='outgoing', @@ -174,7 +174,7 @@ class TestCRM(BaseTestCRM): self.tic() new_event, = [event for event in ticket.getFollowUpRelatedValueList(portal_type=ptype) if\ event.getTitle() == 'Outgoing Title'] - self.assertEquals('planned', new_event.getSimulationState()) + self.assertEqual('planned', new_event.getSimulationState()) def test_Ticket_CreateRelatedEventUnauthorized(self): # test that we don't get Unauthorized error when invoking the "Create @@ -215,12 +215,12 @@ class TestCRM(BaseTestCRM): getter_id = "getSourceRelatedValue" related_event = getattr(pers1, getter_id)(portal_type='Mail Message') self.assertNotEquals(None, related_event) - self.assertEquals('The Event Title', related_event.getTitle()) - self.assertEquals('The Event Descr.', related_event.getDescription()) - self.assertEquals('Event Content', related_event.getTextContent()) + self.assertEqual('The Event Title', related_event.getTitle()) + self.assertEqual('The Event Descr.', related_event.getDescription()) + self.assertEqual('Event Content', related_event.getTextContent()) for person in (pers2, pers3): - self.assertEquals(None, getattr(person, getter_id)( + self.assertEqual(None, getattr(person, getter_id)( portal_type='Mail Message')) def test_PersonModule_CreateOutgoingRelatedEventSelectionParams(self): @@ -255,11 +255,11 @@ class TestCRM(BaseTestCRM): related_event = person.getDestinationRelatedValue( portal_type='Mail Message') self.assertNotEquals(None, related_event) - self.assertEquals('The Event Title', related_event.getTitle()) - self.assertEquals('The Event Descr.', related_event.getDescription()) - self.assertEquals('Event Content', related_event.getTextContent()) + self.assertEqual('The Event Title', related_event.getTitle()) + self.assertEqual('The Event Descr.', related_event.getDescription()) + self.assertEqual('Event Content', related_event.getTextContent()) - self.assertEquals(None, pers3.getDestinationRelatedValue( + self.assertEqual(None, pers3.getDestinationRelatedValue( portal_type='Mail Message')) def test_SaleOpportunitySold(self): @@ -267,17 +267,17 @@ class TestCRM(BaseTestCRM): # finaly sold so = self.portal.sale_opportunity_module.newContent( portal_type='Sale Opportunity') - self.assertEquals('draft', so.getSimulationState()) + self.assertEqual('draft', so.getSimulationState()) self.portal.portal_workflow.doActionFor(so, 'submit_action') - self.assertEquals('submitted', so.getSimulationState()) + self.assertEqual('submitted', so.getSimulationState()) self.portal.portal_workflow.doActionFor(so, 'validate_action') - self.assertEquals('contacted', so.getSimulationState()) + self.assertEqual('contacted', so.getSimulationState()) self.portal.portal_workflow.doActionFor(so, 'enquire_action') - self.assertEquals('enquired', so.getSimulationState()) + self.assertEqual('enquired', so.getSimulationState()) self.portal.portal_workflow.doActionFor(so, 'offer_action') - self.assertEquals('offered', so.getSimulationState()) + self.assertEqual('offered', so.getSimulationState()) self.portal.portal_workflow.doActionFor(so, 'sell_action') - self.assertEquals('sold', so.getSimulationState()) + self.assertEqual('sold', so.getSimulationState()) def test_SaleOpportunityRejected(self): # test the workflow of sale opportunities, when the sale opportunity is @@ -285,26 +285,26 @@ class TestCRM(BaseTestCRM): # Uses different transitions than test_SaleOpportunitySold so = self.portal.sale_opportunity_module.newContent( portal_type='Sale Opportunity') - self.assertEquals('draft', so.getSimulationState()) + self.assertEqual('draft', so.getSimulationState()) self.portal.portal_workflow.doActionFor(so, 'validate_action') - self.assertEquals('contacted', so.getSimulationState()) + self.assertEqual('contacted', so.getSimulationState()) self.portal.portal_workflow.doActionFor(so, 'enquire_action') - self.assertEquals('enquired', so.getSimulationState()) + self.assertEqual('enquired', so.getSimulationState()) self.portal.portal_workflow.doActionFor(so, 'offer_action') - self.assertEquals('offered', so.getSimulationState()) + self.assertEqual('offered', so.getSimulationState()) self.portal.portal_workflow.doActionFor(so, 'reject_action') - self.assertEquals('rejected', so.getSimulationState()) + self.assertEqual('rejected', so.getSimulationState()) def test_SaleOpportunityExpired(self): # test the workflow of sale opportunities, when the sale opportunity # expires so = self.portal.sale_opportunity_module.newContent( portal_type='Sale Opportunity') - self.assertEquals('draft', so.getSimulationState()) + self.assertEqual('draft', so.getSimulationState()) self.portal.portal_workflow.doActionFor(so, 'validate_action') - self.assertEquals('contacted', so.getSimulationState()) + self.assertEqual('contacted', so.getSimulationState()) self.portal.portal_workflow.doActionFor(so, 'expire_action') - self.assertEquals('expired', so.getSimulationState()) + self.assertEqual('expired', so.getSimulationState()) @expectedFailure def test_Event_AcknowledgeAndCreateEvent(self): @@ -395,7 +395,7 @@ class TestCRM(BaseTestCRM): new_support_request = support_request.Base_createCloneDocument( batch_mode=1) - self.assertEquals(new_support_request.getTitle(), title) + self.assertEqual(new_support_request.getTitle(), title) self.assertNotEquals(None, support_request.getReference()) self.assertNotEquals(support_request.getReference(), new_support_request.getReference()) @@ -508,16 +508,16 @@ class TestCRM(BaseTestCRM): self.tic() event_list = [event for event in campaign.getFollowUpRelatedValueList() if event.getPortalType() != 'Mail Message'] - self.assertEquals(event_list, []) + self.assertEqual(event_list, []) event_list = campaign.getFollowUpRelatedValueList(portal_type='Mail Message') self.assertNotEquals(event_list, []) destination_list = map(lambda x: x.getDestinationValue(), event_list) - self.assertEquals(destination_list, [first_user]) + self.assertEqual(destination_list, [first_user]) mail_message = event_list[0] - self.assertEquals(sender.getRelativeUrl(), mail_message.getSource()) - self.assertEquals(mail_message.getTextFormat(), "text/html") - self.assertEquals(mail_message.getTextContent(), "Hello %s" % first_user.getTitle()) - self.assertEquals(mail_message.getResourceValue(), service) + self.assertEqual(sender.getRelativeUrl(), mail_message.getSource()) + self.assertEqual(mail_message.getTextFormat(), "text/html") + self.assertEqual(mail_message.getTextContent(), "Hello %s" % first_user.getTitle()) + self.assertEqual(mail_message.getResourceValue(), service) campaign = portal.campaign_module.newContent(portal_type="Campaign", default_event_path_event_portal_type="Visit", @@ -529,14 +529,14 @@ class TestCRM(BaseTestCRM): self.tic() event_list = [event for event in campaign.getFollowUpRelatedValueList() if event.getPortalType() != 'Visit'] - self.assertEquals([], event_list) + self.assertEqual([], event_list) event_list = campaign.getFollowUpRelatedValueList(portal_type='Visit') self.assertNotEquals([], event_list) destination_uid_list = map(lambda x: x.getDestinationUid(), event_list) - self.assertEquals([organisation.getUid()], destination_uid_list) + self.assertEqual([organisation.getUid()], destination_uid_list) resource_value_list = map(lambda x: x.getResourceValue(), event_list) - self.assertEquals([service], resource_value_list) + self.assertEqual([service], resource_value_list) def test_OutcomePath(self): service = self.portal.service_module.newContent(portal_type='Service') @@ -549,18 +549,18 @@ class TestCRM(BaseTestCRM): campaign.setDefaultOutcomePathPrice(4) campaign.setDefaultOutcomePathPriceCurrency(currency.getRelativeUrl()) - self.assertEquals(3*4, campaign.getDefaultOutcomePathTotalPrice()) + self.assertEqual(3*4, campaign.getDefaultOutcomePathTotalPrice()) - self.assertEquals(3, campaign.getDefaultOutcomePathQuantity()) - self.assertEquals('unit/piece', campaign.getDefaultOutcomePathQuantityUnit()) - self.assertEquals(service.getRelativeUrl(), + self.assertEqual(3, campaign.getDefaultOutcomePathQuantity()) + self.assertEqual('unit/piece', campaign.getDefaultOutcomePathQuantityUnit()) + self.assertEqual(service.getRelativeUrl(), campaign.getDefaultOutcomePathResource()) - self.assertEquals(4, campaign.getDefaultOutcomePathPrice()) - self.assertEquals(currency.getRelativeUrl(), + self.assertEqual(4, campaign.getDefaultOutcomePathPrice()) + self.assertEqual(currency.getRelativeUrl(), campaign.getDefaultOutcomePathPriceCurrency()) outcome_path = campaign._getOb('default_outcome_path') - self.assertEquals('Outcome Path', outcome_path.getPortalType()) + self.assertEqual('Outcome Path', outcome_path.getPortalType()) class TestCRMMailIngestion(BaseTestCRM): """Test Mail Ingestion for standalone CRM. @@ -623,7 +623,7 @@ class TestCRMMailIngestion(BaseTestCRM): def test_findTypeByName_MailMessage(self): # without this, ingestion will not work - self.assertEquals( + self.assertEqual( 'Mail Message', self.portal.portal_contribution_registry.findPortalTypeName( filename='postfix_mail.eml', content_type='message/rfc822', data='Test' @@ -651,41 +651,41 @@ class TestCRMMailIngestion(BaseTestCRM): for header, expected_paths in expected_values: paths = [entity.getRelativeUrl() for entity in portal.Base_getEntityListFromFromHeader(header)] - self.assertEquals(paths, expected_paths, + self.assertEqual(paths, expected_paths, '%r should return %r, but returned %r' % (header, expected_paths, paths)) def test_document_creation(self): # CRM email ingestion creates a Mail Message in event_module event = self._ingestMail('simple') - self.assertEquals(len(self.portal.event_module), 1) - self.assertEquals(event, self.portal.event_module.contentValues()[0]) - self.assertEquals('Mail Message', event.getPortalType()) - self.assertEquals('text/plain', event.getContentType()) - self.assertEquals('message/rfc822', event._baseGetContentType()) + self.assertEqual(len(self.portal.event_module), 1) + self.assertEqual(event, self.portal.event_module.contentValues()[0]) + self.assertEqual('Mail Message', event.getPortalType()) + self.assertEqual('text/plain', event.getContentType()) + self.assertEqual('message/rfc822', event._baseGetContentType()) # check if parsing of metadata from content is working content_dict = {'source_list': ['person_module/sender'], 'destination_list': ['person_module/me', 'person_module/he']} - self.assertEquals(event.getPropertyDictFromContent(), content_dict) + self.assertEqual(event.getPropertyDictFromContent(), content_dict) def test_title(self): # title is found automatically, based on the Subject: header in the mail event = self._ingestMail('simple') - self.assertEquals('Simple Mail Test', event.getTitle()) - self.assertEquals('Simple Mail Test', event.getTitleOrId()) + self.assertEqual('Simple Mail Test', event.getTitle()) + self.assertEqual('Simple Mail Test', event.getTitleOrId()) def test_asText(self): # asText requires portal_transforms event = self._ingestMail('simple') - self.assertEquals('Hello,\nContent of the mail.\n', str(event.asText())) + self.assertEqual('Hello,\nContent of the mail.\n', str(event.asText())) def test_sender(self): # source is found automatically, based on the From: header in the mail event = self._ingestMail('simple') # metadata discovery is done in an activity self.tic() - self.assertEquals('person_module/sender', event.getSource()) + self.assertEqual('person_module/sender', event.getSource()) def test_recipient(self): # destination is found automatically, based on the To: header in the mail @@ -693,37 +693,37 @@ class TestCRMMailIngestion(BaseTestCRM): self.tic() destination_list = event.getDestinationList() destination_list.sort() - self.assertEquals(['person_module/he', 'person_module/me'], + self.assertEqual(['person_module/he', 'person_module/me'], destination_list) def test_clone(self): # cloning an event must keep title and text-content event = self._ingestMail('simple') self.tic() - self.assertEquals('Simple Mail Test', event.getTitle()) - self.assertEquals('Simple Mail Test', event.getTitleOrId()) - self.assertEquals('Hello,\nContent of the mail.\n', str(event.asText())) - self.assertEquals('Hello,\nContent of the mail.\n', str(event.getTextContent())) - self.assertEquals('Mail Message', event.getPortalType()) - self.assertEquals('text/plain', event.getContentType()) - self.assertEquals('message/rfc822', event._baseGetContentType()) + self.assertEqual('Simple Mail Test', event.getTitle()) + self.assertEqual('Simple Mail Test', event.getTitleOrId()) + self.assertEqual('Hello,\nContent of the mail.\n', str(event.asText())) + self.assertEqual('Hello,\nContent of the mail.\n', str(event.getTextContent())) + self.assertEqual('Mail Message', event.getPortalType()) + self.assertEqual('text/plain', event.getContentType()) + self.assertEqual('message/rfc822', event._baseGetContentType()) # check if parsing of metadata from content is working content_dict = {'source_list': ['person_module/sender'], 'destination_list': ['person_module/me', 'person_module/he']} - self.assertEquals(event.getPropertyDictFromContent(), content_dict) + self.assertEqual(event.getPropertyDictFromContent(), content_dict) new_event = event.Base_createCloneDocument(batch_mode=1) self.tic() - self.assertEquals('Simple Mail Test', new_event.getTitle()) - self.assertEquals('Simple Mail Test', new_event.getTitleOrId()) - self.assertEquals('Hello,\nContent of the mail.\n', str(new_event.asText())) - self.assertEquals('Hello,\nContent of the mail.\n', str(new_event.getTextContent())) - self.assertEquals('Mail Message', new_event.getPortalType()) - self.assertEquals('text/plain', new_event.getContentType()) + self.assertEqual('Simple Mail Test', new_event.getTitle()) + self.assertEqual('Simple Mail Test', new_event.getTitleOrId()) + self.assertEqual('Hello,\nContent of the mail.\n', str(new_event.asText())) + self.assertEqual('Hello,\nContent of the mail.\n', str(new_event.getTextContent())) + self.assertEqual('Mail Message', new_event.getPortalType()) + self.assertEqual('text/plain', new_event.getContentType()) # check that metadatas read from data are copied on cloned event - self.assertEquals(new_event.getSourceList(), ['person_module/sender']) - self.assertEquals(new_event.getDestinationList(), ['person_module/me', + self.assertEqual(new_event.getSourceList(), ['person_module/sender']) + self.assertEqual(new_event.getDestinationList(), ['person_module/me', 'person_module/he']) # cloned event got a new reference @@ -755,11 +755,11 @@ class TestCRMMailIngestion(BaseTestCRM): property_dict = event.getPropertyDictFromContent() # destination is set on the event. In this case it is kept as is. - self.assertEquals([organisation.getRelativeUrl()], + self.assertEqual([organisation.getRelativeUrl()], property_dict['destination_list']) # source is not set. In this case it is searched in catalog based on email # address - self.assertEquals([source_person.getRelativeUrl()], + self.assertEqual([source_person.getRelativeUrl()], property_dict['source_list']) @@ -772,7 +772,7 @@ class TestCRMMailIngestion(BaseTestCRM): self.tic() event = self._ingestMail('simple') self.tic() - self.assertEquals(None, event.getFollowUp()) + self.assertEqual(None, event.getFollowUp()) def test_portal_type_determination(self): """ @@ -907,25 +907,25 @@ class TestCRMMailIngestion(BaseTestCRM): stripped_html = document.asStrippedHTML() self.assertTrue('<form' not in stripped_html) self.assertTrue('<form' not in document.getAttachmentData(4)) - self.assertEquals('This is my content.\n*ERP5* is a Free _Software_\n', + self.assertEqual('This is my content.\n*ERP5* is a Free _Software_\n', document.getAttachmentData(2)) - self.assertEquals('text/html', document.getContentType()) - self.assertEquals('\n<html>\n<head>\n\n<meta http-equiv="content-type"'\ + self.assertEqual('text/html', document.getContentType()) + self.assertEqual('\n<html>\n<head>\n\n<meta http-equiv="content-type"'\ ' content="text/html; charset=utf-8" />\n'\ '</head>\n<body text="#000000"'\ ' bgcolor="#ffffff">\nThis is my content.<br />\n'\ '<b>ERP5</b> is a Free <u>Software</u><br />'\ '\n\n</body>\n</html>\n', document.getAttachmentData(3)) - self.assertEquals(document.getAttachmentData(3), document.getTextContent()) + self.assertEqual(document.getAttachmentData(3), document.getTextContent()) # now check a message with multipart/mixed mixed_document = self._ingestMail(filename='sample_html_attachment') self.tic() - self.assertEquals(mixed_document.getAttachmentData(1), + self.assertEqual(mixed_document.getAttachmentData(1), mixed_document.getTextContent()) - self.assertEquals('Hi, this is the Message.\nERP5 is a free software.\n\n', + self.assertEqual('Hi, this is the Message.\nERP5 is a free software.\n\n', mixed_document.getTextContent()) - self.assertEquals('text/plain', mixed_document.getContentType()) + self.assertEqual('text/plain', mixed_document.getContentType()) def test_flawed_html_attachment(self): portal_type = 'Mail Message' @@ -950,7 +950,7 @@ class TestCRMMailIngestion(BaseTestCRM): event.setData(message.as_string()) self.tic() self.assertTrue('html' in event.getTextContent()) - self.assertEquals(len(event.getAttachmentInformationList()), 2) + self.assertEqual(len(event.getAttachmentInformationList()), 2) self.assertTrue(bool(event.getAttachmentData(1))) self.assertTrue(bool(event.getAttachmentData(2))) @@ -1033,12 +1033,12 @@ class TestCRMMailSend(BaseTestCRM): last_message, = self.portal.MailHost._message_list self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('"Me," <me@erp5.org>', mfrom) - self.assertEquals(['"Recipient," <recipient@example.com>'], mto) - self.assertEquals(event.getTextContent(), text_content) + self.assertEqual('"Me," <me@erp5.org>', mfrom) + self.assertEqual(['"Recipient," <recipient@example.com>'], mto) + self.assertEqual(event.getTextContent(), text_content) message = message_from_string(messageText) - self.assertEquals('A Mail', decode_header(message['Subject'])[0][0]) + self.assertEqual('A Mail', decode_header(message['Subject'])[0][0]) part = None for i in message.get_payload(): if i.get_content_type()=='text/plain': @@ -1061,10 +1061,10 @@ class TestCRMMailSend(BaseTestCRM): self.assertNotEquals((), last_message_2) # check last message 1 and last message 2 (the order is random) # both should have 'From: Me' - self.assertEquals(['"Me," <me@erp5.org>', '"Me," <me@erp5.org>'], + self.assertEqual(['"Me," <me@erp5.org>', '"Me," <me@erp5.org>'], [x[0] for x in (last_message_1, last_message_2)]) # one should have 'To: Me' and the other should have 'To: Recipient' - self.assertEquals([['"Me," <me@erp5.org>'], ['"Recipient," <recipient@example.com>']], + self.assertEqual([['"Me," <me@erp5.org>'], ['"Recipient," <recipient@example.com>']], sorted([x[1] for x in (last_message_1, last_message_2)])) def test_MailFromMailMessageEventNoSendMail(self): @@ -1077,11 +1077,11 @@ class TestCRMMailSend(BaseTestCRM): event.setTitle('A Mail') event.setTextContent('Mail Content') self.portal.portal_workflow.doActionFor(event, 'initial_stop_action') - self.assertEquals('stopped', event.getSimulationState()) + self.assertEqual('stopped', event.getSimulationState()) self.tic() # no mail sent last_message = self.portal.MailHost._last_message - self.assertEquals((), last_message) + self.assertEqual((), last_message) def test_MailFromOtherEvents(self): # passing start_action transition on event workflow will not send an email @@ -1097,8 +1097,8 @@ class TestCRMMailSend(BaseTestCRM): self.tic() # this means no message have been set - self.assertEquals([], self.portal.MailHost._message_list) - self.assertEquals((), self.portal.MailHost._last_message) + self.assertEqual([], self.portal.MailHost._message_list) + self.assertEqual((), self.portal.MailHost._last_message) def test_MailMessageHTML(self): # test sending a mail message edited as HTML (the default with FCKEditor), @@ -1112,18 +1112,18 @@ class TestCRMMailSend(BaseTestCRM): self.portal.portal_workflow.doActionFor(event, 'start_action') self.tic() # content type is kept - self.assertEquals(event.getContentType(), 'text/html') + self.assertEqual(event.getContentType(), 'text/html') # The getTextContent() gets the content from the file data instead the # Attribute text_content. - self.assertEquals(event.text_content, text_content) + self.assertEqual(event.text_content, text_content) text_content_from_data = '<html><body>Hello<br />World</body></html>' - self.assertEquals(event.getTextContent(), text_content_from_data) + self.assertEqual(event.getTextContent(), text_content_from_data) last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('"Me," <me@erp5.org>', mfrom) - self.assertEquals(['"Recipient," <recipient@example.com>'], mto) + self.assertEqual('"Me," <me@erp5.org>', mfrom) + self.assertEqual(['"Recipient," <recipient@example.com>'], mto) message = message_from_string(messageText) part = None @@ -1145,12 +1145,12 @@ class TestCRMMailSend(BaseTestCRM): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('"Me," <me@erp5.org>', mfrom) - self.assertEquals(['"Recipient," <recipient@example.com>'], mto) + self.assertEqual('"Me," <me@erp5.org>', mfrom) + self.assertEqual(['"Recipient," <recipient@example.com>'], mto) message = message_from_string(messageText) - self.assertEquals('Héhé', decode_header(message['Subject'])[0][0]) + self.assertEqual('Héhé', decode_header(message['Subject'])[0][0]) part = None for i in message.get_payload(): if i.get_content_type()=='text/plain': @@ -1564,20 +1564,20 @@ class TestCRMMailSend(BaseTestCRM): title=dummy_title, text_content=dummy_content,) self.assertFalse(event.hasFile(), '%r has a file' % (event,)) - self.assertEquals(event.getTitle(), dummy_title) - self.assertEquals(event.getTextContent(), dummy_content) + self.assertEqual(event.getTitle(), dummy_title) + self.assertEqual(event.getTextContent(), dummy_content) event.setData('Subject: %s\r\n\r\n%s' % (real_title, real_content)) self.assertTrue(event.hasFile(), '%r has no file' % (event,)) - self.assertEquals(event.getTitle(), real_title) - self.assertEquals(event.getTextContent(), real_content) + self.assertEqual(event.getTitle(), real_title) + self.assertEqual(event.getTextContent(), real_content) self.tic() new_event = event.Base_createCloneDocument(batch_mode=1) self.assertFalse(new_event.hasFile(), '%r has a file' % (new_event,)) - self.assertEquals(new_event.getData(), '') - self.assertEquals(new_event.getTitle(), real_title) - self.assertEquals(new_event.getTextContent(), real_content) + self.assertEqual(new_event.getData(), '') + self.assertEqual(new_event.getTitle(), real_title) + self.assertEqual(new_event.getTextContent(), real_content) self.assertNotEquals(new_event.getReference(), event.getReference()) def test_cloneTicketAndEventList(self): @@ -1680,14 +1680,14 @@ class TestCRMMailSend(BaseTestCRM): # check created Event event = person.getSourceRelatedValue() - self.assertEquals(event.getTitle(), title) - self.assertEquals(event.getResource(), resource) + self.assertEqual(event.getTitle(), title) + self.assertEqual(event.getResource(), resource) self.assertTrue(event.hasStartDate()) - self.assertEquals(event.getSource(), person.getRelativeUrl()) - self.assertEquals(event.getSourceSection(), + self.assertEqual(event.getSource(), person.getRelativeUrl()) + self.assertEqual(event.getSourceSection(), organisation.getRelativeUrl()) - self.assertEquals(event.getDestination(), user.getRelativeUrl()) - self.assertEquals(event.getDestinationSection(), user.getSubordination()) + self.assertEqual(event.getDestination(), user.getRelativeUrl()) + self.assertEqual(event.getDestinationSection(), user.getSubordination()) ### Outgoing on Person ### # Check another direction @@ -1700,15 +1700,15 @@ class TestCRMMailSend(BaseTestCRM): # check created Event event = another_person.getDestinationRelatedValue() - self.assertEquals(event.getTitle(), title) - self.assertEquals(event.getResource(), resource) + self.assertEqual(event.getTitle(), title) + self.assertEqual(event.getResource(), resource) self.assertTrue(event.hasStartDate()) - self.assertEquals(event.getDestination(), + self.assertEqual(event.getDestination(), another_person.getRelativeUrl()) - self.assertEquals(event.getDestinationSection(), + self.assertEqual(event.getDestinationSection(), organisation.getRelativeUrl()) - self.assertEquals(event.getSource(), user.getRelativeUrl()) - self.assertEquals(event.getSourceSection(), user.getSubordination()) + self.assertEqual(event.getSource(), user.getRelativeUrl()) + self.assertEqual(event.getSourceSection(), user.getSubordination()) ### Outgoing on Organisation ### # check on Organisation @@ -1720,15 +1720,15 @@ class TestCRMMailSend(BaseTestCRM): # check created Event event = organisation.getDestinationSectionRelatedValue() - self.assertEquals(event.getTitle(), title) - self.assertEquals(event.getResource(), resource) + self.assertEqual(event.getTitle(), title) + self.assertEqual(event.getResource(), resource) self.assertTrue(event.hasStartDate()) - self.assertEquals(event.getDestination(), + self.assertEqual(event.getDestination(), organisation.getRelativeUrl()) - self.assertEquals(event.getDestinationSection(), + self.assertEqual(event.getDestinationSection(), organisation.getRelativeUrl()) - self.assertEquals(event.getSource(), user.getRelativeUrl()) - self.assertEquals(event.getSourceSection(), user.getSubordination()) + self.assertEqual(event.getSource(), user.getRelativeUrl()) + self.assertEqual(event.getSourceSection(), user.getSubordination()) ### Outgoing on Career ### # Now check Base_addEvent on any document (follow_up) @@ -1740,11 +1740,11 @@ class TestCRMMailSend(BaseTestCRM): # check created Event event = career.getFollowUpRelatedValue() - self.assertEquals(event.getTitle(), title) - self.assertEquals(event.getResource(), resource) + self.assertEqual(event.getTitle(), title) + self.assertEqual(event.getResource(), resource) self.assertTrue(event.hasStartDate()) - self.assertEquals(event.getSource(), user.getRelativeUrl()) - self.assertEquals(event.getSourceSection(), user.getSubordination()) + self.assertEqual(event.getSource(), user.getRelativeUrl()) + self.assertEqual(event.getSourceSection(), user.getSubordination()) finally: # clean up created roles on portal_types self.login() # admin @@ -1764,7 +1764,7 @@ class TestCRMMailSend(BaseTestCRM): self.tic() mail_message = self.portal.event_module.newContent(portal_type="Mail Message") relative_url_list = [z.getRelativeUrl() for z in self.portal.person_module.searchFolder()] - self.assertEquals(3, len(relative_url_list)) + self.assertEqual(3, len(relative_url_list)) mail_message.setDestinationList(relative_url_list) mail_message.setSource(relative_url_list[0]) mail_text_content = "Body Text Content" @@ -1783,11 +1783,11 @@ class TestCRMMailSend(BaseTestCRM): if i.kw.has_key("event_relative_url")] try: # 3 recipients -> 3 activities - self.assertEquals(3, len(message_list)) + self.assertEqual(3, len(message_list)) finally: self.tic() - self.assertEquals(3, len(self.portal.MailHost._message_list)) + self.assertEqual(3, len(self.portal.MailHost._message_list)) for message_info in self.portal.MailHost._message_list: self.assertTrue(mail_text_content in message_info[-1]) message = message_from_string(message_info[-1]) @@ -1808,8 +1808,8 @@ class TestCRMMailSend(BaseTestCRM): self.tic() (from_url, to_url, last_message,), = self.portal.MailHost._message_list self.assertTrue("Body Simple Case" in last_message) - self.assertEquals('FG ER <eee@eee.com>', from_url) - self.assertEquals(['Expert User <expert@in24.test>'], to_url) + self.assertEqual('FG ER <eee@eee.com>', from_url) + self.assertEqual(['Expert User <expert@in24.test>'], to_url) def test_suite(): diff --git a/product/ERP5/tests/testCalendar.py b/product/ERP5/tests/testCalendar.py index 579592651b..b31891f774 100644 --- a/product/ERP5/tests/testCalendar.py +++ b/product/ERP5/tests/testCalendar.py @@ -226,7 +226,7 @@ class TestCalendar(ERP5ReportTestCase): """ group_calendar = sequence.get('group_calendar') group_calendar.confirm() - self.assertEquals('confirmed', group_calendar.getSimulationState()) + self.assertEqual('confirmed', group_calendar.getSimulationState()) def stepConfirmActionGroupCalendar(self, sequence=None, sequence_list=None, **kw): @@ -238,7 +238,7 @@ class TestCalendar(ERP5ReportTestCase): group_calendar, 'confirm_action', 'group_calendar_workflow') - self.assertEquals('confirmed', group_calendar.getSimulationState()) + self.assertEqual('confirmed', group_calendar.getSimulationState()) def stepCreateLeaveRequest(self, sequence=None, @@ -319,7 +319,7 @@ class TestCalendar(ERP5ReportTestCase): """ leave_request = sequence.get('leave_request') leave_request.plan() - self.assertEquals('planned', leave_request.getSimulationState()) + self.assertEqual('planned', leave_request.getSimulationState()) def stepConfirmLeaveRequest(self, sequence=None, sequence_list=None, **kw): @@ -328,7 +328,7 @@ class TestCalendar(ERP5ReportTestCase): """ leave_request = sequence.get('leave_request') leave_request.confirm() - self.assertEquals('confirmed', leave_request.getSimulationState()) + self.assertEqual('confirmed', leave_request.getSimulationState()) def getSqlUidList(self): """ @@ -368,7 +368,7 @@ class TestCalendar(ERP5ReportTestCase): obj_to_check = sequence.get('obj_to_check') self.assertTrue(obj_to_check.getUid() in uid_list) -# self.assertEquals(len(obj_to_check.getDatePeriodList()), +# self.assertEqual(len(obj_to_check.getDatePeriodList()), # uid_list.count(obj_to_check.getUid())) def stepCheckCataloguedAsMovement(self, sequence=None, @@ -379,7 +379,7 @@ class TestCalendar(ERP5ReportTestCase): uid_list = self.getSqlMovementUidList() obj_to_check = sequence.get('obj_to_check') self.assertTrue(obj_to_check.getUid() in uid_list) -# self.assertEquals(len(obj_to_check.getDatePeriodList()), +# self.assertEqual(len(obj_to_check.getDatePeriodList()), # uid_list.count(obj_to_check.getUid())) def test_01_CatalogCalendarPeriod(self, quiet=0, run=run_all_test): @@ -454,25 +454,25 @@ class TestCalendar(ERP5ReportTestCase): date_period_list = obj_to_check._getDatePeriodList() # Check 1 period - self.assertEquals(second_availability, + self.assertEqual(second_availability, person.getAvailableTime(from_date=start_date, to_date=stop_date)) - self.assertEquals(second_availability, + self.assertEqual(second_availability, person.getAvailableTime(from_date=start_date, to_date=stop_date)) - self.assertEquals(second_availability / 2, + self.assertEqual(second_availability / 2, person.getAvailableTime(from_date=start_date, to_date=self.middle_date)) - self.assertEquals(second_availability / 2, + self.assertEqual(second_availability / 2, person.getAvailableTime(from_date=self.middle_date, to_date=stop_date)) # Check 2 periods - self.assertEquals(2 * second_availability, + self.assertEqual(2 * second_availability, person.getAvailableTime( from_date=start_date, to_date=date_period_list[1][1])) # # Check all periods -# self.assertEquals(len(date_period_list) * second_availability, +# self.assertEqual(len(date_period_list) * second_availability, # person.getAvailableTime()) def stepCheckDoubleGetTimeAvailability(self, sequence=None, @@ -490,16 +490,16 @@ class TestCalendar(ERP5ReportTestCase): date_period_list = obj_to_check._getDatePeriodList() # Check 1 period - self.assertEquals(second_availability, + self.assertEqual(second_availability, person.getAvailableTime(from_date=start_date, to_date=stop_date)) # Check 2 periods - self.assertEquals(2 * second_availability, + self.assertEqual(2 * second_availability, person.getAvailableTime( from_date=start_date, to_date=date_period_list[1][1])) # # Check all periods -# self.assertEquals(len(date_period_list) * second_availability, +# self.assertEqual(len(date_period_list) * second_availability, # person.getAvailableTime()) def stepCheckPersonalTimeAvailability(self, sequence=None, @@ -515,25 +515,25 @@ class TestCalendar(ERP5ReportTestCase): date_period_list = obj_to_check._getDatePeriodList() # Check 1 period - self.assertEquals(second_availability, + self.assertEqual(second_availability, person.getAvailableTime(from_date=start_date, to_date=stop_date)) - self.assertEquals(second_availability, + self.assertEqual(second_availability, person.getAvailableTime(from_date=start_date, to_date=stop_date)) - self.assertEquals(second_availability / 2, + self.assertEqual(second_availability / 2, person.getAvailableTime(from_date=start_date, to_date=self.middle_date)) - self.assertEquals(second_availability / 2, + self.assertEqual(second_availability / 2, person.getAvailableTime(from_date=self.middle_date, to_date=stop_date)) # Check 2 periods - self.assertEquals(2 * second_availability, + self.assertEqual(2 * second_availability, person.getAvailableTime( from_date=start_date, to_date=date_period_list[1][1])) # # Check all periods -# self.assertEquals(len(date_period_list) * second_availability, +# self.assertEqual(len(date_period_list) * second_availability, # person.getAvailableTime()) def stepCheckCumulativeTimeAvailability(self, sequence=None, @@ -549,16 +549,16 @@ class TestCalendar(ERP5ReportTestCase): date_period_list = obj_to_check._getDatePeriodList() # Check 1 period - self.assertEquals(0, + self.assertEqual(0, person.getAvailableTime(from_date=start_date, to_date=stop_date)) # Check 2 periods - self.assertEquals(second_availability, + self.assertEqual(second_availability, person.getAvailableTime( from_date=start_date, to_date=date_period_list[1][1])) # # Check all periods -# self.assertEquals(len(date_period_list) * second_availability, +# self.assertEqual(len(date_period_list) * second_availability, # person.getAvailableTime()) def test_03_getAvailableTime(self, quiet=0, run=run_all_test): @@ -748,55 +748,55 @@ class TestCalendar(ERP5ReportTestCase): group_calendar = self.portal.group_calendar_module.newContent( portal_type='Group Calendar') # no lines - self.assertEquals(1, len(group_calendar.checkConsistency())) + self.assertEqual(1, len(group_calendar.checkConsistency())) group_calendar_period = group_calendar.newContent( portal_type='Group Presence Period') # invalid line (no dates, no resource) - self.assertEquals(3, len(group_calendar.checkConsistency())) + self.assertEqual(3, len(group_calendar.checkConsistency())) group_calendar_period.setStartDate(self.start_date) group_calendar_period.setStopDate(self.stop_date) - self.assertEquals(1, len(group_calendar.checkConsistency())) + self.assertEqual(1, len(group_calendar.checkConsistency())) group_calendar_period.setResourceValue( self.portal.portal_categories.calendar_period_type.type1) - self.assertEquals(0, len(group_calendar.checkConsistency())) + self.assertEqual(0, len(group_calendar.checkConsistency())) def test_LeaveRequestCalendarConstraint(self): leave_request = self.portal.leave_request_module.newContent( portal_type='Leave Request') # no lines, no person - self.assertEquals(2, len(leave_request.checkConsistency())) + self.assertEqual(2, len(leave_request.checkConsistency())) leave_request_period = leave_request.newContent( portal_type='Leave Request Period') # no person, invalid line (no dates, no resource) - self.assertEquals(4, len(leave_request.checkConsistency())) + self.assertEqual(4, len(leave_request.checkConsistency())) leave_request_period.setStartDate(self.start_date) leave_request_period.setStopDate(self.stop_date) - self.assertEquals(2, len(leave_request.checkConsistency())) + self.assertEqual(2, len(leave_request.checkConsistency())) leave_request_period.setResourceValue( self.portal.portal_categories.calendar_period_type.type1) - self.assertEquals(1, len(leave_request.checkConsistency())) + self.assertEqual(1, len(leave_request.checkConsistency())) person = self.portal.person_module.newContent(portal_type='Person') leave_request.setDestinationValue(person) - self.assertEquals(0, len(leave_request.checkConsistency())) + self.assertEqual(0, len(leave_request.checkConsistency())) def test_PresenceRequestCalendarConstraint(self): presence_request = self.portal.presence_request_module.newContent( portal_type='Presence Request') # no lines, no person - self.assertEquals(2, len(presence_request.checkConsistency())) + self.assertEqual(2, len(presence_request.checkConsistency())) presence_request_period = presence_request.newContent( portal_type='Presence Request Period') # no person, invalid line (no dates, no resource) - self.assertEquals(4, len(presence_request.checkConsistency())) + self.assertEqual(4, len(presence_request.checkConsistency())) presence_request_period.setStartDate(self.start_date) presence_request_period.setStopDate(self.stop_date) - self.assertEquals(2, len(presence_request.checkConsistency())) + self.assertEqual(2, len(presence_request.checkConsistency())) presence_request_period.setResourceValue( self.portal.portal_categories.calendar_period_type.type1) - self.assertEquals(1, len(presence_request.checkConsistency())) + self.assertEqual(1, len(presence_request.checkConsistency())) person = self.portal.person_module.newContent(portal_type='Person') presence_request.setDestinationValue(person) - self.assertEquals(0, len(presence_request.checkConsistency())) + self.assertEqual(0, len(presence_request.checkConsistency())) def test_SimpleLeaveRequestWithSameDateAsGroupCalendar(self): group_calendar = self.portal.group_calendar_module.newContent( @@ -817,10 +817,10 @@ class TestCalendar(ERP5ReportTestCase): # there is 43200 seconds between self.start_date and self.stop_date total_time = 43200 - self.assertEquals(total_time, person.getAvailableTime( + self.assertEqual(total_time, person.getAvailableTime( from_date=self.start_date-1, to_date=self.stop_date+1)) - self.assertEquals([total_time], [x.total_quantity for x in + self.assertEqual([total_time], [x.total_quantity for x in person.getAvailableTimeSequence( year=1, from_date=self.start_date-1, @@ -829,8 +829,8 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=self.start_date-1, to_date=self.stop_date+1) - self.assertEquals(1, len(available_time_movement_list)) - self.assertEquals([(self.start_date.ISO(), self.stop_date.ISO())], + self.assertEqual(1, len(available_time_movement_list)) + self.assertEqual([(self.start_date.ISO(), self.stop_date.ISO())], [(x.getStartDate().ISO(), x.getStopDate().ISO()) for x in available_time_movement_list]) @@ -848,10 +848,10 @@ class TestCalendar(ERP5ReportTestCase): self.tic() - self.assertEquals(0, person.getAvailableTime( + self.assertEqual(0, person.getAvailableTime( from_date=self.start_date-1, to_date=self.stop_date+1)) - self.assertEquals([0], [x.total_quantity for x in + self.assertEqual([0], [x.total_quantity for x in person.getAvailableTimeSequence( year=1, from_date=self.start_date-1, @@ -860,7 +860,7 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=self.start_date-1, to_date=self.stop_date+1) - self.assertEquals(0, len(available_time_movement_list)) + self.assertEqual(0, len(available_time_movement_list)) def test_LeaveRequestWithSameDateAsGroupCalendar(self): @@ -886,11 +886,11 @@ class TestCalendar(ERP5ReportTestCase): calendar_value=group_calendar) self.tic() - self.assertEquals((18 - 14 + 12 - 8) * 60 * 60, person.getAvailableTime( + self.assertEqual((18 - 14 + 12 - 8) * 60 * 60, person.getAvailableTime( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime())) - self.assertEquals([(18 - 14 + 12 - 8) * 60 * 60], + self.assertEqual([(18 - 14 + 12 - 8) * 60 * 60], [x.total_quantity for x in person.getAvailableTimeSequence( day=1, from_date=DateTime(2008, 1, 1).earliestTime(), @@ -899,8 +899,8 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime()) - self.assertEquals(2, len(available_time_movement_list)) - self.assertEquals( + self.assertEqual(2, len(available_time_movement_list)) + self.assertEqual( [(DateTime('2008/01/01 08:00'), DateTime('2008/01/01 12:00')), (DateTime('2008/01/01 14:00'), DateTime('2008/01/01 18:00'))], [(m.getStartDate(), m.getStopDate()) for m in @@ -919,11 +919,11 @@ class TestCalendar(ERP5ReportTestCase): self.tic() - self.assertEquals(0, person.getAvailableTime( + self.assertEqual(0, person.getAvailableTime( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime())) - self.assertEquals([0], + self.assertEqual([0], [x.total_quantity for x in person.getAvailableTimeSequence( day=1, from_date=DateTime(2008, 1, 1).earliestTime(), @@ -932,7 +932,7 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime()) - self.assertEquals(0, len(available_time_movement_list)) + self.assertEqual(0, len(available_time_movement_list)) def test_LeaveRequestWithSameDateAsRepeatedGroupCalendar(self): @@ -956,11 +956,11 @@ class TestCalendar(ERP5ReportTestCase): self.tic() # 2008/01/07 was a Monday - self.assertEquals((18 - 8) * 60 * 60, person.getAvailableTime( + self.assertEqual((18 - 8) * 60 * 60, person.getAvailableTime( from_date=DateTime(2008, 1, 6).earliestTime(), to_date=DateTime(2008, 1, 7).latestTime())) - self.assertEquals([(18 - 8) * 60 * 60], + self.assertEqual([(18 - 8) * 60 * 60], [x.total_quantity for x in person.getAvailableTimeSequence( day=2, from_date=DateTime(2008, 1, 6).earliestTime(), @@ -969,8 +969,8 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=DateTime(2008, 1, 6).earliestTime(), to_date=DateTime(2008, 1, 7).latestTime()) - self.assertEquals(1, len(available_time_movement_list)) - self.assertEquals( + self.assertEqual(1, len(available_time_movement_list)) + self.assertEqual( [(DateTime('2008/01/07 08:00'), DateTime('2008/01/07 18:00'))], [(m.getStartDate(), m.getStopDate()) for m in available_time_movement_list]) @@ -989,11 +989,11 @@ class TestCalendar(ERP5ReportTestCase): self.tic() - self.assertEquals(0, person.getAvailableTime( + self.assertEqual(0, person.getAvailableTime( from_date=DateTime(2008, 1, 6).earliestTime(), to_date=DateTime(2008, 1, 7).latestTime())) - self.assertEquals([0], + self.assertEqual([0], [x.total_quantity for x in person.getAvailableTimeSequence( day=2, from_date=DateTime(2008, 1, 6).earliestTime(), @@ -1001,7 +1001,7 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=DateTime(2008, 1, 6).earliestTime(), to_date=DateTime(2008, 1, 7).latestTime()) - self.assertEquals(0, len(available_time_movement_list)) + self.assertEqual(0, len(available_time_movement_list)) def test_LeaveRequestOverlappingGroupCalendar(self): group_calendar = self.portal.group_calendar_module.newContent( @@ -1019,11 +1019,11 @@ class TestCalendar(ERP5ReportTestCase): calendar_value=group_calendar) self.tic() - self.assertEquals((18 - 8) * 60 * 60, person.getAvailableTime( + self.assertEqual((18 - 8) * 60 * 60, person.getAvailableTime( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime())) - self.assertEquals([(18 - 8) * 60 * 60], + self.assertEqual([(18 - 8) * 60 * 60], [x.total_quantity for x in person.getAvailableTimeSequence( day=1, from_date=DateTime(2008, 1, 1).earliestTime(), @@ -1032,8 +1032,8 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime()) - self.assertEquals(1, len(available_time_movement_list)) - self.assertEquals( + self.assertEqual(1, len(available_time_movement_list)) + self.assertEqual( [(DateTime('2008/01/01 08:00'), DateTime('2008/01/01 18:00'))], [(m.getStartDate(), m.getStopDate()) for m in available_time_movement_list]) @@ -1051,11 +1051,11 @@ class TestCalendar(ERP5ReportTestCase): self.tic() - self.assertEquals((9-8 + 18-17) * 60 * 60, person.getAvailableTime( + self.assertEqual((9-8 + 18-17) * 60 * 60, person.getAvailableTime( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime())) - self.assertEquals([(9-8 + 18-17) * 60 * 60], + self.assertEqual([(9-8 + 18-17) * 60 * 60], [x.total_quantity for x in person.getAvailableTimeSequence( day=1, from_date=DateTime(2008, 1, 1).earliestTime(), @@ -1064,8 +1064,8 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime()) - self.assertEquals(2, len(available_time_movement_list)) - self.assertEquals( + self.assertEqual(2, len(available_time_movement_list)) + self.assertEqual( [(DateTime('2008/01/01 08:00'), DateTime('2008/01/01 09:00')), (DateTime('2008/01/01 17:00'), @@ -1101,11 +1101,11 @@ class TestCalendar(ERP5ReportTestCase): self.tic() - self.assertEquals((18-9) * 60 * 60, person.getAvailableTime( + self.assertEqual((18-9) * 60 * 60, person.getAvailableTime( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime())) - self.assertEquals([(18-9) * 60 * 60], + self.assertEqual([(18-9) * 60 * 60], [x.total_quantity for x in person.getAvailableTimeSequence( day=1, from_date=DateTime(2008, 1, 1).earliestTime(), @@ -1114,7 +1114,7 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime()) - self.assertEquals( + self.assertEqual( [(DateTime('2008/01/01 09:00'), DateTime('2008/01/01 18:00'),)], [(m.getStartDate(), m.getStopDate()) for m in @@ -1148,11 +1148,11 @@ class TestCalendar(ERP5ReportTestCase): self.tic() - self.assertEquals((17-8) * 60 * 60, person.getAvailableTime( + self.assertEqual((17-8) * 60 * 60, person.getAvailableTime( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime())) - self.assertEquals([(17-8) * 60 * 60], + self.assertEqual([(17-8) * 60 * 60], [x.total_quantity for x in person.getAvailableTimeSequence( day=1, from_date=DateTime(2008, 1, 1).earliestTime(), @@ -1161,7 +1161,7 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime()) - self.assertEquals( + self.assertEqual( [(DateTime('2008/01/01 08:00'), DateTime('2008/01/01 17:00'),)], [(m.getStartDate(), m.getStopDate()) for m in @@ -1201,11 +1201,11 @@ class TestCalendar(ERP5ReportTestCase): self.tic() - self.assertEquals((18-13 + 12-10 + 9-8) * 60 * 60, person.getAvailableTime( + self.assertEqual((18-13 + 12-10 + 9-8) * 60 * 60, person.getAvailableTime( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime())) - self.assertEquals([(18-13 + 12-10 + 9-8) * 60 * 60], + self.assertEqual([(18-13 + 12-10 + 9-8) * 60 * 60], [x.total_quantity for x in person.getAvailableTimeSequence( day=1, from_date=DateTime(2008, 1, 1).earliestTime(), @@ -1214,7 +1214,7 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime()) - self.assertEquals( + self.assertEqual( [(DateTime('2008/01/01 08:00'), DateTime('2008/01/01 09:00'),), (DateTime('2008/01/01 10:00'), @@ -1258,11 +1258,11 @@ class TestCalendar(ERP5ReportTestCase): self.tic() - self.assertEquals((18-11 + 9-8) * 60 * 60, person.getAvailableTime( + self.assertEqual((18-11 + 9-8) * 60 * 60, person.getAvailableTime( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime())) - self.assertEquals([(18-11 + 9-8) * 60 * 60], + self.assertEqual([(18-11 + 9-8) * 60 * 60], [x.total_quantity for x in person.getAvailableTimeSequence( day=1, from_date=DateTime(2008, 1, 1).earliestTime(), @@ -1271,7 +1271,7 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime()) - self.assertEquals( + self.assertEqual( [(DateTime('2008/01/01 08:00'), DateTime('2008/01/01 09:00'),), (DateTime('2008/01/01 11:00'), @@ -1313,11 +1313,11 @@ class TestCalendar(ERP5ReportTestCase): self.tic() - self.assertEquals((18-11 + 9-8) * 60 * 60, person.getAvailableTime( + self.assertEqual((18-11 + 9-8) * 60 * 60, person.getAvailableTime( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime())) - self.assertEquals([(18-11 + 9-8) * 60 * 60], + self.assertEqual([(18-11 + 9-8) * 60 * 60], [x.total_quantity for x in person.getAvailableTimeSequence( day=1, from_date=DateTime(2008, 1, 1).earliestTime(), @@ -1326,7 +1326,7 @@ class TestCalendar(ERP5ReportTestCase): available_time_movement_list = person.Person_getAvailableTimeMovementList( from_date=DateTime(2008, 1, 1).earliestTime(), to_date=DateTime(2008, 1, 1).latestTime()) - self.assertEquals( + self.assertEqual( [(DateTime('2008/01/01 08:00'), DateTime('2008/01/01 09:00'),), (DateTime('2008/01/01 11:00'), @@ -1405,13 +1405,13 @@ class TestCalendar(ERP5ReportTestCase): report_section_list = self.getReportSectionList( self.portal.person_module, 'PersonModule_viewLeaveRequestReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) - self.assertEquals(data_line_list[0].column_id_list, + self.assertEqual(data_line_list[0].column_id_list, ['person_career_reference', 'person_title', 'calendar_period_type/type2', 'calendar_period_type/type3', 'total']) @@ -1427,7 +1427,7 @@ class TestCalendar(ERP5ReportTestCase): **{'calendar_period_type/type2': 1.0, 'calendar_period_type/type3': 1.5,}) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], total=3.5, **{'calendar_period_type/type2': 2.0, diff --git a/product/ERP5/tests/testContentTranslation.py b/product/ERP5/tests/testContentTranslation.py index b12734640b..ff719dbe5c 100644 --- a/product/ERP5/tests/testContentTranslation.py +++ b/product/ERP5/tests/testContentTranslation.py @@ -88,37 +88,37 @@ class TestContentTranslation(ERP5TypeTestCase): self.tic() result1 = portal.portal_catalog(content_translation_title='Yusuke') - self.assertEquals(len(result1), 1) + self.assertEqual(len(result1), 1) result_obj1 = result1[0].getObject() result2 = portal.portal_catalog(content_translation_title='å‹ä»‹') - self.assertEquals(len(result2), 1) + self.assertEqual(len(result2), 1) result_obj2 = result2[0].getObject() - self.assertEquals(result_obj1, result_obj2) + self.assertEqual(result_obj1, result_obj2) # re-catalog person3.setNobReadTranslatedFirstName('ゆã†ã™ã‘') self.tic() result3 = portal.portal_catalog(content_translation_title='å‹ä»‹') - self.assertEquals(len(result3), 0) + self.assertEqual(len(result3), 0) # un-catalog portal.person_module.manage_delObjects(person3.getId()) self.tic() result4 = portal.portal_catalog(content_translation_title='æ‘岡') - self.assertEquals(len(result4), 0) + self.assertEqual(len(result4), 0) # Low level columns test. This behaviour is not guaranteed. I'm not sure # content_translation must be a search table - jerome result5 = portal.portal_catalog(property_name='title') - self.assertEquals(len(result5), 2) + self.assertEqual(len(result5), 2) result6 = portal.portal_catalog(content_language='nob-read') - self.assertEquals(len(result6), 2) + self.assertEqual(len(result6), 2) result7 = portal.portal_catalog(translated_text='XXX YYY') - self.assertEquals(len(result7), 1) + self.assertEqual(len(result7), 1) def testCatalogSearchTranslatedTitleScriptableKey(self): # Test 'translated_title' scriptable key. @@ -136,10 +136,10 @@ class TestContentTranslation(ERP5TypeTestCase): self.tic() # We can search either by the translated title - self.assertEquals(person, + self.assertEqual(person, portal.portal_catalog.getResultValue(translated_title='å‹ä»‹')) # Or the original title - self.assertEquals(person, + self.assertEqual(person, portal.portal_catalog.getResultValue(translated_title='Yusuke')) # documents for which translation is not set can also be found with @@ -148,7 +148,7 @@ class TestContentTranslation(ERP5TypeTestCase): first_name='Jérome', last_name='Perrin') self.tic() - self.assertEquals(not_translated_person, + self.assertEqual(not_translated_person, portal.portal_catalog.getResultValue(translated_title='Jérome')) @@ -217,20 +217,20 @@ class TestContentTranslation(ERP5TypeTestCase): 'ã‚¿ãƒãƒ© ユウセイ') # check with acquisition - self.assertEquals(person.getAddress(), None) + self.assertEqual(person.getAddress(), None) person.setDefaultAddressStreetAddress('Taito-ku Tokyo') - self.assertEquals(person.getDefaultAddressStreetAddress(), 'Taito-ku Tokyo') + self.assertEqual(person.getDefaultAddressStreetAddress(), 'Taito-ku Tokyo') person.setDefaultAddressJaKanaTranslatedStreetAddress('æ±äº¬éƒ½ å°æ±åŒº') - self.assertEquals(person.getDefaultAddressJaKanaTranslatedStreetAddress(), 'æ±äº¬éƒ½ å°æ±åŒº') - self.assertEquals(person.getDefaultAddressTranslatedStreetAddress(language='ja-kana'), 'æ±äº¬éƒ½ å°æ±åŒº') + self.assertEqual(person.getDefaultAddressJaKanaTranslatedStreetAddress(), 'æ±äº¬éƒ½ å°æ±åŒº') + self.assertEqual(person.getDefaultAddressTranslatedStreetAddress(language='ja-kana'), 'æ±äº¬éƒ½ å°æ±åŒº') # check acquired target address = person.getDefaultAddress() - self.assertEquals(address.getStreetAddress(), 'Taito-ku Tokyo') - self.assertEquals(address.getJaKanaTranslatedStreetAddress(), 'æ±äº¬éƒ½ å°æ±åŒº') - self.assertEquals(address.getTranslatedStreetAddress(language='ja-kana'), 'æ±äº¬éƒ½ å°æ±åŒº') + self.assertEqual(address.getStreetAddress(), 'Taito-ku Tokyo') + self.assertEqual(address.getJaKanaTranslatedStreetAddress(), 'æ±äº¬éƒ½ å°æ±åŒº') + self.assertEqual(address.getTranslatedStreetAddress(language='ja-kana'), 'æ±äº¬éƒ½ å°æ±åŒº') def test_suite(): diff --git a/product/ERP5/tests/testConversionInSimulation.py b/product/ERP5/tests/testConversionInSimulation.py index 7454bdebaf..7619c848c6 100644 --- a/product/ERP5/tests/testConversionInSimulation.py +++ b/product/ERP5/tests/testConversionInSimulation.py @@ -311,9 +311,9 @@ class TestConversionInSimulation(AccountingTestCase): invoice_transaction_applied_rule = invoice_movement.contentValues()[0] invoice_transaction_movement_1 =\ invoice_transaction_applied_rule.contentValues()[0] - self.assertEquals(currency, + self.assertEqual(currency, invoice_transaction_movement_1.getResourceValue()) - self.assertEquals(currency, + self.assertEqual(currency, delivery_movement.getPriceCurrencyValue()) self.assertEquals\ (invoice_transaction_movement_1.getDestinationTotalAssetPrice(), @@ -323,9 +323,9 @@ class TestConversionInSimulation(AccountingTestCase): None) invoice_transaction_movement_2 =\ invoice_transaction_applied_rule.contentValues()[1] - self.assertEquals(currency, + self.assertEqual(currency, invoice_transaction_movement_2.getResourceValue()) - self.assertEquals(currency, + self.assertEqual(currency, delivery_movement.getPriceCurrencyValue()) self.assertEquals\ (invoice_transaction_movement_2.getDestinationTotalAssetPrice(), @@ -403,9 +403,9 @@ class TestConversionInSimulation(AccountingTestCase): invoice_transaction_applied_rule = invoice_movement.contentValues()[0] invoice_transaction_movement =\ invoice_transaction_applied_rule.contentValues()[0] - self.assertEquals(currency, + self.assertEqual(currency, invoice_transaction_movement.getResourceValue()) - self.assertEquals(currency, + self.assertEqual(currency, delivery_movement.getPriceCurrencyValue()) self.assertEquals\ (invoice_transaction_movement.getSourceTotalAssetPrice(), @@ -496,7 +496,7 @@ class TestConversionInSimulation(AccountingTestCase): portal_type=self.portal.getPortalAccountingMovementTypeList()) self.assertNotEquals(line_list, None) for line in line_list: - self.assertEquals(line.getDestinationTotalAssetPrice(), + self.assertEqual(line.getDestinationTotalAssetPrice(), round(655.957*delivery_movement.getTotalPrice())) def test_01_diverged_sale_packing_list_destination_total_asset_price( @@ -568,13 +568,13 @@ class TestConversionInSimulation(AccountingTestCase): self.assertNotEquals(related_packing_list, None) related_packing_list_line_list=related_packing_list.getMovementList() related_packing_list_line= related_packing_list_line_list[0] - self.assertEquals(related_packing_list_line.getQuantity(),5.0) + self.assertEqual(related_packing_list_line.getQuantity(),5.0) old_destination_asset_price = \ round(655.957*related_packing_list_line.getTotalPrice()) related_packing_list_line.edit(quantity=3.0) self.tic() - self.assertEquals(related_packing_list.getCausalityState(), + self.assertEqual(related_packing_list.getCausalityState(), 'diverged') self._solveDivergence(related_packing_list, 'quantity', 'accept') self.tic() @@ -592,7 +592,7 @@ class TestConversionInSimulation(AccountingTestCase): invoice_transaction_applied_rule = invoice_movement.contentValues()[0] invoice_transaction_movement =\ invoice_transaction_applied_rule.contentValues()[0] - self.assertEquals( + self.assertEqual( invoice_transaction_movement.getDestinationTotalAssetPrice(), old_destination_asset_price *(3.0/5.0)) @@ -666,13 +666,13 @@ class TestConversionInSimulation(AccountingTestCase): self.assertNotEquals(related_packing_list, None) related_packing_list_line_list=related_packing_list.getMovementList() related_packing_list_line= related_packing_list_line_list[0] - self.assertEquals(related_packing_list_line.getQuantity(),5.0) + self.assertEqual(related_packing_list_line.getQuantity(),5.0) old_source_asset_price = \ round(655.957*related_packing_list_line.getTotalPrice()) related_packing_list_line.edit(quantity=3.0) self.tic() - self.assertEquals(related_packing_list.getCausalityState(), + self.assertEqual(related_packing_list.getCausalityState(), 'diverged') self._solveDivergence(related_packing_list, 'quantity','accept') @@ -691,7 +691,7 @@ class TestConversionInSimulation(AccountingTestCase): invoice_transaction_applied_rule = invoice_movement.contentValues()[0] invoice_transaction_movement =\ invoice_transaction_applied_rule.contentValues()[0] - self.assertEquals(invoice_transaction_movement.\ + self.assertEqual(invoice_transaction_movement.\ getSourceTotalAssetPrice(), old_source_asset_price *(3.0/5.0)) @@ -764,9 +764,9 @@ class TestConversionInSimulation(AccountingTestCase): related_packing_list = order.getCausalityRelatedValue( portal_type='Sale Packing List') self.assertNotEquals(related_packing_list, None) - self.assertEquals(related_packing_list.getDeliveryMode(), + self.assertEqual(related_packing_list.getDeliveryMode(), order.getDeliveryMode()) - self.assertEquals(related_packing_list.getIncoterm(), + self.assertEqual(related_packing_list.getIncoterm(), order.getIncoterm()) related_packing_list.start() related_packing_list.stop() @@ -775,9 +775,9 @@ class TestConversionInSimulation(AccountingTestCase): related_invoice = related_packing_list.getCausalityRelatedValue( portal_type='Sale Invoice Transaction') self.assertNotEquals(related_invoice, None) - self.assertEquals(related_invoice.getDeliveryMode(), + self.assertEqual(related_invoice.getDeliveryMode(), order.getDeliveryMode()) - self.assertEquals(related_invoice.getIncoterm(), + self.assertEqual(related_invoice.getIncoterm(), order.getIncoterm()) def test_01_quantity_unit_on_sale_packing_list( @@ -842,10 +842,10 @@ class TestConversionInSimulation(AccountingTestCase): self.assertNotEquals(related_packing_list, None) movement_list = related_packing_list.getMovementList() movement_list.sort(key=lambda x:x.getCausalityId()) - self.assertEquals(len(movement_list),2) - self.assertEquals(movement_list[0].getQuantityUnit(), + self.assertEqual(len(movement_list),2) + self.assertEqual(movement_list[0].getQuantityUnit(), first_order_line.getQuantityUnit()) - self.assertEquals(movement_list[1].getQuantityUnit(), + self.assertEqual(movement_list[1].getQuantityUnit(), second_order_line.getQuantityUnit()) def test_suite(): diff --git a/product/ERP5/tests/testCrmReports.py b/product/ERP5/tests/testCrmReports.py index 67033d5a8d..d6ec4a1024 100644 --- a/product/ERP5/tests/testCrmReports.py +++ b/product/ERP5/tests/testCrmReports.py @@ -90,7 +90,7 @@ class CrmTestCase(ERP5ReportTestCase): tk.validate() # sanity check - self.assertEquals(simulation_state, tk.getSimulationState()) + self.assertEqual(simulation_state, tk.getSimulationState()) return tk def _makeOneEvent(self, portal_type='Fax Message', @@ -155,7 +155,7 @@ class CrmTestCase(ERP5ReportTestCase): elif simulation_state == 'stopped': ev.stop() # sanity check - self.assertEquals(simulation_state, ev.getSimulationState()) + self.assertEqual(simulation_state, ev.getSimulationState()) return ev def login(self): @@ -371,16 +371,16 @@ class TestCrmReports(CrmTestCase): report_section_list = self.getReportSectionList( self.portal.campaign_module, 'CampaignModule_viewCampaignStatusReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 2 campaigns - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['title', 'ticket_type', 'destination_section', 'destination_decision', 'source', 'start_date', 'stop_date','validation_state','outgoing', 'incoming','progression','efficiency']) @@ -518,16 +518,16 @@ class TestCrmReports(CrmTestCase): report_section_list = self.getReportSectionList( self.portal.campaign_module, 'CampaignModule_viewCampaignDetailedReport') - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 7 events - self.assertEquals(7, len(data_line_list)) + self.assertEqual(7, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['campaign', 'direction', 'title', 'type','destination_title_list', 'source', 'start_date','stop_date','validation_state']) for i in range(len(data_line_list)): @@ -681,16 +681,16 @@ class TestCrmReports(CrmTestCase): report_section_list = self.getReportSectionList( self.portal.meeting_module, 'MeetingModule_viewMeetingStatusReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 2 meetings - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['title', 'ticket_type', 'destination_section', 'destination_decision', 'destination_title','source', 'start_date', 'stop_date', 'validation_state','outgoing','incoming']) @@ -826,16 +826,16 @@ class TestCrmReports(CrmTestCase): report_section_list = self.getReportSectionList( self.portal.meeting_module, 'MeetingModule_viewMeetingDetailedReport') - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 7 events - self.assertEquals(7, len(data_line_list)) + self.assertEqual(7, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['meeting', 'direction', 'title', 'type','destination_title_list', 'source', 'start_date','stop_date','validation_state']) for i in range(len(data_line_list)): @@ -989,16 +989,16 @@ class TestCrmReports(CrmTestCase): report_section_list = self.getReportSectionList( self.portal.support_request_module, 'SupportRequestModule_viewSupportRequestStatusReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 2 Support Request - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['title', 'ticket_type', 'destination_section', 'destination_decision', 'source', 'source_decision', 'start_date', 'stop_date', 'validation_state','incoming','outgoing']) @@ -1134,16 +1134,16 @@ class TestCrmReports(CrmTestCase): report_section_list = self.getReportSectionList( self.portal.support_request_module, 'SupportRequestModule_viewSupportRequestDetailedReport') - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 7 events - self.assertEquals(7, len(data_line_list)) + self.assertEqual(7, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['support_request', 'direction', 'title', 'type','destination_title_list', 'source', 'start_date','stop_date','validation_state']) for i in range(len(data_line_list)): @@ -1297,16 +1297,16 @@ class TestCrmReports(CrmTestCase): report_section_list = self.getReportSectionList( self.portal.sale_opportunity_module, 'SaleOpportunityModule_viewSaleOpportunityStatusReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 2 Sale Opportunity - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['title', 'ticket_type', 'destination_section', 'destination_decision', 'source','source_decision','start_date', 'stop_date', 'validation_state','outgoing','incoming']) @@ -1442,16 +1442,16 @@ class TestCrmReports(CrmTestCase): report_section_list = self.getReportSectionList( self.portal.sale_opportunity_module, 'SaleOpportunityModule_viewSaleOpportunityDetailedReport') - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 7 events - self.assertEquals(7, len(data_line_list)) + self.assertEqual(7, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['sale_opportunity', 'direction', 'title', 'type','destination_title_list', 'source', 'start_date','stop_date','validation_state']) for i in range(len(data_line_list)): @@ -1699,17 +1699,17 @@ class TestCrmReports(CrmTestCase): self.portal.event_module, 'EventModule_viewEventActivityReport') #Obtain 2 listbox with outgoing and incoming events - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) #Outgoing line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 6 states - self.assertEquals(6, len(data_line_list)) + self.assertEqual(6, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['validation_state','Campaign', 'Meeting', 'SaleOpportunity','SupportRequest', 'unassigned','total']) for i in range(len(data_line_list)): @@ -1771,24 +1771,24 @@ class TestCrmReports(CrmTestCase): total = ptotal) # Stat Line stat_line = line_list[-1] - self.failUnless(stat_line.isStatLine()) - self.assertEquals('Total', stat_line.getColumnProperty('validation_state')) - self.assertEquals(4, stat_line.getColumnProperty('Campaign')) - self.assertEquals(1, stat_line.getColumnProperty('Meeting')) - self.assertEquals(4, stat_line.getColumnProperty('SaleOpportunity')) - self.assertEquals(1, stat_line.getColumnProperty('SupportRequest')) - self.assertEquals(1, stat_line.getColumnProperty('unassigned')) - self.assertEquals(11, stat_line.getColumnProperty('total')) + self.assertTrue(stat_line.isStatLine()) + self.assertEqual('Total', stat_line.getColumnProperty('validation_state')) + self.assertEqual(4, stat_line.getColumnProperty('Campaign')) + self.assertEqual(1, stat_line.getColumnProperty('Meeting')) + self.assertEqual(4, stat_line.getColumnProperty('SaleOpportunity')) + self.assertEqual(1, stat_line.getColumnProperty('SupportRequest')) + self.assertEqual(1, stat_line.getColumnProperty('unassigned')) + self.assertEqual(11, stat_line.getColumnProperty('total')) #Incoming line_list = self.getListBoxLineList(report_section_list[1]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 4 states - self.assertEquals(4, len(data_line_list)) + self.assertEqual(4, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['validation_state','Campaign', 'Meeting', 'SaleOpportunity','SupportRequest', 'unassigned','total']) for i in range(len(data_line_list)): @@ -1834,14 +1834,14 @@ class TestCrmReports(CrmTestCase): total = ptotal) # Stat Line stat_line = line_list[-1] - self.failUnless(stat_line.isStatLine()) - self.assertEquals('Total', stat_line.getColumnProperty('validation_state')) - self.assertEquals(1, stat_line.getColumnProperty('Campaign')) - self.assertEquals(1, stat_line.getColumnProperty('Meeting')) - self.assertEquals(1, stat_line.getColumnProperty('SaleOpportunity')) - self.assertEquals(1, stat_line.getColumnProperty('SupportRequest')) - self.assertEquals(1, stat_line.getColumnProperty('unassigned')) - self.assertEquals(5, stat_line.getColumnProperty('total')) + self.assertTrue(stat_line.isStatLine()) + self.assertEqual('Total', stat_line.getColumnProperty('validation_state')) + self.assertEqual(1, stat_line.getColumnProperty('Campaign')) + self.assertEqual(1, stat_line.getColumnProperty('Meeting')) + self.assertEqual(1, stat_line.getColumnProperty('SaleOpportunity')) + self.assertEqual(1, stat_line.getColumnProperty('SupportRequest')) + self.assertEqual(1, stat_line.getColumnProperty('unassigned')) + self.assertEqual(5, stat_line.getColumnProperty('total')) def testEventDetailedReport(self): # Event Detailed Report report. @@ -2041,16 +2041,16 @@ class TestCrmReports(CrmTestCase): self.portal.event_module, 'EventModule_viewEventDetailedReport') #Obtain 1 listbox with outgoing and incoming events - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] # we have 5 lines - self.assertEquals(5, len(data_line_list)) + self.assertEqual(5, len(data_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, + self.assertEqual(line.column_id_list, ['ticket_title','ticket_type', 'resource', 'delivered', 'ordered', 'acknowledged', 'assigned', 'started', 'draft', 'planned', 'cancelled', 'new', @@ -2148,20 +2148,20 @@ class TestCrmReports(CrmTestCase): total = ptotal) # Stat Line stat_line = line_list[-1] - self.failUnless(stat_line.isStatLine()) - self.assertEquals('Total', stat_line.getColumnProperty('ticket_title')) - self.assertEquals(2, stat_line.getColumnProperty('delivered')) - self.assertEquals(1, stat_line.getColumnProperty('ordered')) - self.assertEquals(1, stat_line.getColumnProperty('acknowledged')) - self.assertEquals(1, stat_line.getColumnProperty('assigned')) - self.assertEquals(1, stat_line.getColumnProperty('started')) - self.assertEquals(1, stat_line.getColumnProperty('draft')) - self.assertEquals(1, stat_line.getColumnProperty('planned')) - self.assertEquals(1, stat_line.getColumnProperty('cancelled')) - self.assertEquals(5, stat_line.getColumnProperty('new')) - self.assertEquals(1, stat_line.getColumnProperty('expired')) - self.assertEquals(2, stat_line.getColumnProperty('responded')) - self.assertEquals(17, stat_line.getColumnProperty('total')) + self.assertTrue(stat_line.isStatLine()) + self.assertEqual('Total', stat_line.getColumnProperty('ticket_title')) + self.assertEqual(2, stat_line.getColumnProperty('delivered')) + self.assertEqual(1, stat_line.getColumnProperty('ordered')) + self.assertEqual(1, stat_line.getColumnProperty('acknowledged')) + self.assertEqual(1, stat_line.getColumnProperty('assigned')) + self.assertEqual(1, stat_line.getColumnProperty('started')) + self.assertEqual(1, stat_line.getColumnProperty('draft')) + self.assertEqual(1, stat_line.getColumnProperty('planned')) + self.assertEqual(1, stat_line.getColumnProperty('cancelled')) + self.assertEqual(5, stat_line.getColumnProperty('new')) + self.assertEqual(1, stat_line.getColumnProperty('expired')) + self.assertEqual(2, stat_line.getColumnProperty('responded')) + self.assertEqual(17, stat_line.getColumnProperty('total')) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testDataProtection.py b/product/ERP5/tests/testDataProtection.py index a00f451c91..dbe05a4d4e 100644 --- a/product/ERP5/tests/testDataProtection.py +++ b/product/ERP5/tests/testDataProtection.py @@ -129,7 +129,7 @@ class TestDataProtection(ERP5TypeTestCase): # or default value is returned. self.assertFalse(document.getProperty(property_id)) # View History permission is now granted only for Manager - self.assertEquals(document._View_History_Permission, ('Manager',)) + self.assertEqual(document._View_History_Permission, ('Manager',)) def stepEraseWorkflowHistoryCommentList(self, sequence=None, sequence_list=None, **kw): @@ -156,7 +156,7 @@ class TestDataProtection(ERP5TypeTestCase): # Last comment of edit workflow is filled by data protection action self.assertTrue(workflow_history['edit_workflow'][-1].get('comment')) # View History permission is now granted only for Manager - self.assertEquals(document._View_History_Permission, ('Manager',)) + self.assertEqual(document._View_History_Permission, ('Manager',)) def test_01_dataProtectionRequest(self): """This test create a person with a compromised description. diff --git a/product/ERP5/tests/testDeliveryBuilderToSupportMultipleLines.py b/product/ERP5/tests/testDeliveryBuilderToSupportMultipleLines.py index 8c7c51b558..0cca5f6209 100644 --- a/product/ERP5/tests/testDeliveryBuilderToSupportMultipleLines.py +++ b/product/ERP5/tests/testDeliveryBuilderToSupportMultipleLines.py @@ -229,23 +229,23 @@ class TestNestedLine(TestNestedLineMixin, ERP5TypeTestCase): # order = sequence.get('order') # packing_list = sequence.get('packing_list') document = sequence.get('invoice') - self.assertEquals('Sale Invoice Transaction', document.getPortalType()) + self.assertEqual('Sale Invoice Transaction', document.getPortalType()) line_list = document.objectValues( portal_type=self.portal.getPortalInvoiceMovementTypeList()) - self.assertEquals(1, len(line_list)) + self.assertEqual(1, len(line_list)) line = line_list[0] - self.assertEquals('Invoice Line', line.getPortalType()) - self.assertEquals(None, line.getQuantity(None)) - self.assertEquals(1, len(line)) + self.assertEqual('Invoice Line', line.getPortalType()) + self.assertEqual(None, line.getQuantity(None)) + self.assertEqual(1, len(line)) line_line = line.objectValues()[0] - self.assertEquals('Invoice Line', line_line.getPortalType()) + self.assertEqual('Invoice Line', line_line.getPortalType()) - self.assertEquals(self.default_price * self.default_quantity, document.getTotalPrice()) - self.assertEquals(self.default_quantity, document.getTotalQuantity()) - self.assertEquals(self.default_price, line_line.getPrice()) - self.assertEquals(self.default_quantity, line_line.getQuantity()) + self.assertEqual(self.default_price * self.default_quantity, document.getTotalPrice()) + self.assertEqual(self.default_quantity, document.getTotalQuantity()) + self.assertEqual(self.default_price, line_line.getPrice()) + self.assertEqual(self.default_quantity, line_line.getQuantity()) def test_02_AdoptingPrevision(self, quiet=quiet): @@ -267,22 +267,22 @@ class TestNestedLine(TestNestedLineMixin, ERP5TypeTestCase): sequence_list.play(self, quiet=quiet) document = sequence.get('invoice') - self.assertEquals('solved', document.getCausalityState()) + self.assertEqual('solved', document.getCausalityState()) line_list = document.objectValues( portal_type=self.portal.getPortalInvoiceMovementTypeList()) - self.assertEquals(1, len(line_list)) + self.assertEqual(1, len(line_list)) line = line_list[0] - self.assertEquals('Invoice Line', line.getPortalType()) - self.assertEquals(None, line.getQuantity(None)) - self.assertEquals(1, len(line)) + self.assertEqual('Invoice Line', line.getPortalType()) + self.assertEqual(None, line.getQuantity(None)) + self.assertEqual(1, len(line)) line_line = line.objectValues()[0] - self.assertEquals('Invoice Line', line_line.getPortalType()) + self.assertEqual('Invoice Line', line_line.getPortalType()) - self.assertEquals(self.default_price * self.new_packing_list_quantity, document.getTotalPrice()) - self.assertEquals(self.new_packing_list_quantity, document.getTotalQuantity()) - self.assertEquals(self.new_packing_list_quantity, line_line.getQuantity()) + self.assertEqual(self.default_price * self.new_packing_list_quantity, document.getTotalPrice()) + self.assertEqual(self.new_packing_list_quantity, document.getTotalQuantity()) + self.assertEqual(self.new_packing_list_quantity, line_line.getQuantity()) @newSimulationExpectedFailure def test_03_AcceptingDecision(self, quiet=quiet): @@ -306,22 +306,22 @@ class TestNestedLine(TestNestedLineMixin, ERP5TypeTestCase): document = sequence.get('invoice') - self.assertEquals('solved', document.getCausalityState()) + self.assertEqual('solved', document.getCausalityState()) line_list = document.objectValues( portal_type=self.portal.getPortalInvoiceMovementTypeList()) - self.assertEquals(1, len(line_list)) + self.assertEqual(1, len(line_list)) line = line_list[0] - self.assertEquals('Invoice Line', line.getPortalType()) - self.assertEquals(None, line.getQuantity(None)) - self.assertEquals(1, len(line)) + self.assertEqual('Invoice Line', line.getPortalType()) + self.assertEqual(None, line.getQuantity(None)) + self.assertEqual(1, len(line)) line_line = line.objectValues()[0] - self.assertEquals('Invoice Line', line_line.getPortalType()) + self.assertEqual('Invoice Line', line_line.getPortalType()) - self.assertEquals(self.default_price * self.new_invoice_quantity, document.getTotalPrice()) - self.assertEquals(self.new_invoice_quantity, document.getTotalQuantity()) - self.assertEquals(self.new_invoice_quantity, line_line.getQuantity()) + self.assertEqual(self.default_price * self.new_invoice_quantity, document.getTotalPrice()) + self.assertEqual(self.new_invoice_quantity, document.getTotalQuantity()) + self.assertEqual(self.new_invoice_quantity, line_line.getQuantity()) def stepPrioritizeInvoiceUpdateCausalityStateTic(self, sequence): invoice = sequence['invoice'] @@ -387,28 +387,28 @@ class TestNestedLine(TestNestedLineMixin, ERP5TypeTestCase): ) sequence_list.play(self, quiet=quiet) - self.assertEquals(1, len(self.portal.accounting_module)) + self.assertEqual(1, len(self.portal.accounting_module)) document = self.portal.accounting_module.objectValues()[0] - self.assertEquals('solved', document.getCausalityState()) + self.assertEqual('solved', document.getCausalityState()) line_list = document.objectValues( portal_type=self.portal.getPortalInvoiceMovementTypeList()) - self.assertEquals(1, len(line_list)) + self.assertEqual(1, len(line_list)) line = line_list[0] - self.assertEquals('Invoice Line', line.getPortalType()) - self.assertEquals(None, line.getQuantity(None)) - self.assertEquals(1, len(line)) + self.assertEqual('Invoice Line', line.getPortalType()) + self.assertEqual(None, line.getQuantity(None)) + self.assertEqual(1, len(line)) line_line = line.objectValues()[0] - self.assertEquals('Invoice Line', line_line.getPortalType()) + self.assertEqual('Invoice Line', line_line.getPortalType()) # The sale invoice summed up from two sale orders. # The quantity of a sale order is self.default_quantity, and # that of the other one is self.new_order_quantity. - self.assertEquals(self.default_price * (self.default_quantity + self.new_order_quantity), document.getTotalPrice()) - self.assertEquals(self.default_quantity + self.new_order_quantity, document.getTotalQuantity()) - self.assertEquals(self.default_quantity + self.new_order_quantity, line_line.getQuantity()) + self.assertEqual(self.default_price * (self.default_quantity + self.new_order_quantity), document.getTotalPrice()) + self.assertEqual(self.default_quantity + self.new_order_quantity, document.getTotalQuantity()) + self.assertEqual(self.default_quantity + self.new_order_quantity, line_line.getQuantity()) def test_suite(): diff --git a/product/ERP5/tests/testDomainTool.py b/product/ERP5/tests/testDomainTool.py index 52c0870f54..d2dc6a6f20 100644 --- a/product/ERP5/tests/testDomainTool.py +++ b/product/ERP5/tests/testDomainTool.py @@ -161,7 +161,7 @@ class TestDomainTool(TestPredicateMixIn): # Test with order line and predicate to none predicate_list = domain_tool.searchPredicateList(order_line,test=test, portal_type=self.portal_type_query) - self.assertEquals(len(predicate_list),1) # Actually, a predicate where + self.assertEqual(len(predicate_list),1) # Actually, a predicate where # nothing is defined is ok # Test with order line not none and predicate to none @@ -169,7 +169,7 @@ class TestDomainTool(TestPredicateMixIn): self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test, portal_type=self.portal_type_query) - self.assertEquals(len(predicate_list),1) + self.assertEqual(len(predicate_list),1) # Test with order line not none and predicate to identity order_line.setQuantity(45) @@ -177,12 +177,12 @@ class TestDomainTool(TestPredicateMixIn): predicate.setCriterion('quantity',identity=45,min=None,max=None) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),1) + self.assertEqual(len(predicate_list),1) order_line.setQuantity(40) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),0) + self.assertEqual(len(predicate_list),0) # Test with order line not none and predicate to min order_line.setQuantity(45) @@ -190,13 +190,13 @@ class TestDomainTool(TestPredicateMixIn): predicate.setCriterion('quantity',identity=None,min=30,max=None) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),1) + self.assertEqual(len(predicate_list),1) order_line.setQuantity(10) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test, portal_type=self.portal_type_query) - self.assertEquals(len(predicate_list),0) + self.assertEqual(len(predicate_list),0) # Test with order line not none and predicate to max order_line.setQuantity(45) @@ -204,12 +204,12 @@ class TestDomainTool(TestPredicateMixIn): predicate.setCriterion('quantity',identity=None,min=None,max=50) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),1) + self.assertEqual(len(predicate_list),1) order_line.setQuantity(60) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),0) + self.assertEqual(len(predicate_list),0) # Test with order line not none and predicate to min max order_line.setQuantity(20) @@ -217,17 +217,17 @@ class TestDomainTool(TestPredicateMixIn): predicate.setCriterion('quantity',identity=None,min=30,max=50) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),0) + self.assertEqual(len(predicate_list),0) order_line.setQuantity(60) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),0) + self.assertEqual(len(predicate_list),0) order_line.setQuantity(45) predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) self.tic() - self.assertEquals(len(predicate_list),1) + self.assertEqual(len(predicate_list),1) # Test with order line not none and predicate to min max # and also predicate to a category @@ -235,22 +235,22 @@ class TestDomainTool(TestPredicateMixIn): predicate.setMembershipCriterionCategoryList(['region/europe']) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),0) + self.assertEqual(len(predicate_list),0) order_line.setCategoryList(['region/africa']) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),0) + self.assertEqual(len(predicate_list),0) order_line.setCategoryList(['region/europe']) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),1) + self.assertEqual(len(predicate_list),1) order_line.setQuantity(60) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),0) + self.assertEqual(len(predicate_list),0) # Test with order line not none and predicate to date min and date max kw = {'portal_type':'Supply Line'} @@ -258,8 +258,8 @@ class TestDomainTool(TestPredicateMixIn): self.supply_line.setPricedQuantity(1) self.supply_line.setDefaultResourceValue(self.resource) order_line.setDefaultResourceValue(self.resource) - self.assertEquals(self.supply_line.getDefaultResourceValue(),self.resource) - self.assertEquals(order_line.getDefaultResourceValue(),self.resource) + self.assertEqual(self.supply_line.getDefaultResourceValue(),self.resource) + self.assertEqual(order_line.getDefaultResourceValue(),self.resource) date1 = DateTime('2005/04/08 10:47:26.388 GMT-4') date2 = DateTime('2005/04/10 10:47:26.388 GMT-4') self.supply_line.setStartDateRangeMin(date1) @@ -268,13 +268,13 @@ class TestDomainTool(TestPredicateMixIn): order_line.setStartDate(current_date) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),0) + self.assertEqual(len(predicate_list),0) current_date = DateTime('2005/04/09 10:47:26.388 GMT-4') order_line.setStartDate(current_date) self.tic() predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw) - self.assertEquals(len(predicate_list),1) + self.assertEqual(len(predicate_list),1) def test_01_SearchPredidateListWithNoTest(self): self.createData() @@ -297,7 +297,7 @@ class TestDomainTool(TestPredicateMixIn): domain_tool = self.getDomainTool() context = self.resource.asContext(categories=['resource/%s' % self.resource.getRelativeUrl()]) mapped_value = domain_tool.generateMappedValue(context, portal_type="Supply Line") - self.assertEquals(mapped_value.getBasePrice(),23) + self.assertEqual(mapped_value.getBasePrice(),23) def test_04_GenerateMappedValueWithRanges(self): self.createData() @@ -317,11 +317,11 @@ class TestDomainTool(TestPredicateMixIn): order_line.setStartDate(current_date) kw = {'portal_type':('Supply Line','Supply Cell')} mapped_value = domain_tool.generateMappedValue(order_line,**kw) - self.assertEquals(mapped_value,None) + self.assertEqual(mapped_value,None) current_date = DateTime('2005/04/09') order_line.setStartDate(current_date) mapped_value = domain_tool.generateMappedValue(order_line,**kw) - self.assertEquals(mapped_value.getBasePrice(),23) + self.assertEqual(mapped_value.getBasePrice(),23) def test_05_GenerateMappedValueWithVariation(self): self.createData() @@ -373,28 +373,28 @@ class TestDomainTool(TestPredicateMixIn): mapped_value = domain_tool.generateMappedValue(context, portal_type=self.portal_type_query, sort_method=sort_method) - self.assertEquals(mapped_value.getProperty('base_price'),45) + self.assertEqual(mapped_value.getProperty('base_price'),45) mapped_value = domain_tool.generateMappedValue(context, portal_type=self.portal_type_query, sort_key_method=sort_key_method) - self.assertEquals(mapped_value.getProperty('base_price'),45) + self.assertEqual(mapped_value.getProperty('base_price'),45) context = self.resource.asContext( categories=['resource/%s' % self.resource.getRelativeUrl(), 'variation/%s/red' % self.resource.getRelativeUrl()]) mapped_value = domain_tool.generateMappedValue(context, portal_type=self.portal_type_query, sort_method=sort_method) - self.assertEquals(mapped_value.getProperty('base_price'),26) + self.assertEqual(mapped_value.getProperty('base_price'),26) mapped_value = domain_tool.generateMappedValue(context, portal_type=self.portal_type_query, sort_key_method=sort_key_method) - self.assertEquals(mapped_value.getProperty('base_price'),26) + self.assertEqual(mapped_value.getProperty('base_price'),26) # Now check the price - self.assertEquals(self.resource.getPrice(context=self.resource.asContext( + self.assertEqual(self.resource.getPrice(context=self.resource.asContext( categories=['resource/%s' % self.resource.getRelativeUrl(), 'variation/%s/blue' % self.resource.getRelativeUrl()]), sort_method=sort_method),45) - self.assertEquals(self.resource.getPrice(context=self.resource.asContext( + self.assertEqual(self.resource.getPrice(context=self.resource.asContext( categories=['resource/%s' % self.resource.getRelativeUrl(), 'variation/%s/blue' % self.resource.getRelativeUrl()]), sort_key_method=sort_key_method),45) diff --git a/product/ERP5/tests/testERP5Administration.py b/product/ERP5/tests/testERP5Administration.py index bc07fb92fe..e08fd5aeb5 100644 --- a/product/ERP5/tests/testERP5Administration.py +++ b/product/ERP5/tests/testERP5Administration.py @@ -97,15 +97,15 @@ class TestERP5Administration(InventoryAPITestCase): # errors reported by property type validity constraint line_list = alarm.Alarm_viewConsistencyCheckReport.listbox.get_value( 'default', render_format='list') - self.assertEquals(1, len([line for line in line_list if line.isDataLine()])) - self.assertEquals(str(line_list[-1].getColumnProperty('getTranslatedMessage')), + self.assertEqual(1, len([line for line in line_list if line.isDataLine()])) + self.assertEqual(str(line_list[-1].getColumnProperty('getTranslatedMessage')), "Attribute title should be of type string but is of type <type 'int'>") # this alarm can solve, as long as the constraints can solve, this is the # case of PropertyTypeValidity alarm.solve() self.tic() - self.assertEquals('3', person.title) + self.assertEqual('3', person.title) def test_suite(): diff --git a/product/ERP5/tests/testERP5Base.py b/product/ERP5/tests/testERP5Base.py index 099ac0736f..0bfebe419b 100644 --- a/product/ERP5/tests/testERP5Base.py +++ b/product/ERP5/tests/testERP5Base.py @@ -296,20 +296,20 @@ class TestERP5Base(ERP5TypeTestCase): category_value_list.append(category_document) set_accessor = getattr(document, 'set' + base_accessor_id) set_accessor(category_relative_url) - self.assertEquals(getattr(document, 'get' + base_accessor_id)(), + self.assertEqual(getattr(document, 'get' + base_accessor_id)(), category_relative_url) - self.assertEquals(getattr(document, 'get' + base_accessor_id + 'Title')(), + self.assertEqual(getattr(document, 'get' + base_accessor_id + 'Title')(), category_title) - self.assertEquals(getattr(document, 'get' + base_accessor_id + 'Value')(), + self.assertEqual(getattr(document, 'get' + base_accessor_id + 'Value')(), category_document) set_accessor_list = 'set' + base_accessor_id + 'List' accessor_list = getattr(document, set_accessor_list) accessor_list(category_relative_url_list) - self.assertEquals(getattr(document, 'get' + base_accessor_id + 'List')(), + self.assertEqual(getattr(document, 'get' + base_accessor_id + 'List')(), category_relative_url_list) - self.assertEquals(getattr(document, 'get' + base_accessor_id + 'TitleList')(), + self.assertEqual(getattr(document, 'get' + base_accessor_id + 'TitleList')(), category_title_list) - self.assertEquals(getattr(document, 'get' + base_accessor_id + 'ValueList')(), + self.assertEqual(getattr(document, 'get' + base_accessor_id + 'ValueList')(), category_value_list) ################################## @@ -353,26 +353,26 @@ class TestERP5Base(ERP5TypeTestCase): organisation.setSite(None) organisation.setSkillList(None) - self.assertEquals(organisation.getFunction() , None) - self.assertEquals(organisation.getActivity() , None) - self.assertEquals(organisation.getGroup() , None) - self.assertEquals(organisation.getRole() , None) - self.assertEquals(organisation.getSite() , None) - self.assertEquals(organisation.getSkillList(), []) + self.assertEqual(organisation.getFunction() , None) + self.assertEqual(organisation.getActivity() , None) + self.assertEqual(organisation.getGroup() , None) + self.assertEqual(organisation.getRole() , None) + self.assertEqual(organisation.getSite() , None) + self.assertEqual(organisation.getSkillList(), []) - self.assertEquals(organisation.getFunctionTitle() , None) - self.assertEquals(organisation.getActivityTitle() , None) - self.assertEquals(organisation.getGroupTitle() , None) - self.assertEquals(organisation.getRoleTitle() , None) - self.assertEquals(organisation.getSiteTitle() , None) - self.assertEquals(organisation.getSkillTitleList(), []) + self.assertEqual(organisation.getFunctionTitle() , None) + self.assertEqual(organisation.getActivityTitle() , None) + self.assertEqual(organisation.getGroupTitle() , None) + self.assertEqual(organisation.getRoleTitle() , None) + self.assertEqual(organisation.getSiteTitle() , None) + self.assertEqual(organisation.getSkillTitleList(), []) - self.assertEquals(organisation.getFunctionValue() , None) - self.assertEquals(organisation.getActivityValue() , None) - self.assertEquals(organisation.getGroupValue() , None) - self.assertEquals(organisation.getRoleValue() , None) - self.assertEquals(organisation.getSiteValue() , None) - self.assertEquals(organisation.getSkillValueList(), []) + self.assertEqual(organisation.getFunctionValue() , None) + self.assertEqual(organisation.getActivityValue() , None) + self.assertEqual(organisation.getGroupValue() , None) + self.assertEqual(organisation.getRoleValue() , None) + self.assertEqual(organisation.getSiteValue() , None) + self.assertEqual(organisation.getSkillValueList(), []) def stepSetOrganisationAddress(self, sequence=None, sequence_list=None, **kw): @@ -409,57 +409,57 @@ class TestERP5Base(ERP5TypeTestCase): organisation.setDefaultFaxText('+55(0)69-1337') organisation.setDefaultEmailText('kevin@truc-bidule.com') - self.failUnless('default_address' in organisation.contentIds()) + self.assertTrue('default_address' in organisation.contentIds()) default_address = organisation.default_address - self.assertEquals(default_address.getPortalType(), 'Address') - self.assertEquals(organisation.getDefaultAddressValue(), default_address) + self.assertEqual(default_address.getPortalType(), 'Address') + self.assertEqual(organisation.getDefaultAddressValue(), default_address) - self.assertEquals( organisation.getDefaultAddressCity() + self.assertEqual( organisation.getDefaultAddressCity() , default_address.getCity() ) - self.assertEquals( organisation.getDefaultAddressRegion() + self.assertEqual( organisation.getDefaultAddressRegion() , default_address.getRegion() ) - self.assertEquals( organisation.getDefaultAddressRegionTitle() + self.assertEqual( organisation.getDefaultAddressRegionTitle() , default_address.getRegionTitle() ) - self.assertEquals( default_address.getRegionValue() + self.assertEqual( default_address.getRegionValue() , region_object ) - self.assertEquals( organisation.getDefaultAddressZipCode() + self.assertEqual( organisation.getDefaultAddressZipCode() , default_address.getZipCode() ) - self.assertEquals( organisation.getDefaultAddressStreetAddress() + self.assertEqual( organisation.getDefaultAddressStreetAddress() , default_address.getStreetAddress() ) # Organisation's region is acquired from the Address object - self.assertEquals( organisation.getRegion() + self.assertEqual( organisation.getRegion() , default_address.getRegion() ) - self.failUnless('default_telephone' in organisation.contentIds()) + self.assertTrue('default_telephone' in organisation.contentIds()) default_telephone = organisation.default_telephone - self.assertEquals(default_telephone.getPortalType(), 'Telephone') - self.assertEquals( organisation.getDefaultTelephoneText() + self.assertEqual(default_telephone.getPortalType(), 'Telephone') + self.assertEqual( organisation.getDefaultTelephoneText() , default_telephone.asText() ) self.assertTrue(organisation.hasDefaultTelephone()) self.assertTrue(organisation.hasDefaultTelephoneCoordinateText()) - self.failUnless('default_fax' in organisation.contentIds()) + self.assertTrue('default_fax' in organisation.contentIds()) default_fax = organisation.default_fax - self.assertEquals(default_fax.getPortalType(), 'Fax') - self.assertEquals( organisation.getDefaultFaxText() + self.assertEqual(default_fax.getPortalType(), 'Fax') + self.assertEqual( organisation.getDefaultFaxText() , default_fax.asText() ) self.assertTrue(organisation.hasDefaultFax()) self.assertTrue(organisation.hasDefaultFaxCoordinateText()) - self.failUnless('default_email' in organisation.contentIds()) + self.assertTrue('default_email' in organisation.contentIds()) default_email = organisation.default_email - self.assertEquals(default_email.getPortalType(), 'Email') - self.assertEquals( organisation.getDefaultEmailText() + self.assertEqual(default_email.getPortalType(), 'Email') + self.assertEqual( organisation.getDefaultEmailText() , default_email.asText() ) self.assertTrue(organisation.hasDefaultEmail()) @@ -487,14 +487,14 @@ class TestERP5Base(ERP5TypeTestCase): # Set subordination person.setCareerSubordinationValue(organisation) - self.assertEquals(person.getCareerSubordinationValue(), organisation) + self.assertEqual(person.getCareerSubordinationValue(), organisation) # Set & Check simple properties with 'Career' prefix person.setCareerTitle('A brand new career step') person.setCareerDescription( 'This career step correspond to my arrival at Nexedi as employee') - self.assertEquals(person.getCareerTitle() , 'A brand new career step') - self.assertEquals(person.getCareerDescription(), + self.assertEqual(person.getCareerTitle() , 'A brand new career step') + self.assertEqual(person.getCareerDescription(), 'This career step correspond to my arrival at Nexedi as employee') dummy_date1 = self.datetime + 10 @@ -505,16 +505,16 @@ class TestERP5Base(ERP5TypeTestCase): person.setCareerCollectiveAgreementTitle('SYNTEC convention') person.setCareerActivity('software') person.setCareerReference('1234') - self.assertEquals(person.getCareerStopDate() , dummy_date2) - self.assertEquals(person.getCareerStartDate() , dummy_date1) - self.assertEquals(person.getCareerSalaryCoefficient() , 1) - self.assertEquals(person.getCareerCollectiveAgreementTitle(), 'SYNTEC convention') - self.assertEquals(person.getCareerActivityTitle(), 'Software') - self.assertEquals(person.getCareerReference(), '1234') + self.assertEqual(person.getCareerStopDate() , dummy_date2) + self.assertEqual(person.getCareerStartDate() , dummy_date1) + self.assertEqual(person.getCareerSalaryCoefficient() , 1) + self.assertEqual(person.getCareerCollectiveAgreementTitle(), 'SYNTEC convention') + self.assertEqual(person.getCareerActivityTitle(), 'Software') + self.assertEqual(person.getCareerReference(), '1234') # activity must be acquired on person - self.assertEquals(person.getActivity(), person.getCareerActivity()) - self.assertEquals('Software', person.getActivityTitle()) + self.assertEqual(person.getActivity(), person.getCareerActivity()) + self.assertEqual('Software', person.getActivityTitle()) tested_base_category_list = ('function', 'role', 'grade', 'salary_level', 'skill') @@ -531,7 +531,7 @@ class TestERP5Base(ERP5TypeTestCase): skill_object_list.append(category_value) for skill_object in skill_object_list: self.assertTrue(person in skill_object.getSkillRelatedValueList()) - self.assertEquals(person.getSkillValue(), skill_object_list[0]) + self.assertEqual(person.getSkillValue(), skill_object_list[0]) def stepCheckPersonCareer(self, sequence=None, sequence_list=None, **kw): """ @@ -541,54 +541,54 @@ class TestERP5Base(ERP5TypeTestCase): person = sequence.get('person') # Check default career sub-object - self.failUnless('default_career' in person.contentIds()) + self.assertTrue('default_career' in person.contentIds()) default_career = person.default_career - self.assertEquals(default_career.getPortalType(), 'Career') + self.assertEqual(default_career.getPortalType(), 'Career') # Test getter with 'Career' prefix - self.assertEquals(person.getCareer() , default_career.getRelativeUrl()) - self.assertEquals(person.getCareerTitle() , default_career.getTitle()) - self.assertEquals(person.getCareerReference(), default_career.getReference()) - self.assertEquals(person.getCareerValue() , default_career) - self.assertEquals(person.getCareerDescription(), default_career.getDescription()) + self.assertEqual(person.getCareer() , default_career.getRelativeUrl()) + self.assertEqual(person.getCareerTitle() , default_career.getTitle()) + self.assertEqual(person.getCareerReference(), default_career.getReference()) + self.assertEqual(person.getCareerValue() , default_career) + self.assertEqual(person.getCareerDescription(), default_career.getDescription()) - self.assertEquals(person.getCareerFunction() , default_career.getFunction()) - self.assertEquals(person.getCareerFunctionTitle(), default_career.getFunctionTitle()) - self.assertEquals(person.getCareerFunctionValue(), default_career.getFunctionValue()) + self.assertEqual(person.getCareerFunction() , default_career.getFunction()) + self.assertEqual(person.getCareerFunctionTitle(), default_career.getFunctionTitle()) + self.assertEqual(person.getCareerFunctionValue(), default_career.getFunctionValue()) # Test getter with no prefix (aka 'transparent' getters) on simple properties # then on category properties - self.assertEquals(person.getCareerStopDate() , default_career.getStopDate()) - self.assertEquals(person.getCareerStartDate() , default_career.getStartDate()) - self.assertEquals(person.getCareerSalaryCoefficient() , default_career.getSalaryCoefficient()) - self.assertEquals(person.getCareerCollectiveAgreementTitle(), default_career.getCollectiveAgreementTitle()) - - self.assertEquals(person.getCareerRole() , default_career.getRole()) - self.assertEquals(person.getCareerRoleTitle(), default_career.getRoleTitle()) - self.assertEquals(person.getCareerRoleValue(), default_career.getRoleValue()) - - self.assertEquals(person.getCareerGrade() , default_career.getGrade()) - self.assertEquals(person.getCareerGradeTitle(), default_career.getGradeTitle()) - self.assertEquals(person.getCareerGradeValue(), default_career.getGradeValue()) + self.assertEqual(person.getCareerStopDate() , default_career.getStopDate()) + self.assertEqual(person.getCareerStartDate() , default_career.getStartDate()) + self.assertEqual(person.getCareerSalaryCoefficient() , default_career.getSalaryCoefficient()) + self.assertEqual(person.getCareerCollectiveAgreementTitle(), default_career.getCollectiveAgreementTitle()) + + self.assertEqual(person.getCareerRole() , default_career.getRole()) + self.assertEqual(person.getCareerRoleTitle(), default_career.getRoleTitle()) + self.assertEqual(person.getCareerRoleValue(), default_career.getRoleValue()) + + self.assertEqual(person.getCareerGrade() , default_career.getGrade()) + self.assertEqual(person.getCareerGradeTitle(), default_career.getGradeTitle()) + self.assertEqual(person.getCareerGradeValue(), default_career.getGradeValue()) - self.assertEquals(person.getCareerActivity(), + self.assertEqual(person.getCareerActivity(), default_career.getActivity()) - self.assertEquals(person.getCareerActivityTitle(), + self.assertEqual(person.getCareerActivityTitle(), default_career.getActivityTitle()) - self.assertEquals(person.getCareerActivityValue(), + self.assertEqual(person.getCareerActivityValue(), default_career.getActivityValue()) - self.assertEquals(person.getCareerSalaryLevel() , default_career.getSalaryLevel()) - self.assertEquals(person.getCareerSalaryLevelTitle(), default_career.getSalaryLevelTitle()) - self.assertEquals(person.getCareerSalaryLevelValue(), default_career.getSalaryLevelValue()) + self.assertEqual(person.getCareerSalaryLevel() , default_career.getSalaryLevel()) + self.assertEqual(person.getCareerSalaryLevelTitle(), default_career.getSalaryLevelTitle()) + self.assertEqual(person.getCareerSalaryLevelValue(), default_career.getSalaryLevelValue()) - self.assertEquals(person.getCareerSkillList() , default_career.getSkillList()) - self.assertEquals(person.getCareerSkillTitleList(), default_career.getSkillTitleList()) - self.assertEquals(person.getCareerSkillValueList(), default_career.getSkillValueList()) + self.assertEqual(person.getCareerSkillList() , default_career.getSkillList()) + self.assertEqual(person.getCareerSkillTitleList(), default_career.getSkillTitleList()) + self.assertEqual(person.getCareerSkillValueList(), default_career.getSkillValueList()) - self.assertEquals(person.getCareerSubordination(), default_career.getSubordination()) + self.assertEqual(person.getCareerSubordination(), default_career.getSubordination()) # Person's subordination is acquired from default career - self.assertEquals(person.getSubordination(), default_career.getSubordination()) + self.assertEqual(person.getSubordination(), default_career.getSubordination()) def stepAddCareerStepInAnotherOrganisation(self, sequence=None, **kw) : """Adds another career step on the person.""" @@ -599,7 +599,7 @@ class TestERP5Base(ERP5TypeTestCase): new_career_title = 'new career title' # Create a new career step. person.Person_shiftDefaultCareer() - self.assertEquals( 2, + self.assertEqual( 2, len(person.contentValues(filter={'portal_type':'Career'}))) person.setCareerSubordination(other_organisation.getRelativeUrl()) person.setCareerTitle(new_career_title) @@ -636,18 +636,18 @@ class TestERP5Base(ERP5TypeTestCase): old_career_step.getCategoryList(), '%s not in %s' % (old_organisation.getRelativeUrl(), old_career_step.getCategoryList())) - self.assertEquals( old_career_step.getSubordination(), + self.assertEqual( old_career_step.getSubordination(), old_organisation.getRelativeUrl() ) - self.assertEquals( old_career_step.getSubordinationTitle(), + self.assertEqual( old_career_step.getSubordinationTitle(), old_organisation_title ) self.assert_( "subordination/%s" % new_organisation.getRelativeUrl() in new_career_step.getCategoryList(), '%s not in %s' % (new_organisation.getRelativeUrl(), new_career_step.getCategoryList())) - self.assertEquals( new_career_step.getSubordination(), + self.assertEqual( new_career_step.getSubordination(), new_organisation.getRelativeUrl() ) - self.assertEquals( new_career_step.getSubordinationTitle(), + self.assertEqual( new_career_step.getSubordinationTitle(), new_organisation_title ) def stepCheckChangePersonAddress(self, sequence=None, **kw) : @@ -657,10 +657,10 @@ class TestERP5Base(ERP5TypeTestCase): """ person = sequence.get('person') organisation = sequence.get('organisation') - self.assertEquals(organisation.getDefaultAddressCity(),'Lille') - self.assertEquals(organisation.getDefaultAddressZipCode(), '59000') - self.assertEquals(person.getDefaultAddressCity(),'Lille') - self.assertEquals(person.getDefaultAddressZipCode(), '59000') + self.assertEqual(organisation.getDefaultAddressCity(),'Lille') + self.assertEqual(organisation.getDefaultAddressZipCode(), '59000') + self.assertEqual(person.getDefaultAddressCity(),'Lille') + self.assertEqual(person.getDefaultAddressZipCode(), '59000') # here, the parameters we pass to edit are the same as the one acquired # from the organisation, edit shouldn't do anything @@ -668,10 +668,10 @@ class TestERP5Base(ERP5TypeTestCase): default_address_city='Lille', default_address_zip_code='59000') - self.assertEquals(person.getDefaultAddress(), + self.assertEqual(person.getDefaultAddress(), organisation.getDefaultAddress()) - self.assertEquals(person.getDefaultAddressCity(),'Lille') - self.assertEquals(person.getDefaultAddressZipCode(), '59000') + self.assertEqual(person.getDefaultAddressCity(),'Lille') + self.assertEqual(person.getDefaultAddressZipCode(), '59000') # here, the first parameter we pass will trigger the creation of a # subobject on person, and we need to make sure that the second one gets @@ -683,10 +683,10 @@ class TestERP5Base(ERP5TypeTestCase): self.assertNotEquals(person.getDefaultAddress(), organisation.getDefaultAddress()) - self.assertEquals(person.getDefaultAddressCity(),'La Garnache') - self.assertEquals(person.getDefaultAddressZipCode(), '59000') - self.assertEquals(organisation.getDefaultAddressCity(),'Lille') - self.assertEquals(organisation.getDefaultAddressZipCode(), '59000') + self.assertEqual(person.getDefaultAddressCity(),'La Garnache') + self.assertEqual(person.getDefaultAddressZipCode(), '59000') + self.assertEqual(organisation.getDefaultAddressCity(),'Lille') + self.assertEqual(organisation.getDefaultAddressZipCode(), '59000') # retry last action, inverting the modified property # XXX Whether this test is usefull or not completely depends on Python @@ -702,21 +702,21 @@ class TestERP5Base(ERP5TypeTestCase): self.assertNotEquals(person.getDefaultAddress(), organisation.getDefaultAddress()) - self.assertEquals(person.getDefaultAddressCity(),'Lille') - self.assertEquals(person.getDefaultAddressZipCode(), '69000') - self.assertEquals(organisation.getDefaultAddressCity(),'Lille') - self.assertEquals(organisation.getDefaultAddressZipCode(), '59000') + self.assertEqual(person.getDefaultAddressCity(),'Lille') + self.assertEqual(person.getDefaultAddressZipCode(), '69000') + self.assertEqual(organisation.getDefaultAddressCity(),'Lille') + self.assertEqual(organisation.getDefaultAddressZipCode(), '59000') # if the address of the person is the same of the organisation # there is no reason to create a subobject (default_address) person.manage_delObjects(['default_address']) person.edit(career_subordination_value=organisation) self.assertTrue('default_address' not in person.objectIds()) - self.assertEquals(person.getDefaultAddress(), + self.assertEqual(person.getDefaultAddress(), organisation.getDefaultAddress()) - self.assertEquals(person.getDefaultAddressCity(), + self.assertEqual(person.getDefaultAddressCity(), organisation.getDefaultAddressCity()) - self.assertEquals(person.getDefaultAddressZipCode(), + self.assertEqual(person.getDefaultAddressZipCode(), organisation.getDefaultAddressZipCode()) # if the address of the person is different then the subobject # (default_address) must be created. @@ -802,11 +802,11 @@ class TestERP5Base(ERP5TypeTestCase): person = self.portal.person_module.newContent( portal_type='Person', career_subordination_value=organisation) - self.assertEquals(portal_categories.role.client, + self.assertEqual(portal_categories.role.client, person.getRoleValue()) - self.assertEquals(portal_categories.activity.software, + self.assertEqual(portal_categories.activity.software, person.getActivityValue()) - self.assertEquals(portal_categories.group.nexedi, + self.assertEqual(portal_categories.group.nexedi, person.getGroupValue()) @@ -818,11 +818,11 @@ class TestERP5Base(ERP5TypeTestCase): birthday = DateTime(1999, 01, 01) now = DateTime() pers.edit(birthday = birthday) - self.assertEquals(birthday, pers.getBirthday()) - self.assertEquals(birthday, pers.getStartDate()) + self.assertEqual(birthday, pers.getBirthday()) + self.assertEqual(birthday, pers.getStartDate()) for slot in ['year', 'month', 'day', 'hour', 'minute']: - self.assertEquals(getattr(now, slot)(), + self.assertEqual(getattr(now, slot)(), getattr(pers.getCreationDate(), slot)(), 'Wrong creation date %s' % pers.getCreationDate()) @@ -833,10 +833,10 @@ class TestERP5Base(ERP5TypeTestCase): start_date = DateTime(1999, 01, 01) now = DateTime() org.edit(start_date = start_date) - self.assertEquals(start_date, org.getStartDate()) + self.assertEqual(start_date, org.getStartDate()) for slot in ['year', 'month', 'day', 'hour', 'minute']: - self.assertEquals(getattr(now, slot)(), + self.assertEqual(getattr(now, slot)(), getattr(org.getCreationDate(), slot)(), 'Wrong creation date %s' % org.getCreationDate()) @@ -845,15 +845,15 @@ class TestERP5Base(ERP5TypeTestCase): """ pers = self.getPersonModule().newContent(portal_type='Person') pers.setDefaultBirthplaceAddressCity('Lille') - self.assertEquals('Lille', pers.getDefaultBirthplaceAddressCity()) + self.assertEqual('Lille', pers.getDefaultBirthplaceAddressCity()) def test_getTranslatedId(self): pers = self.getPersonModule().newContent( portal_type='Person', id='default_email') - self.assertEquals(None, pers.getTranslatedId()) + self.assertEqual(None, pers.getTranslatedId()) pers.setDefaultEmailText('nobody@example.com') email = pers.getDefaultEmailValue() - self.assertEquals('Default Email', str(email.getTranslatedId())) + self.assertEqual('Default Email', str(email.getTranslatedId())) def test_SubordinationAcquisitionAndFunction(self): # function is acquired from the subordination, organisation function are @@ -869,7 +869,7 @@ class TestERP5Base(ERP5TypeTestCase): person = self.getPersonModule().newContent(portal_type='Person', career_subordination_value=organisation) # on Organisation_view, the user usually select node for functions: - self.assertEquals([['', ''], ['Function Node', 'function_node']], + self.assertEqual([['', ''], ['Function Node', 'function_node']], organisation.Organisation_view.my_function.get_value('items')) # on Person_view, the user select leaves for functions: @@ -879,13 +879,13 @@ class TestERP5Base(ERP5TypeTestCase): self.assertTrue('function_node/function_leave' in [x[1] for x in field.get_value('items')]) # person acquire function from the organisation - self.assertEquals(person.getFunctionValue(), function_node) + self.assertEqual(person.getFunctionValue(), function_node) # but the user interface does not show the acquired value in this case - self.assertEquals('', field.get_value('default')) + self.assertEqual('', field.get_value('default')) # (the field is working) person.setDefaultCareerFunctionValue(function_leave) - self.assertEquals(person.getFunctionValue(), function_leave) - self.assertEquals('function_node/function_leave', + self.assertEqual(person.getFunctionValue(), function_leave) + self.assertEqual('function_node/function_leave', field.get_value('default')) @@ -894,18 +894,18 @@ class TestERP5Base(ERP5TypeTestCase): for entity in (self.getPersonModule().newContent(portal_type='Person'), self.getOrganisationModule().newContent(portal_type='Organisation')): bank_account = entity.newContent(portal_type='Bank Account') - self.assertEquals([], bank_account.checkConsistency()) + self.assertEqual([], bank_account.checkConsistency()) bank_account.newContent(portal_type='Agent') - self.assertEquals([], bank_account.checkConsistency()) + self.assertEqual([], bank_account.checkConsistency()) self.portal.portal_workflow.doActionFor(bank_account, 'validate_action') - self.assertEquals('validated', bank_account.getValidationState()) + self.assertEqual('validated', bank_account.getValidationState()) def test_CreateImage(self): # We can add Images inside Persons and Organisation for entity in (self.getPersonModule().newContent(portal_type='Person'), self.getOrganisationModule().newContent(portal_type='Organisation')): image = entity.newContent(portal_type='Embedded File') - self.assertEquals([], image.checkConsistency()) + self.assertEqual([], image.checkConsistency()) image.view() # viewing the image does not cause error def test_ConvertImage(self): @@ -932,19 +932,19 @@ class TestERP5Base(ERP5TypeTestCase): self.assertTrue(isinstance(image.data, Pdata)) image_type, image_data = image.convert('jpg', display='thumbnail') - self.assertEquals('image/jpeg', image_type) + self.assertEqual('image/jpeg', image_type) # magic - self.assertEquals('\xff', image_data[0]) - self.assertEquals('\xd8', image_data[1]) + self.assertEqual('\xff', image_data[0]) + self.assertEqual('\xd8', image_data[1]) def test_ImageSize(self): image = self.portal.newContent(portal_type='Image', id='test_image') image.edit(file=self.makeImageFileUpload('erp5_logo.png')) - self.assertEquals(320, image.getWidth()) - self.assertEquals(250, image.getHeight()) + self.assertEqual(320, image.getWidth()) + self.assertEqual(250, image.getHeight()) image.edit(file=self.makeImageFileUpload('erp5_logo_small.png')) - self.assertEquals(160, image.getWidth()) - self.assertEquals(125, image.getHeight()) + self.assertEqual(160, image.getWidth()) + self.assertEqual(125, image.getHeight()) def test_Person_getCareerStartDate(self): # Person_getCareerStartDate scripts returns the date when an employee @@ -966,10 +966,10 @@ class TestERP5Base(ERP5TypeTestCase): portal_type='Career', subordination_value=second_organisation, start_date=DateTime(1999, 9, 9)) - self.assertEquals(DateTime(2001, 1, 1), + self.assertEqual(DateTime(2001, 1, 1), person.Person_getCareerStartDate( subordination_relative_url=first_organisation.getRelativeUrl())) - self.assertEquals(DateTime(1999, 9, 9), + self.assertEqual(DateTime(1999, 9, 9), person.Person_getCareerStartDate( subordination_relative_url=second_organisation.getRelativeUrl())) @@ -980,7 +980,7 @@ class TestERP5Base(ERP5TypeTestCase): subordination_value=first_organisation, start_date=DateTime(1996, 9, 9)) another_cancelled_career.cancel() - self.assertEquals(DateTime(2001, 01, 01), + self.assertEqual(DateTime(2001, 01, 01), person.Person_getCareerStartDate( subordination_relative_url=first_organisation.getRelativeUrl())) @@ -989,30 +989,30 @@ class TestERP5Base(ERP5TypeTestCase): portal_type='Person', start_date=DateTime(2001, 2, 3)) - self.assertEquals(1, + self.assertEqual(1, person.Person_getAge(year=1, at_date=DateTime(2002, 2, 4))) self.assertTrue(person.Person_getAge(year=1) > 5) # if year is not passed, the script returns the age in a translated string. age_as_text = person.Person_getAge(at_date=DateTime(2002, 2, 4)) - self.assertEquals(age_as_text, "1 years old") + self.assertEqual(age_as_text, "1 years old") def test_AssignmentWorkflow(self): person = self.getPersonModule().newContent(portal_type='Person',) assignment = person.newContent(portal_type='Assignment') - self.assertEquals('draft', assignment.getValidationState()) + self.assertEqual('draft', assignment.getValidationState()) self.portal.portal_workflow.doActionFor(assignment, 'open_action') - self.assertEquals('open', assignment.getValidationState()) + self.assertEqual('open', assignment.getValidationState()) self.portal.portal_workflow.doActionFor(assignment, 'update_action') - self.assertEquals('updated', assignment.getValidationState()) + self.assertEqual('updated', assignment.getValidationState()) self.portal.portal_workflow.doActionFor(assignment, 'open_action') - self.assertEquals('open', assignment.getValidationState()) + self.assertEqual('open', assignment.getValidationState()) # date is set automatically when closing - self.assertEquals(None, assignment.getStopDate()) + self.assertEqual(None, assignment.getStopDate()) self.portal.portal_workflow.doActionFor(assignment, 'close_action') - self.assertEquals('closed', assignment.getValidationState()) + self.assertEqual('closed', assignment.getValidationState()) self.assertNotEquals(None, assignment.getStopDate()) - self.assertEquals(DateTime().day(), assignment.getStopDate().day()) + self.assertEqual(DateTime().day(), assignment.getStopDate().day()) def test_ERP5Site_checkDataWithScript(self): # note the '/'.join(obj.getPhysicalPath()) idiom: @@ -1040,7 +1040,7 @@ class TestERP5Base(ERP5TypeTestCase): relative_url_list = sum((x.detail.split('\n') for x in active_process.getResultList()), []) - self.assertEquals(len(relative_url_list), len(set(relative_url_list))) + self.assertEqual(len(relative_url_list), len(set(relative_url_list))) for obj in organisation, person, person.getDefaultEmailValue(): self.assertTrue('/'.join(obj.getPhysicalPath()) in relative_url_list) for relative_url in relative_url_list: @@ -1073,14 +1073,14 @@ class TestERP5Base(ERP5TypeTestCase): # patch the method, we'll abort later self.portal.Localizer.get_selected_language = lambda: lang - self.assertEquals(set([person_1, person_2]), + self.assertEqual(set([person_1, person_2]), set([x.getObject() for x in self.portal.portal_catalog(translated_portal_type='Personne')])) - self.assertEquals(set([person_2, organisation]), + self.assertEqual(set([person_2, organisation]), set([x.getObject() for x in self.portal.portal_catalog(translated_validation_state_title='Brouillon', portal_type=('Person', 'Organisation'))])) - self.assertEquals([person_2], + self.assertEqual([person_2], [x.getObject() for x in self.portal.portal_catalog(translated_validation_state_title='Brouillon', translated_portal_type='Personne')]) @@ -1091,9 +1091,9 @@ class TestERP5Base(ERP5TypeTestCase): module.manage_permission('Add portal content', ['Member'], 0) self.login_as_auditor() person = module.newContent(portal_type='Person',) - self.assertEquals(1, len(module)) + self.assertEqual(1, len(module)) person.Base_createCloneDocument() - self.assertEquals(2, len(module)) + self.assertEqual(2, len(module)) def test_Base_createCloneDocument_document_in_document(self): module = self.portal.person_module @@ -1102,11 +1102,11 @@ class TestERP5Base(ERP5TypeTestCase): person = module.newContent(portal_type='Person',) # An address is a document, it cannot contain anything address = person.newContent(portal_type='Address') - self.assertEquals(0, len(address.allowedContentTypes())) + self.assertEqual(0, len(address.allowedContentTypes())) - self.assertEquals(1, len(person)) + self.assertEqual(1, len(person)) address.Base_createCloneDocument() - self.assertEquals(2, len(person)) + self.assertEqual(2, len(person)) def test_Base_createCloneDocument_folder_in_document(self): module = self.portal.person_module @@ -1117,9 +1117,9 @@ class TestERP5Base(ERP5TypeTestCase): # A bank account is a folder, it can contain other documents self.assertNotEquals(0, len(bank_account.allowedContentTypes())) - self.assertEquals(1, len(person)) + self.assertEqual(1, len(person)) bank_account.Base_createCloneDocument() - self.assertEquals(2, len(person)) + self.assertEqual(2, len(person)) def getWorkflowHistory(self, document, workflow_id): return self.portal.portal_workflow.getInfoFor(ob=document, name='history', @@ -1177,199 +1177,199 @@ class TestERP5Base(ERP5TypeTestCase): self.portal.portal_catalog.getResultValue(portal_type='Preference', owner='user_login')) # for his assignent group - self.assertEquals('group/nexedi', + self.assertEqual('group/nexedi', self.portal.portal_preferences.getPreferredSectionCategory()) def test_default_address_acquisition(self): # more complete version of test_04_SubordinationAndAddress organisation = \ self.portal.organisation_module.newContent(portal_type='Organisation') - self.assertEquals(None, organisation.getDefaultAddressStreetAddress()) - self.assertEquals(None, organisation.getDefaultAddressCity()) - self.assertEquals(None, organisation.getDefaultAddressZipCode()) - self.assertEquals(None, organisation.getDefaultAddressText()) + self.assertEqual(None, organisation.getDefaultAddressStreetAddress()) + self.assertEqual(None, organisation.getDefaultAddressCity()) + self.assertEqual(None, organisation.getDefaultAddressZipCode()) + self.assertEqual(None, organisation.getDefaultAddressText()) - self.assertEquals(None, organisation.getDefaultAddressRegion()) - self.assertEquals(None, organisation.getRegion()) + self.assertEqual(None, organisation.getDefaultAddressRegion()) + self.assertEqual(None, organisation.getRegion()) organisation.setDefaultAddressRegion('europe/france') - self.assertEquals('europe/france', organisation.getDefaultAddressRegion()) + self.assertEqual('europe/france', organisation.getDefaultAddressRegion()) # region is acquired from default address - self.assertEquals('europe/france', organisation.getRegion()) - self.assertEquals(None, organisation.getDefaultAddressStreetAddress()) - self.assertEquals(None, organisation.getDefaultAddressCity()) - self.assertEquals(None, organisation.getDefaultAddressZipCode()) + self.assertEqual('europe/france', organisation.getRegion()) + self.assertEqual(None, organisation.getDefaultAddressStreetAddress()) + self.assertEqual(None, organisation.getDefaultAddressCity()) + self.assertEqual(None, organisation.getDefaultAddressZipCode()) organisation.setDefaultAddressStreetAddress('Street Address') organisation.setDefaultAddressCity('City') organisation.setDefaultAddressZipCode('Zip Code') - self.assertEquals('Street Address', organisation.getDefaultAddressStreetAddress()) - self.assertEquals('City', organisation.getDefaultAddressCity()) - self.assertEquals('Zip Code', organisation.getDefaultAddressZipCode()) + self.assertEqual('Street Address', organisation.getDefaultAddressStreetAddress()) + self.assertEqual('City', organisation.getDefaultAddressCity()) + self.assertEqual('Zip Code', organisation.getDefaultAddressZipCode()) person = self.portal.person_module.newContent(portal_type='Person') - self.assertEquals(None, person.getDefaultAddressStreetAddress()) - self.assertEquals(None, person.getDefaultAddressCity()) - self.assertEquals(None, person.getDefaultAddressZipCode()) - self.assertEquals(None, person.getDefaultAddressText()) - self.assertEquals(None, person.getDefaultAddressRegion()) - self.assertEquals(None, person.getRegion()) + self.assertEqual(None, person.getDefaultAddressStreetAddress()) + self.assertEqual(None, person.getDefaultAddressCity()) + self.assertEqual(None, person.getDefaultAddressZipCode()) + self.assertEqual(None, person.getDefaultAddressText()) + self.assertEqual(None, person.getDefaultAddressRegion()) + self.assertEqual(None, person.getRegion()) # On persons, Address is acquired from the default carreer person.setDefaultCareerSubordinationValue(organisation) - self.assertEquals('Street Address', person.getDefaultAddressStreetAddress()) - self.assertEquals('City', person.getDefaultAddressCity()) - self.assertEquals('Zip Code', person.getDefaultAddressZipCode()) - self.assertEquals('europe/france', person.getDefaultAddressRegion()) + self.assertEqual('Street Address', person.getDefaultAddressStreetAddress()) + self.assertEqual('City', person.getDefaultAddressCity()) + self.assertEqual('Zip Code', person.getDefaultAddressZipCode()) + self.assertEqual('europe/france', person.getDefaultAddressRegion()) # region is acquired from default address - self.assertEquals('europe/france', person.getRegion()) + self.assertEqual('europe/france', person.getRegion()) # we can set different values on the person address without modifying # organisation address person.setDefaultAddressStreetAddress('Person Street Address') person.setDefaultAddressCity('Person City') person.setDefaultAddressZipCode('Person Zip Code') - self.assertEquals('Person Street Address', person.getDefaultAddressStreetAddress()) - self.assertEquals('Person City', person.getDefaultAddressCity()) - self.assertEquals('Person Zip Code', person.getDefaultAddressZipCode()) - self.assertEquals('Street Address', organisation.getDefaultAddressStreetAddress()) - self.assertEquals('City', organisation.getDefaultAddressCity()) - self.assertEquals('Zip Code', organisation.getDefaultAddressZipCode()) + self.assertEqual('Person Street Address', person.getDefaultAddressStreetAddress()) + self.assertEqual('Person City', person.getDefaultAddressCity()) + self.assertEqual('Person Zip Code', person.getDefaultAddressZipCode()) + self.assertEqual('Street Address', organisation.getDefaultAddressStreetAddress()) + self.assertEqual('City', organisation.getDefaultAddressCity()) + self.assertEqual('Zip Code', organisation.getDefaultAddressZipCode()) def test_default_telephone_acquisition(self): organisation = \ self.portal.organisation_module.newContent(portal_type='Organisation') - self.assertEquals(None, organisation.getDefaultTelephoneCoordinateText()) + self.assertEqual(None, organisation.getDefaultTelephoneCoordinateText()) # There is no problem if this organisation has a region (this use to be a # problem) organisation.setDefaultAddressRegion('europe/france') - self.assertEquals(None, organisation.getDefaultTelephoneCoordinateText()) + self.assertEqual(None, organisation.getDefaultTelephoneCoordinateText()) organisation.setDefaultTelephoneText("12345") - self.assertEquals('12345', organisation.getDefaultTelephoneCoordinateText()) + self.assertEqual('12345', organisation.getDefaultTelephoneCoordinateText()) person = self.portal.person_module.newContent(portal_type='Person') - self.assertEquals(None, person.getDefaultTelephoneCoordinateText()) + self.assertEqual(None, person.getDefaultTelephoneCoordinateText()) # On persons, Telephone is acquired from the default carreer person.setDefaultCareerSubordinationValue(organisation) - self.assertEquals('12345', person.getDefaultTelephoneCoordinateText()) + self.assertEqual('12345', person.getDefaultTelephoneCoordinateText()) # we can set different values on the person address without modifying # organisation address person.setDefaultTelephoneText('54321') - self.assertEquals('54321', person.getDefaultTelephoneCoordinateText()) - self.assertEquals('12345', organisation.getDefaultTelephoneCoordinateText()) + self.assertEqual('54321', person.getDefaultTelephoneCoordinateText()) + self.assertEqual('12345', organisation.getDefaultTelephoneCoordinateText()) def test_mobile_telephone_acquisition(self): organisation = \ self.portal.organisation_module.newContent(portal_type='Organisation') - self.assertEquals(None, organisation.getMobileTelephoneCoordinateText()) + self.assertEqual(None, organisation.getMobileTelephoneCoordinateText()) # There is no problem if this organisation has a region (this use to be a # problem) organisation.setDefaultAddressRegion('europe/france') - self.assertEquals(None, organisation.getMobileTelephoneCoordinateText()) + self.assertEqual(None, organisation.getMobileTelephoneCoordinateText()) organisation.setMobileTelephoneText("12345") - self.assertEquals('12345', organisation.getMobileTelephoneCoordinateText()) + self.assertEqual('12345', organisation.getMobileTelephoneCoordinateText()) person = self.portal.person_module.newContent(portal_type='Person') - self.assertEquals(None, person.getMobileTelephoneCoordinateText()) + self.assertEqual(None, person.getMobileTelephoneCoordinateText()) # On persons, Telephone is acquired from the default carreer person.setDefaultCareerSubordinationValue(organisation) - self.assertEquals('12345', person.getMobileTelephoneCoordinateText()) + self.assertEqual('12345', person.getMobileTelephoneCoordinateText()) # we can set different values on the person address without modifying # organisation address person.setMobileTelephoneText('54321') - self.assertEquals('54321', person.getMobileTelephoneCoordinateText()) - self.assertEquals('12345', organisation.getMobileTelephoneCoordinateText()) + self.assertEqual('54321', person.getMobileTelephoneCoordinateText()) + self.assertEqual('12345', organisation.getMobileTelephoneCoordinateText()) def test_default_fax_acquisition(self): organisation = \ self.portal.organisation_module.newContent(portal_type='Organisation') - self.assertEquals(None, organisation.getDefaultTelephoneCoordinateText()) + self.assertEqual(None, organisation.getDefaultTelephoneCoordinateText()) # There is no problem if this organisation has a region (this use to be a # problem) organisation.setDefaultAddressRegion('europe/france') - self.assertEquals(None, organisation.getDefaultFaxCoordinateText()) + self.assertEqual(None, organisation.getDefaultFaxCoordinateText()) organisation.setDefaultFaxText("12345") - self.assertEquals('12345', organisation.getDefaultFaxCoordinateText()) + self.assertEqual('12345', organisation.getDefaultFaxCoordinateText()) person = self.portal.person_module.newContent(portal_type='Person') - self.assertEquals(None, person.getDefaultFaxCoordinateText()) + self.assertEqual(None, person.getDefaultFaxCoordinateText()) # On persons, Fax is acquired from the default carreer person.setDefaultCareerSubordinationValue(organisation) - self.assertEquals('12345', person.getDefaultFaxCoordinateText()) + self.assertEqual('12345', person.getDefaultFaxCoordinateText()) # we can set different values on the person address without modifying # organisation address person.setDefaultFaxText('54321') - self.assertEquals('54321', person.getDefaultFaxCoordinateText()) - self.assertEquals('12345', organisation.getDefaultFaxCoordinateText()) + self.assertEqual('54321', person.getDefaultFaxCoordinateText()) + self.assertEqual('12345', organisation.getDefaultFaxCoordinateText()) def test_default_email_acquisition(self): organisation = \ self.portal.organisation_module.newContent(portal_type='Organisation') - self.assertEquals(None, organisation.getDefaultTelephoneCoordinateText()) + self.assertEqual(None, organisation.getDefaultTelephoneCoordinateText()) # There is no problem if this organisation has a region (this use to be a # problem) organisation.setDefaultAddressRegion('europe/france') - self.assertEquals(None, organisation.getDefaultEmailCoordinateText()) + self.assertEqual(None, organisation.getDefaultEmailCoordinateText()) organisation.setDefaultEmailText("organisation@example.com") - self.assertEquals('organisation@example.com', + self.assertEqual('organisation@example.com', organisation.getDefaultEmailCoordinateText()) person = self.portal.person_module.newContent(portal_type='Person') - self.assertEquals(None, person.getDefaultEmailCoordinateText()) + self.assertEqual(None, person.getDefaultEmailCoordinateText()) self.assertFalse(person.hasDefaultEmailCoordinateText()) # On persons, Email is acquired from the default carreer person.setDefaultCareerSubordinationValue(organisation) - self.assertEquals('organisation@example.com', + self.assertEqual('organisation@example.com', person.getDefaultEmailCoordinateText()) self.assertFalse(person.hasDefaultEmailCoordinateText()) # we can set different values on the person address without modifying # organisation address person.setDefaultEmailText('person@example.com') - self.assertEquals('person@example.com', person.getDefaultEmailCoordinateText()) - self.assertEquals('organisation@example.com', + self.assertEqual('person@example.com', person.getDefaultEmailCoordinateText()) + self.assertEqual('organisation@example.com', organisation.getDefaultEmailCoordinateText()) self.assertTrue(person.hasDefaultEmailCoordinateText()) def test_alternate_email_acquisition(self): organisation = \ self.portal.organisation_module.newContent(portal_type='Organisation') - self.assertEquals(None, organisation.getAlternateEmailCoordinateText()) + self.assertEqual(None, organisation.getAlternateEmailCoordinateText()) # There is no problem if this organisation has a region (this use to be a # problem) organisation.setDefaultAddressRegion('europe/france') - self.assertEquals(None, organisation.getAlternateEmailCoordinateText()) + self.assertEqual(None, organisation.getAlternateEmailCoordinateText()) organisation.setAlternateEmailText("organisation@example.com") - self.assertEquals('organisation@example.com', + self.assertEqual('organisation@example.com', organisation.getAlternateEmailCoordinateText()) person = self.portal.person_module.newContent(portal_type='Person') - self.assertEquals(None, person.getAlternateEmailCoordinateText()) + self.assertEqual(None, person.getAlternateEmailCoordinateText()) # On persons, Email is acquired from the default carreer person.setDefaultCareerSubordinationValue(organisation) - self.assertEquals('organisation@example.com', + self.assertEqual('organisation@example.com', person.getAlternateEmailCoordinateText()) # we can set different values on the person address without modifying # organisation address person.setAlternateEmailText('person@example.com') - self.assertEquals('person@example.com', person.getAlternateEmailCoordinateText()) - self.assertEquals('organisation@example.com', + self.assertEqual('person@example.com', person.getAlternateEmailCoordinateText()) + self.assertEqual('organisation@example.com', organisation.getAlternateEmailCoordinateText()) # Marked as expectedFailure as it shall be never possible to use edit method to set diff --git a/product/ERP5/tests/testERP5Category.py b/product/ERP5/tests/testERP5Category.py index 5a3f893715..2db58e5989 100644 --- a/product/ERP5/tests/testERP5Category.py +++ b/product/ERP5/tests/testERP5Category.py @@ -201,12 +201,12 @@ class TestERP5Category(ERP5TypeTestCase): organisation2 = self.organisation2 organisation.setAbcValueList([organisation2]) self.commitAndTic() - self.assertEquals(organisation.getAbcValueList(),[organisation2]) - self.assertEquals(organisation.getAbcIdList(),['2']) + self.assertEqual(organisation.getAbcValueList(),[organisation2]) + self.assertEqual(organisation.getAbcIdList(),['2']) organisation2.edit(id='new_id') self.commitAndTic() - self.assertEquals(organisation.getAbcValueList(),[organisation2]) - self.assertEquals(organisation.getAbcIdList(),['new_id']) + self.assertEqual(organisation.getAbcValueList(),[organisation2]) + self.assertEqual(organisation.getAbcIdList(),['new_id']) def test_04_RenameObjectWithRelatedSubObject( self, quiet=quiet, run=run_all_test): @@ -218,12 +218,12 @@ class TestERP5Category(ERP5TypeTestCase): organisation2 = self.organisation2 organisation.setAbcValueList([telephone2]) self.commitAndTic() - self.assertEquals(organisation.getAbcValueList(),[telephone2]) - self.assertEquals(organisation.getAbcList(),[telephone2.getRelativeUrl()]) + self.assertEqual(organisation.getAbcValueList(),[telephone2]) + self.assertEqual(organisation.getAbcList(),[telephone2.getRelativeUrl()]) organisation2.edit(id='new_id') self.commitAndTic() - self.assertEquals(organisation.getAbcValueList(),[telephone2]) - self.assertEquals(organisation.getAbcList(),[telephone2.getRelativeUrl()]) + self.assertEqual(organisation.getAbcValueList(),[telephone2]) + self.assertEqual(organisation.getAbcList(),[telephone2.getRelativeUrl()]) def test_05_RenameMembershipCriterionCategory( self, quiet=quiet, run=run_all_test): @@ -250,10 +250,10 @@ class TestERP5Category(ERP5TypeTestCase): person = self.person person.setSubordinationValue(organisation) self.commitAndTic() - self.assertEquals(person.getSubordinationValue(),organisation) + self.assertEqual(person.getSubordinationValue(),organisation) organisation_module.edit(id='new_id') self.commitAndTic() - self.assertEquals(person.getSubordinationValue(),organisation) + self.assertEqual(person.getSubordinationValue(),organisation) def test_07_RenameBaseCategoryWithPersonRelatedToSubSubSubCategory( self, quiet=quiet, run=run_all_test): @@ -276,17 +276,17 @@ class TestERP5Category(ERP5TypeTestCase): om = self.getOrganisationModule() om['1'].setAbcValue(om['2']) self.commitAndTic() - self.assertEquals(len(om['2'].getRelatedValueList('abc')), 1) - self.assertEquals(len(om['2'].Base_zSearchRelatedObjectsByCategory(category_uid = om['2'].getUid())),1) - self.assertEquals(om['1'].getAbc(),om['2'].getRelativeUrl()) + self.assertEqual(len(om['2'].getRelatedValueList('abc')), 1) + self.assertEqual(len(om['2'].Base_zSearchRelatedObjectsByCategory(category_uid = om['2'].getUid())),1) + self.assertEqual(om['1'].getAbc(),om['2'].getRelativeUrl()) original_uid = om['2'].getUid() om.edit(id='new_id') self.commitAndTic() om = self.getPortal()['new_id'] - self.assertEquals(original_uid, om['2'].getUid()) - self.assertEquals(om['1'].getAbc(),om['2'].getRelativeUrl()) - self.assertEquals(len(om['2'].getRelatedValueList('abc')), 1) - self.assertEquals(len(om['2'].Base_zSearchRelatedObjectsByCategory(category_uid = om['2'].getUid())),1) + self.assertEqual(original_uid, om['2'].getUid()) + self.assertEqual(om['1'].getAbc(),om['2'].getRelativeUrl()) + self.assertEqual(len(om['2'].getRelatedValueList('abc')), 1) + self.assertEqual(len(om['2'].Base_zSearchRelatedObjectsByCategory(category_uid = om['2'].getUid())),1) def test_09_Base_viewDictWithCategoryWithSubCategory( self, quiet=quiet, run=run_all_test): @@ -309,10 +309,10 @@ class TestERP5Category(ERP5TypeTestCase): acquisition_portal_type="python:['Organisation', 'Telephone']",) test_aq_category.newContent(portal_type='Category', id='1') # this category will acquire from parent category - self.assertEquals(['parent'], test_aq_category.getAcquisitionBaseCategoryList()) + self.assertEqual(['parent'], test_aq_category.getAcquisitionBaseCategoryList()) # only if portal type of the current document and his parent are in # acquisition portal type - self.assertEquals(['Organisation', 'Telephone'], + self.assertEqual(['Organisation', 'Telephone'], test_aq_category.getAcquisitionPortalTypeList()) # associate the base category with our portal types @@ -325,16 +325,16 @@ class TestERP5Category(ERP5TypeTestCase): subdoc = doc['1'] doc.setCategoryList(['test_aq_category/1']) - self.assertEquals(['test_aq_category/1'], ctool.getAcquiredCategoryList(doc)) - self.assertEquals(['test_aq_category/1'], doc.getAcquiredCategoryList()) + self.assertEqual(['test_aq_category/1'], ctool.getAcquiredCategoryList(doc)) + self.assertEqual(['test_aq_category/1'], doc.getAcquiredCategoryList()) # Telephone subdocument acquire categories, because 'test_aq_category' has # 'parent' in its acquisition_base_category_list - self.assertEquals([], subdoc.getCategoryList()) - self.assertEquals(['test_aq_category/1'], subdoc.getAcquiredCategoryList()) + self.assertEqual([], subdoc.getCategoryList()) + self.assertEqual(['test_aq_category/1'], subdoc.getAcquiredCategoryList()) doc.setCategoryList([]) - self.assertEquals([], ctool.getAcquiredCategoryList(doc)) + self.assertEqual([], ctool.getAcquiredCategoryList(doc)) # XXX this test's beforeTearDown commits transaction self.abort() diff --git a/product/ERP5/tests/testERP5Commerce.py b/product/ERP5/tests/testERP5Commerce.py index 954693b7e5..49bafc9847 100644 --- a/product/ERP5/tests/testERP5Commerce.py +++ b/product/ERP5/tests/testERP5Commerce.py @@ -366,7 +366,7 @@ class TestCommerce(ERP5TypeTestCase): # set 'session_id' to simulate browser (cookie) environment self.app.REQUEST.set('session_id', SESSION_ID) - self.assertEquals(SESSION_ID, self.website.SaleOrder_getShoppingCartId()) + self.assertEqual(SESSION_ID, self.website.SaleOrder_getShoppingCartId()) # check if the shopping cart is empty self.assertTrue(self.website.SaleOrder_isShoppingCartEmpty()) @@ -375,9 +375,9 @@ class TestCommerce(ERP5TypeTestCase): self.website.Resource_addToShoppingCart(default_product, 1) shoppping_cart_item_list = self.website.SaleOrder_getShoppingCartItemList() - self.assertEquals(1, len(shoppping_cart_item_list)) - self.assertEquals(1, shoppping_cart_item_list[0].getQuantity()) - self.assertEquals(shoppping_cart_item_list[0].getResource(), \ + self.assertEqual(1, len(shoppping_cart_item_list)) + self.assertEqual(1, shoppping_cart_item_list[0].getQuantity()) + self.assertEqual(shoppping_cart_item_list[0].getResource(), \ default_product.getRelativeUrl()) self.assertFalse(self.website.SaleOrder_isShoppingCartEmpty()) @@ -394,9 +394,9 @@ class TestCommerce(ERP5TypeTestCase): shoppping_cart_item_list = self.website.SaleOrder_getShoppingCartItemList() - self.assertEquals(1, len(shoppping_cart_item_list)) - self.assertEquals(2, shoppping_cart_item_list[0].getQuantity()) - self.assertEquals(shoppping_cart_item_list[0].getResource(), \ + self.assertEqual(1, len(shoppping_cart_item_list)) + self.assertEqual(2, shoppping_cart_item_list[0].getQuantity()) + self.assertEqual(shoppping_cart_item_list[0].getResource(), \ default_product.getRelativeUrl()) def test_03_AddDifferentResourceToShoppingCart(self): @@ -411,12 +411,12 @@ class TestCommerce(ERP5TypeTestCase): self.website.Resource_addToShoppingCart(default_product, 1) self.website.Resource_addToShoppingCart(another_product, 1) shoppping_cart_item_list = self.website.SaleOrder_getShoppingCartItemList() - self.assertEquals(2, len(shoppping_cart_item_list)) - self.assertEquals(2, shoppping_cart_item_list[0].getQuantity()) - self.assertEquals(1, shoppping_cart_item_list[1].getQuantity()) - self.assertEquals(shoppping_cart_item_list[0].getResource(), \ + self.assertEqual(2, len(shoppping_cart_item_list)) + self.assertEqual(2, shoppping_cart_item_list[0].getQuantity()) + self.assertEqual(1, shoppping_cart_item_list[1].getQuantity()) + self.assertEqual(shoppping_cart_item_list[0].getResource(), \ default_product.getRelativeUrl()) - self.assertEquals(shoppping_cart_item_list[1].getResource(), \ + self.assertEqual(shoppping_cart_item_list[1].getResource(), \ another_product.getRelativeUrl()) def test_04_CalculateTotaShoppingCartPrice(self): @@ -430,15 +430,15 @@ class TestCommerce(ERP5TypeTestCase): self.website.Resource_addToShoppingCart(another_product, 1) shopping_cart = self.portal.SaleOrder_getShoppingCart() - self.assertEquals(40.0, \ + self.assertEqual(40.0, \ float(self.website.SaleOrder_getShoppingCartTotalPrice())) # include taxes (by default it's 20%) - self.assertEquals(40.0 * 1.20, \ + self.assertEqual(40.0 * 1.20, \ float(self.website.SaleOrder_getShoppingCartTotalPrice( include_shipping=True, include_taxes=True))) # no shipping selected yet so price should be the same - self.assertEquals(40.0, \ + self.assertEqual(40.0, \ float(self.website.SaleOrder_getShoppingCartTotalPrice( include_shipping=True))) @@ -448,12 +448,12 @@ class TestCommerce(ERP5TypeTestCase): field_my_shipping_method=shipping.getRelativeUrl()) # test price calculation only with shipping - self.assertEquals(40.0 + 10.0, \ + self.assertEqual(40.0 + 10.0, \ float(self.website.SaleOrder_getShoppingCartTotalPrice( include_shipping=True))) # test price calculation shipping and taxes - self.assertEquals((40.0 + 10.0) * 1.20, \ + self.assertEqual((40.0 + 10.0) * 1.20, \ float(self.website.SaleOrder_getShoppingCartTotalPrice( include_shipping=True, include_taxes=True))) @@ -477,31 +477,31 @@ class TestCommerce(ERP5TypeTestCase): field_my_shipping_method=shipping_url) # test price calculation without shipping and without taxes - self.assertEquals((10.0 * 2 + 20.0 * 1) * 1.0, \ + self.assertEqual((10.0 * 2 + 20.0 * 1) * 1.0, \ float(self.website.SaleOrder_getShoppingCartTotalPrice( include_shipping=False, include_taxes=False))) # test price calculation with shipping and without taxes - self.assertEquals((10.0 * 2 + 20.0 * 1 + 10.0) * 1.0, \ + self.assertEqual((10.0 * 2 + 20.0 * 1 + 10.0) * 1.0, \ float(self.website.SaleOrder_getShoppingCartTotalPrice( include_shipping=True, include_taxes=False))) # test price calculation with shipping and with taxes - self.assertEquals((10.0 * 2 + 20.0 * 1 + 10.0) * 1.20, \ + self.assertEqual((10.0 * 2 + 20.0 * 1 + 10.0) * 1.20, \ float(self.website.SaleOrder_getShoppingCartTotalPrice( include_shipping=True, include_taxes=True))) # delete shopping item self.portal.SaleOrder_deleteShoppingCartItem('1') - self.assertEquals(1, \ + self.assertEqual(1, \ len(self.website.SaleOrder_getShoppingCartItemList())) self.portal.SaleOrder_deleteShoppingCartItem('2') - self.assertEquals(0, \ + self.assertEqual(0, \ len(self.website.SaleOrder_getShoppingCartItemList())) - self.assertEquals(0.0, \ + self.assertEqual(0.0, \ float(self.website.SaleOrder_getShoppingCartTotalPrice())) def test_06_TestClearShoppingCart(self): @@ -513,23 +513,23 @@ class TestCommerce(ERP5TypeTestCase): self.tic() shopping_cart = self.website.SaleOrder_getShoppingCart(action='reset') - self.assertEquals(0, len(self.website.SaleOrder_getShoppingCartItemList())) + self.assertEqual(0, len(self.website.SaleOrder_getShoppingCartItemList())) def test_07_SessionIDGeneration(self): """ Test the generation of session id. """ id_string = self.getPortal().Base_generateSessionID() - self.assertEquals(10, len(id_string)) + self.assertEqual(10, len(id_string)) for caracter in id_string: self.assertTrue(caracter in string.letters) id_string = self.getPortal().Base_generateSessionID(max_long=20) - self.assertEquals(20, len(id_string)) + self.assertEqual(20, len(id_string)) # XXX : maybe it can be good to forbid this case id_string = self.getPortal().Base_generateSessionID(max_long=0) - self.assertEquals(0, len(id_string)) + self.assertEqual(0, len(id_string)) def test_08_getApplicableTaxList(self): """ @@ -537,7 +537,7 @@ class TestCommerce(ERP5TypeTestCase): """ # XXX : actually the script is only in squeleton mode, # only return a tax of 20% - self.assertEquals( + self.assertEqual( {'VAT': {'translated_title': 'VAT', 'percent': 20.0}}, self.getPortal().Person_getApplicableTaxList()) @@ -551,7 +551,7 @@ class TestCommerce(ERP5TypeTestCase): # the confirmation should not be possible if the user is not logged self.logout() - self.assertEquals(1, len(self.website.SaleOrder_getShoppingCartItemList())) + self.assertEqual(1, len(self.website.SaleOrder_getShoppingCartItemList())) self.website.SaleOrder_paymentRedirect() self.assertTrue(urllib.quote("You need to create an account to " \ "continue. If you already have please login.") in @@ -569,7 +569,7 @@ class TestCommerce(ERP5TypeTestCase): """ default_product = self.getDefaultProduct() self.website.Resource_addToShoppingCart(default_product, quantity=1) - self.assertEquals(1, len(self.website.SaleOrder_getShoppingCartItemList())) + self.assertEqual(1, len(self.website.SaleOrder_getShoppingCartItemList())) # Trying to remove self.portal.SaleOrder_deleteShoppingCartItem() @@ -577,7 +577,7 @@ class TestCommerce(ERP5TypeTestCase): self.app.REQUEST.RESPONSE.getHeader('location')) # Check if the item still into the Shopping Cart - self.assertEquals(1, len(self.website.SaleOrder_getShoppingCartItemList())) + self.assertEqual(1, len(self.website.SaleOrder_getShoppingCartItemList())) # Remove the product from the Shopping Cart product_id = default_product.getId() @@ -590,7 +590,7 @@ class TestCommerce(ERP5TypeTestCase): self.app.REQUEST.RESPONSE.getHeader('location')) # Check if the Shopping Cart is empty - self.assertEquals(0, len(self.website.SaleOrder_getShoppingCartItemList())) + self.assertEqual(0, len(self.website.SaleOrder_getShoppingCartItemList())) def test_11_finalizeShopping(self): """ @@ -603,8 +603,8 @@ class TestCommerce(ERP5TypeTestCase): quantity=1) self.tic() - self.assertEquals(2, len(self.website.SaleOrder_getShoppingCartItemList())) - self.assertEquals(0, len(self.portal.sale_order_module.contentValues())) + self.assertEqual(2, len(self.website.SaleOrder_getShoppingCartItemList())) + self.assertEqual(0, len(self.portal.sale_order_module.contentValues())) #Simulate payment self.doFakePayment() @@ -613,9 +613,9 @@ class TestCommerce(ERP5TypeTestCase): self.tic() sale_order_object_list = self.portal.sale_order_module.contentValues() - self.assertEquals(1, len(sale_order_object_list)) - self.assertEquals(2, len(sale_order_object_list[0].contentValues())) - self.assertEquals(0, len(self.website.SaleOrder_getShoppingCartItemList())) + self.assertEqual(1, len(sale_order_object_list)) + self.assertEqual(2, len(sale_order_object_list[0].contentValues())) + self.assertEqual(0, len(self.website.SaleOrder_getShoppingCartItemList())) def test_12_getAvailableShippingResourceList(self): """ @@ -628,7 +628,7 @@ class TestCommerce(ERP5TypeTestCase): title='shipping', product_line=shipping_url) self.tic() - self.assertEquals(2, + self.assertEqual(2, len(self.portal.SaleOrder_getAvailableShippingResourceList())) def test_13_getFormatedData(self): @@ -665,7 +665,7 @@ class TestCommerce(ERP5TypeTestCase): order_line.setQuantity(1) selected_resource = self.portal.SaleOrder_getSelectedShippingResource() - self.assertEquals(shipping_list[0].getRelativeUrl(), + self.assertEqual(shipping_list[0].getRelativeUrl(), selected_resource.getRelativeUrl()) def test_15_getShoppingCartDefaultCurrency(self): @@ -676,13 +676,13 @@ class TestCommerce(ERP5TypeTestCase): - WebSite_getShoppingCartDefaultCurrencySymbol """ currency = self.portal.restrictedTraverse('currency_module/EUR') - self.assertEquals(currency, + self.assertEqual(currency, self.website.WebSite_getShoppingCartDefaultCurrency()) - self.assertEquals(currency.getReference(), + self.assertEqual(currency.getReference(), self.website.WebSite_getShoppingCartDefaultCurrencyCode()) - self.assertEquals(currency.getShortTitle(), + self.assertEqual(currency.getShortTitle(), self.website.WebSite_getShoppingCartDefaultCurrencySymbol()) def test_16_simulatePaypalPayment(self): @@ -727,21 +727,21 @@ class TestCommerce(ERP5TypeTestCase): #6 : paypal step 3 : check if this token is confirmed by paypal error = self.website.WebSection_checkPaypalIdentification() - self.assertEquals(error, None) + self.assertEqual(error, None) url_location = request.RESPONSE.getHeader('location') self.assertTrue('/checkout' in url_location) #7 : paypal step 4 : validate the payment - self.assertEquals(1, + self.assertEqual(1, len(self.website.SaleOrder_getShoppingCartItemList())) - self.assertEquals(0, len(self.portal.sale_order_module.contentValues())) + self.assertEqual(0, len(self.portal.sale_order_module.contentValues())) self.website.WebSection_doPaypalPayment(token=token) self.tic() #8 check if sale order created - self.assertEquals(0, len(self.website.SaleOrder_getShoppingCartItemList())) - self.assertEquals(1, len(self.portal.sale_order_module.contentValues())) + self.assertEqual(0, len(self.website.SaleOrder_getShoppingCartItemList())) + self.assertEqual(1, len(self.portal.sale_order_module.contentValues())) custom_skin.manage_delObjects([method_id]) @@ -760,13 +760,13 @@ class TestCommerce(ERP5TypeTestCase): depth=2) self.tic() - self.assertEquals(14, + self.assertEqual(14, len(self.website.product_section.WebSection_getProductList())) - self.assertEquals(8, + self.assertEqual(8, len(self.website.product_section.laptop.WebSection_getProductList())) netbook_section = self.website.product_section.laptop.netbook - self.assertEquals(3, len(netbook_section.WebSection_getProductList())) + self.assertEqual(3, len(netbook_section.WebSection_getProductList())) def test_18_editShoppingCardWithABlankShippingMethod(self): """ @@ -804,7 +804,7 @@ class TestCommerce(ERP5TypeTestCase): self.website.SaleOrder_editShoppingCart( field_my_shipping_method=shipping.getRelativeUrl()) - self.assertEquals(10.0, \ + self.assertEqual(10.0, \ float(self.website.SaleOrder_getShoppingCartTotalPrice( include_shipping=True))) @@ -812,8 +812,8 @@ class TestCommerce(ERP5TypeTestCase): """ Test the WebSite_getProductList script. """ - self.assertEquals(5, len(self.website.WebSite_getProductList())) - self.assertEquals(16, + self.assertEqual(5, len(self.website.WebSite_getProductList())) + self.assertEqual(16, len(self.website.WebSite_getProductList(limit=1000))) def test_21_AddResourceToShoppingCartWithAnonymousUser(self): @@ -824,7 +824,7 @@ class TestCommerce(ERP5TypeTestCase): self.logout() self.createShoppingCartWithProductListAndShipping() shoppping_cart_item_list = self.website.SaleOrder_getShoppingCartItemList() - self.assertEquals(1, len(shoppping_cart_item_list)) + self.assertEqual(1, len(shoppping_cart_item_list)) @skip('WebSite_createWebSiteAccount is disabled by default.') def test_22_createShoppingCartWithAnonymousAndLogin(self): @@ -859,12 +859,12 @@ class TestCommerce(ERP5TypeTestCase): """ self.logout() person_object = self.website.SaleOrder_getShoppingCartCustomer() - self.assertEquals(person_object, None) + self.assertEqual(person_object, None) self.login('webmaster') person_object = self.website.SaleOrder_getShoppingCartCustomer() self.assertNotEquals(person_object, None) - self.assertEquals(person_object.getReference(), 'webmaster') + self.assertEqual(person_object.getReference(), 'webmaster') def test_24_getImageDataWithAnonymousUser(self): """ @@ -901,13 +901,13 @@ class TestCommerce(ERP5TypeTestCase): self.logout() currency_url = self.website.getLayoutProperty('ecommerce_base_currency') currency_object = self.portal.restrictedTraverse(currency_url) - self.assertEquals(currency_object, + self.assertEqual(currency_object, self.website.WebSite_getShoppingCartDefaultCurrency()) - self.assertEquals(currency_object.getReference(), + self.assertEqual(currency_object.getReference(), self.website.WebSite_getShoppingCartDefaultCurrencyCode()) - self.assertEquals(currency_object.getShortTitle(), + self.assertEqual(currency_object.getShortTitle(), self.website.WebSite_getShoppingCartDefaultCurrencySymbol()) def test_27_ResourceGetShopUrl(self): @@ -916,7 +916,7 @@ class TestCommerce(ERP5TypeTestCase): should return the Shopping Url. """ product = self.getDefaultProduct() - self.assertEquals(product.Resource_getShopUrl(), + self.assertEqual(product.Resource_getShopUrl(), '%s/%s' % (product.absolute_url(), 'Resource_viewAsShop')) def test_28_finalizeShoppingWithComment(self): @@ -935,7 +935,7 @@ class TestCommerce(ERP5TypeTestCase): self.tic() sale_order_object_list = self.portal.sale_order_module.contentValues() - self.assertEquals(comment, sale_order_object_list[0].getComment()) + self.assertEqual(comment, sale_order_object_list[0].getComment()) import unittest diff --git a/product/ERP5/tests/testERP5Coordinate.py b/product/ERP5/tests/testERP5Coordinate.py index 264876bb70..d2c66f23bf 100644 --- a/product/ERP5/tests/testERP5Coordinate.py +++ b/product/ERP5/tests/testERP5Coordinate.py @@ -67,35 +67,35 @@ class TestERP5Coordinate(ERP5TypeTestCase): person = self.getPersonModule().newContent(portal_type='Person') # check telephone telephone = person.newContent(portal_type='Telephone') - self.assertEquals(telephone.getCoordinateText(), None) - self.assertEquals(telephone.getCoordinateText(''), '') + self.assertEqual(telephone.getCoordinateText(), None) + self.assertEqual(telephone.getCoordinateText(''), '') phone_number = '0320595959' telephone.setCoordinateText(phone_number) - self.assertEquals(telephone.getCoordinateText(), phone_number) - self.assertEquals(telephone.asText(), '+(0)-' + phone_number) + self.assertEqual(telephone.getCoordinateText(), phone_number) + self.assertEqual(telephone.asText(), '+(0)-' + phone_number) # check address address = person.newContent(portal_type='Address') - self.assertEquals(address.getCoordinateText(), None) - self.assertEquals(address.getCoordinateText(''), '') + self.assertEqual(address.getCoordinateText(), None) + self.assertEqual(address.getCoordinateText(''), '') address_text = """15 flower street 75016 PARIS""" address.setCoordinateText(address_text) - self.assertEquals(address.getCoordinateText(), address_text) - self.assertEquals(address.asText(), address_text) + self.assertEqual(address.getCoordinateText(), address_text) + self.assertEqual(address.asText(), address_text) # Check Email email = person.newContent(portal_type='Email') - self.assertEquals(email.getCoordinateText(), None) - self.assertEquals(email.getCoordinateText(''), '') + self.assertEqual(email.getCoordinateText(), None) + self.assertEqual(email.getCoordinateText(''), '') email_text = 'toto@example.com' email.setCoordinateText(email_text) - self.assertEquals(email.getCoordinateText(), email_text) - self.assertEquals(email.asText(), email_text) + self.assertEqual(email.getCoordinateText(), email_text) + self.assertEqual(email.asText(), email_text) # check acquired accessors person.setDefaultEmailCoordinateText(email_text) - self.assertEquals(person.getDefaultEmailCoordinateText(), email_text) - self.assertEquals(person.getDefaultEmailText(), email_text) + self.assertEqual(person.getDefaultEmailCoordinateText(), email_text) + self.assertEqual(person.getDefaultEmailText(), email_text) # Old API check backward compatibility def test_TelephoneAsText(self): @@ -106,7 +106,7 @@ class TestERP5Coordinate(ERP5TypeTestCase): tel.setTelephoneArea(2) tel.setTelephoneNumber(12345678) tel.setTelephoneExtension(999) - self.assertEquals('+33(0)2-12345678/999', tel.asText()) + self.assertEqual('+33(0)2-12345678/999', tel.asText()) def test_TelephonePreference(self): pers = self.getPersonModule().newContent(portal_type='Person') @@ -116,7 +116,7 @@ class TestERP5Coordinate(ERP5TypeTestCase): pref.setPreferredTelephoneDefaultAreaNumber('2') pref.enable() tel.fromText(coordinate_text='11111111') - self.assertEquals('+33(0)2-11111111',tel.asText()) + self.assertEqual('+33(0)2-11111111',tel.asText()) def test_TelephoneCountryAndAreaCodeRemains(self): pers = self.getPersonModule().newContent(portal_type='Person') @@ -127,7 +127,7 @@ class TestERP5Coordinate(ERP5TypeTestCase): pref.enable() tel.fromText(coordinate_text='+11 1 11111111') tel.fromText(coordinate_text='+22333445555') - self.assertEquals('+(0)-22333445555',tel.asText()) + self.assertEqual('+(0)-22333445555',tel.asText()) def test_TelephoneInputList(self): pers = self.getPersonModule().newContent(portal_type='Person') @@ -309,7 +309,7 @@ class TestERP5Coordinate(ERP5TypeTestCase): for i in input_list: tel.fromText(coordinate_text=i[0]) - self.assertEquals(i[1],tel.asText()) + self.assertEqual(i[1],tel.asText()) def test_TelephoneWhenTheDefaultCountryAndAreaPreferenceIsBlank(self): pers = self.getPersonModule().newContent(portal_type='Person') @@ -319,13 +319,13 @@ class TestERP5Coordinate(ERP5TypeTestCase): pref.setPreferredTelephoneDefaultAreaNumber('') pref.enable() tel.fromText(coordinate_text='12345678') - self.assertEquals('+(0)-12345678',tel.asText()) + self.assertEqual('+(0)-12345678',tel.asText()) def test_TelephoneAsTextBlankNumber(self): # Test asText method with blank number pers = self.getPersonModule().newContent(portal_type='Person') tel = pers.newContent(portal_type='Telephone') - self.assertEquals('', tel.asText()) + self.assertEqual('', tel.asText()) def test_TelephoneUrl(self): # http://www.rfc-editor.org/rfc/rfc3966.txt @@ -333,40 +333,40 @@ class TestERP5Coordinate(ERP5TypeTestCase): tel = pers.newContent(portal_type='Telephone') tel.setTelephoneCountry(33) tel.setTelephoneNumber(123456789) - self.assertEquals('tel:+33123456789', tel.asURL()) + self.assertEqual('tel:+33123456789', tel.asURL()) tel.setTelephoneCountry(None) tel.setTelephoneNumber(123456789) - self.assertEquals('tel:0123456789', tel.asURL()) + self.assertEqual('tel:0123456789', tel.asURL()) def test_EmptyTelephoneAsText(self): # asText method returns an empty string for empty telephones pers = self.getPersonModule().newContent(portal_type='Person') - self.assertEquals('', pers.newContent(portal_type='Telephone').asText()) + self.assertEqual('', pers.newContent(portal_type='Telephone').asText()) def test_EmptyFaxAsText(self): # asText method returns an empty string for empty faxes pers = self.getPersonModule().newContent(portal_type='Person') - self.assertEquals('', pers.newContent(portal_type='Fax').asText()) + self.assertEqual('', pers.newContent(portal_type='Fax').asText()) def test_EmailAsURL(self): # asURL method works on email pers = self.getPersonModule().newContent(portal_type='Person') pers.setDefaultEmailText('nobody@example.com') email = pers.getDefaultEmailValue() - self.assertEquals('mailto:nobody@example.com', email.asURL()) - self.assertEquals('mailto:nobody@example.com', + self.assertEqual('mailto:nobody@example.com', email.asURL()) + self.assertEqual('mailto:nobody@example.com', pers.Entity_getDefaultEmailAsURL()) def test_LinkAsURL(self): person = self.getPersonModule().newContent(portal_type='Person') link = person.newContent(portal_type='Link', url_string='http://www.nexedi.com/') - self.assertEquals(link.asURL(), 'http://www.nexedi.com/') + self.assertEqual(link.asURL(), 'http://www.nexedi.com/') link = person.newContent(portal_type='Link', url_string='www.nexedi.com') - self.assertEquals(link.asURL(), 'http://www.nexedi.com') + self.assertEqual(link.asURL(), 'http://www.nexedi.com') def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testERP5Core.py b/product/ERP5/tests/testERP5Core.py index 7bbb665b06..5215200767 100644 --- a/product/ERP5/tests/testERP5Core.py +++ b/product/ERP5/tests/testERP5Core.py @@ -150,7 +150,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): skins_tool = self.portal.portal_skins types_tool = self.portal.portal_types - self.failIf(self.portal._getOb(module_id, None) is not None) + self.assertFalse(self.portal._getOb(module_id, None) is not None) self.assertEqual(skins_tool._getOb(portal_skins_folder, None), None) self.assertEqual(types_tool._getOb(module_portal_type, None), None) self.assertEqual(types_tool._getOb(object_portal_type, None), None) @@ -161,8 +161,8 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): object_title=object_title, module_id=module_id, module_title=module_title) - self.failUnless(self.portal._getOb(module_id, None) is not None) - self.assertEquals(module_title, + self.assertTrue(self.portal._getOb(module_id, None) is not None) + self.assertEqual(module_title, self.portal._getOb(module_id).getTitle()) self.assertNotEqual(types_tool.getTypeInfo(module_portal_type), None) self.assertNotEqual(types_tool.getTypeInfo(object_portal_type), None) @@ -173,13 +173,13 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): self.assertNotEqual(skin_folder, None) self.assert_('UnitTest_view' in skin_folder.objectIds()) view_form = skin_folder.UnitTest_view - self.assertEquals('form_view', view_form.pt) - self.assertEquals('Base_edit', view_form.action) + self.assertEqual('form_view', view_form.pt) + self.assertEqual('Base_edit', view_form.action) self.assert_('UnitTestModule_viewUnitTestList' in skin_folder.objectIds()) list_form = skin_folder.UnitTestModule_viewUnitTestList - self.assertEquals('form_list', list_form.pt) - self.assertEquals('Base_doSelect', list_form.action) + self.assertEqual('form_list', list_form.pt) + self.assertEqual('Base_doSelect', list_form.action) self.assert_('listbox' in [x.getId() for x in list_form.get_fields()]) self.assert_('listbox' in [x.getId() for x in list_form.get_fields_in_group('bottom')]) @@ -190,9 +190,9 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): self.portal.unittest_module.document.view() # make sure translation domains are set correctly - self.assertEquals('erp5_ui', + self.assertEqual('erp5_ui', self.portal.unittest_module.getTitleTranslationDomain()) - self.assertEquals('erp5_ui', + self.assertEqual('erp5_ui', self.portal.unittest_module.getShortTitleTranslationDomain()) type_information = self.portal.portal_types[module_portal_type] @@ -208,7 +208,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): if action['visible']] msg = ("Actions do not match. Expected:\n%s\n\nGot:\n%s\n" % (pprint.pformat(expected), pprint.pformat(got))) - self.assertEquals(expected, got, msg) + self.assertEqual(expected, got, msg) def test_manager_actions_on_portal(self): # as manager: @@ -275,14 +275,14 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): """Test we can view the front page. """ response = self.publish(self.portal_id, self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) def test_login_form(self): """Test anonymous user are redirected to login_form """ response = self.publish(self.portal_id) - self.assertEquals(HTTP_REDIRECT, response.getStatus()) - self.assertEquals('%s/login_form' % self.portal.absolute_url(), + self.assertEqual(HTTP_REDIRECT, response.getStatus()) + self.assertEqual('%s/login_form' % self.portal.absolute_url(), response.getHeader('Location')) def test_view_tools(self): @@ -292,7 +292,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): 'portal_rules', 'portal_alarms',): response = self.publish('%s/%s' % (self.portal_id, tool), self.auth) - self.assertEquals(HTTP_OK, response.getStatus(), + self.assertEqual(HTTP_OK, response.getStatus(), "%s: %s (%s)" % (tool, response.getStatus(), str(response))) @@ -303,10 +303,10 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): # assumes that we can add Business Template in template tool response = self.publish('%s/portal_templates' % self.portal_id, self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) - self.failUnless(('Business Template', {}) + self.assertEqual(HTTP_OK, response.getStatus()) + self.assertTrue(('Business Template', {}) in translation_service._translated['ui']) - self.failUnless( + self.assertTrue( ('Add ${portal_type}', {'portal_type': 'Business Template'}) in translation_service._translated['ui']) @@ -323,14 +323,14 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): action_type='object_jump') response = self.publish('%s/portal_templates' % self.portal_id, self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) - self.failUnless(('Dummy Jump Action', {}) in + self.assertEqual(HTTP_OK, response.getStatus()) + self.assertTrue(('Dummy Jump Action', {}) in translation_service._translated['ui']) def test_error_log(self): - self.failUnless('error_log' in self.portal.objectIds()) - self.failUnless(self.portal.error_log.getProperties()['copy_to_zlog']) - self.failIf('Unauthorized' in + self.assertTrue('error_log' in self.portal.objectIds()) + self.assertTrue(self.portal.error_log.getProperties()['copy_to_zlog']) + self.assertFalse('Unauthorized' in self.portal.error_log.getProperties()['ignored_exceptions']) def test_03_getDefaultModule(self, quiet=quiet, run=run_all_test): @@ -349,7 +349,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): module_title='%ss' % object_portal_type # Create module for testing - self.failIf(self.portal._getOb(module_id, None) is not None) + self.assertFalse(self.portal._getOb(module_id, None) is not None) self.assertEqual(self.portal.portal_skins._getOb(portal_skins_folder, None), None) self.assertEqual(self.portal.portal_types.getTypeInfo(module_portal_type), @@ -364,16 +364,16 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): module_title=module_title) # Test - self.assertEquals( + self.assertEqual( module_id, self.portal.getDefaultModule(object_portal_type).getId()) - self.assertEquals( + self.assertEqual( module_portal_type, self.portal.getDefaultModule(object_portal_type).getPortalType()) - self.assertEquals( + self.assertEqual( module_id, self.portal.getDefaultModule(module_portal_type).getId()) - self.assertEquals( + self.assertEqual( module_portal_type, self.portal.getDefaultModule(module_portal_type).getPortalType()) @@ -403,7 +403,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): title='My Test Preference')), 1) response = self.publish(self.portal_id, self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) def _Folder_delete(self, *object_list): selection_name = 'test_selection' @@ -446,9 +446,9 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): delete(1, person) self.assertEqual(0, organisation.getRelationCountForDeletion()) delete(1, organisation) - self.assertEquals(organisation_module_len + 1, + self.assertEqual(organisation_module_len + 1, len(self.portal.organisation_module)) - self.assertEquals(person_module_len + 1, + self.assertEqual(person_module_len + 1, len(self.portal.person_module)) def test_Folder_delete_non_accessible_object(self): @@ -462,7 +462,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): base_category_list=('source',), category_list=document_2.getRelativeUrl()) self.tic() - self.assertEquals([document_1], + self.assertEqual([document_1], self.portal.portal_categories.getRelatedValueList(document_2)) document_1.manage_permission('View', [], acquire=0) diff --git a/product/ERP5/tests/testERP5Credential.py b/product/ERP5/tests/testERP5Credential.py index 21a6618506..d011482f66 100644 --- a/product/ERP5/tests/testERP5Credential.py +++ b/product/ERP5/tests/testERP5Credential.py @@ -306,10 +306,10 @@ class TestERP5Credential(ERP5TypeTestCase): person = portal_catalog.getResultValue(reference=reference, portal_type="Person") assignment_list = person.objectValues(portal_type="Assignment") - self.assertEquals(len(assignment_list), 1) + self.assertEqual(len(assignment_list), 1) assignment = assignment_list[0] - self.assertEquals(assignment.getFunction(), assignment_function) - self.assertEquals(assignment.getRole(), assignment_role) + self.assertEqual(assignment.getFunction(), assignment_function) + self.assertEqual(assignment.getRole(), assignment_role) def getUserFolder(self): """Returns the acl_users. """ @@ -379,7 +379,7 @@ class TestERP5Credential(ERP5TypeTestCase): result = credential_request_module.contentValues(\ portal_type='Credential Request', first_name='Homer', last_name='Simpson', reference='homie') - self.assertEquals(len(result), 1) + self.assertEqual(len(result), 1) sequence.edit(subscription_request=result[0], person_reference=credential_reference) @@ -401,16 +401,16 @@ class TestERP5Credential(ERP5TypeTestCase): # check a person have been created person_module = self.portal.getDefaultModule('Person') person_result = person_module.contentValues(reference='homie') - self.assertEquals(len(person_result), 1) + self.assertEqual(len(person_result), 1) person = person_result[0].getObject() - self.assertEquals(person.getTitle(), 'Homer Simpson') - self.assertEquals(person.getDefaultEmailText(), 'homer.simpson@fox.com') + self.assertEqual(person.getTitle(), 'Homer Simpson') + self.assertEqual(person.getDefaultEmailText(), 'homer.simpson@fox.com') # check homie can log in the system self._assertUserExists('homie', 'secret') self.login('homie') from AccessControl import getSecurityManager - self.assertEquals(str(getSecurityManager().getUser()), 'homie') + self.assertEqual(str(getSecurityManager().getUser()), 'homie') def stepCreateCredentialUpdate(self, sequence=None, sequence_list=None, **kw): ''' @@ -421,7 +421,7 @@ class TestERP5Credential(ERP5TypeTestCase): # get the 'homie' person object person_module = self.portal.getDefaultModule('Person') result = person_module.searchFolder(reference='homie') - self.assertEquals(len(result), 1) + self.assertEqual(len(result), 1) homie = result[0] # create a credential update @@ -435,7 +435,7 @@ class TestERP5Credential(ERP5TypeTestCase): destination_decision=homie.getRelativeUrl()) credential_update.submit() - self.assertEquals(credential_update.getValidationState(), 'submitted') + self.assertEqual(credential_update.getValidationState(), 'submitted') sequence.edit(credential_update=credential_update) def stepAcceptCredentialUpdate(self, sequence=None, sequence_list=None, @@ -454,10 +454,10 @@ class TestERP5Credential(ERP5TypeTestCase): # check that informations on the person object have been updated person_module = self.portal.getDefaultModule('Person') related_person_result = person_module.searchFolder(reference='homie') - self.assertEquals(len(related_person_result), 1) + self.assertEqual(len(related_person_result), 1) related_person = related_person_result[0] - self.assertEquals(related_person.getLastName(), 'Simpsons') - self.assertEquals(related_person.getDefaultEmailText(), + self.assertEqual(related_person.getLastName(), 'Simpsons') + self.assertEqual(related_person.getDefaultEmailText(), 'homie.simpsons@fox.com') def stepCreateSubscriptionRequestWithSecurityQuestionCategory(self, sequence=None, @@ -483,18 +483,18 @@ class TestERP5Credential(ERP5TypeTestCase): result = credential_request_module.contentValues(\ portal_type='Credential Request', first_name='Homer', last_name='Simpson', reference='homie') - self.assertEquals(len(result), 1) + self.assertEqual(len(result), 1) sequence.edit(subscription_request=result[0]) def stepCheckSecurityQuestionCategoryAsBeenCopiedOnPersonObject(self, sequence=None, sequence_list=None, **kw): person_module = self.portal.getDefaultModule('Person') related_person_result = person_module.contentValues(reference='homie') - self.assertEquals(len(related_person_result), 1) + self.assertEqual(len(related_person_result), 1) related_person = related_person_result[0] - self.assertEquals(related_person.getDefaultCredentialQuestionQuestion(), + self.assertEqual(related_person.getDefaultCredentialQuestionQuestion(), 'credential/library_card_number') - self.assertEquals(related_person.getDefaultCredentialQuestionAnswer(), + self.assertEqual(related_person.getDefaultCredentialQuestionAnswer(), '923R4293') def stepCreateSubscriptionRequestWithSecurityQuestionFreeText(self, sequence=None, @@ -523,18 +523,18 @@ class TestERP5Credential(ERP5TypeTestCase): result = credential_request_module.contentValues(\ portal_type='Credential Request', first_name='Homer', last_name='Simpson', reference='homie') - self.assertEquals(len(result), 1) + self.assertEqual(len(result), 1) sequence.edit(subscription_request=result[0]) def stepCheckSecurityQuestionFreeTextAsBeenCopiedOnPersonObject(self, sequence=None, sequence_list=None, **kw): person_module = self.portal.getDefaultModule('Person') related_person_result = person_module.contentValues(reference='homie') - self.assertEquals(len(related_person_result), 1) + self.assertEqual(len(related_person_result), 1) related_person = related_person_result[0] - self.assertEquals(related_person.getDefaultCredentialQuestionQuestionFreeText(), + self.assertEqual(related_person.getDefaultCredentialQuestionQuestionFreeText(), 'Which car model do you have ?') - self.assertEquals(related_person.getDefaultCredentialQuestionAnswer(), + self.assertEqual(related_person.getDefaultCredentialQuestionAnswer(), 'Renault 4L') def stepCreatePerson(self, sequence=None, sequence_list=None, @@ -597,7 +597,7 @@ class TestERP5Credential(ERP5TypeTestCase): self._assertUserExists('barney', 'secret') self.login('barney') from AccessControl import getSecurityManager - self.assertEquals(str(getSecurityManager().getUser()), 'barney') + self.assertEqual(str(getSecurityManager().getUser()), 'barney') self.login() # create a credential recovery @@ -668,7 +668,7 @@ class TestERP5Credential(ERP5TypeTestCase): self.login() result_list = self.portal.portal_catalog( portal_type='Credential Recovery', reference=person_reference) - self.assertEquals(1, len(result_list)) + self.assertEqual(1, len(result_list)) credential_recovery = result_list[0] sequence.edit(credential_recovery=credential_recovery) @@ -684,11 +684,11 @@ class TestERP5Credential(ERP5TypeTestCase): person_reference = sequence["person_reference"] result_list = self.portal.portal_catalog( portal_type='Credential Recovery', reference=person_reference) - self.assertEquals(1, len(result_list)) + self.assertEqual(1, len(result_list)) credential_recovery = result_list[0] person = credential_recovery.getDestinationDecisionValue() - self.assertEquals("Barney", person.getTitle()) - self.assertEquals("barney@duff.com", person.getEmailText()) + self.assertEqual("Barney", person.getTitle()) + self.assertEqual("barney@duff.com", person.getEmailText()) sequence["credential_recovery"] = credential_recovery def stepSubmitCredentialRecovery(self, sequence=None, sequence_list=None, @@ -825,7 +825,7 @@ class TestERP5Credential(ERP5TypeTestCase): portal_type="Credential Request", reference=credential_reference_str) mail_message = portal_catalog.getResultValue(portal_type="Mail Message", default_follow_up_uid=credential_reference.getUid()) - self.assertEquals(mail_message.getSimulationState(), "started") + self.assertEqual(mail_message.getSimulationState(), "started") self.assertTrue("key=%s" % mail_message.getReference() in mail_message.getTextContent()) def stepSetPreferredCredentialAlarmAutomaticCallAsFalse(self, sequence): @@ -851,10 +851,10 @@ class TestERP5Credential(ERP5TypeTestCase): self.login() person = self.portal.portal_catalog.getResultValue( reference=sequence["person_reference"], portal_type="Person") - self.assertEquals("Homer", person.getFirstName()) - self.assertEquals("Simpson", person.getLastName()) - self.assertEquals("homer.simpson@fox.com", person.getDefaultEmailText()) - self.assertEquals(DateTime('1970/01/01'), person.getStartDate()) + self.assertEqual("Homer", person.getFirstName()) + self.assertEqual("Simpson", person.getLastName()) + self.assertEqual("homer.simpson@fox.com", person.getDefaultEmailText()) + self.assertEqual(DateTime('1970/01/01'), person.getStartDate()) self.logout() def stepSetAuditorRoleToCurrentPerson(self, sequence=None, @@ -870,16 +870,16 @@ class TestERP5Credential(ERP5TypeTestCase): sequence_list=None, **kw): person = self.portal.portal_catalog.getResultValue( reference=sequence["person_reference"], portal_type="Person") - self.assertEquals("tom", person.getFirstName()) - self.assertEquals("Simpson", person.getLastName()) - self.assertEquals("tom@host.com", person.getDefaultEmailText()) - self.assertEquals(DateTime('1970/01/01'), person.getStartDate()) + self.assertEqual("tom", person.getFirstName()) + self.assertEqual("Simpson", person.getLastName()) + self.assertEqual("tom@host.com", person.getDefaultEmailText()) + self.assertEqual(DateTime('1970/01/01'), person.getStartDate()) def stepCheckPersonWhenCredentialUpdateFail(self, sequence=None, sequence_list=None, **kw): person = self.portal.portal_catalog.getResultValue( reference=sequence["person_reference"], portal_type="Person") - self.assertEquals("Barney", person.getFirstName()) + self.assertEqual("Barney", person.getFirstName()) def stepCheckCredentialRecoveryNotEmptyDestinationDecision(self, sequence): credential_recovery = self.portal.portal_catalog.getResultValue( @@ -1061,8 +1061,8 @@ class TestERP5Credential(ERP5TypeTestCase): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, message_text = last_message - self.assertEquals(mfrom, 'Portal Administrator <postmaster@localhost>') - self.assertEquals(['Vifib Test <barney@duff.com>'], mto) + self.assertEqual(mfrom, 'Portal Administrator <postmaster@localhost>') + self.assertEqual(['Vifib Test <barney@duff.com>'], mto) self.assertNotEquals(re.search("Subject\:.*Welcome", message_text), None) self.assertNotEquals(re.search("Hello\ Vifib\ Test\,", message_text), None) decoded_message = self.decode_email(last_message[2]) @@ -1115,10 +1115,10 @@ class TestERP5Credential(ERP5TypeTestCase): portal_type="Person") assignment_list = person.objectValues(portal_type="Assignment") self.assertNotEquals(assignment_list, []) - self.assertEquals(len(assignment_list), 1) + self.assertEqual(len(assignment_list), 1) assignment = assignment_list[0] - self.assertEquals(assignment.getValidationState(), "open") - self.assertEquals(person.getValidationState(), "validated") + self.assertEqual(assignment.getValidationState(), "open") + self.assertEqual(person.getValidationState(), "validated") def testERP5Site_newCredentialRequest(self): """ @@ -1132,11 +1132,11 @@ class TestERP5Credential(ERP5TypeTestCase): portal_catalog = self.portal.portal_catalog credential_request = portal_catalog.getResultValue( portal_type="Credential Request", reference="barney") - self.assertEquals(credential_request.getFirstName(), "Barney") - self.assertEquals(credential_request.getDefaultEmailText(), + self.assertEqual(credential_request.getFirstName(), "Barney") + self.assertEqual(credential_request.getDefaultEmailText(), "barney@duff.com") - self.assertEquals(credential_request.getRole(), "internal") - self.assertEquals(credential_request.getFunction(), "member") + self.assertEqual(credential_request.getRole(), "internal") + self.assertEqual(credential_request.getFunction(), "member") def test_double_ERP5Site_newCredentialRequest(self): """Check that ERP5Site_newCredentialRequest will not create conflicting @@ -1149,11 +1149,11 @@ class TestERP5Credential(ERP5TypeTestCase): portal_catalog = self.portal.portal_catalog credential_request = portal_catalog.getResultValue( portal_type="Credential Request", reference="barney") - self.assertEquals(credential_request.getFirstName(), "Barney") - self.assertEquals(credential_request.getDefaultEmailText(), + self.assertEqual(credential_request.getFirstName(), "Barney") + self.assertEqual(credential_request.getDefaultEmailText(), "barney@duff.com") - self.assertEquals(credential_request.getRole(), "internal") - self.assertEquals(credential_request.getFunction(), "member") + self.assertEqual(credential_request.getRole(), "internal") + self.assertEqual(credential_request.getFunction(), "member") self.portal.portal_alarms.accept_submitted_credentials.activeSense() self.tic() @@ -1363,28 +1363,28 @@ class TestERP5Credential(ERP5TypeTestCase): # test to prevent regression with a bug in property sheet definition cr = self.portal.credential_request_module.newContent( portal_type='Credential Request') - self.assertEquals(cr.getDefaultAddressCity(), None) - self.assertEquals(cr.getDefaultAddressRegion(), None) - self.assertEquals(cr.getOrganisationDefaultAddressCity(), None) - self.assertEquals(cr.getOrganisationDefaultAddressRegion(), None) + self.assertEqual(cr.getDefaultAddressCity(), None) + self.assertEqual(cr.getDefaultAddressRegion(), None) + self.assertEqual(cr.getOrganisationDefaultAddressCity(), None) + self.assertEqual(cr.getOrganisationDefaultAddressRegion(), None) cr.setDefaultAddressRegion('europe/fr') - self.assertEquals(cr.getDefaultAddressCity(), None) - self.assertEquals(cr.getDefaultAddressRegion(), 'europe/fr') - self.assertEquals(cr.getOrganisationDefaultAddressCity(), None) - self.assertEquals(cr.getOrganisationDefaultTelephoneText(), None) - self.assertEquals(cr.getOrganisationDefaultAddressRegion(), None) + self.assertEqual(cr.getDefaultAddressCity(), None) + self.assertEqual(cr.getDefaultAddressRegion(), 'europe/fr') + self.assertEqual(cr.getOrganisationDefaultAddressCity(), None) + self.assertEqual(cr.getOrganisationDefaultTelephoneText(), None) + self.assertEqual(cr.getOrganisationDefaultAddressRegion(), None) cr.deleteContent('default_address') cr.setOrganisationDefaultAddressCity('Lille') cr.setOrganisationDefaultAddressRegion('europe/fr') - self.assertEquals(cr.getOrganisationDefaultAddressCity(), 'Lille') - self.assertEquals(cr.getOrganisationDefaultAddressRegion(), 'europe/fr') - self.assertEquals(cr.getDefaultAddressCity(), None) - self.assertEquals(cr.getDefaultAddressRegion(), None) + self.assertEqual(cr.getOrganisationDefaultAddressCity(), 'Lille') + self.assertEqual(cr.getOrganisationDefaultAddressRegion(), 'europe/fr') + self.assertEqual(cr.getDefaultAddressCity(), None) + self.assertEqual(cr.getDefaultAddressRegion(), None) diff --git a/product/ERP5/tests/testERP5CurrencyExchangeLine.py b/product/ERP5/tests/testERP5CurrencyExchangeLine.py index a518163827..1ead574b49 100644 --- a/product/ERP5/tests/testERP5CurrencyExchangeLine.py +++ b/product/ERP5/tests/testERP5CurrencyExchangeLine.py @@ -93,22 +93,22 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): currency1.setTitle('Euro') currency1.setReference('EUR') currency1.setBaseUnitQuantity(0.01) - self.assertEquals(currency1.getTitle(), 'Euro') - self.assertEquals(currency1.getReference(), 'EUR') - self.assertEquals(currency1.getBaseUnitQuantity(), 0.01) + self.assertEqual(currency1.getTitle(), 'Euro') + self.assertEqual(currency1.getReference(), 'EUR') + self.assertEqual(currency1.getBaseUnitQuantity(), 0.01) currency1.validate() - self.assertEquals(0, len(currency1.checkConsistency())) - self.assertEquals(currency1.getValidationState(),'validated') + self.assertEqual(0, len(currency1.checkConsistency())) + self.assertEqual(currency1.getValidationState(),'validated') currency2 = module.newContent(portal_type = 'Currency') currency2.setTitle('Francs CFA') currency2.setReference('XOF') currency2.setBaseUnitQuantity(1.00) - self.assertEquals(currency2.getTitle(), 'Francs CFA') - self.assertEquals(currency2.getReference(), 'XOF') - self.assertEquals(currency2.getBaseUnitQuantity(), 1.00) + self.assertEqual(currency2.getTitle(), 'Francs CFA') + self.assertEqual(currency2.getReference(), 'XOF') + self.assertEqual(currency2.getBaseUnitQuantity(), 1.00) currency2.validate() - self.assertEquals(currency2.getValidationState(),'validated') - self.assertEquals(0, len(currency2.checkConsistency())) + self.assertEqual(currency2.getValidationState(),'validated') + self.assertEqual(0, len(currency2.checkConsistency())) def test_UseCurrencyExchangeLineForDestination(self): @@ -134,11 +134,11 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): x_curr_ex_line.setBasePrice(655.957) x_curr_ex_line.setStartDate(DateTime(2008,9,8)) x_curr_ex_line.setStopDate(DateTime(2008,9,10)) - self.assertEquals(x_curr_ex_line.getPriceCurrencyTitle(), + self.assertEqual(x_curr_ex_line.getPriceCurrencyTitle(), 'Francs CFA') - self.assertEquals(x_curr_ex_line.getBasePrice(),655.957) + self.assertEqual(x_curr_ex_line.getBasePrice(),655.957) x_curr_ex_line.validate() - self.assertEquals(x_curr_ex_line.getValidationState(), + self.assertEqual(x_curr_ex_line.getValidationState(), 'validated') accounting_module = self.portal.accounting_module invoice = self._makeOne( @@ -154,7 +154,7 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): line_list = invoice.contentValues( portal_type=self.portal.getPortalAccountingMovementTypeList()) for line in line_list: - self.assertEquals(line.getDestinationTotalAssetPrice(), + self.assertEqual(line.getDestinationTotalAssetPrice(), round(655.957*line.getQuantity())) @@ -182,11 +182,11 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): x_curr_ex_line.setBasePrice(655.957) x_curr_ex_line.setStartDate(DateTime(2008,9,8)) x_curr_ex_line.setStopDate(DateTime(2008,9,10)) - self.assertEquals(x_curr_ex_line.getPriceCurrencyTitle(), + self.assertEqual(x_curr_ex_line.getPriceCurrencyTitle(), 'Francs CFA') - self.assertEquals(x_curr_ex_line.getBasePrice(),655.957) + self.assertEqual(x_curr_ex_line.getBasePrice(),655.957) x_curr_ex_line.validate() - self.assertEquals(x_curr_ex_line.getValidationState(), + self.assertEqual(x_curr_ex_line.getValidationState(), 'validated') yen = self.portal.currency_module.yen yen_line1 = yen.newContent( @@ -218,7 +218,7 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): line_list = invoice.contentValues( portal_type=self.portal.getPortalAccountingMovementTypeList()) for line in line_list: - self.assertEquals(line.getDestinationTotalAssetPrice(), + self.assertEqual(line.getDestinationTotalAssetPrice(), round(655.957*line.getQuantity())) def test_UseCurrencyExchangeLineForSource(self): @@ -244,11 +244,11 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): x_curr_ex_line.setBasePrice(655.957) x_curr_ex_line.setStartDate(DateTime(2008,9,8)) x_curr_ex_line.setStopDate(DateTime(2008,9,10)) - self.assertEquals(x_curr_ex_line.getPriceCurrencyTitle(), + self.assertEqual(x_curr_ex_line.getPriceCurrencyTitle(), 'Francs CFA') - self.assertEquals(x_curr_ex_line.getBasePrice(),655.957) + self.assertEqual(x_curr_ex_line.getBasePrice(),655.957) x_curr_ex_line.validate() - self.assertEquals(x_curr_ex_line.getValidationState(), + self.assertEqual(x_curr_ex_line.getValidationState(), 'validated') accounting_module = self.portal.accounting_module invoice = self._makeOne( @@ -265,10 +265,10 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): portal_type=self.portal.getPortalAccountingMovementTypeList()) for line in line_list: if line.getSourceValue() == self.account_module.goods_purchase: - self.assertEquals(line.getSourceInventoriatedTotalAssetDebit(), + self.assertEqual(line.getSourceInventoriatedTotalAssetDebit(), 327979) elif line.getSourceValue() == self.account_module.receivable: - self.assertEquals(line.getSourceInventoriatedTotalAssetCredit(), + self.assertEqual(line.getSourceInventoriatedTotalAssetCredit(), 327979) else: self.fail('line not found') @@ -304,7 +304,7 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): line_list = invoice.contentValues( portal_type=self.portal.getPortalAccountingMovementTypeList()) for line in line_list: - self.assertEquals(line.getDestinationTotalAssetPrice(),None) + self.assertEqual(line.getDestinationTotalAssetPrice(),None) def test_DateOfCurrencyExchangeLineNotDateofTransaction(self): @@ -333,11 +333,11 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): x_curr_ex_line.setBasePrice(655.957) x_curr_ex_line.setStartDate(DateTime(2008,9,6)) x_curr_ex_line.setStopDate(DateTime(2008,9,7)) - self.assertEquals(x_curr_ex_line.getPriceCurrencyTitle(), + self.assertEqual(x_curr_ex_line.getPriceCurrencyTitle(), 'Francs CFA') - self.assertEquals(x_curr_ex_line.getBasePrice(),655.957) + self.assertEqual(x_curr_ex_line.getBasePrice(),655.957) x_curr_ex_line.validate() - self.assertEquals(x_curr_ex_line.getValidationState(), + self.assertEqual(x_curr_ex_line.getValidationState(), 'validated') accounting_module = self.portal.accounting_module transaction1 = self._makeOne( @@ -354,7 +354,7 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): line_list = transaction1.contentValues( portal_type=self.portal.getPortalAccountingMovementTypeList()) for line in line_list: - self.assertEquals(line.getDestinationTotalAssetPrice(),None) + self.assertEqual(line.getDestinationTotalAssetPrice(),None) transaction2 = self._makeOne( portal_type='Purchase Invoice Transaction', stop_date=DateTime('2008/09/06'), @@ -370,10 +370,10 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): portal_type=self.portal.getPortalAccountingMovementTypeList()) for line in line_list: if line.getDestinationValue() == self.account_module.goods_purchase: - self.assertEquals(line.getDestinationInventoriatedTotalAssetDebit(), + self.assertEqual(line.getDestinationInventoriatedTotalAssetDebit(), 327979) elif line.getDestinationValue() == self.account_module.receivable: - self.assertEquals(line.getDestinationInventoriatedTotalAssetCredit(), + self.assertEqual(line.getDestinationInventoriatedTotalAssetCredit(), 327979) else: self.fail('line not found') @@ -401,10 +401,10 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): x_curr_ex_line.setBasePrice(655.957) x_curr_ex_line.setStartDate(DateTime(2008,9,8)) x_curr_ex_line.setStopDate(DateTime(2008,9,10)) - self.assertEquals(x_curr_ex_line.getPriceCurrency(),None) - self.assertEquals(x_curr_ex_line.getBasePrice(),655.957) + self.assertEqual(x_curr_ex_line.getPriceCurrency(),None) + self.assertEqual(x_curr_ex_line.getBasePrice(),655.957) x_curr_ex_line.validate() - self.assertEquals(x_curr_ex_line.getValidationState(), + self.assertEqual(x_curr_ex_line.getValidationState(), 'validated') accounting_module = self.portal.accounting_module @@ -423,7 +423,7 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): line_list = invoice.contentValues( portal_type=self.portal.getPortalAccountingMovementTypeList()) for line in line_list: - self.assertEquals(line.getDestinationTotalAssetPrice(), + self.assertEqual(line.getDestinationTotalAssetPrice(), None) @@ -451,11 +451,11 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): euro_line1.setBasePrice(655.957) euro_line1.setStartDate(DateTime(2008,9,8)) euro_line1.setStopDate(DateTime(2008,9,10)) - self.assertEquals(euro_line1.getPriceCurrencyTitle(), + self.assertEqual(euro_line1.getPriceCurrencyTitle(), 'Francs CFA') - self.assertEquals(euro_line1.getBasePrice(),655.957) + self.assertEqual(euro_line1.getBasePrice(),655.957) euro_line1.validate() - self.assertEquals(euro_line1.getValidationState(), + self.assertEqual(euro_line1.getValidationState(), 'validated') euro_line2 = euro.newContent( portal_type='Currency Exchange Line', @@ -463,12 +463,12 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): euro_line2.setTitle('Euro to Francs CFA') euro_line2.setStartDate(DateTime(2008,9,8)) euro_line2.setStopDate(DateTime(2008,9,10)) - self.assertEquals(euro_line2.getPriceCurrencyTitle(), + self.assertEqual(euro_line2.getPriceCurrencyTitle(), 'Francs CFA') - self.assertEquals(euro_line2.getBasePrice(),None) + self.assertEqual(euro_line2.getBasePrice(),None) euro_line2.validate() - self.assertEquals(euro_line2.getValidationState(), + self.assertEqual(euro_line2.getValidationState(), 'validated') accounting_module = self.portal.accounting_module invoice = self._makeOne( @@ -487,10 +487,10 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): for line in line_list: if line.getDestinationValue() == self.account_module.goods_purchase: - self.assertEquals(line.getDestinationInventoriatedTotalAssetDebit(), + self.assertEqual(line.getDestinationInventoriatedTotalAssetDebit(), 327979) elif line.getDestinationValue() == self.account_module.receivable: - self.assertEquals(line.getDestinationInventoriatedTotalAssetCredit(), + self.assertEqual(line.getDestinationInventoriatedTotalAssetCredit(), 327979) else: self.fail('line not found') @@ -515,13 +515,13 @@ class TestCurrencyExchangeCell(CurrencyExchangeTestCase): euro = module.euro usd = module.usd euro_to_usd = euro.newContent(portal_type='Currency Exchange Line') - self.assertEquals(0, len(euro_to_usd.contentValues())) + self.assertEqual(0, len(euro_to_usd.contentValues())) # when we set the target currency, currency exchange cells will be added euro_to_usd.setPriceCurrencyValue(usd) - self.assertEquals(2, len(euro_to_usd.contentValues())) + self.assertEqual(2, len(euro_to_usd.contentValues())) # cell range is like this: - self.assertEquals([ + self.assertEqual([ ['currency_exchange_type/type_a', 'currency_exchange_type/type_b'], ['resource/%s' % euro.getRelativeUrl()], ['price_currency/%s' % usd.getRelativeUrl()], @@ -533,23 +533,23 @@ class TestCurrencyExchangeCell(CurrencyExchangeTestCase): 'price_currency/%s' % usd.getRelativeUrl(), base_id='path') self.assertNotEquals(None, type_a_cell) - self.assertEquals('Currency Exchange Cell', type_a_cell.getPortalTypeName()) + self.assertEqual('Currency Exchange Cell', type_a_cell.getPortalTypeName()) # int index have been copied, so that listbox in CurrencyExchangeLine_view # displays currency exchange line in same order than int indexes on # currency_exchange_type categories. - self.assertEquals(1, type_a_cell.getIntIndex()) + self.assertEqual(1, type_a_cell.getIntIndex()) self.assertTrue('currency_exchange_type/type_a' in type_a_cell.getCategoryList()) type_a_cell_predicate = type_a_cell.asPredicate() - self.assertEquals(sorted(('price_currency', + self.assertEqual(sorted(('price_currency', 'resource', 'currency_exchange_type')), sorted(type_a_cell_predicate.getMembershipCriterionBaseCategoryList())) - self.assertEquals(sorted(('price_currency/currency_module/usd', + self.assertEqual(sorted(('price_currency/currency_module/usd', 'resource/currency_module/euro', 'currency_exchange_type/type_a')), sorted(type_a_cell_predicate.getMembershipCriterionCategoryList())) @@ -588,7 +588,7 @@ class TestCurrencyExchangeCell(CurrencyExchangeTestCase): exchange_ratio = euro.getPrice(context=context, portal_type='Currency Exchange Cell') - self.assertEquals(0.98, exchange_ratio) + self.assertEqual(0.98, exchange_ratio) def test_suite(): diff --git a/product/ERP5/tests/testERP5Simulation.py b/product/ERP5/tests/testERP5Simulation.py index b9f14ca998..18ed824884 100644 --- a/product/ERP5/tests/testERP5Simulation.py +++ b/product/ERP5/tests/testERP5Simulation.py @@ -121,7 +121,7 @@ class TestERP5Simulation(TestPackingListMixin, ERP5TypeTestCase): order = sequence.get('order') packing_list_list = order.getCausalityRelatedValueList( portal_type=self.packing_list_portal_type) - self.assertEquals(2,len(packing_list_list)) + self.assertEqual(2,len(packing_list_list)) packing_list1 = None packing_list2 = None for packing_list in packing_list_list: @@ -132,10 +132,10 @@ class TestERP5Simulation(TestPackingListMixin, ERP5TypeTestCase): sequence.edit(new_packing_list=packing_list2) for line in packing_list1.objectValues( portal_type= self.packing_list_line_portal_type): - self.assertEquals(self.default_quantity-10,line.getQuantity()) + self.assertEqual(self.default_quantity-10,line.getQuantity()) for line in packing_list2.objectValues( portal_type= self.packing_list_line_portal_type): - self.assertEquals(10,line.getQuantity()) + self.assertEqual(10,line.getQuantity()) def _checkSolverState(self, sequence=None, sequence_list=None, state='solved'): @@ -145,7 +145,7 @@ class TestERP5Simulation(TestPackingListMixin, ERP5TypeTestCase): solver_process = sequence.get('solver_process') for solver in solver_process.objectValues( portal_type=self.portal.getPortalTargetSolverTypeList()): - self.assertEquals(state, solver.getValidationState()) + self.assertEqual(state, solver.getValidationState()) def stepCheckSolverIsSolving(self, sequence=None, sequence_list=None, **kw): """ @@ -168,7 +168,7 @@ class TestERP5Simulation(TestPackingListMixin, ERP5TypeTestCase): portal_catalog = self.portal.portal_catalog portal_simulation_path = self.portal.portal_simulation.getPath() - self.assertEquals(1, + self.assertEqual(1, len(portal_catalog(path=portal_simulation_path))) def test_01_splitAndDefer(self, quiet=quiet, run=run_all_test): @@ -217,7 +217,7 @@ class TestERP5Simulation(TestPackingListMixin, ERP5TypeTestCase): order = sequence.get('order') packing_list_list = order.getCausalityRelatedValueList( portal_type=self.packing_list_portal_type) - self.assertEquals(2,len(packing_list_list)) + self.assertEqual(2,len(packing_list_list)) packing_list1 = None packing_list2 = None for packing_list in packing_list_list: @@ -227,16 +227,16 @@ class TestERP5Simulation(TestPackingListMixin, ERP5TypeTestCase): packing_list2 = packing_list destination_value = sequence.get('organisation3') - self.assertEquals(packing_list1.getDestinationValue(), destination_value) - self.assertEquals(packing_list2.getDestinationValue(), destination_value) + self.assertEqual(packing_list1.getDestinationValue(), destination_value) + self.assertEqual(packing_list2.getDestinationValue(), destination_value) sequence.edit(new_packing_list=packing_list2) for line in packing_list1.objectValues( portal_type= self.packing_list_line_portal_type): - self.assertEquals(self.default_quantity-10,line.getQuantity()) + self.assertEqual(self.default_quantity-10,line.getQuantity()) for line in packing_list2.objectValues( portal_type= self.packing_list_line_portal_type): - self.assertEquals(10+1000,line.getQuantity()) + self.assertEqual(10+1000,line.getQuantity()) def test_02_splitAndDeferAfterAcceptDecision(self, quiet=quiet, run=run_all_test): """ diff --git a/product/ERP5/tests/testERP5Web.py b/product/ERP5/tests/testERP5Web.py index a04a6b9f10..bb163648d5 100644 --- a/product/ERP5/tests/testERP5Web.py +++ b/product/ERP5/tests/testERP5Web.py @@ -147,10 +147,10 @@ class TestERP5Web(ERP5TypeTestCase): **kw) webpage.publish() self.tic() - self.assertEquals(language, webpage.getLanguage()) - self.assertEquals(reference, webpage.getReference()) - self.assertEquals(version, webpage.getVersion()) - self.assertEquals('published', webpage.getValidationState()) + self.assertEqual(language, webpage.getLanguage()) + self.assertEqual(reference, webpage.getReference()) + self.assertEqual(version, webpage.getVersion()) + self.assertEqual('published', webpage.getValidationState()) webpage_list.append(webpage) return webpage_list @@ -176,8 +176,8 @@ class TestERP5Web(ERP5TypeTestCase): """ page = self.web_page_module.newContent(portal_type='Web Page') page.edit(text_content='<b>OK</b>') - self.assertEquals('text/html', page.getContentType()) - self.assertEquals('<b>OK</b>', page.getTextContent()) + self.assertEqual('text/html', page.getContentType()) + self.assertEqual('<b>OK</b>', page.getTextContent()) def test_02a_WebPageAsText(self): """ @@ -189,10 +189,10 @@ class TestERP5Web(ERP5TypeTestCase): page = self.web_page_module.newContent(portal_type='Web Page') page.edit(text_content='<p>Hé Hé Hé!</p>') self.tic() - self.assertEquals('Hé Hé Hé!', page.asText().strip()) + self.assertEqual('Hé Hé Hé!', page.asText().strip()) page.edit(text_content='<p>Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé!</p>') self.tic() - self.assertEquals("""Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé + self.assertEqual("""Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé!""", page.asText().strip()) @skip('WebSite_createWebSiteAccount is disabled by default.') @@ -219,19 +219,19 @@ Hé Hé Hé!""", page.asText().strip()) # find person object by reference person = website.ERP5Site_getAuthenticatedMemberPersonValue( kw['reference']) - self.assertEquals(person.getReference(), kw['reference']) - self.assertEquals(person.getFirstName(), kw['first_name']) - self.assertEquals(person.getLastName(), kw['last_name']) - self.assertEquals(person.getDefaultEmailText(), kw['default_email_text']) - self.assertEquals(person.getValidationState(), 'validated') + self.assertEqual(person.getReference(), kw['reference']) + self.assertEqual(person.getFirstName(), kw['first_name']) + self.assertEqual(person.getLastName(), kw['last_name']) + self.assertEqual(person.getDefaultEmailText(), kw['default_email_text']) + self.assertEqual(person.getValidationState(), 'validated') # check if user account is 'loggable' uf = portal.acl_users user = uf.getUserById(kw['reference']) - self.assertEquals(str(user), kw['reference']) - self.assertEquals(1, user.has_role(('Member', 'Authenticated',))) + self.assertEqual(str(user), kw['reference']) + self.assertEqual(1, user.has_role(('Member', 'Authenticated',))) self.login(kw['reference']) - self.assertEquals(kw['reference'], + self.assertEqual(kw['reference'], str(portal.portal_membership.getAuthenticatedMember())) # test redirection to person oobject @@ -244,7 +244,7 @@ Hé Hé Hé!""", page.asText().strip()) response = self.publish(path, '%s:%s' % (kw['reference'], kw['password'])) self.assertTrue('portal_preferences' in response.getHeader("Location")) # one preference should be created for user - self.assertEquals(1, + self.assertEqual(1, self.portal.portal_catalog.countResults(**{'portal_type': 'Preference', 'owner': kw['reference']})[0][0]) @@ -268,7 +268,7 @@ Hé Hé Hé!""", page.asText().strip()) websection.getAggregateReferenceList()) # even though we create many pages we should get only one # this is the most recent one since all share the same reference - self.assertEquals(1, len(websection.WebSection_getDocumentValueList())) + self.assertEqual(1, len(websection.WebSection_getDocumentValueList())) # use already created few pages in different languages with same reference # and check that we always get the right one based on selected @@ -279,7 +279,7 @@ Hé Hé Hé!""", page.asText().strip()) # XXX: Extend API so we can select language from REQUEST portal.Localizer.manage_changeDefaultLang(language=language) default_document = websection.getDefaultDocumentValue() - self.assertEquals(language, default_document.getLanguage()) + self.assertEqual(language, default_document.getLanguage()) def test_05_WebPageTextContentSubstitutions(self): """ @@ -298,16 +298,16 @@ Hé Hé Hé!""", page.asText().strip()) text_content=content) # No substitution should occur. - self.assertEquals(document.asStrippedHTML(), content) - self.assertEquals(document.asText(), asText_content) + self.assertEqual(document.asStrippedHTML(), content) + self.assertEqual(document.asText(), asText_content) klass = document.__class__ klass.getTestSubstitutionMapping = lambda self, **kw: mapping document.setTextContentSubstitutionMappingMethodId('getTestSubstitutionMapping') # Substitutions should occur. - self.assertEquals(document.asStrippedHTML(), substituted_content) - self.assertEquals(document.asText(), substituted_asText_content) + self.assertEqual(document.asStrippedHTML(), substituted_content) + self.assertEqual(document.asText(), substituted_asText_content) klass._getTestSubstitutionMapping = klass.getTestSubstitutionMapping document.setTextContentSubstitutionMappingMethodId('_getTestSubstitutionMapping') @@ -679,8 +679,8 @@ Hé Hé Hé!""", page.asText().strip()) # Check if they have good acquisition wrappers. for doc in (default_document, document1, document2) + tuple(document_list): - self.assertEquals(doc.aq_parent, websection) - self.assertEquals(doc.aq_parent.aq_parent, website) + self.assertEqual(doc.aq_parent, websection) + self.assertEqual(doc.aq_parent.aq_parent, website) def test_09_WebSiteSkinSelection(self): """Test skin selection through a Web Site. @@ -724,14 +724,14 @@ Hé Hé Hé!""", page.asText().strip()) # With the default skin. request['PARENTS'] = [self.app] - self.assertEquals(request.traverse(path)(), 'foo') + self.assertEqual(request.traverse(path)(), 'foo') # With the test skin. website.setSkinSelectionName('Test ERP5 Web') self.tic() request['PARENTS'] = [self.app] - self.assertEquals(request.traverse(path)(), 'bar') + self.assertEqual(request.traverse(path)(), 'bar') def test_10_getDocumentValueList(self): """Make sure that getDocumentValueList works.""" @@ -835,17 +835,17 @@ Hé Hé Hé!""", page.asText().strip()) webpage_module_fr = self.portal.restrictedTraverse( 'web_site_module/%s/fr/web_page_module' % website_id) - self.assertEquals(website_relative_url, + self.assertEqual(website_relative_url, website.getWebSiteValue().absolute_url(relative=1)) - self.assertEquals(website_relative_url_fr, + self.assertEqual(website_relative_url_fr, website_fr.getWebSiteValue().absolute_url(relative=1)) - self.assertEquals(website_relative_url, + self.assertEqual(website_relative_url, webpage.getWebSiteValue().absolute_url(relative=1)) - self.assertEquals(website_relative_url_fr, + self.assertEqual(website_relative_url_fr, webpage_fr.getWebSiteValue().absolute_url(relative=1)) - self.assertEquals(website_relative_url, + self.assertEqual(website_relative_url, webpage_module.getWebSiteValue().absolute_url(relative=1)) - self.assertEquals(website_relative_url_fr, + self.assertEqual(website_relative_url_fr, webpage_module_fr.getWebSiteValue().absolute_url(relative=1)) webpage = self.portal.restrictedTraverse( @@ -858,17 +858,17 @@ Hé Hé Hé!""", page.asText().strip()) webpage_module_fr = self.portal.restrictedTraverse( 'web_site_module/%s/fr/%s/web_page_module' % (website_id, websection_id)) - self.assertEquals(websection_relative_url, + self.assertEqual(websection_relative_url, websection.getWebSectionValue().absolute_url(relative=1)) - self.assertEquals(websection_relative_url_fr, + self.assertEqual(websection_relative_url_fr, websection_fr.getWebSectionValue().absolute_url(relative=1)) - self.assertEquals(websection_relative_url, + self.assertEqual(websection_relative_url, webpage.getWebSectionValue().absolute_url(relative=1)) - self.assertEquals(websection_relative_url_fr, + self.assertEqual(websection_relative_url_fr, webpage_fr.getWebSectionValue().absolute_url(relative=1)) - self.assertEquals(websection_relative_url, + self.assertEqual(websection_relative_url, webpage_module.getWebSectionValue().absolute_url(relative=1)) - self.assertEquals(websection_relative_url_fr, + self.assertEqual(websection_relative_url_fr, webpage_module_fr.getWebSectionValue().absolute_url(relative=1)) def test_13_DocumentCache(self): @@ -892,7 +892,7 @@ Hé Hé Hé!""", page.asText().strip()) text_content=content) document.publish() self.tic() - self.assertEquals(document.asText().strip(), 'initial text') + self.assertEqual(document.asText().strip(), 'initial text') # First make sure conversion already exists on the web site web_document = website.restrictedTraverse('NXD-Document.Cache') @@ -912,7 +912,7 @@ Hé Hé Hé!""", page.asText().strip()) # modified the web_page content document.edit(text_content=new_content) - self.assertEquals(document.asText().strip(), 'modified text') + self.assertEqual(document.asText().strip(), 'modified text') self.tic() # check the cache doesn't send again the old content @@ -952,7 +952,7 @@ Hé Hé Hé!""", page.asText().strip()) text_content=content) document.publish() self.tic() - self.assertEquals(document.asText().strip(), 'initial text') + self.assertEqual(document.asText().strip(), 'initial text') # Make sure document cache keeps converted content even if ID changes self.assertTrue(document.hasConversion(format='txt')) @@ -984,7 +984,7 @@ Hé Hé Hé!""", page.asText().strip()) text_content=content) document.publish() self.tic() - self.assertEquals(document.asText().strip(), 'initial text') + self.assertEqual(document.asText().strip(), 'initial text') # Through the web_site. path = website.absolute_url_path() + '/NXD-Document.Cache' @@ -1003,7 +1003,7 @@ Hé Hé Hé!""", page.asText().strip()) self.assertFalse(web_document.hasConversion(format='txt')) self.assertFalse(document.hasConversion(format='txt')) # Make sure cache is regenerated - self.assertEquals(web_document.asText().strip(), 'modified text') + self.assertEqual(web_document.asText().strip(), 'modified text') self.tic() # First make sure conversion already exists (since it should @@ -1016,18 +1016,18 @@ Hé Hé Hé!""", page.asText().strip()) # check the cache doesn't send again the old content # test this fist on the initial document - self.assertEquals(document.asText().strip(), 'modified text') + self.assertEqual(document.asText().strip(), 'modified text') # Through a web_section. web_document = web_section.restrictedTraverse('NXD-Document.Cache') - self.assertEquals(web_document.asText().strip(), 'modified text') + self.assertEqual(web_document.asText().strip(), 'modified text') path = web_section.absolute_url_path() + '/NXD-Document.Cache' response = self.publish(path, self.credential) self.assertNotEquals(response.getBody().find(new_content), -1) # Through a web_site. web_document = website.restrictedTraverse('NXD-Document.Cache') - self.assertEquals(web_document.asText().strip(), 'modified text') + self.assertEqual(web_document.asText().strip(), 'modified text') path = website.absolute_url_path() + '/NXD-Document.Cache' response = self.publish(path, self.credential) self.assertNotEquals(response.getBody().find(new_content), -1) @@ -1194,11 +1194,11 @@ Hé Hé Hé!""", page.asText().strip()) website = self.setupWebSite() # Check that language in defined in the URL - self.assertEquals(True, website.getStaticLanguageSelection()) + self.assertEqual(True, website.getStaticLanguageSelection()) self.assertNotEquals(language, website.getDefaultAvailableLanguage()) websection = self.setupWebSection() - self.assertEquals(websection.getId(), websection.getTitle()) + self.assertEqual(websection.getId(), websection.getTitle()) self.tic() response = self.publish('/%s/%s/%s/%s/Base_editAndEditAsWeb' % \ @@ -1216,22 +1216,22 @@ Hé Hé Hé!""", page.asText().strip()) } ) - self.assertEquals(MOVED_TEMPORARILY, response.getStatus()) + self.assertEqual(MOVED_TEMPORARILY, response.getStatus()) new_location = response.getHeader('Location') new_location = new_location.split('/', 3)[-1] self.tic() response = self.publish(new_location, basic='ERP5TypeTestCase:',) - self.assertEquals(HTTP_OK, response.getStatus()) - self.assertEquals('text/html; charset=utf-8', + self.assertEqual(HTTP_OK, response.getStatus()) + self.assertEqual('text/html; charset=utf-8', response.getHeader('content-type')) self.assertTrue("Data updated." in response.getBody()) self.tic() - self.assertEquals('%s_edited' % websection.getId(), websection.getTitle()) - self.assertEquals(1, len(self.portal.portal_catalog( + self.assertEqual('%s_edited' % websection.getId(), websection.getTitle()) + self.assertEqual(1, len(self.portal.portal_catalog( relative_url=websection.getRelativeUrl(), title=websection.getTitle()))) @@ -1250,10 +1250,10 @@ Hé Hé Hé!""", page.asText().strip()) website = self.setupWebSite() # Check that language in defined in the URL - self.assertEquals(True, website.getStaticLanguageSelection()) + self.assertEqual(True, website.getStaticLanguageSelection()) self.assertNotEquals(language, website.getDefaultAvailableLanguage()) - self.assertEquals(website.getId(), website.getTitle()) + self.assertEqual(website.getId(), website.getTitle()) self.tic() @@ -1272,22 +1272,22 @@ Hé Hé Hé!""", page.asText().strip()) } ) - self.assertEquals(MOVED_TEMPORARILY, response.getStatus()) + self.assertEqual(MOVED_TEMPORARILY, response.getStatus()) new_location = response.getHeader('Location') new_location = new_location.split('/', 3)[-1] self.tic() response = self.publish(new_location, basic='ERP5TypeTestCase:',) - self.assertEquals(HTTP_OK, response.getStatus()) - self.assertEquals('text/html; charset=utf-8', + self.assertEqual(HTTP_OK, response.getStatus()) + self.assertEqual('text/html; charset=utf-8', response.getHeader('content-type')) self.assertTrue("Data updated." in response.getBody()) self.tic() - self.assertEquals('%s_edited' % website.getId(), website.getTitle()) - self.assertEquals(1, len(self.portal.portal_catalog( + self.assertEqual('%s_edited' % website.getId(), website.getTitle()) + self.assertEqual(1, len(self.portal.portal_catalog( relative_url=website.getRelativeUrl(), title=website.getTitle()))) @@ -1299,19 +1299,19 @@ Hé Hé Hé!""", page.asText().strip()) website = self.setupWebSite() # web mode - self.assertEquals(False, self.portal.person_module.isWebMode()) - self.assertEquals(True, website.isWebMode()) - self.assertEquals(True, getattr(website, 'person_module').isWebMode()) + self.assertEqual(False, self.portal.person_module.isWebMode()) + self.assertEqual(True, website.isWebMode()) + self.assertEqual(True, getattr(website, 'person_module').isWebMode()) # editable mode - self.assertEquals(False, self.portal.person_module.isEditableMode()) - self.assertEquals(False, website.isEditableMode()) - self.assertEquals(False, getattr(website, 'person_module').isEditableMode()) + self.assertEqual(False, self.portal.person_module.isEditableMode()) + self.assertEqual(False, website.isEditableMode()) + self.assertEqual(False, getattr(website, 'person_module').isEditableMode()) request.set('editable_mode', 1) - self.assertEquals(1, self.portal.person_module.isEditableMode()) - self.assertEquals(1, website.isEditableMode()) - self.assertEquals(1, getattr(website, 'person_module').isEditableMode()) + self.assertEqual(1, self.portal.person_module.isEditableMode()) + self.assertEqual(1, website.isEditableMode()) + self.assertEqual(1, getattr(website, 'person_module').isEditableMode()) def test_20_reStructuredText(self): web_page = self.portal.web_page_module.newContent(portal_type='Web Page', @@ -1608,28 +1608,28 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase): self.tic() self.portal.Localizer.changeLanguage('en') - self.assertEquals(0, len(section.WebSection_getDocumentValueList())) + self.assertEqual(0, len(section.WebSection_getDocumentValueList())) self.login('erp5user') page_en_0.publish() self.tic() self.portal.Localizer.changeLanguage('en') - self.assertEquals(1, len(section.WebSection_getDocumentValueList())) - self.assertEquals(page_en_0.getUid(), + self.assertEqual(1, len(section.WebSection_getDocumentValueList())) + self.assertEqual(page_en_0.getUid(), section.WebSection_getDocumentValueList()[0].getUid()) self.portal.Localizer.changeLanguage('jp') - self.assertEquals(0, len(section.WebSection_getDocumentValueList())) + self.assertEqual(0, len(section.WebSection_getDocumentValueList())) # By Anonymous self.logout() self.portal.Localizer.changeLanguage('en') - self.assertEquals(1, len(section.WebSection_getDocumentValueList())) - self.assertEquals(page_en_0.getUid(), + self.assertEqual(1, len(section.WebSection_getDocumentValueList())) + self.assertEqual(page_en_0.getUid(), section.WebSection_getDocumentValueList()[0].getUid()) self.portal.Localizer.changeLanguage('jp') - self.assertEquals(0, len(section.WebSection_getDocumentValueList())) + self.assertEqual(0, len(section.WebSection_getDocumentValueList())) # Second Object self.login('erp5user') @@ -1637,17 +1637,17 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase): self.tic() self.portal.Localizer.changeLanguage('en') - self.assertEquals(1, len(section.WebSection_getDocumentValueList())) - self.assertEquals(page_en_1.getUid(), + self.assertEqual(1, len(section.WebSection_getDocumentValueList())) + self.assertEqual(page_en_1.getUid(), section.WebSection_getDocumentValueList()[0].getUid()) self.portal.Localizer.changeLanguage('jp') - self.assertEquals(0, len(section.WebSection_getDocumentValueList())) + self.assertEqual(0, len(section.WebSection_getDocumentValueList())) # By Anonymous self.logout() self.portal.Localizer.changeLanguage('en') - self.assertEquals(1, len(section.WebSection_getDocumentValueList())) - self.assertEquals(page_en_1.getUid(), + self.assertEqual(1, len(section.WebSection_getDocumentValueList())) + self.assertEqual(page_en_1.getUid(), section.WebSection_getDocumentValueList()[0].getUid()) # Trird Object @@ -1656,16 +1656,16 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase): self.tic() self.portal.Localizer.changeLanguage('en') - self.assertEquals(2, len(section.WebSection_getDocumentValueList())) + self.assertEqual(2, len(section.WebSection_getDocumentValueList())) self.portal.Localizer.changeLanguage('jp') - self.assertEquals(0, len(section.WebSection_getDocumentValueList())) + self.assertEqual(0, len(section.WebSection_getDocumentValueList())) # By Anonymous self.logout() self.portal.Localizer.changeLanguage('en') - self.assertEquals(2, len(section.WebSection_getDocumentValueList())) + self.assertEqual(2, len(section.WebSection_getDocumentValueList())) self.portal.Localizer.changeLanguage('jp') - self.assertEquals(0, len(section.WebSection_getDocumentValueList())) + self.assertEqual(0, len(section.WebSection_getDocumentValueList())) # First Japanese Object self.login('erp5user') @@ -1673,17 +1673,17 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase): self.tic() self.portal.Localizer.changeLanguage('en') - self.assertEquals(2, len(section.WebSection_getDocumentValueList())) + self.assertEqual(2, len(section.WebSection_getDocumentValueList())) self.portal.Localizer.changeLanguage('jp') - self.assertEquals(1, len(section.WebSection_getDocumentValueList())) + self.assertEqual(1, len(section.WebSection_getDocumentValueList())) # By Anonymous self.logout() self.portal.Localizer.changeLanguage('en') - self.assertEquals(2, len(section.WebSection_getDocumentValueList())) + self.assertEqual(2, len(section.WebSection_getDocumentValueList())) self.portal.Localizer.changeLanguage('jp') - self.assertEquals(1, len(section.WebSection_getDocumentValueList())) - self.assertEquals(page_jp_0.getUid(), + self.assertEqual(1, len(section.WebSection_getDocumentValueList())) + self.assertEqual(page_jp_0.getUid(), section.WebSection_getDocumentValueList()[0].getUid()) def test_04_ExpireUserAction(self): @@ -1736,7 +1736,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase): site_2_copy = web_site_module.manage_copyObjects(ids=(site_2.getId(),)) site_2_clone = web_site_module[web_site_module.manage_pasteObjects( site_2_copy)[0]['new_id']] - self.assertEquals(site_2_clone.getPortalType(), 'Web Site') + self.assertEqual(site_2_clone.getPortalType(), 'Web Site') def test_06_createWebSection(self): """ Test to create or clone web sections with many users """ @@ -1760,11 +1760,11 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase): section_2_copy = site.manage_copyObjects(ids=(section_2.getId(),)) section_2_clone = site[site.manage_pasteObjects( section_2_copy)[0]['new_id']] - self.assertEquals(section_2_clone.getPortalType(), 'Web Section') + self.assertEqual(section_2_clone.getPortalType(), 'Web Section') section_3_copy = section_2.manage_copyObjects(ids=(section_3.getId(),)) section_3_clone = section_2[section_2.manage_pasteObjects( section_3_copy)[0]['new_id']] - self.assertEquals(section_3_clone.getPortalType(), 'Web Section') + self.assertEqual(section_3_clone.getPortalType(), 'Web Section') def test_07_createCategory(self): """ Test to create or clone categories with many users """ @@ -1785,11 +1785,11 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase): category_1_copy = publication_section.manage_copyObjects(ids=(category_1.getId(),)) category_1_clone = publication_section[publication_section.manage_pasteObjects( category_1_copy)[0]['new_id']] - self.assertEquals(category_1_clone.getPortalType(), 'Category') + self.assertEqual(category_1_clone.getPortalType(), 'Category') category_2_copy = category_1.manage_copyObjects(ids=(category_2.getId(),)) category_2_clone = category_1[category_1.manage_pasteObjects( category_2_copy)[0]['new_id']] - self.assertEquals(category_2_clone.getPortalType(), 'Category') + self.assertEqual(category_2_clone.getPortalType(), 'Category') # test as a web user (assignor) self.login('webmaster') @@ -1808,17 +1808,17 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase): category_3_copy = publication_section.manage_copyObjects(ids=(category_3.getId(),)) category_3_clone = publication_section[publication_section.manage_pasteObjects( category_3_copy)[0]['new_id']] - self.assertEquals(category_3_clone.getPortalType(), 'Category') + self.assertEqual(category_3_clone.getPortalType(), 'Category') # try to clone a sub category of the different owner category_2_copy = category_1.manage_copyObjects(ids=(category_2.getId(),)) category_2_clone = category_1[category_1.manage_pasteObjects( category_2_copy)[0]['new_id']] - self.assertEquals(category_2_clone.getPortalType(), 'Category') + self.assertEqual(category_2_clone.getPortalType(), 'Category') # try to clone a sub category of the same owner category_4_copy = category_3.manage_copyObjects(ids=(category_4.getId(),)) category_4_clone = category_3[category_3.manage_pasteObjects( category_4_copy)[0]['new_id']] - self.assertEquals(category_4_clone.getPortalType(), 'Category') + self.assertEqual(category_4_clone.getPortalType(), 'Category') def test_08_createAndrenameCategory(self): """ Test to create or rename categories with many users """ @@ -1912,10 +1912,10 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase): web_page_no_follow_up.publish() self.tic() - self.assertEquals(1, len(website.WebSection_getDocumentValueList())) + self.assertEqual(1, len(website.WebSection_getDocumentValueList())) self.logout() - self.assertEquals(1, len(website.WebSection_getDocumentValueList())) + self.assertEqual(1, len(website.WebSection_getDocumentValueList())) def test_WebSiteModuleDefaultSecurity(self): """ diff --git a/product/ERP5/tests/testERP5WebWithCRM.py b/product/ERP5/tests/testERP5WebWithCRM.py index 23bf750185..c5cb095532 100644 --- a/product/ERP5/tests/testERP5WebWithCRM.py +++ b/product/ERP5/tests/testERP5WebWithCRM.py @@ -118,32 +118,32 @@ class TestERP5WebWithCRM(ERP5TypeTestCase): if property_id == telephone_key: value = '+(0)-%s' % value - self.assertEquals(event.getProperty(property_id), value) - self.assertEquals(event.getSourceCarrier(), web_section.getRelativeUrl()) + self.assertEqual(event.getProperty(property_id), value) + self.assertEqual(event.getSourceCarrier(), web_section.getRelativeUrl()) self.assertTrue(event.hasStartDate()) # Trig alarm execution self.portal.portal_alarms.fetch_incoming_web_message_list.activeSense() self.tic() - self.assertEquals(event.getSimulationState(), 'delivered') + self.assertEqual(event.getSimulationState(), 'delivered') ticket = event.getFollowUpValue() self.assertTrue(ticket is not None) - self.assertEquals(ticket.getSimulationState(), 'submitted') + self.assertEqual(ticket.getSimulationState(), 'submitted') person = event.getSourceValue() self.assertTrue(person is not None) - self.assertEquals(person.getFirstName(), + self.assertEqual(person.getFirstName(), form_kw['source_person_first_name']) - self.assertEquals(person.getLastName(), + self.assertEqual(person.getLastName(), form_kw['source_person_last_name']) - self.assertEquals(person.getDefaultEmailText(), + self.assertEqual(person.getDefaultEmailText(), form_kw['source_person_default_email_text']) self.assertTrue(form_kw['source_person_default_telephone_text'] in\ person.getDefaultTelephoneText()) - self.assertEquals(person.getValidationState(), 'validated') + self.assertEqual(person.getValidationState(), 'validated') organisation = person.getSubordinationValue() self.assertTrue(organisation is not None) - self.assertEquals(organisation.getValidationState(), 'validated') - self.assertEquals(organisation.getTitle(), + self.assertEqual(organisation.getValidationState(), 'validated') + self.assertEqual(organisation.getTitle(), form_kw['source_organisation_title']) def test_02_Contact_Us_with_Aunthenticated_user(self): @@ -198,9 +198,9 @@ class TestERP5WebWithCRM(ERP5TypeTestCase): for property_id, value in form_kw.iteritems(): if property_id == telephone_key: value = '+(0)-%s' % value - self.assertEquals(event.getProperty(property_id), value) + self.assertEqual(event.getProperty(property_id), value) - self.assertEquals(event.getSourceCarrier(), web_section.getRelativeUrl()) + self.assertEqual(event.getSourceCarrier(), web_section.getRelativeUrl()) self.assertTrue(event.hasStartDate()) self.assertTrue(event.hasSource()) # User was connected # he became source of event @@ -208,7 +208,7 @@ class TestERP5WebWithCRM(ERP5TypeTestCase): # Trig alarm execution self.portal.portal_alarms.fetch_incoming_web_message_list.activeSense() self.tic() - self.assertEquals(event.getSimulationState(), 'delivered') + self.assertEqual(event.getSimulationState(), 'delivered') def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testERP5WebWithDms.py b/product/ERP5/tests/testERP5WebWithDms.py index 07d5e98167..5973418af0 100644 --- a/product/ERP5/tests/testERP5WebWithDms.py +++ b/product/ERP5/tests/testERP5WebWithDms.py @@ -191,10 +191,10 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): **kw) webpage.publish() self.tic() - self.assertEquals(language, webpage.getLanguage()) - self.assertEquals(reference, webpage.getReference()) - self.assertEquals(version, webpage.getVersion()) - self.assertEquals('published', webpage.getValidationState()) + self.assertEqual(language, webpage.getLanguage()) + self.assertEqual(reference, webpage.getReference()) + self.assertEqual(version, webpage.getVersion()) + self.assertEqual('published', webpage.getValidationState()) webpage_list.append(webpage) return webpage_list @@ -235,15 +235,15 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): self.tic() # is old archived? - self.assertEquals('archived', en_01.getValidationState()) + self.assertEqual('archived', en_01.getValidationState()) # is new public and default web page for section? portal.Localizer.manage_changeDefaultLang(language = 'en') default_document = websection.getDefaultDocumentValue() - self.assertEquals(en_02, default_document) - self.assertEquals('en', default_document.getLanguage()) - self.assertEquals('0.2', default_document.getVersion()) - self.assertEquals('published', default_document.getValidationState()) + self.assertEqual(en_02, default_document) + self.assertEqual('en', default_document.getLanguage()) + self.assertEqual('0.2', default_document.getVersion()) + self.assertEqual('published', default_document.getValidationState()) def test_02_WebSectionAuthorizationForced(self, quiet=quiet, run=run_all_test): """ Check that when a document is requested within a Web Section we have a chance to @@ -310,15 +310,15 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): %publication_section_category_id_list[0]]) self.tic() - self.assertEquals(0, len(websection.getDocumentValueList())) + self.assertEqual(0, len(websection.getDocumentValueList())) # create pages belonging to this publication_section 'documentation' web_page_en = portal.web_page_module.newContent(portal_type = 'Web Page', language = 'en', publication_section_list=publication_section_category_id_list[:1]) web_page_en.publish() self.tic() - self.assertEquals(1, len(websection.getDocumentValueList(language='en'))) - self.assertEquals(web_page_en, websection.getDocumentValueList(language='en')[0].getObject()) + self.assertEqual(1, len(websection.getDocumentValueList(language='en'))) + self.assertEqual(web_page_en, websection.getDocumentValueList(language='en')[0].getObject()) # create pages belonging to this publication_section 'documentation' but for 'bg' language web_page_bg = portal.web_page_module.newContent(portal_type = 'Web Page', @@ -326,19 +326,19 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): publication_section_list=publication_section_category_id_list[:1]) web_page_bg.publish() self.tic() - self.assertEquals(1, len(websection.getDocumentValueList(language='bg'))) - self.assertEquals(web_page_bg, websection.getDocumentValueList(language='bg')[0].getObject()) + self.assertEqual(1, len(websection.getDocumentValueList(language='bg'))) + self.assertEqual(web_page_bg, websection.getDocumentValueList(language='bg')[0].getObject()) # reject page web_page_bg.reject() self.tic() - self.assertEquals(0, len(websection.getDocumentValueList(language='bg'))) + self.assertEqual(0, len(websection.getDocumentValueList(language='bg'))) # publish page and search without a language (by default system should return 'en' docs only) web_page_bg.publish() self.tic() - self.assertEquals(1, len(websection.getDocumentValueList())) - self.assertEquals(web_page_en, websection.getDocumentValueList()[0].getObject()) + self.assertEqual(1, len(websection.getDocumentValueList())) + self.assertEqual(web_page_en, websection.getDocumentValueList()[0].getObject()) def test_04_WebSectionAuthorizationForcedForDefaultDocument(self, quiet=quiet, run=run_all_test): """ Check that when a Web Section contains a default document not accessible by user we have a chance to @@ -467,9 +467,12 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): reference, 'img%s.png' % i)) response = self.publish(path) + policy_list = self.portal.caching_policy_manager.listPolicies() + policy = [policy for policy in policy_list\ + if policy[0] == 'unauthenticated'][0] self.assertEquals(response.getHeader('Content-Type'), 'image/png') self.assertEquals(response.getHeader('Cache-Control'), - 'max-age=%s, public' % policy.getMaxAgeSecs()) + 'max-age=%s, public' % policy[1].getMaxAgeSecs()) def test_07_TestDocumentViewBehaviour(self): """All Documents shared the same downloading behaviour @@ -515,60 +518,60 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): # testing TextDocument response = self.publish(website.absolute_url_path() + '/' +\ web_page_reference, credential) - self.assertEquals(response.getHeader('content-type'), + self.assertEqual(response.getHeader('content-type'), 'text/html; charset=utf-8') self.assertTrue('<form' in response.getBody()) # means the web_page # is rendered in web_site context response = self.publish(website.absolute_url_path() + '/' +\ web_page_reference, credential) - self.assertEquals(response.getHeader('content-type'), + self.assertEqual(response.getHeader('content-type'), 'text/html; charset=utf-8') self.assertTrue('<form' in response.getBody()) # means the web_page # is rendered in web_site context response = self.publish(website.absolute_url_path() + '/' +\ web_page_reference + '?format=pdf', credential) - self.assertEquals(response.getHeader('content-type'), 'application/pdf') + self.assertEqual(response.getHeader('content-type'), 'application/pdf') # testing Image response = self.publish(website.absolute_url_path() + '/' +\ image_reference, credential) # image is rendered in web_site context - self.assertEquals(response.getHeader('content-type'), + self.assertEqual(response.getHeader('content-type'), 'text/html; charset=utf-8') response = self.publish(website.absolute_url_path() + '/' +\ image_reference + '?format=png', credential) # image is downloaded because format parameter is passed - self.assertEquals(response.getHeader('content-type'), 'image/png') + self.assertEqual(response.getHeader('content-type'), 'image/png') response = self.publish(website.absolute_url_path() + '/' +\ image_reference + '?display=small', credential) # image is downloaded because display parameter is passed - self.assertEquals(response.getHeader('content-type'), 'image/png') + self.assertEqual(response.getHeader('content-type'), 'image/png') # image is rendered in web_site context response = self.publish(website.absolute_url_path() + '/' +\ image_reference, credential) - self.assertEquals(response.getHeader('content-type'), + self.assertEqual(response.getHeader('content-type'), 'text/html; charset=utf-8') # testing OOoDocument # Document is downloaded response = self.publish(website.absolute_url_path() + '/' +\ document_reference, credential) - self.assertEquals(response.getHeader('content-type'), + self.assertEqual(response.getHeader('content-type'), 'text/html; charset=utf-8') response = self.publish(website.absolute_url_path() + '/' +\ document_reference + '?format=odp', credential) # document is resturned because format parameter is passed - self.assertEquals(response.getHeader('content-type'), + self.assertEqual(response.getHeader('content-type'), 'application/vnd.oasis.opendocument.presentation') # Document is rendered in web_site context response = self.publish(website.absolute_url_path() + '/' +\ document_reference, credential) - self.assertEquals(response.getHeader('content-type'), + self.assertEqual(response.getHeader('content-type'), 'text/html; charset=utf-8') def test_08_RFC5861(self): @@ -683,13 +686,13 @@ return True # find the img src img_list = etree.HTML(html).findall('.//img') - self.assertEquals(1, len(img_list)) + self.assertEqual(1, len(img_list)) src = img_list[0].get('src') # and make another query for this img response = self.publish('%s/%s' % ( document.absolute_url_path(), src), credential) - self.assertEquals(response.getHeader('content-type'), 'image/png') + self.assertEqual(response.getHeader('content-type'), 'image/png') png = response.getBody() self.assertTrue(png.startswith('\x89PNG')) @@ -707,13 +710,13 @@ return True # find the img src img_list = etree.HTML(html).findall('.//img') - self.assertEquals(1, len(img_list)) + self.assertEqual(1, len(img_list)) src = img_list[0].get('src') # and make another query for this img response = self.publish('%s/%s/%s' % ( website.absolute_url_path(), document_reference, src)) - self.assertEquals(response.getHeader('content-type'), 'image/png') + self.assertEqual(response.getHeader('content-type'), 'image/png') png = response.getBody() self.assertTrue(png.startswith('\x89PNG')) @@ -729,7 +732,7 @@ return True # find the img src img_list = etree.HTML(html).findall('.//img') - self.assertEquals(1, len(img_list)) + self.assertEqual(1, len(img_list)) src = img_list[0].get('src') def test_ImageConversionThroughWebSite_using_file(self): @@ -772,17 +775,17 @@ return True response = self.publish(website.absolute_url_path() + '/' +\ image_reference + '?format=', credential) - self.assertEquals(response.getHeader('content-type'), 'image/png') + self.assertEqual(response.getHeader('content-type'), 'image/png') # testing Image conversions, png response = self.publish(website.absolute_url_path() + '/' +\ image_reference + '?format=png', credential) - self.assertEquals(response.getHeader('content-type'), 'image/png') + self.assertEqual(response.getHeader('content-type'), 'image/png') # testing Image conversions, jpg response = self.publish(website.absolute_url_path() + '/' +\ image_reference + '?format=jpg', credential) - self.assertEquals(response.getHeader('content-type'), 'image/jpeg') + self.assertEqual(response.getHeader('content-type'), 'image/jpeg') # testing Image conversions, svg # disable Image permissiions checks format checks @@ -790,16 +793,16 @@ return True '**kw', 'return 1') response = self.publish(website.absolute_url_path() + '/' +\ image_reference + '?format=svg', credential) - self.assertEquals(response.getHeader('content-type'), 'image/svg+xml') + self.assertEqual(response.getHeader('content-type'), 'image/svg+xml') # testing Image conversions, resizing response = self.publish(website.absolute_url_path() + '/' +\ image_reference + '?display=large', credential) - self.assertEquals(response.getHeader('content-type'), 'image/png') + self.assertEqual(response.getHeader('content-type'), 'image/png') large_image = response.getBody() response = self.publish(website.absolute_url_path() + '/' +\ image_reference + '?display=small', credential) - self.assertEquals(response.getHeader('content-type'), 'image/png') + self.assertEqual(response.getHeader('content-type'), 'image/png') small_image = response.getBody() # if larger image is longer than smaller, then # Resizing works @@ -844,9 +847,9 @@ return True reference="NXD-DOCUMENT") image.publish() self.tic() - self.assertEquals(image.getContentType(), 'image/svg+xml') + self.assertEqual(image.getContentType(), 'image/svg+xml') mime, converted_data = image.convert("png") - self.assertEquals(mime, 'image/png') + self.assertEqual(mime, 'image/png') expected_image = makeFileUpload('%s.png' % filename) # Compare images and accept some minimal difference, @@ -874,9 +877,9 @@ return True reference="NXD-DOCYMENT") image.publish() self.tic() - self.assertEquals(image.getContentType(), 'image/svg+xml') + self.assertEqual(image.getContentType(), 'image/svg+xml') mime, converted_data = image.convert("png") - self.assertEquals(mime, 'image/png') + self.assertEqual(mime, 'image/png') expected_image = makeFileUpload('user-TESTSVG-CASE-URL.png') # Compare images and accept some minimal difference, @@ -952,8 +955,8 @@ return True image.publish() image2.publish() self.tic() - self.assertEquals(image.getContentType(), 'image/svg+xml') - self.assertEquals(image2.getContentType(), 'image/svg+xml') + self.assertEqual(image.getContentType(), 'image/svg+xml') + self.assertEqual(image2.getContentType(), 'image/svg+xml') self.assertRaises(ConversionError, image.convert, "png") self.assertRaises(ConversionError, image2.convert, "png") @@ -972,7 +975,7 @@ return True image.publish() self.tic() - self.assertEquals(image.getContentType(), 'image/svg+xml') + self.assertEqual(image.getContentType(), 'image/svg+xml') self.assertRaises(ConversionError, image.convert, "png") def test_ImageConversionFromSVGToPNG_embeeded_data(self): diff --git a/product/ERP5/tests/testERP5eGov.py b/product/ERP5/tests/testERP5eGov.py index ce0717ef2d..64e2fb8751 100644 --- a/product/ERP5/tests/testERP5eGov.py +++ b/product/ERP5/tests/testERP5eGov.py @@ -264,15 +264,15 @@ class TestEgov(ERP5TypeTestCase): self.fillProcedureForm(procedure, 'vat declaration') procedure.validate() vat_module = self.portal.getDefaultModule('Vat Declaration') - self.assertEquals(vat_module.getId(), 'vat_declaration_module') + self.assertEqual(vat_module.getId(), 'vat_declaration_module') vat_portal_type = self.portal.portal_types.getTypeInfo('Vat Declaration') - self.assertEquals(vat_portal_type.getId(), 'Vat Declaration') + self.assertEqual(vat_portal_type.getId(), 'Vat Declaration') self.assertTrue(vat_portal_type.getDefaultScribusFormValue().getData() not in ('', None)) self.assertTrue(vat_portal_type.getDefaultPdfFormValue().getData() not in ('', None)) id_generator = vat_module.getIdGenerator() - self.assertEquals(id_generator, '_generatePerDayId') + self.assertEqual(id_generator, '_generatePerDayId') def test_02_application_creation(self): """ @@ -294,9 +294,9 @@ class TestEgov(ERP5TypeTestCase): vat_declaration.view() vat_declaration.PDFType_viewAsPdf() application_dict = vat_declaration.PDFDocument_getApplicationIncomeDict() - self.assertEquals(len(application_dict), 1) + self.assertEqual(len(application_dict), 1) report_section_list = vat_declaration.PDFDocument_getReportSectionList() - self.assertEquals(len(report_section_list), 1) + self.assertEqual(len(report_section_list), 1) vat_declaration.PDFDocument_viewHistory() def test_03_submit_application(self): @@ -316,9 +316,9 @@ class TestEgov(ERP5TypeTestCase): # test form generation # change to EGov skin which is defined in erp5_egov self.changeSkin('EGov') - self.assertEquals('draft', vat_declaration.getValidationState()) + self.assertEqual('draft', vat_declaration.getValidationState()) missing_file = vat_declaration.PDFDocument_getRequirementCount() - self.assertEquals(missing_file, 1) + self.assertEqual(missing_file, 1) type_allowed_content_type_list = vat_declaration.getTypeInfo().getTypeAllowedContentTypeList() type_allowed_content_type_list.append('PDF') vat_declaration.getTypeInfo().setTypeAllowedContentTypeList(type_allowed_content_type_list) @@ -327,9 +327,9 @@ class TestEgov(ERP5TypeTestCase): self.tic() self.commit() missing_file = vat_declaration.PDFDocument_getRequirementCount() - self.assertEquals(missing_file, 0) + self.assertEqual(missing_file, 0) self.portal.portal_workflow.doActionFor(vat_declaration, 'submit_draft_action') - self.assertEquals('submitted', vat_declaration.getValidationState()) + self.assertEqual('submitted', vat_declaration.getValidationState()) def test_05_process_application(self): """ @@ -349,7 +349,7 @@ class TestEgov(ERP5TypeTestCase): # change to EGov skin which is defined in erp5_egov self.changeSkin('EGov') self.portal.portal_workflow.doActionFor(vat_declaration, 'submit_draft_action') - self.assertEquals('submitted', vat_declaration.getValidationState()) + self.assertEqual('submitted', vat_declaration.getValidationState()) self.createAgentUser() self.logout() self.login('agent') @@ -359,18 +359,18 @@ class TestEgov(ERP5TypeTestCase): vat_declaration.PDFDocument_viewHistory() self.portal.portal_workflow.doActionFor(vat_declaration, 'receive_action') if vat_declaration.getTypeInfo().getStepReviewRequest() is None: - self.assertEquals('completed', vat_declaration.getValidationState()) + self.assertEqual('completed', vat_declaration.getValidationState()) """ else: - self.assertEquals('receivable', vat_declaration.getValidationState()) - self.assertEquals(vat_declaration.getTypeInfo().getStepReviewRequest(),None) + self.assertEqual('receivable', vat_declaration.getValidationState()) + self.assertEqual(vat_declaration.getTypeInfo().getStepReviewRequest(),None) self.portal.portal_workflow.doActionFor(vat_declaration, 'assign_action') - self.assertEquals('assigned', vat_declaration.getValidationState()) + self.assertEqual('assigned', vat_declaration.getValidationState()) self.createValidatorUser() self.logout() self.login('major') self.portal.portal_workflow.doActionFor(vat_declaration, 'complete_action') - self.assertEquals('completed', vat_declaration.getValidationState()) + self.assertEqual('completed', vat_declaration.getValidationState()) """ def test_suite(): diff --git a/product/ERP5/tests/testEditorField.py b/product/ERP5/tests/testEditorField.py index 7fa638272d..07fee5feb4 100644 --- a/product/ERP5/tests/testEditorField.py +++ b/product/ERP5/tests/testEditorField.py @@ -108,13 +108,13 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional): self.commit() # Make sure preferred editor was set on preference - self.assertEquals(self.getDefaultSitePreference().getPreferredTextEditor(), preferred_editor) + self.assertEqual(self.getDefaultSitePreference().getPreferredTextEditor(), preferred_editor) # then on portal preferences - self.assertEquals(self.getPreferenceTool().getPreferredTextEditor(), preferred_editor) + self.assertEqual(self.getPreferenceTool().getPreferredTextEditor(), preferred_editor) # Make sure editor field preference is also set form = getattr(event, form_id) field = getattr(form, field_id) - self.assertEquals(field.get_value('text_editor'), editor) + self.assertEqual(field.get_value('text_editor'), editor) def _isFCKEditor(self, html_text, field_id, text_content): """ diff --git a/product/ERP5/tests/testFieldLibraryGuideline.py b/product/ERP5/tests/testFieldLibraryGuideline.py index 51494cb666..5fdcacb8ed 100644 --- a/product/ERP5/tests/testFieldLibraryGuideline.py +++ b/product/ERP5/tests/testFieldLibraryGuideline.py @@ -76,7 +76,7 @@ class TestFieldLibraryGuideline(ERP5TypeTestCase): ps = self.getSkinsTool() ps.manage_addProduct['OFSP'].manage_addFolder(self.skin_folder_name) skin_folder = ps._getOb(self.skin_folder_name, None) - self.failUnless(skin_folder is not None) + self.assertTrue(skin_folder is not None) sequence.edit(skin_folder_id=skin_folder.getId()) # add skin in layers for skin_name, selection in ps.getSkinPaths(): @@ -105,10 +105,10 @@ class TestFieldLibraryGuideline(ERP5TypeTestCase): business_template = sequence.get('custom_business_template') modifiable_field_list = \ business_template.BusinessTemplate_getModifiableFieldList() - self.assertEquals(1, len(modifiable_field_list)) + self.assertEqual(1, len(modifiable_field_list)) modifiable_field = modifiable_field_list[0] - self.assertEquals('1_create_form', modifiable_field.choice[0]) - self.assertEquals('%s/%s' % (self.skin_folder_name, self.field_library_id), + self.assertEqual('1_create_form', modifiable_field.choice[0]) + self.assertEqual('%s/%s' % (self.skin_folder_name, self.field_library_id), modifiable_field.object_id) def test_01_missingFieldLibrary(self): @@ -166,11 +166,11 @@ class TestFieldLibraryGuideline(ERP5TypeTestCase): business_template = sequence.get('custom_business_template') modifiable_field_list = \ business_template.BusinessTemplate_getModifiableFieldList() - self.assertEquals(1, len(modifiable_field_list)) + self.assertEqual(1, len(modifiable_field_list)) modifiable_field = modifiable_field_list[0] - self.assertEquals('0_keep_non_proxy_field', + self.assertEqual('0_keep_non_proxy_field', modifiable_field.choice_item_list[0][1]) - self.assertEquals('%s/%s/my_title' % (self.skin_folder_name, + self.assertEqual('%s/%s/my_title' % (self.skin_folder_name, self.form_id), modifiable_field.object_id) @@ -210,11 +210,11 @@ class TestFieldLibraryGuideline(ERP5TypeTestCase): business_template = sequence.get('custom_business_template') modifiable_field_list = \ business_template.BusinessTemplate_getModifiableFieldList() - self.assertEquals(1, len(modifiable_field_list)) + self.assertEqual(1, len(modifiable_field_list)) modifiable_field = modifiable_field_list[0] - self.assertEquals('0_keep_dead_proxy_field', + self.assertEqual('0_keep_dead_proxy_field', modifiable_field.choice_item_list[0][1]) - self.assertEquals('%s/%s/my_title' % (self.skin_folder_name, + self.assertEqual('%s/%s/my_title' % (self.skin_folder_name, self.form_id), modifiable_field.object_id) @@ -254,11 +254,11 @@ class TestFieldLibraryGuideline(ERP5TypeTestCase): business_template = sequence.get('custom_business_template') modifiable_field_list = \ business_template.BusinessTemplate_getModifiableFieldList() - self.assertEquals(1, len(modifiable_field_list)) + self.assertEqual(1, len(modifiable_field_list)) modifiable_field = modifiable_field_list[0] - self.assertEquals('0_unused_proxy_field', + self.assertEqual('0_unused_proxy_field', modifiable_field.choice_item_list[0][1]) - self.assertEquals('%s/%s/my_title' % (self.skin_folder_name, + self.assertEqual('%s/%s/my_title' % (self.skin_folder_name, self.field_library_id), modifiable_field.object_id) @@ -300,11 +300,11 @@ class TestFieldLibraryGuideline(ERP5TypeTestCase): business_template = sequence.get('custom_business_template') modifiable_field_list = \ business_template.BusinessTemplate_getModifiableFieldList() - self.assertEquals(1, len(modifiable_field_list)) + self.assertEqual(1, len(modifiable_field_list)) modifiable_field = modifiable_field_list[0] - self.assertEquals('2_unproxify_field', + self.assertEqual('2_unproxify_field', modifiable_field.choice_item_list[0][1]) - self.assertEquals('%s/%s/my_title' % (self.skin_folder_name, + self.assertEqual('%s/%s/my_title' % (self.skin_folder_name, self.form_id), modifiable_field.object_id) @@ -344,10 +344,10 @@ class TestFieldLibraryGuideline(ERP5TypeTestCase): business_template = sequence.get('custom_business_template') modifiable_field_list = \ business_template.BusinessTemplate_getModifiableFieldList() - self.assertEquals(1, len(modifiable_field_list)) + self.assertEqual(1, len(modifiable_field_list)) modifiable_field = modifiable_field_list[0] - self.assertEquals('4_delete_form', modifiable_field.choice[0]) - self.assertEquals('%s/%s' % (self.skin_folder_name, + self.assertEqual('4_delete_form', modifiable_field.choice[0]) + self.assertEqual('%s/%s' % (self.skin_folder_name, self.wrong_field_library_id), modifiable_field.object_id) diff --git a/product/ERP5/tests/testGeographicalAddress.py b/product/ERP5/tests/testGeographicalAddress.py index 372d05ee21..5de25bc2dc 100644 --- a/product/ERP5/tests/testGeographicalAddress.py +++ b/product/ERP5/tests/testGeographicalAddress.py @@ -135,7 +135,7 @@ class TestGeographicalAddress(ERP5TypeTestCase): Check getAddressText """ address = sequence.get('address') - self.assertEquals(address.asText(), + self.assertEqual(address.asText(), "%s %s\n%s %s" % (self.street_address_number, self.street_address_text, self.zip_code_text, @@ -174,7 +174,7 @@ return '%s\\n%s %s COUNTRY' % \\ Check getAddressText """ address = sequence.get('address') - self.assertEquals(address.asText(), + self.assertEqual(address.asText(), "%s %s\n%s %s COUNTRY" % (self.street_address_number, self.street_address_text, self.zip_code_text, diff --git a/product/ERP5/tests/testI18NSearch.py b/product/ERP5/tests/testI18NSearch.py index c14c8502fb..930087f35a 100644 --- a/product/ERP5/tests/testI18NSearch.py +++ b/product/ERP5/tests/testI18NSearch.py @@ -52,12 +52,12 @@ class TestI18NSearch(ERP5TypeTestCase): self.tic() # check if 'é' == 'e' collation works result = person_module.searchFolder(SearchableText='Faure') - self.assertEquals(len(result), 1) - self.assertEquals(result[0].getPath(), person1.getPath()) + self.assertEqual(len(result), 1) + self.assertEqual(result[0].getPath(), person1.getPath()) # check if a partial string of CJK string matches result = person_module.searchFolder(SearchableText='æ¦è€…') - self.assertEquals(len(result), 1) - self.assertEquals(result[0].getPath(), person2.getPath()) + self.assertEqual(len(result), 1) + self.assertEqual(result[0].getPath(), person2.getPath()) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testICal.py b/product/ERP5/tests/testICal.py index 8946603f6e..49db1fb4e6 100644 --- a/product/ERP5/tests/testICal.py +++ b/product/ERP5/tests/testICal.py @@ -109,19 +109,19 @@ class TestICal(ERP5TypeTestCase): self.assertTrue('END:VCALENDAR' in feed_dict) self.assertTrue('BEGIN:VEVENT' in feed_dict) self.assertTrue('END:VEVENT' in feed_dict) - self.assertEquals(feed_dict['SUMMARY'], 'Event One') + self.assertEqual(feed_dict['SUMMARY'], 'Event One') # if not set start date, it must be same as creation date # if not set end date, it must be same as start date - self.assertEquals(feed_dict['DTSTART'], event.getCreationDate().HTML4().replace('-','').replace(':','')) - self.assertEquals(feed_dict['DTEND'], event.getCreationDate().HTML4().replace('-','').replace(':','')) - self.assertEquals(feed_dict['CREATED'], event.getCreationDate().HTML4().replace('-','').replace(':','')) - self.assertEquals(feed_dict['LAST-MODIFIED'], event.getModificationDate().HTML4().replace('-','').replace(':','')) - self.assertEquals(feed_dict['URL'], event.absolute_url()) - self.assertEquals(feed_dict['UID'], 'uuid%s' % event.getUid()) + self.assertEqual(feed_dict['DTSTART'], event.getCreationDate().HTML4().replace('-','').replace(':','')) + self.assertEqual(feed_dict['DTEND'], event.getCreationDate().HTML4().replace('-','').replace(':','')) + self.assertEqual(feed_dict['CREATED'], event.getCreationDate().HTML4().replace('-','').replace(':','')) + self.assertEqual(feed_dict['LAST-MODIFIED'], event.getModificationDate().HTML4().replace('-','').replace(':','')) + self.assertEqual(feed_dict['URL'], event.absolute_url()) + self.assertEqual(feed_dict['UID'], 'uuid%s' % event.getUid()) # there is no description self.assertFalse('DESCRIPTION' in feed_dict) # current workflow state - draft - self.assertEquals(feed_dict['STATUS'], 'TENTATIVE') + self.assertEqual(feed_dict['STATUS'], 'TENTATIVE') # set start date, description and change workflow state - new event.plan() @@ -131,11 +131,11 @@ class TestICal(ERP5TypeTestCase): feed_dict = self.getICalFeed(module) # DSTART and DTEND are the date in UTC - self.assertEquals(feed_dict['DTSTART'], '20070815T083000Z') + self.assertEqual(feed_dict['DTSTART'], '20070815T083000Z') # if not set end date, it must be same as start date - self.assertEquals(feed_dict['DTEND'], '20070815T083000Z') - self.assertEquals(feed_dict['STATUS'], 'TENTATIVE') - self.assertEquals(feed_dict['DESCRIPTION'], 'Event One description') + self.assertEqual(feed_dict['DTEND'], '20070815T083000Z') + self.assertEqual(feed_dict['STATUS'], 'TENTATIVE') + self.assertEqual(feed_dict['DESCRIPTION'], 'Event One description') # check categorization sale_op = self.portal.sale_opportunity_module.newContent(portal_type='Sale Opportunity', title='New Opportunity', reference='NEWSALEOP') @@ -152,8 +152,8 @@ class TestICal(ERP5TypeTestCase): self.tic() feed_dict = self.getICalFeed(module) - self.assertEquals(feed_dict['DTEND'], '20070815T133000Z') - self.assertEquals(feed_dict['STATUS'], 'CONFIRMED') + self.assertEqual(feed_dict['DTEND'], '20070815T133000Z') + self.assertEqual(feed_dict['STATUS'], 'CONFIRMED') # cancel event but first remove previously created module.manage_delObjects([event.getId()]) @@ -162,7 +162,7 @@ class TestICal(ERP5TypeTestCase): self.tic() feed_dict = self.getICalFeed(module) - self.assertEquals(feed_dict['STATUS'], 'CANCELLED') + self.assertEqual(feed_dict['STATUS'], 'CANCELLED') def test_02_renderTask(self, quiet=0, run=run_all_test): """ @@ -182,9 +182,9 @@ class TestICal(ERP5TypeTestCase): self.assertTrue('END:VCALENDAR' in feed_dict) self.assertTrue('BEGIN:VTODO' in feed_dict) self.assertTrue('END:VTODO' in feed_dict) - self.assertEquals(feed_dict['SUMMARY'], 'Task One') - self.assertEquals(feed_dict['STATUS'], 'NEEDS-ACTION') - self.assertEquals(feed_dict.get('PERCENT-COMPLETE', '0'), '0') # when it is zero it doesn't have to be there + self.assertEqual(feed_dict['SUMMARY'], 'Task One') + self.assertEqual(feed_dict['STATUS'], 'NEEDS-ACTION') + self.assertEqual(feed_dict.get('PERCENT-COMPLETE', '0'), '0') # when it is zero it doesn't have to be there # now we check categorization (while we can edit the object) project = self.portal.project_module.newContent(portal_type='Project', title='New Project', @@ -193,31 +193,31 @@ class TestICal(ERP5TypeTestCase): self.tic() feed_dict = self.getICalFeed(module) - self.assertEquals(feed_dict['CATEGORIES'], 'NEWPROJ') + self.assertEqual(feed_dict['CATEGORIES'], 'NEWPROJ') # change workflow state - planned task.plan() self.tic() feed_dict = self.getICalFeed(module) - self.assertEquals(feed_dict['STATUS'], 'NEEDS-ACTION') - self.assertEquals(feed_dict['PERCENT-COMPLETE'], '33') + self.assertEqual(feed_dict['STATUS'], 'NEEDS-ACTION') + self.assertEqual(feed_dict['PERCENT-COMPLETE'], '33') # change workflow state - ordered task.order() self.tic() feed_dict = self.getICalFeed(module) - self.assertEquals(feed_dict['STATUS'], 'IN-PROCESS') - self.assertEquals(feed_dict['PERCENT-COMPLETE'], '66') + self.assertEqual(feed_dict['STATUS'], 'IN-PROCESS') + self.assertEqual(feed_dict['PERCENT-COMPLETE'], '66') # change workflow state - confirmed task.confirm() self.tic() feed_dict = self.getICalFeed(module) - self.assertEquals(feed_dict['STATUS'], 'COMPLETED') - self.assertEquals(feed_dict['PERCENT-COMPLETE'], '100') + self.assertEqual(feed_dict['STATUS'], 'COMPLETED') + self.assertEqual(feed_dict['PERCENT-COMPLETE'], '100') def test_03_renderJournal(self, quiet=0, run=run_all_test): """ @@ -256,9 +256,9 @@ class TestICal(ERP5TypeTestCase): self.assertTrue('END:VCALENDAR' in feed_dict) self.assertTrue('BEGIN:VJOURNAL' in feed_dict) self.assertTrue('END:VJOURNAL' in feed_dict) - self.assertEquals(feed_dict['SUMMARY'], 'One') - self.assertEquals(feed_dict['DESCRIPTION'], 'Person One') - self.assertEquals(feed_dict['CREATED'], one.getCreationDate().HTML4().replace('-','').replace(':','')) + self.assertEqual(feed_dict['SUMMARY'], 'One') + self.assertEqual(feed_dict['DESCRIPTION'], 'Person One') + self.assertEqual(feed_dict['CREATED'], one.getCreationDate().HTML4().replace('-','').replace(':','')) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testIdTool.py b/product/ERP5/tests/testIdTool.py index dfd57d503a..44616b6f0a 100644 --- a/product/ERP5/tests/testIdTool.py +++ b/product/ERP5/tests/testIdTool.py @@ -113,7 +113,7 @@ class TestIdTool(ERP5TypeTestCase): getLatestVersionValue() last_sql = self.conceptual_sql_generator.getSpecialiseValue().\ getLatestVersionValue() - self.assertEquals(last_sql.getVersion(), '001') + self.assertEqual(last_sql.getVersion(), '001') # Create new id generator with a more higher version sql_generator_2 = self.id_tool.newContent(\ portal_type='SQL Non Continuous Increasing Id Generator', @@ -125,25 +125,25 @@ class TestIdTool(ERP5TypeTestCase): self.portal.portal_caches.clearAllCache() last_sql = self.conceptual_sql_generator.getSpecialiseValue().\ getLatestVersionValue() - self.assertEquals(last_sql.getVersion(), '002') + self.assertEqual(last_sql.getVersion(), '002') def checkGenerateNewId(self, id_generator): """ Check the method generateNewId """ - self.assertEquals(0, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(0, self.id_tool.generateNewId(id_generator=id_generator, id_group='a02')) # Different groups generate different ids - self.assertEquals(0, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(0, self.id_tool.generateNewId(id_generator=id_generator, id_group='b02')) - self.assertEquals(1, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(1, self.id_tool.generateNewId(id_generator=id_generator, id_group='a02')) # With default value - self.assertEquals(0, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(0, self.id_tool.generateNewId(id_generator=id_generator, id_group='c02', default=0)) - self.assertEquals(20, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(20, self.id_tool.generateNewId(id_generator=id_generator, id_group='d02', default=20)) - self.assertEquals(21, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(21, self.id_tool.generateNewId(id_generator=id_generator, id_group='d02', default=3)) def test_02a_generateNewIdWithZODBGenerator(self): @@ -154,7 +154,7 @@ class TestIdTool(ERP5TypeTestCase): # check zodb dict is empty zodb_generator = self.getLastGenerator('test_application_zodb') zodb_portal_type = 'ZODB Continuous Increasing Id Generator' - self.assertEquals(zodb_generator.getPortalType(), zodb_portal_type) + self.assertEqual(zodb_generator.getPortalType(), zodb_portal_type) self.assertEqual(len(zodb_generator.last_id_dict), 0) # generate ids self.checkGenerateNewId('test_application_zodb') @@ -171,12 +171,12 @@ class TestIdTool(ERP5TypeTestCase): # check zodb dict is empty sql_generator = self.getLastGenerator('test_application_sql') sql_portal_type = 'SQL Non Continuous Increasing Id Generator' - self.assertEquals(sql_generator.getPortalType(), sql_portal_type) + self.assertEqual(sql_generator.getPortalType(), sql_portal_type) # This assertEquals() make sure that last_max_id_dict property is empty. # Note that keys(), values() and items() methods of OOBTree do not return # a list of all the items. The methods return a lazy evaluated object. # len() method on OOBTree can handle properly even in the situation. - self.assertEquals(len(sql_generator.last_max_id_dict), 0) + self.assertEqual(len(sql_generator.last_max_id_dict), 0) # retrieve method to recovery the last id in the database last_id_method = getattr(self.portal, 'IdTool_zGetLastId', None) self.assertNotEquals(last_id_method, None) @@ -187,14 +187,14 @@ class TestIdTool(ERP5TypeTestCase): # generate ids self.checkGenerateNewId('test_application_sql') # check last_id in sql - self.assertEquals(last_id_method(id_group='c02')[0]['LAST_INSERT_ID()'], 0) - self.assertEquals(last_id_method(id_group='d02')[0]['LAST_INSERT_ID()'], 21) + self.assertEqual(last_id_method(id_group='c02')[0]['LAST_INSERT_ID()'], 0) + self.assertEqual(last_id_method(id_group='d02')[0]['LAST_INSERT_ID()'], 21) # check zodb dict if store: - self.assertEquals(sql_generator.last_max_id_dict['c02'].value, 0) - self.assertEquals(sql_generator.last_max_id_dict['d02'].value, 21) + self.assertEqual(sql_generator.last_max_id_dict['c02'].value, 0) + self.assertEqual(sql_generator.last_max_id_dict['d02'].value, 21) else: - self.assertEquals(len(sql_generator.last_max_id_dict), 0) + self.assertEqual(len(sql_generator.last_max_id_dict), 0) def test_02b_generateNewIdWithSQLGeneratorWithoutStorageZODB(self): """ @@ -214,23 +214,23 @@ class TestIdTool(ERP5TypeTestCase): """ Check the generateNewIdList """ - self.assertEquals([0], self.id_tool.generateNewIdList(\ + self.assertEqual([0], self.id_tool.generateNewIdList(\ id_generator=id_generator, id_group='a03')) # Different groups generate different ids - self.assertEquals([0, 1], self.id_tool.generateNewIdList(\ + self.assertEqual([0, 1], self.id_tool.generateNewIdList(\ id_generator=id_generator, id_group='b03', id_count=2)) - self.assertEquals([1 ,2, 3], self.id_tool.generateNewIdList(\ + self.assertEqual([1 ,2, 3], self.id_tool.generateNewIdList(\ id_generator=id_generator, id_group='a03', id_count=3)) # With default value - self.assertEquals([0, 1, 2], self.id_tool.generateNewIdList(\ + self.assertEqual([0, 1, 2], self.id_tool.generateNewIdList(\ id_generator=id_generator, id_group='c03', default=0, id_count=3)) - self.assertEquals([20, 21, 22], self.id_tool.generateNewIdList(\ + self.assertEqual([20, 21, 22], self.id_tool.generateNewIdList(\ id_generator=id_generator, id_group='d03', default=20, id_count=3)) - self.assertEquals([23, 24], self.id_tool.generateNewIdList(\ + self.assertEqual([23, 24], self.id_tool.generateNewIdList(\ id_generator=id_generator, id_group='d03', default=3, id_count=2)) @@ -251,16 +251,16 @@ class TestIdTool(ERP5TypeTestCase): Check that the same id_group between the generators is not modified Check the generateNewIdList and generateNewId in the same test """ - self.assertEquals([1, 2, 3], self.id_tool.generateNewIdList( + self.assertEqual([1, 2, 3], self.id_tool.generateNewIdList( id_generator='test_application_zodb', id_group='a04', default=1, id_count=3)) - self.assertEquals(4, self.id_tool.generateNewId( + self.assertEqual(4, self.id_tool.generateNewId( id_generator='test_application_zodb', id_group='a04')) - self.assertEquals(1, self.id_tool.generateNewId( + self.assertEqual(1, self.id_tool.generateNewId( id_generator='test_application_sql', id_group='a04', default=1)) - self.assertEquals([2, 3, 4], self.id_tool.generateNewIdList( + self.assertEqual([2, 3, 4], self.id_tool.generateNewIdList( id_generator='test_application_sql', id_group='a04', id_count=3)) @@ -274,7 +274,7 @@ class TestIdTool(ERP5TypeTestCase): 'mysql_non_continuous_increasing') self.assertTrue(generator is not None) generator.generateNewId(id_group='foo_bar', default=4) - self.assertEquals(generator.last_max_id_dict['foo_bar'].value, 4) + self.assertEqual(generator.last_max_id_dict['foo_bar'].value, 4) portal.IdTool_zDropTable() # make sure to use same connector as IdTool_zDropTable to avoid mariadb : # "Waiting for table metadata lock" @@ -290,12 +290,12 @@ class TestIdTool(ERP5TypeTestCase): Check export import on id generator """ generator = self.getLastGenerator(id_generator) - self.assertEquals(0, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(0, self.id_tool.generateNewId(id_generator=id_generator, id_group='06')) id_dict = generator.exportGeneratorIdDict() - self.assertEquals(0, id_dict['06']) + self.assertEqual(0, id_dict['06']) generator.importGeneratorIdDict(id_dict={'06':6}) - self.assertEquals(7, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(7, self.id_tool.generateNewId(id_generator=id_generator, id_group='06')) def test_06_ExportImportDict(self): @@ -310,20 +310,20 @@ class TestIdTool(ERP5TypeTestCase): Check export clear import on id generator """ generator = self.getLastGenerator(id_generator) - self.assertEquals(0, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(0, self.id_tool.generateNewId(id_generator=id_generator, id_group='07')) id_dict = generator.exportGeneratorIdDict() id_dict_before = dict(id_dict) generator.importGeneratorIdDict(id_dict=id_dict, clear=True) # make sure it is reimported properly - self.assertEquals(id_dict_before, generator.exportGeneratorIdDict()) + self.assertEqual(id_dict_before, generator.exportGeneratorIdDict()) # make sure generating a new id will increment - self.assertEquals(1, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(1, self.id_tool.generateNewId(id_generator=id_generator, id_group='07')) - self.assertEquals(0, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(0, self.id_tool.generateNewId(id_generator=id_generator, id_group='another_group')) # reimport clearing, the group we just use should have been cleared out generator.importGeneratorIdDict(id_dict=id_dict, clear=True) @@ -347,27 +347,27 @@ class TestIdTool(ERP5TypeTestCase): sql_generator.setStoredInZodb(True) sql_generator.setStoreInterval(2) #sql_generator.setStoreInterval(2) - self.assertEquals(0, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(0, self.id_tool.generateNewId(id_generator=id_generator, id_group='07')) - self.assertEquals(sql_generator.last_max_id_dict['07'].value, 0) - self.assertEquals(1, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(sql_generator.last_max_id_dict['07'].value, 0) + self.assertEqual(1, self.id_tool.generateNewId(id_generator=id_generator, id_group='07')) # last_id isn't stored because 1 < last_id (0) + store_interval - self.assertEquals(sql_generator.last_max_id_dict['07'].value, 0) - self.assertEquals(2, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(sql_generator.last_max_id_dict['07'].value, 0) + self.assertEqual(2, self.id_tool.generateNewId(id_generator=id_generator, id_group='07')) - self.assertEquals(sql_generator.last_max_id_dict['07'].value, 2) + self.assertEqual(sql_generator.last_max_id_dict['07'].value, 2) self.getLastGenerator(id_generator).\ importGeneratorIdDict(id_dict = {'07':5}) - self.assertEquals(6, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(6, self.id_tool.generateNewId(id_generator=id_generator, id_group='07')) # last_id stored because 6 < last_id (5) + store_interval - self.assertEquals(sql_generator.last_max_id_dict['07'].value, 5) + self.assertEqual(sql_generator.last_max_id_dict['07'].value, 5) # the sql value is higher that zodb value so the export return the sql # value id_dict = self.getLastGenerator(id_generator).exportGeneratorIdDict() - self.assertEquals(id_dict['07'], 6) + self.assertEqual(id_dict['07'], 6) def test_08_updateLastMaxIdDictFromTable(self): """ @@ -377,28 +377,28 @@ class TestIdTool(ERP5TypeTestCase): id_generator = 'test_application_sql' sql_generator = self.getLastGenerator(id_generator) sql_generator.setStoredInZodb(False) - self.assertEquals(0, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(0, self.id_tool.generateNewId(id_generator=id_generator, id_group='A-08')) - self.assertEquals(1, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(1, self.id_tool.generateNewId(id_generator=id_generator, id_group='A-08')) - self.assertEquals(2, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(2, self.id_tool.generateNewId(id_generator=id_generator, id_group='A-08')) - self.assertEquals(0, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(0, self.id_tool.generateNewId(id_generator=id_generator, id_group='B-08')) - self.assertEquals(1, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(1, self.id_tool.generateNewId(id_generator=id_generator, id_group='B-08')) A_LOT_OF_KEY = 2500 var_id = 'C-%04d' for x in xrange(A_LOT_OF_KEY): - self.assertEquals(0, self.id_tool.generateNewId(id_generator=id_generator, + self.assertEqual(0, self.id_tool.generateNewId(id_generator=id_generator, id_group=var_id % x)) # test before update - self.assertEquals(None, sql_generator.last_max_id_dict.get('A-08')) - self.assertEquals(None, sql_generator.last_max_id_dict.get('B-08')) + self.assertEqual(None, sql_generator.last_max_id_dict.get('A-08')) + self.assertEqual(None, sql_generator.last_max_id_dict.get('B-08')) for x in xrange(A_LOT_OF_KEY): - self.assertEquals(None, sql_generator.last_max_id_dict.get(var_id % x)) + self.assertEqual(None, sql_generator.last_max_id_dict.get(var_id % x)) createZODBPythonScript( self.portal.portal_skins.custom, 'IdTool_updateLastMaxId', @@ -419,10 +419,10 @@ if new_last_id_group is not None: self.tic() # asserts - self.assertEquals(2, sql_generator.last_max_id_dict['A-08'].value) - self.assertEquals(1, sql_generator.last_max_id_dict['B-08'].value) + self.assertEqual(2, sql_generator.last_max_id_dict['A-08'].value) + self.assertEqual(1, sql_generator.last_max_id_dict['B-08'].value) for x in xrange(A_LOT_OF_KEY): - self.assertEquals(0, sql_generator.last_max_id_dict[var_id % x].value) + self.assertEqual(0, sql_generator.last_max_id_dict[var_id % x].value) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testIdToolUpgrade.py b/product/ERP5/tests/testIdToolUpgrade.py index 7d0aad5744..6ba19cf2e6 100644 --- a/product/ERP5/tests/testIdToolUpgrade.py +++ b/product/ERP5/tests/testIdToolUpgrade.py @@ -141,15 +141,15 @@ class TestIdToolUpgrade(ERP5TypeTestCase): template_tool = self.getPortal().portal_templates erp5_core_bt_list = [x for x in template_tool.objectValues() if x.getTitle()=='erp5_core'] - self.assertEquals(len(erp5_core_bt_list), 1) + self.assertEqual(len(erp5_core_bt_list), 1) erp5_core_bt = erp5_core_bt_list[0] erp5_core_bt.setRevision(1561) # Delete all new generators generator_id_list = [x for x in id_tool.objectIds()] id_tool.manage_delObjects(ids=generator_id_list) id_list = id_tool.generateNewLengthIdList(id_group='foo', store=1) - self.assertEquals(id_list, [5]) - self.assertEquals(int(id_tool.dict_length_ids['foo'].value), 6) + self.assertEqual(id_list, [5]) + self.assertEqual(int(id_tool.dict_length_ids['foo'].value), 6) # Now, reinstall erp5_core, and make sure we still have the possibility # to continue generating ids cp_data = template_tool.manage_copyObjects(ids=(erp5_core_bt.getId(),)) @@ -163,31 +163,31 @@ class TestIdToolUpgrade(ERP5TypeTestCase): skin_folder.manage_pasteObjects(cp_data) id_list = id_tool.generateNewLengthIdList(id_group='foo') # it is known that with current upgrade there is a whole - self.assertEquals(id_list, [7]) + self.assertEqual(id_list, [7]) new_id = id_tool.generateNewId(id_group='foo') - self.assertEquals(new_id, 4) + self.assertEqual(new_id, 4) new_id = id_tool.generateNewId(id_group=('bar','baz')) - self.assertEquals(new_id, 3) + self.assertEqual(new_id, 3) # Make sure that the old code is not used any more, so the dic on # id tool should not change, checking for length_dict - self.assertEquals(int(id_tool.dict_length_ids['foo'].value), 6) + self.assertEqual(int(id_tool.dict_length_ids['foo'].value), 6) id_list = id_tool.generateNewLengthIdList(id_group='bar') - self.assertEquals(id_list, [11]) + self.assertEqual(id_list, [11]) generator_list = [x for x in id_tool.objectValues() if x.getReference()=='mysql_non_continuous_increasing'] - self.assertEquals(len(generator_list), 1) + self.assertEqual(len(generator_list), 1) generator = generator_list[0] - self.assertEquals(generator.last_max_id_dict['foo'].value, 7) - self.assertEquals(generator.last_max_id_dict['bar'].value, 11) + self.assertEqual(generator.last_max_id_dict['foo'].value, 7) + self.assertEqual(generator.last_max_id_dict['bar'].value, 11) # Make sure that the old code is not used any more, so the dic on # id tool should not change, checking for dict - self.assertEquals(id_tool.dict_ids['foo'], 3) + self.assertEqual(id_tool.dict_ids['foo'], 3) generator_list = [x for x in id_tool.objectValues() if x.getReference()=='zodb_continuous_increasing'] - self.assertEquals(len(generator_list), 1) + self.assertEqual(len(generator_list), 1) generator = generator_list[0] - self.assertEquals(generator.last_id_dict['foo'], 4) - self.assertEquals(generator.last_id_dict["('bar', 'baz')"], 3) + self.assertEqual(generator.last_id_dict['foo'], 4) + self.assertEqual(generator.last_id_dict["('bar', 'baz')"], 3) def _setUpLastMaxIdDict(self, id_generator_reference): @@ -231,11 +231,11 @@ class TestIdToolUpgrade(ERP5TypeTestCase): def _assertIdGeneratorLastMaxIdDict(self, id_generator): last_id_dict = self._getLastIdDict(id_generator) - self.assertEquals(2, self._getValueFromLastIdDict(last_id_dict, 'A-01')) - self.assertEquals(1, self._getValueFromLastIdDict(last_id_dict, 'B-01')) + self.assertEqual(2, self._getValueFromLastIdDict(last_id_dict, 'A-01')) + self.assertEqual(1, self._getValueFromLastIdDict(last_id_dict, 'B-01')) for x in xrange(self.a_lot_of_key): key = 'C-%04d' % x - self.assertEquals(0, self._getValueFromLastIdDict(last_id_dict, key)) + self.assertEqual(0, self._getValueFromLastIdDict(last_id_dict, key)) # 1(A-01) + 1(B-01) + a_lot_of_key(C-*) number_of_group_id = self.a_lot_of_key + 2 @@ -259,7 +259,7 @@ class TestIdToolUpgrade(ERP5TypeTestCase): } try: portal_type = reference_portal_type_dict[id_generator_reference] - self.assertEquals(id_generator.getPortalType(), portal_type) + self.assertEqual(id_generator.getPortalType(), portal_type) except: raise ValueError("reference is not valid: %s" % id_generator_reference) diff --git a/product/ERP5/tests/testImmobilisation.py b/product/ERP5/tests/testImmobilisation.py index afbc755784..963aed99b6 100644 --- a/product/ERP5/tests/testImmobilisation.py +++ b/product/ERP5/tests/testImmobilisation.py @@ -449,7 +449,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): def stepTestItemValidationState(self, sequence=None, sequence_list=None, **kw): item = self.getItemModule()['item1'] - self.assertEquals(item.getValidationState(), 'exploited') + self.assertEqual(item.getValidationState(), 'exploited') def stepAggregateItems(self, sequence=None, sequence_list=None, **kw): @@ -571,13 +571,13 @@ class TestImmobilisationMixin(ERP5TypeTestCase): self.stepTestPackingListImmobilisationState(pl, "calculating") def stepTestPackingListImmobilisationState(self, pl, state, **kw): - self.assertEquals(pl.getImmobilisationState(), state) + self.assertEqual(pl.getImmobilisationState(), state) def stepTestPackingListSimulationState(self, pl, state, **kw): - self.assertEquals(pl.getSimulationState(), state) + self.assertEqual(pl.getSimulationState(), state) def stepTestPackingListValidationState(self, pl, state, **kw): - self.assertEquals(pl.getValidationState(), state) + self.assertEqual(pl.getValidationState(), state) def stepCreatePackingListsForContinuousAmortisationPeriodList(self, sequence=None, sequence_list=None, **kw): """ @@ -1002,7 +1002,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): for item in self.getItemModule().contentValues(): applied_rule_list = item.getCausalityRelatedValueList() for applied_rule in applied_rule_list: - self.assertEquals(len(applied_rule.contentValues()), 0) + self.assertEqual(len(applied_rule.contentValues()), 0) def stepTestLinearAmortisationImmobilisationPeriods(self, sequence=None, sequence_list=None, **kw): """ @@ -1128,14 +1128,14 @@ class TestImmobilisationMixin(ERP5TypeTestCase): for c_period in c_period_list: #LOG('c_period :', 0, c_period) if e_period_cursor >= len(e_period_list): - self.assertEquals(len(c_period_list), len(e_period_list)) + self.assertEqual(len(c_period_list), len(e_period_list)) e_period = e_period_list[e_period_cursor] #LOG('e_period :', 0, e_period) e_period_cursor += 1 for key in e_period.keys(): e_value = e_period[key] #LOG('testing c_period %s "%s" value' % (e_period_cursor-1, key), 0, '') - self.failUnless(c_period.has_key(key)) + self.assertTrue(c_period.has_key(key)) c_value = c_period[key] is_float = 0 try: @@ -1145,11 +1145,11 @@ class TestImmobilisationMixin(ERP5TypeTestCase): except: pass if is_float: - self.assertEquals(round(c_value,2),e_value) + self.assertEqual(round(c_value,2),e_value) else: - self.assertEquals(c_value,e_value) + self.assertEqual(c_value,e_value) if e_period_cursor != len(e_period_list): - self.assertEquals(len(c_period_list), len(e_period_list)) + self.assertEqual(len(c_period_list), len(e_period_list)) def stepTestLinearAmortisationPriceCalculation(self, sequence=None, sequence_list=None, **kw): @@ -1172,7 +1172,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): c_price = item.getAmortisationPrice(at_date=date) #LOG('testing amortisation price at date', 0, date) #LOG('c_price',0,c_price) - self.assertEquals(round(c_price,2), e_price) + self.assertEqual(round(c_price,2), e_price) """ 09BIS @@ -1196,7 +1196,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): c_price = item.getAmortisationPrice(at_date=date) #LOG('testing amortisation price at date', 0, date) #LOG('c_price',0,c_price) - self.assertEquals(round(c_price,2), e_price) + self.assertEqual(round(c_price,2), e_price) def stepTestDegressiveAmortisationPriceCalculation(self, sequence=None, sequence_list=None, **kw): """ @@ -1217,7 +1217,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): for date, e_price in price_list: c_price = item.getAmortisationPrice(at_date=date) #LOG('testing amortisation price at date', 0, date) - self.assertEquals(round(c_price,2), e_price) + self.assertEqual(round(c_price,2), e_price) def stepTestUncontinuousDegressiveAmortisationPriceCalculation(self, sequence=None, sequence_list=None, **kw): @@ -1239,7 +1239,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): for date, e_price in price_list: c_price = item.getAmortisationPrice(at_date=date) #LOG('testing amortisation price at date', 0, date) - self.assertEquals(round(c_price,2), e_price) + self.assertEqual(round(c_price,2), e_price) def stepTestActualUseAmortisationPriceCalculation(self, sequence=None, sequence_list=None, **kw): @@ -1262,7 +1262,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): for date, e_price in price_list: c_price = item.getAmortisationPrice(at_date=date) #LOG('testing amortisation price at date', 0, date) - self.assertEquals(round(c_price,2), e_price) + self.assertEqual(round(c_price,2), e_price) def stepTestNoAmortisationMethodPriceCalculation(self, sequence=None, sequence_list=None, **kw): @@ -1284,7 +1284,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): for date, e_price in price_list: c_price = item.getAmortisationPrice(at_date=date) #LOG('testing amortisation price at date', 0, date) - self.assertEquals(round(c_price,2), e_price) + self.assertEqual(round(c_price,2), e_price) def _createExpectedMovement(self, date, quantity, source=None, destination=None, @@ -1358,7 +1358,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): '2006/01/01', -1666.67, 'depreciation_account', None, 'A', None)) applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1402,7 +1402,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1487,7 +1487,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1519,7 +1519,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1564,7 +1564,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1607,7 +1607,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1656,7 +1656,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): '2003/01/01', -3333.33, 'depreciation_account', None, 'Ba', None)) applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1709,7 +1709,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1763,7 +1763,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1817,7 +1817,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1854,7 +1854,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1897,7 +1897,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -1947,7 +1947,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -2079,7 +2079,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -2143,7 +2143,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): e_simulation_movement_list.remove(e_found_movement) if len(e_simulation_movement_list) > 0: #LOG('More expected movements than calculated ! Remaining expected ones are', 0, e_simulation_movement_list) - self.assertEquals(len(e_simulation_movement_list),0) + self.assertEqual(len(e_simulation_movement_list),0) def _buildExpectedTransaction(self, date, source_section, destination_section, causality_state, causality_list=[]): self.id_transaction+=1 @@ -2322,7 +2322,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -2384,7 +2384,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -2449,7 +2449,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -2726,7 +2726,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -2777,7 +2777,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -2828,7 +2828,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -2863,7 +2863,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) @@ -2915,14 +2915,14 @@ class TestImmobilisationMixin(ERP5TypeTestCase): applied_rule_list = item.getCausalityRelatedValueList(portal_type='Applied Rule') #LOG('Check number of applied rules for item', 0, item.getRelativeUrl()) - self.assertEquals(len(applied_rule_list),1) + self.assertEqual(len(applied_rule_list),1) applied_rule = applied_rule_list[0] c_simulation_movement_list = applied_rule.contentValues() self._testSimulationBuild(c_simulation_movement_list, e_simulation_movement_list) def _testAccountingBuild(self, c_transaction_list, e_transaction_list): - self.assertEquals(len(c_transaction_list), len(e_transaction_list)) + self.assertEqual(len(c_transaction_list), len(e_transaction_list)) e_removed_list = [] for c_transaction in c_transaction_list: #LOG('c_transaction %s :' % c_transaction, 0, @@ -2973,7 +2973,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): e_cursor += 1 if e_found_transaction is None: #LOG('No expected transaction found for this calculated one !',0,'') - self.failUnless(e_found_transaction is not None) + self.assertTrue(e_found_transaction is not None) #e_transaction_list.remove(e_transaction) e_removed_list.append(e_transaction_list.pop(e_transaction_list.index(e_transaction))) e_line_list = e_transaction['line_list'] @@ -3024,10 +3024,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase): pprint.pformat(e_line_list))) e_line_list.remove(e_found_line) if len(e_line_list) > 0: - self.assertEquals(len(e_line_list),0) + self.assertEqual(len(e_line_list),0) if len(e_transaction_list) > 0: - self.assertEquals(len(e_transaction_list),0) + self.assertEqual(len(e_transaction_list),0) class TestImmobilisation(TestImmobilisationMixin): @@ -3613,17 +3613,17 @@ class TestImmobilisation(TestImmobilisationMixin): self.tic() # Now we can check several Accounting methods account = self.getPortal().account_module.account3 - self.assertEquals(10000.0,account.AccountModule_getTotalSourceDebit(brain=account)) - self.assertEquals(10000.0,account.AccountModule_getTotalSourceCredit(brain=account)) + self.assertEqual(10000.0,account.AccountModule_getTotalSourceDebit(brain=account)) + self.assertEqual(10000.0,account.AccountModule_getTotalSourceCredit(brain=account)) preference.edit(preferred_accounting_transaction_section_category=\ 'group/group B') self.tic() - self.assertEquals('group/group B', + self.assertEqual('group/group B', preference_tool.getPreferredAccountingTransactionSectionCategory()) # Make sure to not use the cache self.portal.REQUEST['ERP5Accounting_getParams'] = None - self.assertEquals(5000.0,account.AccountModule_getTotalSourceDebit(brain=account)) - self.assertEquals(0.0,account.AccountModule_getTotalSourceCredit(brain=account)) + self.assertEqual(5000.0,account.AccountModule_getTotalSourceDebit(brain=account)) + self.assertEqual(0.0,account.AccountModule_getTotalSourceCredit(brain=account)) def test_19_TestAccountingBuildingAndDivergence(self, quiet=0, run=run_all_test): if not run: return diff --git a/product/ERP5/tests/testIntrospectionTool.py b/product/ERP5/tests/testIntrospectionTool.py index 20a6684a51..6c1a102276 100644 --- a/product/ERP5/tests/testIntrospectionTool.py +++ b/product/ERP5/tests/testIntrospectionTool.py @@ -61,7 +61,7 @@ class TestIntrospectionTool(ERP5TypeTestCase): self.assertSameSet(signature_by_json.keys(), signature.keys()) for key in signature: - self.assertEquals(signature[key], signature_by_json[key]) + self.assertEqual(signature[key], signature_by_json[key]) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testInventory.py b/product/ERP5/tests/testInventory.py index 2e4ff68a27..24918d9744 100644 --- a/product/ERP5/tests/testInventory.py +++ b/product/ERP5/tests/testInventory.py @@ -282,7 +282,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): section = sequence.get('section').getRelativeUrl(), node = sequence.get('node').getRelativeUrl(), ) - self.assertEquals(inventory, 100., + self.assertEqual(inventory, 100., 'section=%s, node=%s' % ( sequence.get('section').getRelativeUrl(), sequence.get('node').getRelativeUrl())) @@ -292,7 +292,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): section = sequence.get('section').getRelativeUrl(), node = sequence.get('node').getRelativeUrl(), ) - self.assertEquals(inventory, 101., + self.assertEqual(inventory, 101., 'section=%s, node=%s' % ( sequence.get('section').getRelativeUrl(), sequence.get('node').getRelativeUrl())) @@ -693,7 +693,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): if len(c.split('/')) == 1: variation[i] = '%s/%s' % (base_category_list[i], resource_value[c].getRelativeUrl()) new_variation = [] - self.failUnless(len(packing_list_line.getVariationBaseCategoryList())>0) + self.assertTrue(len(packing_list_line.getVariationBaseCategoryList())>0) for bc in packing_list_line.getVariationBaseCategoryList(): new_variation.append(variation[base_category_dict[bc]]) variation = new_variation @@ -959,9 +959,9 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): inventory_object = inventory.getObject() if inventory_object.getUid()==uid: found=1 - self.assertEquals(inventory_object.getQuantity(), 0.5) - self.assertEquals(inventory.getQuantity(), 0.5) - self.failUnless(found==1) + self.assertEqual(inventory_object.getQuantity(), 0.5) + self.assertEqual(inventory.getQuantity(), 0.5) + self.assertTrue(found==1) @@ -1230,7 +1230,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): % (repr(e_inventory), repr(a_inventory)) LOG('TestInventory._testGetInventory', 0, msg) LOG('SQL Query was : ', 0, str(simulation.getInventory(src__=1, **kw))) - self.assertEquals(e_inventory, a_inventory, msg) + self.assertEqual(e_inventory, a_inventory, msg) def stepTestGetInventoryOnSimulationState(self, sequence=None, @@ -1309,7 +1309,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): if method is None: LOG('TEST ERROR : Simulation Tool has no %s method' % method_name, 0, '') - self.failUnless(0) + self.assertTrue(0) a_inventory = method(section=organisation_url, omit_transit=omit_transit, transit_simulation_state=transit_simulation_state, @@ -1320,7 +1320,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): omit_transit=omit_transit, transit_simulation_state=transit_simulation_state, at_date=date, src__=1)) - self.assertEquals(a_inventory, e_inventory) + self.assertEqual(a_inventory, e_inventory) # First, test with draft state everywhere LOG('Testing Inventory with every Packing List in draft state...', 0, '') @@ -1707,7 +1707,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): if not hasattr(inventory, attr): LOG('TEST ERROR : Result of getInventoryList has no %s attribute' % attr, 0, '') LOG('SQL Query was : ', 0, repr(simulation.getInventoryList(src__=1, **kw))) - self.failUnless(0) + self.assertTrue(0) a_attributes[attr] = getattr(inventory, attr) a_inventory = inventory.inventory # Build a function to filter on attributes @@ -1736,7 +1736,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): if len(expected) > 0: LOG('TEST ERROR : Not all expected values were matched. Remaining =', 0, expected) LOG('SQL Query was : ', 0, str(simulation.getInventoryList(src__=1, **kw))) - self.failUnless(len(expected), 0) + self.assertTrue(len(expected), 0) def stepTestGetNextNegativeInventoryDate(self, sequence=None, sequence_list=None, **kw): @@ -1855,7 +1855,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): resource=resource_value.getRelativeUrl(), node=organisation_list[node].getRelativeUrl(), variation_category=variation_categories, src__=1)) - self.assertEquals(next_date, expected_negative_date) + self.assertEqual(next_date, expected_negative_date) def checkVariatedInventory(self, sequence=None, sequence_list=None, @@ -1873,7 +1873,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): node = sequence.get('node').getRelativeUrl(), variation_text = variation_text ) - self.assertEquals(inventory, quantity) + self.assertEqual(inventory, quantity) def stepTestInitialVariatedInventory(self, sequence=None, sequence_list=None, **kw): """ @@ -1953,7 +1953,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): section = sequence.get('section').getRelativeUrl(), node = sequence.get('node').getRelativeUrl(), ) - self.assertEquals(inventory, 101., + self.assertEqual(inventory, 101., 'section=%s, node=%s' % ( sequence.get('section').getRelativeUrl(), sequence.get('node').getRelativeUrl())) @@ -1973,7 +1973,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): node=sequence.get('node').getRelativeUrl(), at_date=inventory_list[expected[step][1]].getStartDate() ) - self.assertEquals(inventory, expected[step][0], + self.assertEqual(inventory, expected[step][0], 'section=%s, node=%s' % ( sequence.get('section').getRelativeUrl(), sequence.get('node').getRelativeUrl())) @@ -1993,7 +1993,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): section = sequence.get('section').getRelativeUrl(), node = sequence.get('node').getRelativeUrl(), ) - self.assertEquals(inventory, 0., + self.assertEqual(inventory, 0., 'section=%s, node=%s' % ( sequence.get('section').getRelativeUrl(), sequence.get('node').getRelativeUrl())) @@ -2003,7 +2003,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): section = sequence.get('section').getRelativeUrl(), node = sequence.get('node').getRelativeUrl(), ) - self.assertEquals(inventory, 101., + self.assertEqual(inventory, 101., 'section=%s, node=%s' % ( sequence.get('section').getRelativeUrl(), sequence.get('node').getRelativeUrl())) @@ -2088,19 +2088,19 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): node = sequence.get('node') section = sequence.get('section') getInventory = self.getSimulationTool().getInventory - self.assertEquals(10, getInventory(section_uid=section.getUid(), + self.assertEqual(10, getInventory(section_uid=section.getUid(), node_uid=node.getUid(), resource_category='product_line/level1', optimisation__=False)) - self.assertEquals(10, getInventory(section_uid=section.getUid(), + self.assertEqual(10, getInventory(section_uid=section.getUid(), node_uid=node.getUid(), resource_category='product_line/level1', optimisation__=True)) - self.assertEquals(100, getInventory(section_uid=section.getUid(), + self.assertEqual(100, getInventory(section_uid=section.getUid(), node_uid=node.getUid(), resource_category='product_line/apparel', optimisation__=False)) - self.assertEquals(100, getInventory(section_uid=section.getUid(), + self.assertEqual(100, getInventory(section_uid=section.getUid(), node_uid=node.getUid(), resource_category='product_line/apparel', optimisation__=True)) @@ -2159,11 +2159,11 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): node = sequence.get('node') section = sequence.get('section') getInventory = self.getSimulationTool().getInventory - self.assertEquals(202, getInventory(node_uid=node.getUid())) - self.assertEquals(101, getInventory(section_category='group/level1/level2', + self.assertEqual(202, getInventory(node_uid=node.getUid())) + self.assertEqual(101, getInventory(section_category='group/level1/level2', node_uid=node.getUid(), optimisation__=False)) - self.assertEquals(101, getInventory(node_uid=node.getUid(), + self.assertEqual(101, getInventory(node_uid=node.getUid(), section_category='group/level1/level2', optimisation__=True)) @@ -2190,11 +2190,11 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): node = sequence.get('node') section = sequence.get('section') getInventory = self.getSimulationTool().getInventory - self.assertEquals(202, getInventory(section_uid=section.getUid())) - self.assertEquals(101, getInventory(section_uid=section.getUid(), + self.assertEqual(202, getInventory(section_uid=section.getUid())) + self.assertEqual(101, getInventory(section_uid=section.getUid(), node_category='region/level1/level2', optimisation__=False)) - self.assertEquals(101, getInventory(section_uid=section.getUid(), + self.assertEqual(101, getInventory(section_uid=section.getUid(), node_category='region/level1/level2', optimisation__=True)) @@ -2381,12 +2381,12 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): # Note: Now only checking total_quantity but can be checked more actual_history = [{'total_quantity':x.total_quantity} for x in result] try: - self.assertEquals(len(expected_history), len(actual_history)) + self.assertEqual(len(expected_history), len(actual_history)) for expected, actual in zip(expected_history, actual_history): shared_keys = set(expected.keys()) & set(actual.keys()) - self.assertEquals(len(shared_keys), len(expected.keys())) + self.assertEqual(len(shared_keys), len(expected.keys())) shared_item = set(expected.items()) & set(actual.items()) - self.assertEquals(len(shared_item), len(expected.keys())) + self.assertEqual(len(shared_item), len(expected.keys())) except AssertionError: msg = 'History differs between expected:\n%s\nand real:\n%s'\ % (repr(expected_history), repr(actual_history)) diff --git a/product/ERP5/tests/testInventoryAPI.py b/product/ERP5/tests/testInventoryAPI.py index b9041f90aa..3c0e34308b 100644 --- a/product/ERP5/tests/testInventoryAPI.py +++ b/product/ERP5/tests/testInventoryAPI.py @@ -267,14 +267,14 @@ class TestInventory(InventoryAPITestCase): """Tests getInventory methods. """ def assertInventoryEquals(self, value, **inventory_kw): - self.assertEquals(value, self.getInventory(**inventory_kw)) + self.assertEqual(value, self.getInventory(**inventory_kw)) def testReturnedTypeIsFloat(self): """getInventory returns a float""" inventory = self.getInventory() - self.assertEquals(type(inventory), type(0.1)) + self.assertEqual(type(inventory), type(0.1)) # default is 0 - self.assertEquals(0, inventory) + self.assertEqual(0, inventory) def test_SimulationMovement(self): """Test Simulation Movements works in this testing environnement. @@ -291,10 +291,10 @@ class TestInventory(InventoryAPITestCase): sim_mvt = self._makeSimulationMovement(quantity=2) mvt = self._makeMovement(quantity=3) # simulation movement are accountable, - self.failUnless(sim_mvt.isAccountable()) + self.assertTrue(sim_mvt.isAccountable()) # unless connected to a delivery movement sim_mvt.setDeliveryValue(mvt) - self.failIf(sim_mvt.isAccountable()) + self.assertFalse(sim_mvt.isAccountable()) # not accountable movement are not counted by getInventory self.tic() # (after reindexing of course) self.assertInventoryEquals(3, section_uid=self.section.getUid()) @@ -678,7 +678,7 @@ class TestInventory(InventoryAPITestCase): for i in range(10): self._makeMovement( quantity=-0.1, price=1 ) self.assertInventoryEquals(0, precision=2, node_uid=self.node.getUid()) - self.assertEquals(0, getInventoryAssetPrice(precision=2, + self.assertEqual(0, getInventoryAssetPrice(precision=2, node_uid=self.node.getUid())) def test_OmitInputOmitOutput(self): @@ -776,9 +776,9 @@ class TestInventory(InventoryAPITestCase): def test_OmitInputOmitOutputWithZeroQuantity(self): self._makeMovement(quantity=0, destination_total_asset_price=1) getInventoryAssetPrice = self.portal.portal_simulation.getInventoryAssetPrice - self.assertEquals(0, getInventoryAssetPrice(node_uid=self.node.getUid(), + self.assertEqual(0, getInventoryAssetPrice(node_uid=self.node.getUid(), omit_input=1)) - self.assertEquals(1, getInventoryAssetPrice(node_uid=self.node.getUid(), + self.assertEqual(1, getInventoryAssetPrice(node_uid=self.node.getUid(), omit_output=1)) def test_OmitAssetIncreaseDecreaseWithZeroPrice(self): @@ -811,22 +811,22 @@ class TestInventoryList(InventoryAPITestCase): """Inventory List returns a sequence object""" getInventoryList = self.getSimulationTool().getInventoryList inventory_list = getInventoryList() - self.assertEquals(str(inventory_list.__class__), + self.assertEqual(str(inventory_list.__class__), 'Shared.DC.ZRDB.Results.Results') # the brain is InventoryListBrain self.assert_('InventoryListBrain' in [c.__name__ for c in inventory_list._class.__bases__]) # default is an empty list - self.assertEquals(0, len(inventory_list)) + self.assertEqual(0, len(inventory_list)) def testDefault0(self): getInventoryList = self.getSimulationTool().getInventoryList self._makeMovement() inventory_list = getInventoryList(section_uid=self.section.getUid(),) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(0, inventory_list[0].total_quantity) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(0, inventory_list[0].total_quantity) # The total price of grouped movements without price is 0 - self.assertEquals(0, inventory_list[0].total_price) + self.assertEqual(0, inventory_list[0].total_price) def test_GroupByNode(self): getInventoryList = self.getSimulationTool().getInventoryList @@ -834,12 +834,12 @@ class TestInventoryList(InventoryAPITestCase): self._makeMovement(destination_value=self.other_node, quantity=100) self._makeMovement(destination_value=None, quantity=100) inventory_list = getInventoryList(group_by_node=1) - self.assertEquals(3, len(inventory_list)) - self.assertEquals([r for r in inventory_list if r.node_relative_url == + self.assertEqual(3, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.node_relative_url == self.node.getRelativeUrl()][0].inventory, 100) - self.assertEquals([r for r in inventory_list if r.node_relative_url == + self.assertEqual([r for r in inventory_list if r.node_relative_url == self.other_node.getRelativeUrl()][0].inventory, 100) - self.assertEquals([r for r in inventory_list if r.node_relative_url == + self.assertEqual([r for r in inventory_list if r.node_relative_url == self.mirror_node.getRelativeUrl()][0].inventory, -300) def test_GroupByMirrorNode(self): @@ -849,12 +849,12 @@ class TestInventoryList(InventoryAPITestCase): self._makeMovement(source_value=None, quantity=100) inventory_list = getInventoryList(section_uid=self.section.getUid(), group_by_mirror_node=1) - self.assertEquals(3, len(inventory_list)) - self.assertEquals([r for r in inventory_list if r.mirror_node_uid == + self.assertEqual(3, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.mirror_node_uid == self.mirror_node.getUid()][0].inventory, 100) - self.assertEquals([r for r in inventory_list if r.mirror_node_uid == + self.assertEqual([r for r in inventory_list if r.mirror_node_uid == self.other_node.getUid()][0].inventory, 100) - self.assertEquals([r for r in inventory_list + self.assertEqual([r for r in inventory_list if r.mirror_node_uid is None][0].inventory, 100) def test_GroupBySection(self): @@ -864,12 +864,12 @@ class TestInventoryList(InventoryAPITestCase): self._makeMovement(destination_section_value=None, quantity=100) inventory_list = getInventoryList(node_uid=self.node.getUid(), group_by_section=1) - self.assertEquals(3, len(inventory_list)) - self.assertEquals([r for r in inventory_list if r.section_relative_url == + self.assertEqual(3, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.section_relative_url == self.section.getRelativeUrl()][0].inventory, 100) - self.assertEquals([r for r in inventory_list if r.section_relative_url == + self.assertEqual([r for r in inventory_list if r.section_relative_url == self.other_node.getRelativeUrl()][0].inventory, 100) - self.assertEquals([r for r in inventory_list if r.section_relative_url is + self.assertEqual([r for r in inventory_list if r.section_relative_url is None][0].inventory, 100) def test_GroupBySectionCategory(self): @@ -882,11 +882,11 @@ class TestInventoryList(InventoryAPITestCase): inventory_list = getInventoryList(node_uid=self.node.getUid(), section_category='group/level1', group_by_section_category=1) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(3+2, inventory_list[0].inventory) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(3+2, inventory_list[0].inventory) # section category is exported in the brain self.assertTrue(hasattr(inventory_list[0], 'section_category_uid')) - self.assertEquals(self.portal.portal_categories.group.level1.getUid(), + self.assertEqual(self.portal.portal_categories.group.level1.getUid(), inventory_list[0].section_category_uid) def test_GroupBySectionCategoryStrict(self): @@ -899,12 +899,12 @@ class TestInventoryList(InventoryAPITestCase): inventory_list = getInventoryList(node_uid=self.node.getUid(), section_category='group/level1', group_by_section_category_strict_membership=1) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(3+2, inventory_list[0].inventory) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(3+2, inventory_list[0].inventory) # section category is exported in the brain self.assertTrue(hasattr(inventory_list[0], 'section_category_strict_membership_uid')) - self.assertEquals(self.portal.portal_categories.group.level1.getUid(), + self.assertEqual(self.portal.portal_categories.group.level1.getUid(), inventory_list[0].section_category_strict_membership_uid) def test_GroupByFunction(self): @@ -920,10 +920,10 @@ class TestInventoryList(InventoryAPITestCase): inventory_list = getInventoryList(node_uid=self.node.getUid(), group_by_function=1) - self.assertEquals(2, len(inventory_list)) - self.assertEquals([r for r in inventory_list if r.function_uid == + self.assertEqual(2, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.function_uid == function1.getUid()][0].inventory, 2) - self.assertEquals([r for r in inventory_list if r.function_uid == + self.assertEqual([r for r in inventory_list if r.function_uid == function2.getUid()][0].inventory, 3) def test_GroupByFunding(self): @@ -939,10 +939,10 @@ class TestInventoryList(InventoryAPITestCase): inventory_list = getInventoryList(node_uid=self.node.getUid(), group_by_funding=1) - self.assertEquals(2, len(inventory_list)) - self.assertEquals([r for r in inventory_list if r.funding_uid == + self.assertEqual(2, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.funding_uid == funding1.getUid()][0].inventory, 2) - self.assertEquals([r for r in inventory_list if r.funding_uid == + self.assertEqual([r for r in inventory_list if r.funding_uid == funding2.getUid()][0].inventory, 3) def test_GroupByPaymentRequest(self): @@ -958,10 +958,10 @@ class TestInventoryList(InventoryAPITestCase): inventory_list = getInventoryList(node_uid=self.node.getUid(), group_by_payment_request=1) - self.assertEquals(2, len(inventory_list)) - self.assertEquals([r for r in inventory_list if r.payment_request_uid == + self.assertEqual(2, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.payment_request_uid == payment_request1.getUid()][0].inventory, 2) - self.assertEquals([r for r in inventory_list if r.payment_request_uid == + self.assertEqual([r for r in inventory_list if r.payment_request_uid == payment_request2.getUid()][0].inventory, 3) def test_GroupByProject(self): @@ -973,10 +973,10 @@ class TestInventoryList(InventoryAPITestCase): inventory_list = getInventoryList(node_uid=self.node.getUid(), group_by_project=1) - self.assertEquals(2, len(inventory_list)) - self.assertEquals([r for r in inventory_list if r.project_uid == + self.assertEqual(2, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.project_uid == self.project.getUid()][0].inventory, 2) - self.assertEquals([r for r in inventory_list if r.project_uid == + self.assertEqual([r for r in inventory_list if r.project_uid == self.other_project.getUid()][0].inventory, 3) def test_GroupByResource(self): @@ -986,17 +986,17 @@ class TestInventoryList(InventoryAPITestCase): # group_by_resource is implicit when grouping by something ... inventory_list = getInventoryList(node_uid=self.node.getUid(), group_by_node=1) - self.assertEquals(2, len(inventory_list)) - self.assertEquals([r for r in inventory_list if r.resource_relative_url == + self.assertEqual(2, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.resource_relative_url == self.resource.getRelativeUrl()][0].inventory, 100) - self.assertEquals([r for r in inventory_list if r.resource_relative_url == + self.assertEqual([r for r in inventory_list if r.resource_relative_url == self.other_resource.getRelativeUrl()][0].inventory, 100) # ... but can be disabled inventory_list = getInventoryList(node_uid=self.node.getUid(), group_by_node=1, group_by_resource=0) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(inventory_list[0].inventory, 200) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(inventory_list[0].inventory, 200) def test_GroupByPayment(self): getInventoryList = self.getSimulationTool().getInventoryList @@ -1005,10 +1005,10 @@ class TestInventoryList(InventoryAPITestCase): quantity=200) inventory_list = getInventoryList(node_uid=self.node.getUid(), group_by_node=1, group_by_payment=1) - self.assertEquals(2, len(inventory_list)) - self.assertEquals([r for r in inventory_list if r.payment_uid is + self.assertEqual(2, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.payment_uid is None][0].inventory, 100) - self.assertEquals([r for r in inventory_list if r.payment_uid == + self.assertEqual([r for r in inventory_list if r.payment_uid == self.payment_node.getUid()][0].inventory, 200) def test_GroupByDate(self): @@ -1019,10 +1019,10 @@ class TestInventoryList(InventoryAPITestCase): self._makeMovement(quantity=1, start_date=DateTime('2001/1/1 12:00 UTC')) inventory_list = getInventoryList(node_uid=self.node.getUid(), group_by_date=1) - self.assertEquals(2, len(inventory_list)) - self.assertEquals([r for r in inventory_list + self.assertEqual(2, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.date.year() == 2000][0].inventory, 2) - self.assertEquals([r for r in inventory_list + self.assertEqual([r for r in inventory_list if r.date.year() == 2001][0].inventory, 1) def test_GroupByRelatedKey(self): @@ -1037,10 +1037,10 @@ class TestInventoryList(InventoryAPITestCase): inventory_list = getInventoryList(node_uid=(self.node.getUid(), self.other_node.getUid()), group_by=('strict_use_uid', )) - self.assertEquals(2, len(inventory_list)) - self.assertEquals([r for r in inventory_list + self.assertEqual(2, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.getObject().getUse() == 'use1'][0].inventory, 5) - self.assertEquals([r for r in inventory_list + self.assertEqual([r for r in inventory_list if r.getObject().getUse() == 'use2'][0].inventory, 11) # in such case, it's interesting to pass a select expression, to be have on @@ -1049,22 +1049,22 @@ class TestInventoryList(InventoryAPITestCase): self.other_node.getUid()), group_by=('strict_use_uid', ), select_list=['strict_use_uid']) - self.assertEquals(2, len(inventory_list)) + self.assertEqual(2, len(inventory_list)) self.assertTrue(hasattr(inventory_list[0], 'strict_use_uid')) use = self.portal.portal_categories.use - self.assertEquals([r for r in inventory_list + self.assertEqual([r for r in inventory_list if r.strict_use_uid == use.use1.getUid()][0].inventory, 5) - self.assertEquals([r for r in inventory_list + self.assertEqual([r for r in inventory_list if r.strict_use_uid == use.use2.getUid()][0].inventory, 11) # group_by can also be passed as string inventory_list = getInventoryList(node_uid=(self.node.getUid(), self.other_node.getUid()), group_by='strict_use_uid', ) - self.assertEquals(2, len(inventory_list)) - self.assertEquals([r for r in inventory_list + self.assertEqual(2, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.getObject().getUse() == 'use1'][0].inventory, 5) - self.assertEquals([r for r in inventory_list + self.assertEqual([r for r in inventory_list if r.getObject().getUse() == 'use2'][0].inventory, 11) # if we group by "use_uid" instead of "strict_use_uid", then we'll have @@ -1073,40 +1073,40 @@ class TestInventoryList(InventoryAPITestCase): self.other_node.getUid()), group_by=('use_uid', ), select_list=['use_uid']) - self.assertEquals(3, len(inventory_list)) + self.assertEqual(3, len(inventory_list)) self.assertTrue(hasattr(inventory_list[0], 'use_uid')) use = self.portal.portal_categories.use - self.assertEquals([r for r in inventory_list + self.assertEqual([r for r in inventory_list if r.use_uid == use.use1.getUid()][0].inventory, 5) - self.assertEquals([r for r in inventory_list + self.assertEqual([r for r in inventory_list if r.use_uid == use.use2.getUid()][0].inventory, 11) # the summary line - self.assertEquals([r for r in inventory_list + self.assertEqual([r for r in inventory_list if r.use_uid == use.getUid()][0].inventory, 11+5) # the name of a column can also be used, from stock or other tables inventory_list = getInventoryList(node_uid=(self.node.getUid(), self.other_node.getUid()), group_by='node_uid', ) - self.assertEquals(2, len(inventory_list)) + self.assertEqual(2, len(inventory_list)) inventory_list = getInventoryList(node_uid=(self.node.getUid(), self.other_node.getUid()), group_by='title', ) - self.assertEquals(4, len(inventory_list)) + self.assertEqual(4, len(inventory_list)) # group_by= can be mixed with group_by_* arguments inventory_list = getInventoryList(node_uid=(self.node.getUid(), self.other_node.getUid()), group_by_node=True, group_by=('strict_use_uid',)) - self.assertEquals(3, len(inventory_list)) - self.assertEquals([r for r in inventory_list + self.assertEqual(3, len(inventory_list)) + self.assertEqual([r for r in inventory_list if r.getObject().getUse() == 'use1' and r.node_uid == self.node.getUid()][0].inventory, 2) - self.assertEquals([r for r in inventory_list + self.assertEqual([r for r in inventory_list if r.getObject().getUse() == 'use1' and r.node_uid == self.other_node.getUid()][0].inventory, 3) - self.assertEquals([r for r in inventory_list + self.assertEqual([r for r in inventory_list if r.getObject().getUse() == 'use2'][0].inventory, 11) def test_OmitInputOmitOutput(self): @@ -1116,19 +1116,19 @@ class TestInventoryList(InventoryAPITestCase): # omit input ignores movement comming to this node inventory_list = getInventoryList(node_uid=self.node.getUid(), omit_input=1) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(-1, inventory_list[0].total_price) - self.assertEquals(-1, inventory_list[0].total_quantity) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(-1, inventory_list[0].total_price) + self.assertEqual(-1, inventory_list[0].total_quantity) # omit output ignores movement going to this node inventory_list = getInventoryList(node_uid=self.node.getUid(), omit_output=1) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(1, inventory_list[0].total_price) - self.assertEquals(1, inventory_list[0].total_quantity) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(1, inventory_list[0].total_price) + self.assertEqual(1, inventory_list[0].total_quantity) # omit_output & omit_input return nothing in that case - self.assertEquals(0, len(getInventoryList(node_uid=self.node.getUid(), + self.assertEqual(0, len(getInventoryList(node_uid=self.node.getUid(), omit_input=1, omit_output=1))) @@ -1139,44 +1139,44 @@ class TestInventoryList(InventoryAPITestCase): # omit movements that increases the asset inventory_list = getInventoryList(node_uid=self.node.getUid(), omit_asset_increase=1) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(-1, inventory_list[0].total_price) - self.assertEquals(-1, inventory_list[0].total_quantity) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(-1, inventory_list[0].total_price) + self.assertEqual(-1, inventory_list[0].total_quantity) # omit movements that decrease the asset inventory_list = getInventoryList(node_uid=self.node.getUid(), omit_asset_decrease=1) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(1, inventory_list[0].total_price) - self.assertEquals(1, inventory_list[0].total_quantity) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(1, inventory_list[0].total_price) + self.assertEqual(1, inventory_list[0].total_quantity) # omit_asset_increase and omit_asset_decrease return nothing in that case - self.assertEquals(0, len(getInventoryList(node_uid=self.node.getUid(), + self.assertEqual(0, len(getInventoryList(node_uid=self.node.getUid(), omit_asset_increase=1, omit_asset_decrease=1))) # so far, it works the same as omit_input & omit_output, but if we have # negative prices, we see the interest of such feature m1.setPrice(-1) - self.assertEquals(-1, m1.getTotalPrice()) + self.assertEqual(-1, m1.getTotalPrice()) m2.setPrice(-1) - self.assertEquals(1, m2.getTotalPrice()) + self.assertEqual(1, m2.getTotalPrice()) self.tic() inventory_list = getInventoryList(node_uid=self.node.getUid(), omit_asset_increase=1) - self.assertEquals(1, len(inventory_list)) + self.assertEqual(1, len(inventory_list)) # this is m1 - self.assertEquals(-1, inventory_list[0].total_price) - self.assertEquals(1, inventory_list[0].total_quantity) + self.assertEqual(-1, inventory_list[0].total_price) + self.assertEqual(1, inventory_list[0].total_quantity) inventory_list = getInventoryList(node_uid=self.node.getUid(), omit_asset_decrease=1) - self.assertEquals(1, len(inventory_list)) + self.assertEqual(1, len(inventory_list)) # this is m2 - self.assertEquals(1, inventory_list[0].total_price) - self.assertEquals(-1, inventory_list[0].total_quantity) + self.assertEqual(1, inventory_list[0].total_price) + self.assertEqual(-1, inventory_list[0].total_quantity) def test_OmitInputOmitOutputWithDifferentPaymentSameNodeSameSection(self): @@ -1192,17 +1192,17 @@ class TestInventoryList(InventoryAPITestCase): section_uid=self.section.getUid(), payment_uid=self.payment_node.getUid(), omit_output=1) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(2, inventory_list[0].total_price) - self.assertEquals(2, inventory_list[0].total_quantity) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(2, inventory_list[0].total_price) + self.assertEqual(2, inventory_list[0].total_quantity) inventory_list = getInventoryList(node_uid=self.node.getUid(), section_uid=self.section.getUid(), payment_uid=self.other_payment_node.getUid(), omit_input=1) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(-2, inventory_list[0].total_price) - self.assertEquals(-2, inventory_list[0].total_quantity) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(-2, inventory_list[0].total_price) + self.assertEqual(-2, inventory_list[0].total_quantity) def test_OmitInputOmitOutputCancellationAmount(self): getInventoryList = self.getSimulationTool().getInventoryList @@ -1211,16 +1211,16 @@ class TestInventoryList(InventoryAPITestCase): inventory_list = getInventoryList(node_uid=self.node.getUid(), omit_input=1) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(2, inventory_list[0].total_price) - self.assertEquals(2, inventory_list[0].total_quantity) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(2, inventory_list[0].total_price) + self.assertEqual(2, inventory_list[0].total_quantity) # omit output ignores movement going to this node inventory_list = getInventoryList(node_uid=self.node.getUid(), omit_output=1) - self.assertEquals(1, len(inventory_list)) - self.assertEquals(-1, inventory_list[0].total_price) - self.assertEquals(-1, inventory_list[0].total_quantity) + self.assertEqual(1, len(inventory_list)) + self.assertEqual(-1, inventory_list[0].total_price) + self.assertEqual(-1, inventory_list[0].total_quantity) def test_CurentAvailableFutureInventoryList(self): def makeMovement(simulation_state=None, quantity=None): @@ -1239,9 +1239,9 @@ class TestInventoryList(InventoryAPITestCase): if destination: node_uid = self.other_node.getUid() inventory_list = method(node_uid=node_uid) - self.assertEquals(len(inventory_list), line) + self.assertEqual(len(inventory_list), line) if quantity is not None: - self.assertEquals(sum([x.total_quantity for x in inventory_list]), + self.assertEqual(sum([x.total_quantity for x in inventory_list]), quantity) makeMovement(quantity=1, simulation_state='ordered') checkInventory(line=0, type='Current', destination=1) @@ -1296,9 +1296,9 @@ class TestInventoryList(InventoryAPITestCase): return round(r) - self.assertEquals(7895, valuate("MovingAverage")) - self.assertEquals(7200, valuate("Filo")) - self.assertEquals(8600, valuate("Fifo")) + self.assertEqual(7895, valuate("MovingAverage")) + self.assertEqual(7200, valuate("Filo")) + self.assertEqual(8600, valuate("Fifo")) def test_weighted_average_asset_price(self): def h(quantity, total_price): @@ -1367,7 +1367,7 @@ class TestInventoryList(InventoryAPITestCase): resource_uid=resource.getUid(), node_uid=self.node.getUid()) self.assertTrue(result is not None) - self.assertEquals(data[cur]['after']['total_price'], round(result)) + self.assertEqual(data[cur]['after']['total_price'], round(result)) # check internal data internal_data = { @@ -1389,7 +1389,7 @@ class TestInventoryList(InventoryAPITestCase): resource_uid=resource.getUid(), section_uid=self.section.getUid()) self.assertTrue(result is not None) - self.assertEquals(internal_data[cur]['after']['total_price'], round(result)) + self.assertEqual(internal_data[cur]['after']['total_price'], round(result)) class TestMovementHistoryList(InventoryAPITestCase): @@ -1399,27 +1399,27 @@ class TestMovementHistoryList(InventoryAPITestCase): """Movement History List returns a sequence object""" getMovementHistoryList = self.getSimulationTool().getMovementHistoryList mvt_history_list = getMovementHistoryList() - self.assertEquals(str(mvt_history_list.__class__), + self.assertEqual(str(mvt_history_list.__class__), 'Shared.DC.ZRDB.Results.Results') # default is an empty list - self.assertEquals(0, len(mvt_history_list)) + self.assertEqual(0, len(mvt_history_list)) def testDefault0(self): self._makeMovement() getMovementHistoryList = self.getSimulationTool().getMovementHistoryList mvt_history_list = getMovementHistoryList( section_uid=self.section.getUid(),) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(0, mvt_history_list[0].total_quantity) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(0, mvt_history_list[0].total_quantity) # If a movement have no price, None is returned - self.assertEquals(None, mvt_history_list[0].total_price) + self.assertEqual(None, mvt_history_list[0].total_price) def testMovementBothSides(self): """Movement History List returns movement from both sides""" getMovementHistoryList = self.getSimulationTool().getMovementHistoryList self._makeMovement(quantity=100) # we don't filter, so we have the same movement from both sides. - self.assertEquals(2, len(getMovementHistoryList())) + self.assertEqual(2, len(getMovementHistoryList())) def testBrainClass(self): """Movement History List uses InventoryListBrain for brains""" @@ -1428,7 +1428,7 @@ class TestMovementHistoryList(InventoryAPITestCase): # maybe this check is too low level (Shared/DC/ZRDB//Results.py, class r) r_bases = getMovementHistoryList()._class.__bases__ brain_class = r_bases[2].__name__ - self.assertEquals('MovementHistoryListBrain', brain_class, + self.assertEqual('MovementHistoryListBrain', brain_class, "unexpected brain class for getMovementHistoryList InventoryListBrain" " != %s (bases %s)" % (brain_class, r_bases)) @@ -1450,17 +1450,17 @@ class TestMovementHistoryList(InventoryAPITestCase): # compatiblity names self.assertTrue(hasattr(brain, 'section_title')) - self.assertEquals(brain.section_title, self.section.getTitle()) + self.assertEqual(brain.section_title, self.section.getTitle()) self.assertTrue(hasattr(brain, 'section_relative_url')) - self.assertEquals(brain.section_relative_url, self.section.getRelativeUrl()) + self.assertEqual(brain.section_relative_url, self.section.getRelativeUrl()) self.assertTrue(hasattr(brain, 'node_title')) - self.assertEquals(brain.node_title, self.node.getTitle()) + self.assertEqual(brain.node_title, self.node.getTitle()) self.assertTrue(hasattr(brain, 'node_relative_url')) - self.assertEquals(brain.node_relative_url, self.node.getRelativeUrl()) + self.assertEqual(brain.node_relative_url, self.node.getRelativeUrl()) self.assertTrue(hasattr(brain, 'resource_title')) - self.assertEquals(brain.resource_title, self.resource.getTitle()) + self.assertEqual(brain.resource_title, self.resource.getTitle()) self.assertTrue(hasattr(brain, 'resource_relative_url')) - self.assertEquals(brain.resource_relative_url, self.resource.getRelativeUrl()) + self.assertEqual(brain.resource_relative_url, self.resource.getRelativeUrl()) def testBrainGetItem(self): """Test __getitem__ interface on brains.""" @@ -1468,25 +1468,25 @@ class TestMovementHistoryList(InventoryAPITestCase): self._makeMovement(quantity=100) brain = getMovementHistoryList(section_uid=self.section.getUid())[0] - self.assertEquals(brain['node_uid'], self.node.getUid()) - self.assertEquals(brain['node_relative_url'], self.node.getRelativeUrl()) - self.assertEquals(brain['node_title'], self.node.getTitle()) - self.assertEquals(brain['section_uid'], self.section.getUid()) - self.assertEquals(brain['section_relative_url'], self.section.getRelativeUrl()) - self.assertEquals(brain['section_title'], self.section.getTitle()) - self.assertEquals(brain['resource_uid'], self.resource.getUid()) - self.assertEquals(brain['resource_relative_url'], self.resource.getRelativeUrl()) - self.assertEquals(brain['resource_title'], self.resource.getTitle()) + self.assertEqual(brain['node_uid'], self.node.getUid()) + self.assertEqual(brain['node_relative_url'], self.node.getRelativeUrl()) + self.assertEqual(brain['node_title'], self.node.getTitle()) + self.assertEqual(brain['section_uid'], self.section.getUid()) + self.assertEqual(brain['section_relative_url'], self.section.getRelativeUrl()) + self.assertEqual(brain['section_title'], self.section.getTitle()) + self.assertEqual(brain['resource_uid'], self.resource.getUid()) + self.assertEqual(brain['resource_relative_url'], self.resource.getRelativeUrl()) + self.assertEqual(brain['resource_title'], self.resource.getTitle()) def testSection(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList mvt = self._makeMovement(quantity=100) mvt_history_list = getMovementHistoryList( section_uid = self.section.getUid()) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(mvt.getUid(), mvt_history_list[0].uid) - self.assertEquals(100, mvt_history_list[0].total_quantity) - self.assertEquals(self.section.getRelativeUrl(), + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(mvt.getUid(), mvt_history_list[0].uid) + self.assertEqual(100, mvt_history_list[0].total_quantity) + self.assertEqual(self.section.getRelativeUrl(), mvt_history_list[0].section_relative_url) def testMirrorSection(self): @@ -1494,22 +1494,22 @@ class TestMovementHistoryList(InventoryAPITestCase): mvt = self._makeMovement(quantity=100) mvt_history_list = getMovementHistoryList( mirror_section_uid = self.section.getUid()) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(mvt.getUid(), mvt_history_list[0].uid) - self.assertEquals(-100, mvt_history_list[0].total_quantity) - self.assertEquals(self.mirror_section.getRelativeUrl(), + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(mvt.getUid(), mvt_history_list[0].uid) + self.assertEqual(-100, mvt_history_list[0].total_quantity) + self.assertEqual(self.mirror_section.getRelativeUrl(), mvt_history_list[0].section_relative_url) - self.assertEquals(self.mirror_node.getRelativeUrl(), + self.assertEqual(self.mirror_node.getRelativeUrl(), mvt_history_list[0].node_relative_url) # if we look from the other side, everything is reverted mvt_history_list = getMovementHistoryList( section_uid = self.section.getUid()) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(100, mvt_history_list[0].total_quantity) - self.assertEquals(self.section.getRelativeUrl(), + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(100, mvt_history_list[0].total_quantity) + self.assertEqual(self.section.getRelativeUrl(), mvt_history_list[0].section_relative_url) - self.assertEquals(self.node.getRelativeUrl(), + self.assertEqual(self.node.getRelativeUrl(), mvt_history_list[0].node_relative_url) def testDifferentDatesPerSection(self): @@ -1520,10 +1520,10 @@ class TestMovementHistoryList(InventoryAPITestCase): start_date=start_date, stop_date=stop_date) # start_date is for source - self.assertEquals(start_date, getMovementHistoryList( + self.assertEqual(start_date, getMovementHistoryList( section_uid=self.mirror_section.getUid())[0].date) # stop_date is for destination - self.assertEquals(stop_date, getMovementHistoryList( + self.assertEqual(stop_date, getMovementHistoryList( section_uid=self.section.getUid())[0].date) def testNode(self): @@ -1531,18 +1531,18 @@ class TestMovementHistoryList(InventoryAPITestCase): mvt = self._makeMovement(quantity=100) mvt_history_list = getMovementHistoryList( node_uid = self.node.getUid()) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(mvt.getUid(), mvt_history_list[0].uid) - self.assertEquals(100, mvt_history_list[0].total_quantity) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(mvt.getUid(), mvt_history_list[0].uid) + self.assertEqual(100, mvt_history_list[0].total_quantity) def testMirrorNode(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList mvt = self._makeMovement(quantity=100) mvt_history_list = getMovementHistoryList( mirror_node_uid = self.node.getUid()) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(mvt.getUid(), mvt_history_list[0].uid) - self.assertEquals(-100, mvt_history_list[0].total_quantity) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(mvt.getUid(), mvt_history_list[0].uid) + self.assertEqual(-100, mvt_history_list[0].total_quantity) def testResource(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList @@ -1554,17 +1554,17 @@ class TestMovementHistoryList(InventoryAPITestCase): mvt_history_list = getMovementHistoryList( node_uid=self.node.getUid(), resource_uid=self.resource.getUid()) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(100, mvt_history_list[0].total_quantity) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(100, mvt_history_list[0].total_quantity) # getMovementHistoryList should return only movement for mvt_history_list = getMovementHistoryList( node_uid=self.node.getUid(), resource_uid=another_resource.getUid()) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(3, mvt_history_list[0].total_quantity) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(3, mvt_history_list[0].total_quantity) # wrong value yields an empty list - self.assertEquals(0, len(getMovementHistoryList( + self.assertEqual(0, len(getMovementHistoryList( resource_uid = self.node.getUid()))) def testSectionCategory(self): @@ -1581,15 +1581,15 @@ class TestMovementHistoryList(InventoryAPITestCase): ]: movement_history_list = getMovementHistoryList( section_category=section_category) - self.assertEquals(len(movement_history_list), 1) - self.assertEquals(movement_history_list[0].total_quantity, 100) + self.assertEqual(len(movement_history_list), 1) + self.assertEqual(movement_history_list[0].total_quantity, 100) # again, bad category raises an exception self.assertRaises(ValueError, getMovementHistoryList, section_category='group/notexists') # (but other arguments are ignored) - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( section_category='group/level1', ignored='argument')), 1) @@ -1602,8 +1602,8 @@ class TestMovementHistoryList(InventoryAPITestCase): movement_history_list = getMovementHistoryList( section_category=['group/level1', 'group/level1/level2']) - self.assertEquals(len(movement_history_list), 1) - self.assertEquals(movement_history_list[0].total_quantity, 100) + self.assertEqual(len(movement_history_list), 1) + self.assertEqual(movement_history_list[0].total_quantity, 100) def testNodeCategoryAndSectionCategory(self): @@ -1623,8 +1623,8 @@ class TestMovementHistoryList(InventoryAPITestCase): movement_history_list = getMovementHistoryList( node_category=node_category, section_category=section_category) - self.assertEquals(len(movement_history_list), 1) - self.assertEquals(movement_history_list[0].total_quantity, 100) + self.assertEqual(len(movement_history_list), 1) + self.assertEqual(movement_history_list[0].total_quantity, 100) # if node category OR section category is not matched, no movement are # returned. @@ -1633,14 +1633,14 @@ class TestMovementHistoryList(InventoryAPITestCase): movement_history_list = getMovementHistoryList( node_category=node_category, section_category=section_category) - self.assertEquals(len(movement_history_list), 0) + self.assertEqual(len(movement_history_list), 0) for section_category in invalid_category_list: for node_category in valid_category_list: movement_history_list = getMovementHistoryList( node_category=node_category, section_category=section_category) - self.assertEquals(len(movement_history_list), 0) + self.assertEqual(len(movement_history_list), 0) # Date tests: @@ -1663,10 +1663,10 @@ class TestMovementHistoryList(InventoryAPITestCase): start_date=date, stop_date=date+1) # from_date takes all movements >= - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( from_date=DateTime(2006, 01, 03), section_uid=self.section.getUid())), 2) - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( from_date=DateTime(2006, 01, 02), section_uid=self.mirror_section.getUid())), 2) @@ -1677,10 +1677,10 @@ class TestMovementHistoryList(InventoryAPITestCase): start_date=date, stop_date=date+1) # at_date takes all movements <= - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( at_date=DateTime(2006, 01, 03), section_uid=self.section.getUid())), 2) - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( at_date=DateTime(2006, 01, 02), section_uid=self.mirror_section.getUid())), 2) @@ -1691,10 +1691,10 @@ class TestMovementHistoryList(InventoryAPITestCase): start_date=date, stop_date=date+1) # to_date takes all movements < - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( to_date=DateTime(2006, 01, 03), section_uid=self.section.getUid())), 1) - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( to_date=DateTime(2006, 01, 02), section_uid=self.mirror_section.getUid())), 1) @@ -1705,20 +1705,20 @@ class TestMovementHistoryList(InventoryAPITestCase): start_date=date, stop_date=date+1) # both from_date and at_date - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( from_date=DateTime(2006, 01, 03), at_date=DateTime(2006, 01, 03), section_uid=self.section.getUid())), 1) - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( from_date=DateTime(2006, 01, 02), at_date=DateTime(2006, 01, 03), section_uid=self.section.getUid())), 2) - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( from_date=DateTime(2005, 01, 02), at_date=DateTime(2006, 01, 03), section_uid=self.section.getUid())), 2) # from other side - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( from_date=DateTime(2006, 01, 02), at_date=DateTime(2006, 01, 03), section_uid=self.mirror_section.getUid())), 2) @@ -1730,20 +1730,20 @@ class TestMovementHistoryList(InventoryAPITestCase): start_date=date, stop_date=date+1) # both from_date and to_date - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( from_date=DateTime(2006, 01, 03), to_date=DateTime(2006, 01, 03), section_uid=self.section.getUid())), 0) - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( from_date=DateTime(2006, 01, 02), to_date=DateTime(2006, 01, 03), section_uid=self.section.getUid())), 1) - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( from_date=DateTime(2005, 01, 02), to_date=DateTime(2007, 01, 02), section_uid=self.section.getUid())), 3) # from other side - self.assertEquals(len(getMovementHistoryList( + self.assertEqual(len(getMovementHistoryList( from_date=DateTime(2006, 01, 02), to_date=DateTime(2006, 01, 03), section_uid=self.mirror_section.getUid())), 1) @@ -1755,10 +1755,10 @@ class TestMovementHistoryList(InventoryAPITestCase): start_date=DateTime('2001/02/03 04:05 GMT+3')) movement_history_list = getMovementHistoryList( section_uid=self.section.getUid()) - self.assertEquals(len(movement_history_list), 1) + self.assertEqual(len(movement_history_list), 1) brain = movement_history_list[0] - self.assertEquals(DateTime('2001/02/03 04:05 GMT+3'), brain.date) - self.assertEquals('GMT+3', brain.date.timezone()) + self.assertEqual(DateTime('2001/02/03 04:05 GMT+3'), brain.date) + self.assertEqual('GMT+3', brain.date.timezone()) def test_BrainDateTimeZoneStopDate(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList @@ -1767,19 +1767,19 @@ class TestMovementHistoryList(InventoryAPITestCase): stop_date=DateTime('2001/02/03 04:05 GMT+3')) movement_history_list = getMovementHistoryList( mirror_section_uid=self.section.getUid()) - self.assertEquals(len(movement_history_list), 1) + self.assertEqual(len(movement_history_list), 1) brain = movement_history_list[0] - self.assertEquals(DateTime('2001/02/03 04:05 GMT+2'), brain.date) - self.assertEquals('GMT+2', brain.date.timezone()) + self.assertEqual(DateTime('2001/02/03 04:05 GMT+2'), brain.date) + self.assertEqual('GMT+2', brain.date.timezone()) def test_BrainEmptyDate(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList self._makeMovement(quantity=100,) movement_history_list = getMovementHistoryList( section_uid=self.section.getUid()) - self.assertEquals(len(movement_history_list), 1) + self.assertEqual(len(movement_history_list), 1) brain = movement_history_list[0] - self.assertEquals(None, brain.date) + self.assertEqual(None, brain.date) def test_SortOnDate(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList @@ -1799,11 +1799,11 @@ class TestMovementHistoryList(InventoryAPITestCase): movement_date_list = [ x.date for x in getMovementHistoryList( section_uid=self.section.getUid(), sort_on=(('stock.date', 'ascending'),)) ] - self.assertEquals(movement_date_list, date_list) + self.assertEqual(movement_date_list, date_list) movement_date_list = [ x.date for x in getMovementHistoryList( section_uid=self.section.getUid(), sort_on=(('stock.date', 'descending'),)) ] - self.assertEquals(movement_date_list, reverse_date_list) + self.assertEqual(movement_date_list, reverse_date_list) # minimum test for (('stock.date', 'ASC'), ('stock.uid', 'ASC')) which is # what you want to make sure that the last line on a page precedes the # first line on the previous page. @@ -1811,17 +1811,17 @@ class TestMovementHistoryList(InventoryAPITestCase): section_uid=self.section.getUid(), sort_on=(('stock.date', 'ascending'), ('stock.uid', 'ascending'),)) ] - self.assertEquals(movement_date_list, date_list) + self.assertEqual(movement_date_list, date_list) def test_SortOnCatalogColumn(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList self._makeMovement(quantity=1, title='First') self._makeMovement(quantity=2, title='Second') - self.assertEquals(['First', 'Second'], [ x.getObject().getTitle() for x in + self.assertEqual(['First', 'Second'], [ x.getObject().getTitle() for x in getMovementHistoryList(section_uid=self.section.getUid(), sort_on=(('title', 'ascending'),)) ]) - self.assertEquals(['Second', 'First'], [ x.getObject().getTitle() for x in + self.assertEqual(['Second', 'First'], [ x.getObject().getTitle() for x in getMovementHistoryList(section_uid=self.section.getUid(), sort_on=(('title', 'descending'),)) ]) @@ -1829,8 +1829,8 @@ class TestMovementHistoryList(InventoryAPITestCase): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList for q in range(6): self._makeMovement(quantity=1) - self.assertEquals(3, len(getMovementHistoryList(limit=3))) - self.assertEquals(4, len(getMovementHistoryList(limit=(1, 4)))) + self.assertEqual(3, len(getMovementHistoryList(limit=3))) + self.assertEqual(4, len(getMovementHistoryList(limit=(1, 4)))) def test_SimulationState(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList @@ -1840,13 +1840,13 @@ class TestMovementHistoryList(InventoryAPITestCase): movement_history_list = getMovementHistoryList( simulation_state=simulation_state, section_uid=self.section.getUid()) - self.assertEquals(len(movement_history_list), 1) - self.assertEquals(movement_history_list[0].total_quantity, 2) + self.assertEqual(len(movement_history_list), 1) + self.assertEqual(movement_history_list[0].total_quantity, 2) movement_history_list = getMovementHistoryList( simulation_state=["confirmed", "planned"], section_uid=self.section.getUid()) - self.assertEquals(len(movement_history_list), 2) + self.assertEqual(len(movement_history_list), 2) def test_SimulationMovement(self): """Test simulation movement are listed in getMovementHistoryList @@ -1856,7 +1856,7 @@ class TestMovementHistoryList(InventoryAPITestCase): self._makeMovement(quantity=100) movement_history_list = getMovementHistoryList( section_uid=self.section.getUid()) - self.assertEquals(2, len(movement_history_list)) + self.assertEqual(2, len(movement_history_list)) def test_OmitSimulation(self): """Test omit_simulation argument to getMovementHistoryList. @@ -1867,8 +1867,8 @@ class TestMovementHistoryList(InventoryAPITestCase): movement_history_list = getMovementHistoryList( section_uid=self.section.getUid(), omit_simulation=1) - self.assertEquals(1, len(movement_history_list)) - self.assertEquals(100, movement_history_list[0].quantity) + self.assertEqual(1, len(movement_history_list)) + self.assertEqual(100, movement_history_list[0].quantity) def test_OnlyAccountable(self): """Test that only_accountable works with getMovementHistoryList""" @@ -1878,14 +1878,14 @@ class TestMovementHistoryList(InventoryAPITestCase): # by default, only accountable movements are returned movement_history_list = getMovementHistoryList( section_uid=self.section.getUid(),) - self.assertEquals(1, len(movement_history_list)) - self.assertEquals(2, movement_history_list[0].quantity) + self.assertEqual(1, len(movement_history_list)) + self.assertEqual(2, movement_history_list[0].quantity) # unless only_accountable=False is passed movement_history_list = getMovementHistoryList( section_uid=self.section.getUid(), only_accountable=False) - self.assertEquals(2, len(movement_history_list)) - self.assertEquals(sorted((2,3)), sorted( + self.assertEqual(2, len(movement_history_list)) + self.assertEqual(sorted((2,3)), sorted( brain.quantity for brain in movement_history_list)) def test_RunningTotalQuantity(self): @@ -1903,9 +1903,9 @@ class TestMovementHistoryList(InventoryAPITestCase): for idx, (date, quantity) in enumerate(date_and_qty_list): brain = movement_history_list[idx] running_total_quantity += quantity - self.assertEquals(running_total_quantity, brain.running_total_quantity) - self.assertEquals(date, brain.date) - self.assertEquals(quantity, brain.quantity) + self.assertEqual(running_total_quantity, brain.running_total_quantity) + self.assertEqual(date, brain.date) + self.assertEqual(quantity, brain.quantity) def test_RunningTotalPrice(self): """Test that a running_total_price attribute is set on brains @@ -1922,9 +1922,9 @@ class TestMovementHistoryList(InventoryAPITestCase): for idx, (date, price) in enumerate(date_and_price_list): brain = movement_history_list[idx] running_total_price += price - self.assertEquals(running_total_price, brain.running_total_price) - self.assertEquals(date, brain.date) - self.assertEquals(price, brain.total_price) + self.assertEqual(running_total_price, brain.running_total_price) + self.assertEqual(date, brain.date) + self.assertEqual(price, brain.total_price) def test_RunningTotalWithInitialValue(self): """Test running_total_price and running_total_quantity with an initial @@ -1948,11 +1948,11 @@ class TestMovementHistoryList(InventoryAPITestCase): running_total_quantity=initial_running_total_quantity for idx, (date, quantity) in enumerate(date_and_qty_list): brain = movement_history_list[idx] - self.assertEquals(date, brain.date) + self.assertEqual(date, brain.date) running_total_quantity += quantity - self.assertEquals(running_total_quantity, brain.running_total_quantity) + self.assertEqual(running_total_quantity, brain.running_total_quantity) running_total_price += quantity * quantity # we've set price=quantity - self.assertEquals(running_total_price, brain.running_total_price) + self.assertEqual(running_total_price, brain.running_total_price) def testRunningQuantityWithQuantity0(self): # a 0 quantity should not be a problem for running total price @@ -1964,13 +1964,13 @@ class TestMovementHistoryList(InventoryAPITestCase): mvt_history_list = getMovementHistoryList( node_uid=self.node.getUid(), sort_on=[['stock.date', 'ASC']]) - self.assertEquals(3, len(mvt_history_list)) - self.assertEquals(-1, mvt_history_list[0].running_total_quantity) - self.assertEquals(-1, mvt_history_list[0].running_total_price) - self.assertEquals(-1, mvt_history_list[1].running_total_quantity) - self.assertEquals(-1, mvt_history_list[1].running_total_price) - self.assertEquals(0, mvt_history_list[2].running_total_quantity) - self.assertEquals(0, mvt_history_list[2].running_total_price) + self.assertEqual(3, len(mvt_history_list)) + self.assertEqual(-1, mvt_history_list[0].running_total_quantity) + self.assertEqual(-1, mvt_history_list[0].running_total_price) + self.assertEqual(-1, mvt_history_list[1].running_total_quantity) + self.assertEqual(-1, mvt_history_list[1].running_total_price) + self.assertEqual(0, mvt_history_list[2].running_total_quantity) + self.assertEqual(0, mvt_history_list[2].running_total_price) # bug #352 def testSameNodeDifferentDates(self): @@ -1984,8 +1984,8 @@ class TestMovementHistoryList(InventoryAPITestCase): mvt_history_list = getMovementHistoryList( node_uid=self.node.getUid(),) - self.assertEquals(2, len(mvt_history_list)) - self.assertEquals(0, sum([r.total_quantity for r in mvt_history_list])) + self.assertEqual(2, len(mvt_history_list)) + self.assertEqual(0, sum([r.total_quantity for r in mvt_history_list])) def testSameNodeSameDates(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList @@ -1995,8 +1995,8 @@ class TestMovementHistoryList(InventoryAPITestCase): destination_value=self.node ) mvt_history_list = getMovementHistoryList( node_uid=self.node.getUid(),) - self.assertEquals(2, len(mvt_history_list)) - self.assertEquals(0, sum([r.total_quantity for r in mvt_history_list])) + self.assertEqual(2, len(mvt_history_list)) + self.assertEqual(0, sum([r.total_quantity for r in mvt_history_list])) def testSameNodeSameDatesSameSections(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList @@ -2013,8 +2013,8 @@ class TestMovementHistoryList(InventoryAPITestCase): ignore_group_by=True, node_uid=self.node.getUid(), section_uid=self.section.getUid()) - self.assertEquals(2, len(mvt_history_list)) - self.assertEquals(0, sum([r.total_quantity for r in mvt_history_list])) + self.assertEqual(2, len(mvt_history_list)) + self.assertEqual(0, sum([r.total_quantity for r in mvt_history_list])) def testPrecision(self): # getMovementHistoryList supports a precision= argument to specify the @@ -2024,20 +2024,20 @@ class TestMovementHistoryList(InventoryAPITestCase): mvt_history_list = getMovementHistoryList( precision=2, node_uid=self.node.getUid()) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(0.12, mvt_history_list[0].running_total_quantity) - self.assertEquals(0.12, mvt_history_list[0].running_total_price) - self.assertEquals(0.12, mvt_history_list[0].total_quantity) - self.assertEquals(0.12, mvt_history_list[0].total_price) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(0.12, mvt_history_list[0].running_total_quantity) + self.assertEqual(0.12, mvt_history_list[0].running_total_price) + self.assertEqual(0.12, mvt_history_list[0].total_quantity) + self.assertEqual(0.12, mvt_history_list[0].total_price) mvt_history_list = getMovementHistoryList( precision=3, node_uid=self.node.getUid()) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(0.123, mvt_history_list[0].running_total_quantity) - self.assertEquals(0.123, mvt_history_list[0].running_total_price) - self.assertEquals(0.123, mvt_history_list[0].total_quantity) - self.assertEquals(0.123, mvt_history_list[0].total_price) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(0.123, mvt_history_list[0].running_total_quantity) + self.assertEqual(0.123, mvt_history_list[0].running_total_price) + self.assertEqual(0.123, mvt_history_list[0].total_quantity) + self.assertEqual(0.123, mvt_history_list[0].total_price) def testPrecisionAndFloatRoundingIssues(self): # sum([0.1] * 10) != 1.0 but this is not a problem here @@ -2050,9 +2050,9 @@ class TestMovementHistoryList(InventoryAPITestCase): precision=2, node_uid=self.node.getUid(), sort_on=[['stock.date', 'ASC']]) - self.assertEquals(11, len(mvt_history_list)) - self.assertEquals(0, mvt_history_list[-1].running_total_quantity) - self.assertEquals(0, mvt_history_list[-1].running_total_price) + self.assertEqual(11, len(mvt_history_list)) + self.assertEqual(0, mvt_history_list[-1].running_total_quantity) + self.assertEqual(0, mvt_history_list[-1].running_total_price) def test_OmitInputOmitOutput(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList @@ -2061,18 +2061,18 @@ class TestMovementHistoryList(InventoryAPITestCase): # omit input ignores movement comming to this node mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(), omit_input=1) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(-1, mvt_history_list[0].total_price) - self.assertEquals(-1, mvt_history_list[0].total_quantity) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(-1, mvt_history_list[0].total_price) + self.assertEqual(-1, mvt_history_list[0].total_quantity) # omit output ignores movement going to this node mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(), omit_output=1) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(1, mvt_history_list[0].total_price) - self.assertEquals(1, mvt_history_list[0].total_quantity) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(1, mvt_history_list[0].total_price) + self.assertEqual(1, mvt_history_list[0].total_quantity) - self.assertEquals(0, len(getMovementHistoryList( + self.assertEqual(0, len(getMovementHistoryList( node_uid=self.node.getUid(), omit_input=1, omit_output=1))) @@ -2083,15 +2083,15 @@ class TestMovementHistoryList(InventoryAPITestCase): m2 = self._makeMovement(quantity=-1, price=-1) mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(), omit_asset_increase=1) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(-1, mvt_history_list[0].total_price) - self.assertEquals(1, mvt_history_list[0].total_quantity) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(-1, mvt_history_list[0].total_price) + self.assertEqual(1, mvt_history_list[0].total_quantity) mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(), omit_asset_decrease=1) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(1, mvt_history_list[0].total_price) - self.assertEquals(-1, mvt_history_list[0].total_quantity) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(1, mvt_history_list[0].total_price) + self.assertEqual(-1, mvt_history_list[0].total_quantity) def test_OmitInputOmitOutputWithDifferentPaymentSameNodeSameSection(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList @@ -2107,17 +2107,17 @@ class TestMovementHistoryList(InventoryAPITestCase): section_uid=self.section.getUid(), payment_uid=self.payment_node.getUid(), omit_output=1) - self.assertEquals(1, len(movement_history_list)) - self.assertEquals(2, movement_history_list[0].total_price) - self.assertEquals(2, movement_history_list[0].total_quantity) + self.assertEqual(1, len(movement_history_list)) + self.assertEqual(2, movement_history_list[0].total_price) + self.assertEqual(2, movement_history_list[0].total_quantity) movement_history_list = getMovementHistoryList(node_uid=self.node.getUid(), section_uid=self.section.getUid(), payment_uid=self.other_payment_node.getUid(), omit_input=1) - self.assertEquals(1, len(movement_history_list)) - self.assertEquals(-2, movement_history_list[0].total_price) - self.assertEquals(-2, movement_history_list[0].total_quantity) + self.assertEqual(1, len(movement_history_list)) + self.assertEqual(-2, movement_history_list[0].total_price) + self.assertEqual(-2, movement_history_list[0].total_quantity) def test_OmitInputOmitOutputCancellationAmount(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList @@ -2125,17 +2125,17 @@ class TestMovementHistoryList(InventoryAPITestCase): self._makeMovement(quantity=2, price=1, cancellation_amount=True) mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(), omit_input=1) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(2, mvt_history_list[0].total_price) - self.assertEquals(2, mvt_history_list[0].total_quantity) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(2, mvt_history_list[0].total_price) + self.assertEqual(2, mvt_history_list[0].total_quantity) mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(), omit_output=1) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(-1, mvt_history_list[0].total_price) - self.assertEquals(-1, mvt_history_list[0].total_quantity) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(-1, mvt_history_list[0].total_price) + self.assertEqual(-1, mvt_history_list[0].total_quantity) - self.assertEquals(0, len(getMovementHistoryList( + self.assertEqual(0, len(getMovementHistoryList( node_uid=self.node.getUid(), omit_input=1, omit_output=1))) @@ -2148,16 +2148,16 @@ class TestMovementHistoryList(InventoryAPITestCase): start_date=DateTime(2010, 1, 2)) mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(), sort_on=(('stock.date', 'ASC'),)) - self.assertEquals(2, len(mvt_history_list)) - self.assertEquals(0, mvt_history_list[0].debit) - self.assertEquals(1, mvt_history_list[0].credit) - self.assertEquals(0, mvt_history_list[0].debit_price) - self.assertEquals(2, mvt_history_list[0].credit_price) + self.assertEqual(2, len(mvt_history_list)) + self.assertEqual(0, mvt_history_list[0].debit) + self.assertEqual(1, mvt_history_list[0].credit) + self.assertEqual(0, mvt_history_list[0].debit_price) + self.assertEqual(2, mvt_history_list[0].credit_price) - self.assertEquals(2, mvt_history_list[1].debit) - self.assertEquals(0, mvt_history_list[1].credit) - self.assertEquals(4, mvt_history_list[1].debit_price) - self.assertEquals(0, mvt_history_list[1].credit_price) + self.assertEqual(2, mvt_history_list[1].debit) + self.assertEqual(0, mvt_history_list[1].credit) + self.assertEqual(4, mvt_history_list[1].debit_price) + self.assertEqual(0, mvt_history_list[1].credit_price) def test_debit_credit_cancellation_amount(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList @@ -2167,16 +2167,16 @@ class TestMovementHistoryList(InventoryAPITestCase): start_date=DateTime(2010, 1, 2)) mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(), sort_on=(('stock.date', 'ASC'),)) - self.assertEquals(2, len(mvt_history_list)) - self.assertEquals(-1, mvt_history_list[0].debit) - self.assertEquals(0, mvt_history_list[0].credit) - self.assertEquals(-2, mvt_history_list[0].debit_price) - self.assertEquals(0, mvt_history_list[0].credit_price) + self.assertEqual(2, len(mvt_history_list)) + self.assertEqual(-1, mvt_history_list[0].debit) + self.assertEqual(0, mvt_history_list[0].credit) + self.assertEqual(-2, mvt_history_list[0].debit_price) + self.assertEqual(0, mvt_history_list[0].credit_price) - self.assertEquals(0, mvt_history_list[1].debit) - self.assertEquals(-2, mvt_history_list[1].credit) - self.assertEquals(0, mvt_history_list[1].debit_price) - self.assertEquals(-4, mvt_history_list[1].credit_price) + self.assertEqual(0, mvt_history_list[1].debit) + self.assertEqual(-2, mvt_history_list[1].credit) + self.assertEqual(0, mvt_history_list[1].debit_price) + self.assertEqual(-4, mvt_history_list[1].credit_price) def test_group_by_explanation(self): getMovementHistoryList = self.getSimulationTool().getMovementHistoryList @@ -2198,37 +2198,37 @@ class TestMovementHistoryList(InventoryAPITestCase): self.tic() # sanity check, our fake movements are all created in the same delivery, # and have a valid explanation uid - self.assertEquals(m1.getExplanationUid(), + self.assertEqual(m1.getExplanationUid(), m2.getExplanationUid()) self.assertTrue(m1.getExplanationUid()) # also make sure they acquire from delivery - self.assertEquals(self.node, m1.getDestinationValue()) + self.assertEqual(self.node, m1.getDestinationValue()) # group by explanation mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(), group_by=('explanation_uid',), ) - self.assertEquals(1, len(mvt_history_list)) - self.assertEquals(3, mvt_history_list[0].total_quantity) - self.assertEquals(3, mvt_history_list[0].running_total_quantity) - self.assertEquals(12, mvt_history_list[0].total_price) - self.assertEquals(12, mvt_history_list[0].running_total_price) + self.assertEqual(1, len(mvt_history_list)) + self.assertEqual(3, mvt_history_list[0].total_quantity) + self.assertEqual(3, mvt_history_list[0].running_total_quantity) + self.assertEqual(12, mvt_history_list[0].total_price) + self.assertEqual(12, mvt_history_list[0].running_total_price) # group by explanation and resource mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(), group_by_resource=True, group_by=('explanation_uid',), sort_on=(('stock.date', 'ASC'),)) - self.assertEquals(2, len(mvt_history_list)) + self.assertEqual(2, len(mvt_history_list)) - self.assertEquals(2, mvt_history_list[0].total_quantity) - self.assertEquals(2, mvt_history_list[0].running_total_quantity) - self.assertEquals(5, mvt_history_list[0].total_price) - self.assertEquals(5, mvt_history_list[0].running_total_price) + self.assertEqual(2, mvt_history_list[0].total_quantity) + self.assertEqual(2, mvt_history_list[0].running_total_quantity) + self.assertEqual(5, mvt_history_list[0].total_price) + self.assertEqual(5, mvt_history_list[0].running_total_price) - self.assertEquals(1, mvt_history_list[1].total_quantity) - self.assertEquals(3, mvt_history_list[1].running_total_quantity) - self.assertEquals(7, mvt_history_list[1].total_price) - self.assertEquals(12, mvt_history_list[1].running_total_price) + self.assertEqual(1, mvt_history_list[1].total_quantity) + self.assertEqual(3, mvt_history_list[1].running_total_quantity) + self.assertEqual(7, mvt_history_list[1].total_price) + self.assertEqual(12, mvt_history_list[1].running_total_price) class TestNextNegativeInventoryDate(InventoryAPITestCase): @@ -2250,19 +2250,19 @@ class TestNextNegativeInventoryDate(InventoryAPITestCase): simulation_state='planned') node_uid = self.node.getUid() date = DateTime(DateTime().strftime('%Y/%m/%d')) - self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None) + self.assertEqual(getNextNegativeInventoryDate(node_uid=node_uid), None) makeMovement(quantity=1, change_way=1, start_date=date) - self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None) + self.assertEqual(getNextNegativeInventoryDate(node_uid=node_uid), None) makeMovement(quantity=3, change_way=0, start_date=date+2) - self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), date+2) + self.assertEqual(getNextNegativeInventoryDate(node_uid=node_uid), date+2) makeMovement(quantity=5, change_way=1, start_date=date+1) - self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None) + self.assertEqual(getNextNegativeInventoryDate(node_uid=node_uid), None) makeMovement(quantity=7, change_way=0, start_date=date+5) - self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), date+5) + self.assertEqual(getNextNegativeInventoryDate(node_uid=node_uid), date+5) makeMovement(quantity=7, change_way=1, start_date=date+4) - self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None) + self.assertEqual(getNextNegativeInventoryDate(node_uid=node_uid), None) makeMovement(quantity=7, change_way=0, start_date=date+3) - self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), date+3) + self.assertEqual(getNextNegativeInventoryDate(node_uid=node_uid), date+3) class TestInventoryStat(InventoryAPITestCase): """Tests Inventory Stat methods. @@ -2276,11 +2276,11 @@ class TestInventoryStat(InventoryAPITestCase): node_uid = self.node.getUid() makeMovement(quantity=1) # Test the number of movement for this particular node - self.assertEquals(getInventoryStat(node_uid=node_uid)[0].stock_uid, 1) + self.assertEqual(getInventoryStat(node_uid=node_uid)[0].stock_uid, 1) makeMovement(quantity=3) - self.assertEquals(getInventoryStat(node_uid=node_uid)[0].stock_uid, 2) + self.assertEqual(getInventoryStat(node_uid=node_uid)[0].stock_uid, 2) makeMovement(quantity=5) - self.assertEquals(getInventoryStat(node_uid=node_uid)[0].stock_uid, 3) + self.assertEqual(getInventoryStat(node_uid=node_uid)[0].stock_uid, 3) class TestTrackingList(InventoryAPITestCase): """Tests Item Tracking @@ -2298,15 +2298,15 @@ class TestTrackingList(InventoryAPITestCase): item_uid = self.item.getUid() other_item_uid = self.other_item.getUid() node_uid = self.node.getUid() - self.assertEquals(len(getTrackingList(node_uid=node_uid, + self.assertEqual(len(getTrackingList(node_uid=node_uid, at_date=start_date)),0) makeMovement(aggregate=self.item) result = getTrackingList(node_uid=node_uid,at_date=start_date) - self.assertEquals(len(result),1) + self.assertEqual(len(result),1) self.failIfDifferentSet([x.uid for x in result], [item_uid]) makeMovement(aggregate=self.other_item) result = getTrackingList(node_uid=node_uid,at_date=start_date) - self.assertEquals(len(result),2) + self.assertEqual(len(result),2) self.failIfDifferentSet([x.uid for x in result], [item_uid, other_item_uid]) def testSeveralAggregateOnMovement(self): @@ -2322,12 +2322,12 @@ class TestTrackingList(InventoryAPITestCase): item_uid = self.item.getUid() other_item_uid = self.other_item.getUid() node_uid = self.node.getUid() - self.assertEquals(len(getTrackingList(node_uid=node_uid, + self.assertEqual(len(getTrackingList(node_uid=node_uid, at_date=start_date)),0) makeMovement(aggregate_list=[self.item.getRelativeUrl(), self.other_item.getRelativeUrl()]) result = getTrackingList(node_uid=node_uid,at_date=start_date) - self.assertEquals(len(result),2) + self.assertEqual(len(result),2) self.failIfDifferentSet([x.uid for x in result], [item_uid, other_item_uid]) def testDates(self): @@ -2393,7 +2393,7 @@ class TestTrackingList(InventoryAPITestCase): self.tic() tracking_node_uid_list = [brain.node_uid for brain in getFutureTrackingList(item=self.item.getRelativeUrl())] - self.assertEquals([node_uid], tracking_node_uid_list, + self.assertEqual([node_uid], tracking_node_uid_list, "%s != %s (state:%s)" % ([node_uid], tracking_node_uid_list, state)) for state in ('draft', 'cancelled', 'deleted'): @@ -2402,7 +2402,7 @@ class TestTrackingList(InventoryAPITestCase): self.tic() tracking_node_uid_list = [brain.node_uid for brain in getFutureTrackingList(item=self.item.getRelativeUrl())] - self.assertEquals([], tracking_node_uid_list, + self.assertEqual([], tracking_node_uid_list, "%s != %s (state:%s)" % ([], tracking_node_uid_list, state)) # TODO: missing tests for input=1 and output=1 @@ -2568,7 +2568,7 @@ class TestInventoryCacheTable(InventoryAPITestCase): # Make stock table inconsistent to be sure it uses cache self.doubleStockValue() # Check it use cache - self.assertEquals(value, self.getInventory(**inventory_kw)) + self.assertEqual(value, self.getInventory(**inventory_kw)) self.assertNotEquals(value, self.getInventory(optimisation__=False, **inventory_kw)) @@ -2791,8 +2791,8 @@ class TestInventoryCacheTable(InventoryAPITestCase): value = self.INVENTORY_QUANTITY_3 + self.INVENTORY_QUANTITY_2 + \ 2 * self.INVENTORY_QUANTITY_1 self.doubleStockValue() - self.assertEquals(value, self.getInventory(**inventory_kw)) - self.assertEquals(value, + self.assertEqual(value, self.getInventory(**inventory_kw)) + self.assertEqual(value, self.getInventory(optimisation__=False, **inventory_kw)) @@ -2820,24 +2820,24 @@ class TestInventoryCacheTable(InventoryAPITestCase): ) self.tic() # Optimisation must still be used - self.assertEquals( + self.assertEqual( value + INVENTORY_QUANTITY_4, self.getInventory(**inventory_kw), ) # Edit start date so that cache table is cleared movement.edit(start_date=self.LAST_CACHED_MOVEMENT_DATE) self.tic() - self.assertEquals( + self.assertEqual( value + INVENTORY_QUANTITY_4 + self.INVENTORY_QUANTITY_1, self.getInventory(**inventory_kw), ) self.doubleStockValue() # Cache hit again - self.assertEquals( + self.assertEqual( value + INVENTORY_QUANTITY_4 + self.INVENTORY_QUANTITY_1, self.getInventory(**inventory_kw), ) - self.assertEquals( + self.assertEqual( value + 2 * INVENTORY_QUANTITY_4 + 3 * self.INVENTORY_QUANTITY_1, self.getInventory(optimisation__=False, **inventory_kw), ) @@ -2845,17 +2845,17 @@ class TestInventoryCacheTable(InventoryAPITestCase): # at former date movement.edit(start_date=self.NOW - 1) self.tic() - self.assertEquals( + self.assertEqual( value + INVENTORY_QUANTITY_4 + 3 * self.INVENTORY_QUANTITY_1, self.getInventory(**inventory_kw), ) self.doubleStockValue() # Cache hit again - self.assertEquals( + self.assertEqual( value + INVENTORY_QUANTITY_4 + 3 * self.INVENTORY_QUANTITY_1, self.getInventory(**inventory_kw), ) - self.assertEquals( + self.assertEqual( value + INVENTORY_QUANTITY_4 + 7 * self.INVENTORY_QUANTITY_1, self.getInventory(optimisation__=False, **inventory_kw), ) @@ -2863,17 +2863,17 @@ class TestInventoryCacheTable(InventoryAPITestCase): # Set date back in the past, cache is clear again movement.edit(start_date=self.LAST_CACHED_MOVEMENT_DATE) self.tic() - self.assertEquals( + self.assertEqual( value + INVENTORY_QUANTITY_4 + 7 * self.INVENTORY_QUANTITY_1, self.getInventory(**inventory_kw), ) self.doubleStockValue() # Cache hit again - self.assertEquals( + self.assertEqual( value + INVENTORY_QUANTITY_4 + 7 * self.INVENTORY_QUANTITY_1, self.getInventory(**inventory_kw), ) - self.assertEquals( + self.assertEqual( value + 2 * INVENTORY_QUANTITY_4 + 15 * self.INVENTORY_QUANTITY_1, self.getInventory(optimisation__=False, **inventory_kw), ) @@ -2881,13 +2881,13 @@ class TestInventoryCacheTable(InventoryAPITestCase): # Delete movement, so it gets unindexed and cache entry is flushed self.folder.manage_delObjects(ids=[movement.getId(), ]) self.tic() - self.assertEquals( + self.assertEqual( value + 15 * self.INVENTORY_QUANTITY_1, self.getInventory(**inventory_kw), ) self.doubleStockValue() # Cache hit again - self.assertEquals( + self.assertEqual( value + 15 * self.INVENTORY_QUANTITY_1, self.getInventory(**inventory_kw), ) @@ -3026,7 +3026,7 @@ class TestInventoryCacheTable(InventoryAPITestCase): """ Check getInventory without date when there is no cache. """ - self.assertEquals( + self.assertEqual( self.INVENTORY_QUANTITY_1 + \ self.INVENTORY_QUANTITY_2 + self.INVENTORY_QUANTITY_3, self.getInventory(node_uid=self.node_uid) @@ -3237,19 +3237,19 @@ class TestUnitConversion(BaseTestUnitConversion): for i in range(3): - self.assertEquals(None, self.convertedSimulation('unit/%i' % i)) + self.assertEqual(None, self.convertedSimulation('unit/%i' % i)) - self.assertEquals(None, + self.assertEqual(None, self.convertedSimulation('unit', simulation_period='Current')) - self.assertEquals(11, self.convertedSimulation('unit')) + self.assertEqual(11, self.convertedSimulation('unit')) - self.assertEquals(11 * .123 - .789, self.convertedSimulation('mass/net')) - self.assertEquals((11 * 123 - 789) / 1e6, + self.assertEqual(11 * .123 - .789, self.convertedSimulation('mass/net')) + self.assertEqual((11 * 123 - 789) / 1e6, self.convertedSimulation('mass/net', quantity_unit='mass/t')) - self.assertEquals(13 * .056 - 2 * .043, + self.assertEqual(13 * .056 - 2 * .043, self.convertedSimulation('mass/nutr/lipid')) def testInventoryNoMetricType(self): @@ -3257,7 +3257,7 @@ class TestUnitConversion(BaseTestUnitConversion): providing only the quantity_unit argument should also work, and the standard metric type is used """ - self.assertEquals((11 * 123 - 789) / 1e6, + self.assertEqual((11 * 123 - 789) / 1e6, self.getSimulationTool().getInventory( node_uid=self.node.getUid(), quantity_unit="mass/t")) @@ -3323,16 +3323,16 @@ class TestUnitConversionDefinition(BaseTestUnitConversion): self.makeMovement(500, self.resource_byunit) # Always displayed as quantity*unit_ratio - self.assertEquals(10*1000 + 1*6 - 2*50 - 500*1, + self.assertEqual(10*1000 + 1*6 - 2*50 - 500*1, self.convertedSimulation('unit')) - self.assertEquals(10*1000 + 1*6 - 2*50 - 500*1, + self.assertEqual(10*1000 + 1*6 - 2*50 - 500*1, self.convertedSimulation('unit', quantity_unit='unit/unit')) - self.assertEquals(10*1 + 1*(6*0.001) - 2*1 - 500*(1./1000), + self.assertEqual(10*1 + 1*(6*0.001) - 2*1 - 500*(1./1000), self.convertedSimulation('unit', quantity_unit='unit/lot')) # amounts are rounded on the 12th digit. - self.assertEquals(round(10*(1000./6) + 1*1 - 2*(50./6) - 500*(1./6), 12), + self.assertEqual(round(10*(1000./6) + 1*1 - 2*(50./6) - 500*(1./6), 12), self.convertedSimulation('unit', quantity_unit='unit/pack')) @@ -3342,36 +3342,36 @@ class TestUnitConversionDefinition(BaseTestUnitConversion): self.resource_bypack, self.resource_byunit): # not_reference -> reference quantity - self.assertEquals(1000, + self.assertEqual(1000, resource.convertQuantity(1, "unit/lot", "unit/unit")) # reference -> not_reference - self.assertEquals(1, + self.assertEqual(1, resource.convertQuantity(1000, "unit/unit", "unit/lot")) # not_reference -> not_reference - self.assertEquals(1*1000./6, + self.assertEqual(1*1000./6, resource.convertQuantity(1, "unit/lot", "unit/pack")) - self.assertEquals(1*6./1000, + self.assertEqual(1*6./1000, resource.convertQuantity(1, "unit/pack", "unit/lot")) # then with local Unit definition - self.assertEquals(1*50, + self.assertEqual(1*50, self.resource_bylot_overriding\ .convertQuantity(1, "unit/lot", "unit/unit")) - self.assertEquals(1./50, + self.assertEqual(1./50, self.resource_bylot_overriding\ .convertQuantity(1, "unit/unit", "unit/lot")) - self.assertEquals(1*50./6, + self.assertEqual(1*50./6, self.resource_bylot_overriding\ .convertQuantity(1, "unit/lot", "unit/pack")) - self.assertEquals(1*6./50, + self.assertEqual(1*6./50, self.resource_bylot_overriding\ .convertQuantity(1, "unit/pack", "unit/lot")) @@ -3382,12 +3382,12 @@ class TestUnitConversionDefinition(BaseTestUnitConversion): changes. """ # Before the global change, global definition reads 1000 - self.assertEquals(1000, + self.assertEqual(1000, self.resource_bylot.convertQuantity(1, "unit/lot", "unit/unit")) # which does not affect resources overriding the definition - self.assertEquals(1*50, + self.assertEqual(1*50, self.resource_bylot_overriding\ .convertQuantity(1, "unit/lot", "unit/unit")) @@ -3402,7 +3402,7 @@ class TestUnitConversionDefinition(BaseTestUnitConversion): portal_type= \ "Quantity Unit Conversion" \ " Definition") - self.assertEquals(1, len(query)) + self.assertEqual(1, len(query)) return query[0].getObject() def testResourceConvertQuantityAfterGlobalChange(self): @@ -3421,12 +3421,12 @@ class TestUnitConversionDefinition(BaseTestUnitConversion): self.tic() # SQL tables should have been updated: - self.assertEquals(500, + self.assertEqual(500, self.resource_bylot.convertQuantity(1, "unit/lot", "unit/unit")) # without affecting resources that override the definition - self.assertEquals(1*50, + self.assertEqual(1*50, self.resource_bylot_overriding\ .convertQuantity(1, "unit/lot", "unit/unit")) finally: @@ -3449,12 +3449,12 @@ class TestUnitConversionDefinition(BaseTestUnitConversion): self.tic() # SQL tables should have been updated: - self.assertEquals(None, + self.assertEqual(None, self.resource_bylot.convertQuantity(1, "unit/lot", "unit/unit")) # without affecting resources that override the definition - self.assertEquals(1*50, + self.assertEqual(1*50, self.resource_bylot_overriding\ .convertQuantity(1, "unit/lot", "unit/unit")) finally: @@ -3511,13 +3511,13 @@ class TestUnitConversionBackwardCompatibility(BaseTestUnitConversion): self.tic() # inventories of that resource are indexed in grams - self.assertEquals(3010, + self.assertEqual(3010, self.portal.portal_simulation.getCurrentInventory( resource_uid=resource.getUid(), node_uid=node.getUid())) # converted inventory also works - self.assertEquals(3.01, + self.assertEqual(3.01, self.portal.portal_simulation.getCurrentInventory( quantity_unit='mass/kilogram', resource_uid=resource.getUid(), diff --git a/product/ERP5/tests/testInventoryModule.py b/product/ERP5/tests/testInventoryModule.py index f57a8e93bf..0af963d52b 100644 --- a/product/ERP5/tests/testInventoryModule.py +++ b/product/ERP5/tests/testInventoryModule.py @@ -66,7 +66,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): pl.start() pl.stop() pl.deliver() - self.assertEquals(pl.getSimulationState(), 'delivered') + self.assertEqual(pl.getSimulationState(), 'delivered') # we create content : # 1 purchase packing list @@ -179,7 +179,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=date,simulation_state='delivered') - self.assertEquals(self.default_quantity,quantity) + self.assertEqual(self.default_quantity,quantity) def stepCheckSecondNotVariatedInventory(self, start_date=None,quantity=None, sequence=None, **kw): @@ -189,7 +189,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=date,simulation_state='delivered') - self.assertEquals(self.default_quantity-2,quantity) + self.assertEqual(self.default_quantity-2,quantity) def stepCheckSecondNotVariatedInventoryModified(self, start_date=None,quantity=None, sequence=None,**kw): @@ -199,7 +199,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=date,simulation_state='delivered') - self.assertEquals(self.default_quantity,quantity) + self.assertEqual(self.default_quantity,quantity) def test_01_NotVariatedInventory(self, quiet=0, run=run_all_test): @@ -246,7 +246,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): resource_vcl = list(resource.getVariationCategoryList( omit_individual_variation=1, omit_optional_variation=1)) resource_vcl.sort() - self.assertEquals(len(resource_vcl),2) + self.assertEqual(len(resource_vcl),2) inventory_line.setVariationCategoryList(resource_vcl) base_id = 'movement' cell_key_list = list(inventory_line.getCellKeyList(base_id=base_id)) @@ -314,14 +314,14 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=date) - self.assertEquals(total_quantity,quantity) + self.assertEqual(total_quantity,quantity) variation_text = 'size/Child/32' total_quantity = 99 quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, variation_text=variation_text, to_date=date,simulation_state='delivered') - self.assertEquals(total_quantity,quantity) + self.assertEqual(total_quantity,quantity) def stepCheckSecondVariatedInventory(self, start_date=None,quantity=None, sequence=None,**kw): @@ -332,14 +332,14 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=date) - self.assertEquals(total_quantity,quantity) + self.assertEqual(total_quantity,quantity) variation_text = 'size/Child/32' total_quantity = 89 quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, variation_text=variation_text, to_date=date,simulation_state='delivered') - self.assertEquals(total_quantity,quantity) + self.assertEqual(total_quantity,quantity) def test_02_VariatedInventory(self, run=run_all_test): """ @@ -411,14 +411,14 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=date) - self.assertEquals(total_quantity,quantity) + self.assertEqual(total_quantity,quantity) variation_text = 'size/Child/32' total_quantity = (99) * 2 quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, variation_text=variation_text, to_date=date) - self.assertEquals(total_quantity,quantity) + self.assertEqual(total_quantity,quantity) # Also check when we look stock for a particular aggregate sub_variation_text = self.getAggregateRelativeUrlText( sequence.get('item_list')) @@ -428,7 +428,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): variation_text=variation_text, to_date=date, sub_variation_text=sub_variation_text) - self.assertEquals(total_quantity,quantity) + self.assertEqual(total_quantity,quantity) def stepCheckExplanationTextInInventoryList(self, start_date=None, quantity=None, sequence=None, **kw): @@ -478,14 +478,14 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=date) - self.assertEquals(total_quantity,quantity) + self.assertEqual(total_quantity,quantity) variation_text = 'size/Child/32' total_quantity = (89) * 2 quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, variation_text=variation_text, to_date=date,simulation_state='delivered') - self.assertEquals(total_quantity,quantity) + self.assertEqual(total_quantity,quantity) # Also check when we look stock for a particular aggregate sub_variation_text = self.getAggregateRelativeUrlText( sequence.get('item_list')) @@ -495,7 +495,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): to_date=date, sub_variation_text=sub_variation_text, simulation_state='delivered') - self.assertEquals(total_quantity,quantity) + self.assertEqual(total_quantity,quantity) sub_variation_text = self.getAggregateRelativeUrlText( sequence.get('item_list')[:1]) @@ -585,14 +585,14 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=date) - self.assertEquals(total_quantity, quantity) + self.assertEqual(total_quantity, quantity) variation_text = 'size/Child/32' total_quantity = (99*100 + 99) quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, variation_text=variation_text, to_date=date) - self.assertEquals(total_quantity,quantity) + self.assertEqual(total_quantity,quantity) def test_05_VariatedMultipleQuantityUnitResourceInventory(self, run=run_all_test): """ diff --git a/product/ERP5/tests/testInvoice.py b/product/ERP5/tests/testInvoice.py index b730f309a4..4098ca6873 100644 --- a/product/ERP5/tests/testInvoice.py +++ b/product/ERP5/tests/testInvoice.py @@ -216,7 +216,7 @@ class TestInvoiceMixin(TestPackingListMixin): client1.validate() sequence.edit(client1=client1) client2 = sequence.get('organisation3') - self.assertEquals(client2.getRegionValue(), None) + self.assertEqual(client2.getRegionValue(), None) client2.validate() sequence.edit(client2=client2) @@ -230,7 +230,7 @@ class TestInvoiceMixin(TestPackingListMixin): self.assertNotEquals(len(rule_list), 0) sequence.edit(order_rule_list = rule_list) - self.assertEquals(len(order.getMovementList()), + self.assertEqual(len(order.getMovementList()), sum([len(rule.objectIds()) for rule in rule_list])) def stepCheckInvoicingRule(self, sequence=None, sequence_list=None, **kw): @@ -244,15 +244,15 @@ class TestInvoiceMixin(TestPackingListMixin): for order_simulation_movement in order_rule.objectValues() : temp_invoicing_rule_list = [ar for ar in order_simulation_movement.objectValues()[0].objectValues()[0].objectValues() if ar.getSpecialiseValue().getPortalType() == 'Invoice Simulation Rule'] - self.assertEquals(len(temp_invoicing_rule_list), 1) + self.assertEqual(len(temp_invoicing_rule_list), 1) invoicing_rule_list.extend(temp_invoicing_rule_list) sequence.edit(invoicing_rule_list=invoicing_rule_list) invoicing_rule = invoicing_rule_list[0] sequence.edit(invoicing_rule = invoicing_rule) for invoicing_rule in invoicing_rule_list: - self.assertEquals(invoicing_rule.getSpecialiseReference(), + self.assertEqual(invoicing_rule.getSpecialiseReference(), 'default_invoicing_rule') - self.assertEquals(invoicing_rule.getPortalType(), + self.assertEqual(invoicing_rule.getPortalType(), 'Applied Rule') simulation_movement_list = invoicing_rule.objectValues() self.assertNotEquals(len(simulation_movement_list), 0) @@ -262,16 +262,16 @@ class TestInvoiceMixin(TestPackingListMixin): .getSpecialiseValue().getPortalType() == 'Invoice Transaction Simulation Rule']) resource_list = sequence.get('resource_list') - self.assertEquals(simulation_movement.getPortalType(), + self.assertEqual(simulation_movement.getPortalType(), 'Simulation Movement') self.assertTrue(simulation_movement.getResourceValue() in resource_list) self.assertTrue(simulation_movement.isConvergent()) # TODO: What is the invoice dates supposed to be ? # is this done through profiles ? - #self.assertEquals(simulation_movement.getStartDate(), + #self.assertEqual(simulation_movement.getStartDate(), # sequence.get('order').getStartDate()) - #self.assertEquals(simulation_movement.getStopDate(), + #self.assertEqual(simulation_movement.getStopDate(), # sequence.get('order').getStopDate()) sequence.edit(invoice_transaction_rule_list=invoice_transaction_rule_list) @@ -287,7 +287,7 @@ class TestInvoiceMixin(TestPackingListMixin): parent_movement = aq_parent(applied_invoice_transaction_rule) invoice_transaction_rule = \ applied_invoice_transaction_rule.getSpecialiseValue() - self.assertEquals(3, len(applied_invoice_transaction_rule.objectValues())) + self.assertEqual(3, len(applied_invoice_transaction_rule.objectValues())) for line_id, line_source_id, line_destination_id, line_ratio in \ self.transaction_line_definition_list: movement = None @@ -299,11 +299,11 @@ class TestInvoiceMixin(TestPackingListMixin): break self.assertTrue(movement is not None) - self.assertEquals(movement.getCorrectedQuantity(), parent_movement.getPrice() * + self.assertEqual(movement.getCorrectedQuantity(), parent_movement.getPrice() * parent_movement.getCorrectedQuantity() * line_ratio) - self.assertEquals(movement.getStartDate(), + self.assertEqual(movement.getStartDate(), parent_movement.getStartDate()) - self.assertEquals(movement.getStopDate(), + self.assertEqual(movement.getStopDate(), parent_movement.getStopDate()) def modifyPackingListState(self, transition_name, @@ -317,7 +317,7 @@ class TestInvoiceMixin(TestPackingListMixin): """ set the Packing List as Ready. This must build the invoice. """ self.modifyPackingListState('set_ready_action', sequence=sequence) packing_list = sequence.get('packing_list') - self.assertEquals(packing_list.getSimulationState(), 'ready') + self.assertEqual(packing_list.getSimulationState(), 'ready') def stepSetReadyNewPackingList(self, sequence=None, sequence_list=None, **kw): @@ -325,33 +325,33 @@ class TestInvoiceMixin(TestPackingListMixin): packing_list = sequence.get('new_packing_list') self.modifyPackingListState('set_ready_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'ready') + self.assertEqual(packing_list.getSimulationState(), 'ready') def stepStartPackingList(self, sequence=None, sequence_list=None, **kw): self.modifyPackingListState('start_action', sequence=sequence) packing_list = sequence.get('packing_list') - self.assertEquals(packing_list.getSimulationState(), 'started') + self.assertEqual(packing_list.getSimulationState(), 'started') def stepStartNewPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('new_packing_list') self.modifyPackingListState('start_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'started') + self.assertEqual(packing_list.getSimulationState(), 'started') def stepStopPackingList(self, sequence=None, sequence_list=None, **kw): self.modifyPackingListState('stop_action', sequence=sequence) packing_list = sequence.get('packing_list') - self.assertEquals(packing_list.getSimulationState(), 'stopped') + self.assertEqual(packing_list.getSimulationState(), 'stopped') def stepDeliverPackingList(self, sequence=None, sequence_list=None, **kw): self.modifyPackingListState('deliver_action', sequence=sequence) packing_list = sequence.get('packing_list') - self.assertEquals(packing_list.getSimulationState(), 'delivered') + self.assertEqual(packing_list.getSimulationState(), 'delivered') def stepCancelPackingList(self, sequence=None, sequence_list=None, **kw): self.modifyPackingListState('cancel_action', sequence=sequence) packing_list = sequence.get('packing_list') - self.assertEquals(packing_list.getSimulationState(), 'cancelled') + self.assertEqual(packing_list.getSimulationState(), 'cancelled') def modifyInvoiceState(self, transition_name, sequence,invoice=None): @@ -363,28 +363,28 @@ class TestInvoiceMixin(TestPackingListMixin): def stepStartInvoice(self, sequence=None, sequence_list=None, **kw): self.modifyInvoiceState('start_action', sequence=sequence) invoice = sequence.get('invoice') - self.assertEquals(invoice.getSimulationState(), 'started') + self.assertEqual(invoice.getSimulationState(), 'started') def stepStartNewInvoice(self, sequence=None, sequence_list=None, **kw): invoice = sequence.get('new_invoice') self.modifyInvoiceState('start_action', sequence=sequence, invoice=invoice) - self.assertEquals(invoice.getSimulationState(), 'started') + self.assertEqual(invoice.getSimulationState(), 'started') def stepStopInvoice(self, sequence=None, sequence_list=None, **kw): self.modifyInvoiceState('stop_action', sequence=sequence) invoice = sequence.get('invoice') - self.assertEquals(invoice.getSimulationState(), 'stopped') + self.assertEqual(invoice.getSimulationState(), 'stopped') def stepDeliverInvoice(self, sequence=None, sequence_list=None, **kw): self.modifyInvoiceState('deliver_action', sequence=sequence) invoice = sequence.get('invoice') - self.assertEquals(invoice.getSimulationState(), 'delivered') + self.assertEqual(invoice.getSimulationState(), 'delivered') def stepCancelInvoice(self, sequence=None, sequence_list=None, **kw): self.modifyInvoiceState('cancel_action', sequence=sequence) invoice = sequence.get('invoice') - self.assertEquals(invoice.getSimulationState(), 'cancelled') + self.assertEqual(invoice.getSimulationState(), 'cancelled') def stepSwitchPackingLists(self, sequence=None, sequence_list=None, **kw): @@ -415,9 +415,9 @@ class TestInvoiceMixin(TestPackingListMixin): total_quantity += simulation_movement.getQuantity() # check that those movements come from the same root applied # rule than the order. - self.assertEquals( simulation_movement.getRootAppliedRule(), + self.assertEqual( simulation_movement.getRootAppliedRule(), order_root_applied_rule) - self.assertEquals(total_quantity, movement.getQuantity()) + self.assertEqual(total_quantity, movement.getQuantity()) def checkMirrorAcquisition(self, object, acquired_object): """ @@ -425,16 +425,16 @@ class TestInvoiceMixin(TestPackingListMixin): """ # packing_list_movement, simulation_movement - self.assertEquals(acquired_object.getStartDate(), object.getStopDate()) - self.assertEquals(acquired_object.getStopDate(), object.getStartDate()) - self.assertEquals(acquired_object.getSourceValue(), \ + self.assertEqual(acquired_object.getStartDate(), object.getStopDate()) + self.assertEqual(acquired_object.getStopDate(), object.getStartDate()) + self.assertEqual(acquired_object.getSourceValue(), \ object.getDestinationValue()) - self.assertEquals(acquired_object.getDestinationValue(), \ + self.assertEqual(acquired_object.getDestinationValue(), \ object.getSourceValue()) - self.assertEquals(acquired_object.getSourceSectionValue(), \ + self.assertEqual(acquired_object.getSourceSectionValue(), \ object.getDestinationSectionValue()) - self.assertEquals(acquired_object.getDestinationSectionValue(), \ + self.assertEqual(acquired_object.getDestinationSectionValue(), \ object.getSourceSectionValue()) def stepCheckInvoiceBuilding(self, sequence=None, sequence_list=None, **kw): @@ -451,14 +451,14 @@ class TestInvoiceMixin(TestPackingListMixin): packing_list_building_state = 'started' packing_list_state = packing_list.getSimulationState() if packing_list_state != packing_list_building_state : - self.assertEquals(0, len(related_invoice_list)) + self.assertEqual(0, len(related_invoice_list)) else: - self.assertEquals(1, len(related_invoice_list)) + self.assertEqual(1, len(related_invoice_list)) invoice = related_invoice_list[0].getObject() - self.failUnless(invoice is not None) + self.assertTrue(invoice is not None) # Invoices created by Delivery Builder are in confirmed state - self.assertEquals(invoice.getSimulationState(), 'confirmed') + self.assertEqual(invoice.getSimulationState(), 'confirmed') # Get the list of simulation movements of packing list ... packing_list_simulation_movement_list = [] @@ -476,9 +476,9 @@ class TestInvoiceMixin(TestPackingListMixin): invoice_relative_url = invoice.getRelativeUrl() for simulation_movement in simulation_movement_list: invoice_movement_list = simulation_movement.getDeliveryValueList() - self.assertEquals(len(invoice_movement_list), 1) + self.assertEqual(len(invoice_movement_list), 1) invoice_movement = invoice_movement_list[0] - self.failUnless(invoice_movement is not None) + self.assertTrue(invoice_movement is not None) self.assert_(invoice_movement.getRelativeUrl().\ startswith(invoice_relative_url)) @@ -497,36 +497,36 @@ class TestInvoiceMixin(TestPackingListMixin): total_price += related_simulation_movement.getPrice() *\ related_simulation_movement.getQuantity() # Test resource - self.assertEquals(invoice_movement.getResource(), \ + self.assertEqual(invoice_movement.getResource(), \ related_simulation_movement.getResource()) # Test resource variation - self.assertEquals(invoice_movement.getVariationText(), \ + self.assertEqual(invoice_movement.getVariationText(), \ related_simulation_movement.getVariationText()) - self.assertEquals(invoice_movement.getVariationCategoryList(), \ + self.assertEqual(invoice_movement.getVariationCategoryList(), \ related_simulation_movement.getVariationCategoryList()) # Test acquisition self.checkAcquisition(invoice_movement, related_simulation_movement) # Test delivery ratio - self.assertEquals(related_simulation_movement.getQuantity() /\ + self.assertEqual(related_simulation_movement.getQuantity() /\ invoice_movement_quantity, \ related_simulation_movement.getDeliveryRatio()) - self.assertEquals(quantity, invoice_movement.getQuantity()) + self.assertEqual(quantity, invoice_movement.getQuantity()) # Test price - self.assertEquals(total_price / quantity, invoice_movement.getPrice()) + self.assertEqual(total_price / quantity, invoice_movement.getPrice()) sequence.edit(invoice = invoice) # Test causality - self.assertEquals(len(invoice.getCausalityValueList( + self.assertEqual(len(invoice.getCausalityValueList( portal_type = self.packing_list_portal_type)), 1) - self.assertEquals(invoice.getCausalityValue(), packing_list) + self.assertEqual(invoice.getCausalityValue(), packing_list) # Finally, test getTotalQuantity and getTotalPrice on Invoice - self.assertEquals(packing_list.getTotalQuantity(), + self.assertEqual(packing_list.getTotalQuantity(), invoice.getTotalQuantity()) - self.assertEquals(packing_list.getTotalPrice(), + self.assertEqual(packing_list.getTotalPrice(), invoice.getTotalPrice()) def stepCheckInvoicesConsistency(self, sequence=None, sequence_list=None, @@ -546,7 +546,7 @@ class TestInvoiceMixin(TestPackingListMixin): portal_type=self.invoice_line_portal_type) invoice_transaction_line_list = invoice.contentValues( portal_type=self.invoice_transaction_line_portal_type) - self.assertEquals(3, len(invoice_transaction_line_list)) + self.assertEqual(3, len(invoice_transaction_line_list)) expected_price = 0.0 for line in invoice_line_list: expected_price += line.getTotalPrice() @@ -560,7 +560,7 @@ class TestInvoiceMixin(TestPackingListMixin): else: self.fail('No line found that matches %s' % line_id) resource_precision = line.getResourceValue().getQuantityPrecision() - self.assertEquals(round(line.getQuantity(), resource_precision), + self.assertEqual(round(line.getQuantity(), resource_precision), round(expected_price * line_ratio, resource_precision)) def stepCheckInvoiceLineHasReferenceAndIntIndex(self, sequence=None, **kw): @@ -570,10 +570,10 @@ class TestInvoiceMixin(TestPackingListMixin): invoice = sequence.get('invoice') invoice_line_list = invoice.contentValues( portal_type=self.invoice_line_portal_type) - self.assertEquals(1, len(invoice_line_list)) + self.assertEqual(1, len(invoice_line_list)) invoice_line = invoice_line_list[0] - self.assertEquals(1, invoice_line.getIntIndex()) - self.assertEquals('1', invoice_line.getReference()) + self.assertEqual(1, invoice_line.getIntIndex()) + self.assertEqual('1', invoice_line.getReference()) def stepCheckPackingListInvoice( self, sequence=None, sequence_list=None, **kw): @@ -582,27 +582,27 @@ class TestInvoiceMixin(TestPackingListMixin): packing_list = sequence.get('packing_list') related_invoice_list = packing_list.getCausalityRelatedValueList( portal_type=self.invoice_portal_type) - self.assertEquals(len(related_invoice_list), 1) + self.assertEqual(len(related_invoice_list), 1) invoice = related_invoice_list[0] - self.assertEquals(packing_list.getSource(), invoice.getSource()) - self.assertEquals(packing_list.getDestination(), invoice.getDestination()) - self.assertEquals(packing_list.getDestinationSection(), \ + self.assertEqual(packing_list.getSource(), invoice.getSource()) + self.assertEqual(packing_list.getDestination(), invoice.getDestination()) + self.assertEqual(packing_list.getDestinationSection(), \ invoice.getDestinationSection()) - self.assertEquals(packing_list.getSourceSection(), \ + self.assertEqual(packing_list.getSourceSection(), \ invoice.getSourceSection()) - self.assertEquals(packing_list.getDestinationDecision(), \ + self.assertEqual(packing_list.getDestinationDecision(), \ invoice.getDestinationDecision()) - self.assertEquals(packing_list.getSourceDecision(), \ + self.assertEqual(packing_list.getSourceDecision(), \ invoice.getSourceDecision()) - self.assertEquals(packing_list.getDestinationAdministration(), \ + self.assertEqual(packing_list.getDestinationAdministration(), \ invoice.getDestinationAdministration()) - self.assertEquals(packing_list.getSourceAdministration(), \ + self.assertEqual(packing_list.getSourceAdministration(), \ invoice.getSourceAdministration()) - self.assertEquals(packing_list.getDestinationProject(), \ + self.assertEqual(packing_list.getDestinationProject(), \ invoice.getDestinationProject()) - self.assertEquals(packing_list.getSourceProject(), \ + self.assertEqual(packing_list.getSourceProject(), \ invoice.getSourceProject()) - self.assertEquals(packing_list.getPriceCurrency(), \ + self.assertEqual(packing_list.getPriceCurrency(), \ invoice.getPriceCurrency()) @@ -618,30 +618,30 @@ class TestInvoiceMixin(TestPackingListMixin): """ Checks that an empty delivery rule is created for the convergeant Packing List""" packing_list = sequence.get('packing_list') - self.failUnless(packing_list is not None) + self.assertTrue(packing_list is not None) simulation_tool = self.getSimulationTool() # Check that there is an applied rule for our packing list rule_list = [x for x in simulation_tool.objectValues() if x.getCausalityValue()==packing_list] - self.assertEquals(len(rule_list),1) + self.assertEqual(len(rule_list),1) packing_list_rule = rule_list[0] sequence.edit(packing_list_rule=packing_list_rule) rule_line_list = packing_list_rule.objectValues() packing_list_line_list = packing_list.objectValues() - self.assertEquals(len(packing_list_line_list), + self.assertEqual(len(packing_list_line_list), len(rule_line_list)) - self.assertEquals(1, len(rule_line_list)) + self.assertEqual(1, len(rule_line_list)) rule_line = rule_line_list[0] packing_list_line = packing_list_line_list[0] - self.assertEquals(rule_line.getQuantity(), 10) - self.assertEquals(rule_line.getPrice(), 100) - self.assertEquals(rule_line.getDeliveryValue(), + self.assertEqual(rule_line.getQuantity(), 10) + self.assertEqual(rule_line.getPrice(), 100) + self.assertEqual(rule_line.getDeliveryValue(), packing_list_line) - self.assertEquals(rule_line.getStartDate(), + self.assertEqual(rule_line.getStartDate(), packing_list_line.getStartDate()) - self.assertEquals(rule_line.getStopDate(), + self.assertEqual(rule_line.getStopDate(), packing_list_line.getStopDate()) - self.assertEquals(rule_line.getPortalType(), + self.assertEqual(rule_line.getPortalType(), 'Simulation Movement') @@ -654,21 +654,21 @@ class TestInvoiceMixin(TestPackingListMixin): for o in packing_list_module.objectValues(): if o.getCausalityValue() == order: sale_packing_list_list.append(o) - self.assertEquals(len(sale_packing_list_list), 1) + self.assertEqual(len(sale_packing_list_list), 1) sale_packing_list = sale_packing_list_list[0] sale_packing_list_line_list = sale_packing_list.objectValues() - self.assertEquals(len(sale_packing_list_line_list),1) + self.assertEqual(len(sale_packing_list_line_list),1) sale_packing_list_line = sale_packing_list_line_list[0] product = sequence.get('resource') - self.assertEquals(sale_packing_list_line.getResourceValue(), + self.assertEqual(sale_packing_list_line.getResourceValue(), product) - self.assertEquals(sale_packing_list_line.getPrice(), + self.assertEqual(sale_packing_list_line.getPrice(), self.price1) LOG('sale_packing_list_line.showDict()',0, sale_packing_list_line.showDict()) - self.assertEquals(sale_packing_list_line.getQuantity(), + self.assertEqual(sale_packing_list_line.getQuantity(), self.quantity1) - self.assertEquals(sale_packing_list_line.getTotalPrice(), + self.assertEqual(sale_packing_list_line.getTotalPrice(), self.total_price1) sequence.edit(packing_list = sale_packing_list) @@ -695,9 +695,9 @@ class TestInvoiceMixin(TestPackingListMixin): """ checks invoice properties are well set. """ invoice = sequence.get('invoice') new_invoice = sequence.get('new_invoice') - self.assertEquals(3,len(invoice.objectValues( + self.assertEqual(3,len(invoice.objectValues( portal_type=self.invoice_transaction_line_portal_type))) - self.assertEquals(3,len(new_invoice.objectValues( + self.assertEqual(3,len(new_invoice.objectValues( portal_type=self.invoice_transaction_line_portal_type))) account_module = self.portal.account_module found_dict = {} @@ -739,7 +739,7 @@ class TestInvoiceMixin(TestPackingListMixin): portal_type=portal_type_list)) for builder in self.getPortal().portal_deliveries.objectValues(): builder.build() - self.assertEquals(sale_invoice_transaction_count, + self.assertEqual(sale_invoice_transaction_count, len(accounting_module.objectValues( portal_type=portal_type_list))) @@ -857,7 +857,7 @@ class TestInvoiceMixin(TestPackingListMixin): Test if invoice is calculating """ invoice = sequence.get('invoice') - self.assertEquals('calculating',invoice.getCausalityState()) + self.assertEqual('calculating',invoice.getCausalityState()) def stepCheckInvoiceIsDiverged(self, sequence=None, sequence_list=None, **kw): @@ -865,7 +865,7 @@ class TestInvoiceMixin(TestPackingListMixin): Test if invoice is diverged """ invoice = sequence.get('invoice') - self.assertEquals('diverged',invoice.getCausalityState()) + self.assertEqual('diverged',invoice.getCausalityState()) def stepCheckInvoiceIsSolved(self, sequence=None, sequence_list=None, **kw): @@ -873,7 +873,7 @@ class TestInvoiceMixin(TestPackingListMixin): Test if invoice is solved """ invoice = sequence.get('invoice') - self.assertEquals('solved', invoice.getCausalityState(), + self.assertEqual('solved', invoice.getCausalityState(), invoice.getDivergenceList()) def stepCheckInvoiceIsDivergent(self, sequence=None, sequence_list=None, @@ -939,7 +939,7 @@ class TestInvoiceMixin(TestPackingListMixin): packing_list = sequence.get('packing_list') invoice_list = packing_list.getCausalityRelatedValueList( portal_type=self.invoice_portal_type) - self.assertEquals(2,len(invoice_list)) + self.assertEqual(2,len(invoice_list)) invoice1 = None invoice2 = None for invoice in invoice_list: @@ -950,10 +950,10 @@ class TestInvoiceMixin(TestPackingListMixin): sequence.edit(new_invoice=invoice2) for line in invoice1.objectValues( portal_type=self.invoice_line_portal_type): - self.assertEquals(self.default_quantity-1,line.getQuantity()) + self.assertEqual(self.default_quantity-1,line.getQuantity()) for line in invoice2.objectValues( portal_type=self.invoice_line_portal_type): - self.assertEquals(1,line.getQuantity()) + self.assertEqual(1,line.getQuantity()) def stepCheckInvoiceNotSplitted(self, sequence=None, sequence_list=None, **kw): """ @@ -962,7 +962,7 @@ class TestInvoiceMixin(TestPackingListMixin): packing_list = sequence.get('packing_list') invoice_list = packing_list.getCausalityRelatedValueList( portal_type=self.invoice_portal_type) - self.assertEquals(1,len(invoice_list)) + self.assertEqual(1,len(invoice_list)) invoice1 = None for invoice in invoice_list: if invoice.getUid() == sequence.get('invoice').getUid(): @@ -970,7 +970,7 @@ class TestInvoiceMixin(TestPackingListMixin): last_delta = sequence.get('last_delta', 0.0) for line in invoice1.objectValues( portal_type=self.invoice_line_portal_type): - self.assertEquals(self.default_quantity + last_delta, + self.assertEqual(self.default_quantity + last_delta, line.getQuantity()) def stepAddInvoiceLines(self, sequence=None, sequence_list=[]): @@ -1094,7 +1094,7 @@ class TestInvoiceMixin(TestPackingListMixin): # for each movement, we want to make sure that each rule is not # instanciated more than once if len(found_rule_dict): - self.assertEquals(set(found_rule_dict.itervalues()), set([1])) + self.assertEqual(set(found_rule_dict.itervalues()), set([1])) elif k == 'parent_movement_type_list': if rule.getParentValue().getDeliveryValue() is not None: parent_type = rule.getParentValue().getDeliveryValue().getPortalType() @@ -1190,9 +1190,9 @@ class TestInvoice(TestInvoiceMixin): invoice_transaction_applied_rule = invoice_movement.contentValues()[0] invoice_transaction_movement =\ invoice_transaction_applied_rule.contentValues()[0] - self.assertEquals(currency, + self.assertEqual(currency, invoice_transaction_movement.getResourceValue()) - self.assertEquals(currency, + self.assertEqual(currency, delivery_movement.getPriceCurrencyValue()) @newSimulationExpectedFailure @@ -1243,7 +1243,7 @@ class TestInvoice(TestInvoiceMixin): title='Other Project') order.plan() self.tic() - self.assertEquals('planned', order.getSimulationState()) + self.assertEqual('planned', order.getSimulationState()) related_applied_rule = order.getCausalityRelatedValue( portal_type='Applied Rule') @@ -1254,19 +1254,19 @@ class TestInvoice(TestInvoiceMixin): order_line.setSourceValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getSourceValue()) order_line.setDestinationValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getDestinationValue()) order_line.setSourceSectionValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getSourceSectionValue()) # make sure destination_section != source_section, this might be needed by @@ -1276,81 +1276,81 @@ class TestInvoice(TestInvoiceMixin): order_line.setDestinationSectionValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getDestinationSectionValue()) order_line.setSourceAdministrationValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getSourceAdministrationValue()) order_line.setDestinationAdministrationValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getDestinationAdministrationValue()) order_line.setSourceDecisionValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getSourceDecisionValue()) order_line.setDestinationDecisionValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getDestinationDecisionValue()) order_line.setSourceProjectValue(other_project) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_project, + self.assertEqual(other_project, invoice_movement.getSourceProjectValue()) order_line.setDestinationProjectValue(other_project) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_project, + self.assertEqual(other_project, invoice_movement.getDestinationProjectValue()) order_line.setSourcePaymentValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getSourcePaymentValue()) order_line.setDestinationPaymentValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getDestinationPaymentValue()) order_line.setSourceFunctionValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getSourceFunctionValue()) order_line.setDestinationFunctionValue(other_entity) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_movement.getDestinationFunctionValue()) self.assertNotEquals(123, order_line.getPrice()) order_line.setPrice(123) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(123, + self.assertEqual(123, invoice_movement.getPrice()) self.assertNotEquals(456, order_line.getQuantity()) order_line.setQuantity(456) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(456, + self.assertEqual(456, invoice_movement.getQuantity()) other_resource = self.portal.product_module.newContent( @@ -1364,19 +1364,19 @@ class TestInvoice(TestInvoiceMixin): delivery_movement = related_applied_rule.contentValues()[0] invoice_applied_rule = delivery_movement.contentValues()[0] invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(other_resource, + self.assertEqual(other_resource, invoice_movement.getResourceValue()) order_line.setStartDate(DateTime(2001, 02, 03)) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(DateTime(2001, 02, 03), + self.assertEqual(DateTime(2001, 02, 03), invoice_movement.getStartDate()) order_line.setStopDate(DateTime(2002, 03, 04)) self.tic() invoice_movement = invoice_applied_rule.contentValues()[0] - self.assertEquals(DateTime(2002, 03, 04), + self.assertEqual(DateTime(2002, 03, 04), invoice_movement.getStopDate()) @newSimulationExpectedFailure @@ -1425,7 +1425,7 @@ class TestInvoice(TestInvoiceMixin): title='Other Project') order.plan() self.tic() - self.assertEquals('planned', order.getSimulationState()) + self.assertEqual('planned', order.getSimulationState()) related_applied_rule = order.getCausalityRelatedValue( portal_type='Applied Rule') @@ -1445,13 +1445,13 @@ class TestInvoice(TestInvoiceMixin): return movement self.fail('Income movement not found') - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) order_line.setSourceSectionValue(other_entity) self.tic() - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_transaction_movement.getSourceSectionValue()) # make sure destination_section != source_section, this might be needed by @@ -1460,124 +1460,124 @@ class TestInvoice(TestInvoiceMixin): order_line.setDestinationSectionValue(other_entity) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_transaction_movement.getDestinationSectionValue()) order_line.setSourceAdministrationValue(other_entity) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_transaction_movement.getSourceAdministrationValue()) order_line.setDestinationAdministrationValue(other_entity) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_transaction_movement.getDestinationAdministrationValue()) order_line.setSourceDecisionValue(other_entity) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_transaction_movement.getSourceDecisionValue()) order_line.setDestinationDecisionValue(other_entity) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_transaction_movement.getDestinationDecisionValue()) order_line.setSourceProjectValue(other_project) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(other_project, + self.assertEqual(other_project, invoice_transaction_movement.getSourceProjectValue()) order_line.setDestinationProjectValue(other_project) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(other_project, + self.assertEqual(other_project, invoice_transaction_movement.getDestinationProjectValue()) order_line.setSourceFunctionValue(other_entity) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_transaction_movement.getSourceFunctionValue()) order_line.setDestinationFunctionValue(other_entity) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_transaction_movement.getDestinationFunctionValue()) order_line.setSourcePaymentValue(other_entity) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_transaction_movement.getSourcePaymentValue()) order_line.setDestinationPaymentValue(other_entity) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(other_entity, + self.assertEqual(other_entity, invoice_transaction_movement.getDestinationPaymentValue()) order_line.setQuantity(1) order_line.setPrice(123) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(123, + self.assertEqual(123, invoice_transaction_movement.getQuantity()) order_line.setQuantity(456) order_line.setPrice(1) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(456, + self.assertEqual(456, invoice_transaction_movement.getQuantity()) order_line.setStartDate(DateTime(2001, 02, 03)) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(DateTime(2001, 02, 03), + self.assertEqual(DateTime(2001, 02, 03), invoice_transaction_movement.getStartDate()) order_line.setStopDate(DateTime(2002, 03, 04)) self.tic() - self.assertEquals(3, len(invoice_transaction_applied_rule)) + self.assertEqual(3, len(invoice_transaction_applied_rule)) invoice_transaction_movement = getIncomeSimulationMovement( invoice_transaction_applied_rule) - self.assertEquals(DateTime(2002, 03, 04), + self.assertEqual(DateTime(2002, 03, 04), invoice_transaction_movement.getStopDate()) def test_Invoice_viewAsODT(self): @@ -1693,9 +1693,9 @@ class TestInvoice(TestInvoiceMixin): portal_type='Organisation', title='Vendor') vendor_logo = vendor.newContent(portal_type='Embedded File', id='default_image') - self.assertEquals(0, vendor_logo.getSize()) - self.assertEquals(0, vendor.getDefaultImageWidth()) - self.assertEquals(0, vendor.getDefaultImageHeight()) + self.assertEqual(0, vendor_logo.getSize()) + self.assertEqual(0, vendor.getDefaultImageWidth()) + self.assertEqual(0, vendor.getDefaultImageHeight()) invoice = self.portal.getDefaultModule(self.invoice_portal_type).newContent( portal_type=self.invoice_portal_type, start_date=DateTime(2008, 12, 31), @@ -1744,8 +1744,8 @@ class TestInvoice(TestInvoiceMixin): # width and height of an invalid image are -1 according to # OFS.Image.getImageInfo maybe this is not what we want here ? - self.assertEquals(-1, vendor.getDefaultImageWidth()) - self.assertEquals(-1, vendor.getDefaultImageHeight()) + self.assertEqual(-1, vendor.getDefaultImageWidth()) + self.assertEqual(-1, vendor.getDefaultImageHeight()) invoice = self.portal.getDefaultModule(self.invoice_portal_type).newContent( portal_type=self.invoice_portal_type, @@ -1839,28 +1839,28 @@ class TestInvoice(TestInvoiceMixin): line_list = related_invoice.contentValues( portal_type=self.invoice_line_portal_type) - self.assertEquals(1, len(line_list)) + self.assertEqual(1, len(line_list)) invoice_line = line_list[0] - self.assertEquals(resource, invoice_line.getResourceValue()) - self.assertEquals(['size'], invoice_line.getVariationBaseCategoryList()) - self.assertEquals(2, + self.assertEqual(resource, invoice_line.getResourceValue()) + self.assertEqual(['size'], invoice_line.getVariationBaseCategoryList()) + self.assertEqual(2, len(invoice_line.getCellValueList(base_id='movement'))) cell_baby = invoice_line.getCell('size/Baby', base_id='movement') self.assertNotEquals(cell_baby, None) - self.assertEquals(resource, cell_baby.getResourceValue()) - self.assertEquals(10, cell_baby.getQuantity()) - self.assertEquals(4, cell_baby.getPrice()) + self.assertEqual(resource, cell_baby.getResourceValue()) + self.assertEqual(10, cell_baby.getQuantity()) + self.assertEqual(4, cell_baby.getPrice()) self.assertTrue('size/Baby' in cell_baby.getVariationCategoryList()) self.assertTrue(cell_baby.isMemberOf('size/Baby')) cell_child_32 = invoice_line.getCell('size/Child/32', base_id='movement') self.assertNotEquals(cell_child_32, None) - self.assertEquals(resource, cell_child_32.getResourceValue()) - self.assertEquals(20, cell_child_32.getQuantity()) - self.assertEquals(5, cell_child_32.getPrice()) + self.assertEqual(resource, cell_child_32.getResourceValue()) + self.assertEqual(20, cell_child_32.getQuantity()) + self.assertEqual(5, cell_child_32.getPrice()) self.assertTrue('size/Child/32' in cell_child_32.getVariationCategoryList()) self.assertTrue(cell_child_32.isMemberOf('size/Child/32')) @@ -1935,28 +1935,28 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( line_list = related_invoice.contentValues( portal_type=self.invoice_line_portal_type) - self.assertEquals(1, len(line_list)) + self.assertEqual(1, len(line_list)) invoice_line = line_list[0] - self.assertEquals(resource, invoice_line.getResourceValue()) - self.assertEquals(['size'], invoice_line.getVariationBaseCategoryList()) - self.assertEquals(2, + self.assertEqual(resource, invoice_line.getResourceValue()) + self.assertEqual(['size'], invoice_line.getVariationBaseCategoryList()) + self.assertEqual(2, len(invoice_line.getCellValueList(base_id='movement'))) cell_baby = invoice_line.getCell('size/Baby', base_id='movement') self.assertNotEquals(cell_baby, None) - self.assertEquals(resource, cell_baby.getResourceValue()) - self.assertEquals(10, cell_baby.getQuantity()) - self.assertEquals(4, cell_baby.getPrice()) + self.assertEqual(resource, cell_baby.getResourceValue()) + self.assertEqual(10, cell_baby.getQuantity()) + self.assertEqual(4, cell_baby.getPrice()) self.assertTrue('size/Baby' in cell_baby.getVariationCategoryList()) self.assertTrue(cell_baby.isMemberOf('size/Baby')) cell_child_32 = invoice_line.getCell('size/Child/32', base_id='movement') self.assertNotEquals(cell_child_32, None) - self.assertEquals(resource, cell_child_32.getResourceValue()) - self.assertEquals(20, cell_child_32.getQuantity()) - self.assertEquals(5, cell_child_32.getPrice()) + self.assertEqual(resource, cell_child_32.getResourceValue()) + self.assertEqual(20, cell_child_32.getQuantity()) + self.assertEqual(5, cell_child_32.getPrice()) self.assertTrue('size/Child/32' in cell_child_32.getVariationCategoryList()) self.assertTrue(cell_child_32.isMemberOf('size/Child/32')) @@ -2031,28 +2031,28 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( line_list = related_invoice.contentValues( portal_type=self.invoice_line_portal_type) - self.assertEquals(1, len(line_list)) + self.assertEqual(1, len(line_list)) invoice_line = line_list[0] - self.assertEquals(resource, invoice_line.getResourceValue()) - self.assertEquals(['size'], invoice_line.getVariationBaseCategoryList()) - self.assertEquals(2, + self.assertEqual(resource, invoice_line.getResourceValue()) + self.assertEqual(['size'], invoice_line.getVariationBaseCategoryList()) + self.assertEqual(2, len(invoice_line.getCellValueList(base_id='movement'))) cell_baby = invoice_line.getCell('size/Baby', base_id='movement') self.assertNotEquals(cell_baby, None) - self.assertEquals(resource, cell_baby.getResourceValue()) - self.assertEquals(10, cell_baby.getQuantity()) - self.assertEquals(4, cell_baby.getPrice()) + self.assertEqual(resource, cell_baby.getResourceValue()) + self.assertEqual(10, cell_baby.getQuantity()) + self.assertEqual(4, cell_baby.getPrice()) self.assertTrue('size/Baby' in cell_baby.getVariationCategoryList()) self.assertTrue(cell_baby.isMemberOf('size/Baby')) cell_child_32 = invoice_line.getCell('size/Child/32', base_id='movement') self.assertNotEquals(cell_child_32, None) - self.assertEquals(resource, cell_child_32.getResourceValue()) - self.assertEquals(20, cell_child_32.getQuantity()) - self.assertEquals(5, cell_child_32.getPrice()) + self.assertEqual(resource, cell_child_32.getResourceValue()) + self.assertEqual(20, cell_child_32.getQuantity()) + self.assertEqual(5, cell_child_32.getPrice()) self.assertTrue('size/Child/32' in cell_child_32.getVariationCategoryList()) self.assertTrue(cell_child_32.isMemberOf('size/Child/32')) @@ -2111,10 +2111,10 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( self.assertNotEquals(related_packing_list, None) movement_list = related_packing_list.getMovementList() - self.assertEquals(2, len(movement_list)) - self.assertEquals(['The first line'], + self.assertEqual(2, len(movement_list)) + self.assertEqual(['The first line'], [m.getDescription() for m in movement_list if m.getQuantity() == 3]) - self.assertEquals(['The second line'], + self.assertEqual(['The second line'], [m.getDescription() for m in movement_list if m.getQuantity() == 5]) related_packing_list.start() @@ -2129,10 +2129,10 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( movement_list = related_invoice.getMovementList( portal_type=self.invoice_line_portal_type) - self.assertEquals(2, len(movement_list)) - self.assertEquals(['The first line'], + self.assertEqual(2, len(movement_list)) + self.assertEqual(['The first line'], [m.getDescription() for m in movement_list if m.getQuantity() == 3]) - self.assertEquals(['The second line'], + self.assertEqual(['The second line'], [m.getDescription() for m in movement_list if m.getQuantity() == 5]) @@ -2201,9 +2201,9 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( related_packing_list = order.getCausalityRelatedValue( portal_type=self.packing_list_portal_type) self.assertNotEquals(related_packing_list, None) - self.assertEquals(related_packing_list.getDeliveryMode(), + self.assertEqual(related_packing_list.getDeliveryMode(), order.getDeliveryMode()) - self.assertEquals(related_packing_list.getIncoterm(), + self.assertEqual(related_packing_list.getIncoterm(), order.getIncoterm()) related_packing_list.start() related_packing_list.stop() @@ -2213,9 +2213,9 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( related_invoice = related_packing_list.getCausalityRelatedValue( portal_type=self.invoice_portal_type) self.assertNotEquals(related_invoice, None) - self.assertEquals(related_invoice.getDeliveryMode(), + self.assertEqual(related_invoice.getDeliveryMode(), order.getDeliveryMode()) - self.assertEquals(related_invoice.getIncoterm(), + self.assertEqual(related_invoice.getIncoterm(), order.getIncoterm()) @@ -2268,9 +2268,9 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( quantity_unit=self.mass_quantity_unit, quantity=1.5, price=2) - self.assertEquals(first_order_line.getQuantityUnit(), + self.assertEqual(first_order_line.getQuantityUnit(), self.unit_piece_quantity_unit) - self.assertEquals(second_order_line.getQuantityUnit(), + self.assertEqual(second_order_line.getQuantityUnit(), self.mass_quantity_unit) order.confirm() @@ -2281,14 +2281,14 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( portal_type=self.packing_list_portal_type) self.assertNotEquals(related_packing_list, None) movement_list = related_packing_list.getMovementList() - self.assertEquals(len(movement_list),2) + self.assertEqual(len(movement_list),2) movement_list = sorted(movement_list, key=lambda x: x.getQuantity()) - self.assertEquals(movement_list[0].getQuantityUnit(), + self.assertEqual(movement_list[0].getQuantityUnit(), self.mass_quantity_unit) - self.assertEquals(movement_list[0].getQuantity(), 1.5) - self.assertEquals(movement_list[1].getQuantityUnit(), + self.assertEqual(movement_list[0].getQuantity(), 1.5) + self.assertEqual(movement_list[1].getQuantityUnit(), self.unit_piece_quantity_unit) - self.assertEquals(movement_list[1].getQuantity(), 5) + self.assertEqual(movement_list[1].getQuantity(), 5) related_packing_list.start() related_packing_list.stop() @@ -2300,14 +2300,14 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( portal_type=self.invoice_portal_type) self.assertNotEquals(related_invoice, None) movement_list = related_invoice.getMovementList() - self.assertEquals(len(movement_list),2) + self.assertEqual(len(movement_list),2) movement_list = sorted(movement_list, key=lambda x: x.getQuantity()) - self.assertEquals(movement_list[0].getQuantityUnit(), + self.assertEqual(movement_list[0].getQuantityUnit(), self.mass_quantity_unit) - self.assertEquals(movement_list[0].getQuantity(), 1.5) - self.assertEquals(movement_list[1].getQuantityUnit(), + self.assertEqual(movement_list[0].getQuantity(), 1.5) + self.assertEqual(movement_list[1].getQuantityUnit(), self.unit_piece_quantity_unit) - self.assertEquals(movement_list[1].getQuantity(), 5) + self.assertEqual(movement_list[1].getQuantity(), 5) @@ -2328,7 +2328,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( packing_list.setReady() packing_list.start() packing_list.stop() - self.assertEquals('stopped', packing_list.getSimulationState()) + self.assertEqual('stopped', packing_list.getSimulationState()) self.tic() self.stepInvoiceBuilderAlarm() self.tic() @@ -2337,7 +2337,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( portal_type=self.invoice_portal_type) self.assertNotEquals(invoice, None) invoice_line_list = invoice.getMovementList() - self.assertEquals(1, len(invoice_line_list)) + self.assertEqual(1, len(invoice_line_list)) invoice_line = invoice_line_list[0] new_quantity = invoice_line.getQuantity() * 2 @@ -2347,25 +2347,25 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( self.assertTrue(invoice.isDivergent()) divergence_list = invoice.getDivergenceList() - self.assertEquals(1, len(divergence_list)) + self.assertEqual(1, len(divergence_list)) divergence = divergence_list[0] - self.assertEquals('quantity', divergence.tested_property) + self.assertEqual('quantity', divergence.tested_property) # accept decision self._acceptDivergenceOnInvoice(invoice, divergence_list) self.tic() - self.assertEquals('solved', invoice.getCausalityState()) + self.assertEqual('solved', invoice.getCausalityState()) - self.assertEquals([], invoice.getDivergenceList()) - self.assertEquals(new_quantity, invoice_line.getQuantity()) - self.assertEquals(new_quantity, + self.assertEqual([], invoice.getDivergenceList()) + self.assertEqual(new_quantity, invoice_line.getQuantity()) + self.assertEqual(new_quantity, invoice_line.getDeliveryRelatedValue(portal_type='Simulation Movement' ).getQuantity()) - self.assertEquals([], packing_list.getDivergenceList()) - self.assertEquals('solved', packing_list.getCausalityState()) + self.assertEqual([], packing_list.getDivergenceList()) + self.assertEqual('solved', packing_list.getCausalityState()) def _adoptDivergenceOnInvoice(self, invoice, divergence_list): print invoice, divergence_list @@ -2387,7 +2387,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( packing_list.setReady() packing_list.start() packing_list.stop() - self.assertEquals('stopped', packing_list.getSimulationState()) + self.assertEqual('stopped', packing_list.getSimulationState()) self.tic() self.stepInvoiceBuilderAlarm() self.tic() @@ -2396,7 +2396,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( portal_type=self.invoice_portal_type) self.assertNotEquals(invoice, None) invoice_line_list = invoice.getMovementList() - self.assertEquals(1, len(invoice_line_list)) + self.assertEqual(1, len(invoice_line_list)) invoice_line = invoice_line_list[0] new_quantity = invoice_line.getQuantity() * 2 @@ -2406,32 +2406,32 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( self.assertTrue(invoice.isDivergent()) divergence_list = invoice.getDivergenceList() - self.assertEquals(1, len(divergence_list)) + self.assertEqual(1, len(divergence_list)) divergence = divergence_list[0] - self.assertEquals('quantity', divergence.tested_property) + self.assertEqual('quantity', divergence.tested_property) # adopt prevision self._adoptDivergenceOnInvoice(invoice, divergence_list) self.tic() - self.assertEquals([], invoice.getDivergenceList()) - self.assertEquals('solved', invoice.getCausalityState()) + self.assertEqual([], invoice.getDivergenceList()) + self.assertEqual('solved', invoice.getCausalityState()) - self.assertEquals(1, + self.assertEqual(1, len(invoice.getMovementList(portal_type=self.invoice_line_portal_type))) - self.assertEquals(0, + self.assertEqual(0, len(invoice.getMovementList(portal_type=self.invoice_transaction_line_portal_type))) - self.assertEquals(previous_resource, invoice_line.getResource()) - self.assertEquals(previous_quantity, invoice_line.getQuantity()) - self.assertEquals(previous_price, invoice_line.getPrice()) - self.assertEquals(previous_quantity, + self.assertEqual(previous_resource, invoice_line.getResource()) + self.assertEqual(previous_quantity, invoice_line.getQuantity()) + self.assertEqual(previous_price, invoice_line.getPrice()) + self.assertEqual(previous_quantity, invoice_line.getDeliveryRelatedValue(portal_type='Simulation Movement' ).getQuantity()) - self.assertEquals([], packing_list.getDivergenceList()) - self.assertEquals('solved', packing_list.getCausalityState()) + self.assertEqual([], packing_list.getDivergenceList()) + self.assertEqual('solved', packing_list.getCausalityState()) def test_subcontent_reindexing(self): """Tests, that modification on Order are propagated to lines and cells @@ -3374,7 +3374,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): destination_section_value=client) self.portal.portal_workflow.doActionFor(invoice, 'confirm_action') - self.assertEquals('1', invoice.getReference()) + self.assertEqual('1', invoice.getReference()) def test_16_ManuallyAddedMovements(self, quiet=quiet): """ @@ -3478,7 +3478,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): packing_list.setReady() packing_list.start() - self.assertEquals('started', packing_list.getSimulationState()) + self.assertEqual('started', packing_list.getSimulationState()) self.tic() self.stepInvoiceBuilderAlarm() self.tic() @@ -3487,7 +3487,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): portal_type=self.invoice_portal_type) self.assertNotEquals(invoice, None) invoice_line_list = invoice.getMovementList() - self.assertEquals(1, len(invoice_line_list)) + self.assertEqual(1, len(invoice_line_list)) invoice_line = invoice_line_list[0] new_quantity = invoice_line.getQuantity() * 2 @@ -3497,20 +3497,20 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): self.assertTrue(invoice.isDivergent()) divergence_list = invoice.getDivergenceList() - self.assertEquals(1, len(divergence_list)) + self.assertEqual(1, len(divergence_list)) divergence = divergence_list[0] - self.assertEquals('quantity', divergence.tested_property) + self.assertEqual('quantity', divergence.tested_property) # accept decision self._acceptDivergenceOnInvoice(invoice, divergence_list) self.tic() - self.assertEquals('solved', invoice.getCausalityState()) + self.assertEqual('solved', invoice.getCausalityState()) - self.assertEquals([], invoice.getDivergenceList()) - self.assertEquals(new_quantity, invoice_line.getQuantity()) - self.assertEquals(new_quantity, + self.assertEqual([], invoice.getDivergenceList()) + self.assertEqual(new_quantity, invoice_line.getQuantity()) + self.assertEqual(new_quantity, invoice_line.getDeliveryRelatedValue(portal_type='Simulation Movement' ).getQuantity()) @@ -3523,17 +3523,17 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): # With legacy simulation solvers, changes on simulation movements # will backtrack if simulation movements are not frozen. # the packing list is divergent, because it is not frozen - self.assertEquals('diverged', packing_list.getCausalityState()) + self.assertEqual('diverged', packing_list.getCausalityState()) divergence_list = packing_list.getDivergenceList() - self.assertEquals(1, len(divergence_list)) + self.assertEqual(1, len(divergence_list)) divergence = divergence_list[0] - self.assertEquals('quantity', divergence.tested_property) + self.assertEqual('quantity', divergence.tested_property) # if we adopt prevision on this packing list, both invoice and # packing list will be solved self._adoptDivergenceOnPackingList(packing_list, divergence_list) self.tic() - self.assertEquals('solved', packing_list.getCausalityState()) - self.assertEquals('solved', invoice.getCausalityState()) + self.assertEqual('solved', packing_list.getCausalityState()) + self.assertEqual('solved', invoice.getCausalityState()) class TestPurchaseInvoice(TestInvoice, ERP5TypeTestCase): """Tests for purchase invoice. diff --git a/product/ERP5/tests/testItem.py b/product/ERP5/tests/testItem.py index b34588f023..1f8872cd58 100644 --- a/product/ERP5/tests/testItem.py +++ b/product/ERP5/tests/testItem.py @@ -184,7 +184,7 @@ class TestItemMixin(TestSaleInvoiceMixin): """ Check items """ order_line = sequence.get('order_line') simulation_movement = order_line.getDeliveryRelatedValue() - self.failIf(simulation_movement is None) + self.assertFalse(simulation_movement is None) self.checkAggregate(line=simulation_movement, sequence=sequence) def stepCheckPackingListLineAggregate(self, sequence=None, @@ -219,7 +219,7 @@ class TestItemMixin(TestSaleInvoiceMixin): Check that start date is adopted. """ packing_list = sequence.get('packing_list') - self.assertEquals(packing_list.getStartDate(),self.datetime+15) + self.assertEqual(packing_list.getStartDate(),self.datetime+15) def stepModifyOrderLinesQuantity(self,sequence=None, sequence_list=None, **kw): @@ -238,7 +238,7 @@ class TestItemMixin(TestSaleInvoiceMixin): order = sequence.get('order') resource_list = sequence.get('resource_list') order_line_list = order.contentValues(portal_type=self.order_line_portal_type) - self.assertEquals(len(order_line_list),len(resource_list)) + self.assertEqual(len(order_line_list),len(resource_list)) order_line_list[-1].edit(start_date=self.datetime+15) @@ -253,13 +253,13 @@ class TestItemMixin(TestSaleInvoiceMixin): def checkAggregate(self, line=None, sequence=None): """ Check items """ item_list = sequence.get('item_list') - self.assertEquals(len(line.getAggregateList()),1) - self.failUnless(item_list[0] in line.getAggregateValueList()) + self.assertEqual(len(line.getAggregateList()),1) + self.assertTrue(item_list[0] in line.getAggregateValueList()) def checkAggregateList(self, line=None, sequence=None): """ Check items """ item_list = self.portal.item_module.contentValues(portal_type='Item') - self.failUnless(line.getAggregateValueList()[0] in item_list) + self.assertTrue(line.getAggregateValueList()[0] in item_list) DEFAULT_ITEM_WITH_ORDER_SEQUENCE = \ @@ -415,7 +415,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): self.tic() resource = self.createVariatedResource() # XXX this tests depends on the relative url of the resource - self.assertEquals('product_module/1', resource.getRelativeUrl()) + self.assertEqual('product_module/1', resource.getRelativeUrl()) self.tic() packing_list = self.createPackingList(resource=resource,organisation=organisation) packing_list_line= self.createPackingListLine(packing_list=packing_list, @@ -448,44 +448,44 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): packing_list_line.DeliveryLine_createItemList(type='Item', listbox=listbox) self.tic() - self.assertEquals( + self.assertEqual( len([x.getObject() for x in self.portal.portal_catalog( portal_type='Item', title='Lot A')]) ,1) - self.assertEquals( + self.assertEqual( len([x.getObject() for x in self.portal.portal_catalog( portal_type='Item', title='Lot B')]), 1) - self.assertEquals( + self.assertEqual( len([x.getObject() for x in self.portal.portal_catalog( portal_type='Item', title='Lot C')]), 1) - self.assertEquals(packing_list_line.getTotalQuantity(), 45.0) - self.assertEquals(sorted(packing_list_line.getVariationCategoryList()), + self.assertEqual(packing_list_line.getTotalQuantity(), 45.0) + self.assertEqual(sorted(packing_list_line.getVariationCategoryList()), sorted(['size/product_module/1/3', 'size/product_module/1/2', 'size/product_module/1/1'])) - self.assertEquals(packing_list_line.getAggregateTitleList(), []) + self.assertEqual(packing_list_line.getAggregateTitleList(), []) movement_cell_list = packing_list_line.contentValues( portal_type='Purchase Packing List Cell') - self.assertEquals(3, len(movement_cell_list)) + self.assertEqual(3, len(movement_cell_list)) cell = packing_list_line.getCell(base_id='movement', *('size/product_module/1/3', )) - self.assertEquals(cell.getQuantity(), 20) - self.assertEquals(['Lot A'], cell.getAggregateTitleList()) + self.assertEqual(cell.getQuantity(), 20) + self.assertEqual(['Lot A'], cell.getAggregateTitleList()) cell = packing_list_line.getCell(base_id='movement', *('size/product_module/1/2', )) - self.assertEquals(cell.getQuantity(), 10) - self.assertEquals(['Lot B'], cell.getAggregateTitleList()) + self.assertEqual(cell.getQuantity(), 10) + self.assertEqual(['Lot B'], cell.getAggregateTitleList()) cell = packing_list_line.getCell(base_id='movement', *('size/product_module/1/1', )) - self.assertEquals(cell.getQuantity(), 15) - self.assertEquals(['Lot C'], cell.getAggregateTitleList()) + self.assertEqual(cell.getQuantity(), 15) + self.assertEqual(['Lot C'], cell.getAggregateTitleList()) def test_04_CreateItemsFromPackingListLineWithVariationDefined(self): @@ -493,7 +493,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): self.tic() resource = self.createVariatedResource() # XXX this tests depends on the relative url of the resource - self.assertEquals('product_module/2', resource.getRelativeUrl()) + self.assertEqual('product_module/2', resource.getRelativeUrl()) self.tic() packing_list = self.createPackingList(resource=resource,organisation=organisation) @@ -510,9 +510,9 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): }, ) packing_list_line.DeliveryLine_createItemList(type='Item', listbox=listbox) - self.assertEquals(packing_list_line.getVariationCategoryList(), + self.assertEqual(packing_list_line.getVariationCategoryList(), ['size/product_module/2/3']) - self.assertEquals(packing_list_line.getTotalQuantity(), 20) + self.assertEqual(packing_list_line.getTotalQuantity(), 20) # create listbox a second time listbox = ({ 'listbox_key': '000', @@ -531,30 +531,30 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): packing_list_line.DeliveryLine_createItemList(type='Item', listbox=listbox) self.tic() - self.assertEquals(packing_list_line.getTotalQuantity(), 55.0) - self.assertEquals(sorted(packing_list_line.getVariationCategoryList()), + self.assertEqual(packing_list_line.getTotalQuantity(), 55.0) + self.assertEqual(sorted(packing_list_line.getVariationCategoryList()), sorted(['size/product_module/2/1', 'size/product_module/2/2', 'size/product_module/2/3'])) movement_cell_list = packing_list_line.contentValues( portal_type='Purchase Packing List Cell') - self.assertEquals(3, len(movement_cell_list)) + self.assertEqual(3, len(movement_cell_list)) cell = packing_list_line.getCell(base_id='movement', *('size/product_module/2/3', )) - self.assertEquals(cell.getQuantity(), 20) - self.assertEquals(['Lot A2'], cell.getAggregateTitleList()) + self.assertEqual(cell.getQuantity(), 20) + self.assertEqual(['Lot A2'], cell.getAggregateTitleList()) cell = packing_list_line.getCell(base_id='movement', *('size/product_module/2/1', )) - self.assertEquals(cell.getQuantity(), 20) - self.assertEquals(['Lot B2'], cell.getAggregateTitleList()) + self.assertEqual(cell.getQuantity(), 20) + self.assertEqual(['Lot B2'], cell.getAggregateTitleList()) cell = packing_list_line.getCell(base_id='movement', *('size/product_module/2/2', )) - self.assertEquals(cell.getQuantity(), 15) - self.assertEquals(['Lot C2'], cell.getAggregateTitleList()) + self.assertEqual(cell.getQuantity(), 15) + self.assertEqual(['Lot C2'], cell.getAggregateTitleList()) def test_05_CreateItemsFromPackingListLineWithNotVariatedResource(self): @@ -588,26 +588,26 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): ) packing_list_line.DeliveryLine_createItemList(type='Item', listbox=listbox) self.tic() - self.assertEquals( + self.assertEqual( len([x.getObject() for x in self.portal.portal_catalog( portal_type='Item', title='Lot A3')]), 1) - self.assertEquals( + self.assertEqual( len([x.getObject() for x in self.portal.portal_catalog( portal_type='Item', title='Lot B3')]), 1) - self.assertEquals( + self.assertEqual( len([x.getObject() for x in self.portal.portal_catalog( portal_type='Item', title='Lot C3')]), 1) - self.assertEquals(packing_list_line.getQuantity(),30.0) + self.assertEqual(packing_list_line.getQuantity(),30.0) - self.assertEquals(packing_list_line.getVariationCategoryList(), []) - self.assertEquals(packing_list_line.getAggregateTitleList(), + self.assertEqual(packing_list_line.getVariationCategoryList(), []) + self.assertEqual(packing_list_line.getAggregateTitleList(), ['Lot A3', 'Lot B3', 'Lot C3']) movement_cell_list = packing_list_line.contentValues( portal_type='Purchase Packing List Cell') - self.assertEquals(movement_cell_list,[]) + self.assertEqual(movement_cell_list,[]) @newSimulationExpectedFailure def test_06_VerifyHavingSameItemTwiceOnMovementCausesNoBug(self): @@ -617,7 +617,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): self.tic() resource = self.createVariatedResource() # XXX this tests depends on the relative url of the resource - self.assertEquals('product_module/4', resource.getRelativeUrl()) + self.assertEqual('product_module/4', resource.getRelativeUrl()) self.tic() packing_list = self.createPackingList(resource=resource,organisation=organisation) @@ -646,10 +646,10 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): packing_list_cell.setAggregateValueList(packing_list_cell.getAggregateValueList()+[item]) self.portal.portal_workflow.doActionFor(packing_list, 'confirm_action') - self.assertEquals(packing_list.getSimulationState(), + self.assertEqual(packing_list.getSimulationState(), 'confirmed') self.tic() - self.assertEquals(packing_list.getCausalityState(),'solved') + self.assertEqual(packing_list.getCausalityState(),'solved') def test_07_WithPackingListChangePackingListQuantityAndAccept(self, quiet=quiet, run=run_all_test): """ @@ -877,7 +877,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): packing_list_line.setAggregateValue(item) packing_list.confirm() packing_list.stop() - self.assertEquals('stopped', packing_list.getSimulationState()) + self.assertEqual('stopped', packing_list.getSimulationState()) self.tic() @@ -895,7 +895,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): # the listbox contains the items physically in the source of the packing # list - self.assertEquals([item], + self.assertEqual([item], packing_list_line.DeliveryLine_getSelectableItemList()) packing_list_line.DeliveryLine_selectItemList( @@ -903,8 +903,8 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): listbox_uid=(item.getUid(),), uids=(item.getUid(),)) - self.assertEquals([item], packing_list_line.getAggregateValueList()) - self.assertEquals(12, packing_list_line.getQuantity()) + self.assertEqual([item], packing_list_line.getAggregateValueList()) + self.assertEqual(12, packing_list_line.getQuantity()) @newSimulationExpectedFailure @@ -938,7 +938,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): packing_list.confirm() packing_list.stop() - self.assertEquals('stopped', packing_list.getSimulationState()) + self.assertEqual('stopped', packing_list.getSimulationState()) self.tic() @@ -956,7 +956,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): # the listbox contains the items physically in the source of the packing # list, and have matching variations - self.assertEquals([item], + self.assertEqual([item], packing_list_line.DeliveryLine_getSelectableItemList()) packing_list_line.DeliveryLine_selectItemList( @@ -964,17 +964,17 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): listbox_uid=(item.getUid(),), uids=(item.getUid(),)) - self.assertEquals([variation], + self.assertEqual([variation], packing_list_line.getVariationCategoryList()) - self.assertEquals(12, packing_list_line.getTotalQuantity()) - self.assertEquals([], packing_list_line.getAggregateValueList()) + self.assertEqual(12, packing_list_line.getTotalQuantity()) + self.assertEqual([], packing_list_line.getAggregateValueList()) - self.assertEquals(1, + self.assertEqual(1, len(packing_list_line.getCellValueList(base_id='movement'))) cell = packing_list_line.getCell(base_id='movement', *(variation, )) - self.assertEquals(12, cell.getQuantity()) - self.assertEquals([item], cell.getAggregateValueList()) + self.assertEqual(12, cell.getQuantity()) + self.assertEqual([item], cell.getAggregateValueList()) class TestItemScripts(ERP5TypeTestCase): @@ -1056,50 +1056,50 @@ class TestItemScripts(ERP5TypeTestCase): # with line @newSimulationExpectedFailure def test_Item_getResourceValue(self): - self.assertEquals(None, self.item.Item_getResourceValue()) + self.assertEqual(None, self.item.Item_getResourceValue()) line = self._makeSalePackingListLine() - self.assertEquals(self.product, self.item.Item_getResourceValue()) - self.assertEquals(None, self.item.Item_getResourceValue( + self.assertEqual(self.product, self.item.Item_getResourceValue()) + self.assertEqual(None, self.item.Item_getResourceValue( at_date=DateTime() - 2)) @newSimulationExpectedFailure def test_Item_getResourceTitle(self): - self.assertEquals(None, self.item.Item_getResourceTitle()) + self.assertEqual(None, self.item.Item_getResourceTitle()) line = self._makeSalePackingListLine() - self.assertEquals('Product', self.item.Item_getResourceTitle()) - self.assertEquals(None, self.item.Item_getResourceTitle( + self.assertEqual('Product', self.item.Item_getResourceTitle()) + self.assertEqual(None, self.item.Item_getResourceTitle( at_date=DateTime() - 2)) @newSimulationExpectedFailure def test_Item_getCurrentOwnerValue(self): - self.assertEquals(None, self.item.Item_getCurrentOwnerValue()) + self.assertEqual(None, self.item.Item_getCurrentOwnerValue()) line = self._makeSalePackingListLine() - self.assertEquals(self.section, self.item.Item_getCurrentOwnerValue()) - self.assertEquals(None, + self.assertEqual(self.section, self.item.Item_getCurrentOwnerValue()) + self.assertEqual(None, self.item.Item_getCurrentOwnerValue(at_date=DateTime() - 2)) @newSimulationExpectedFailure def test_Item_getCurrentOwnerTitle(self): - self.assertEquals(None, self.item.Item_getCurrentOwnerTitle()) + self.assertEqual(None, self.item.Item_getCurrentOwnerTitle()) line = self._makeSalePackingListLine() - self.assertEquals('Section', self.item.Item_getCurrentOwnerTitle()) - self.assertEquals(None, + self.assertEqual('Section', self.item.Item_getCurrentOwnerTitle()) + self.assertEqual(None, self.item.Item_getCurrentOwnerTitle(at_date=DateTime() - 2)) @newSimulationExpectedFailure def test_Item_getCurrentSiteValue(self): - self.assertEquals(None, self.item.Item_getCurrentSiteValue()) + self.assertEqual(None, self.item.Item_getCurrentSiteValue()) line = self._makeSalePackingListLine() - self.assertEquals(self.node, self.item.Item_getCurrentSiteValue()) - self.assertEquals(None, self.item.Item_getCurrentSiteValue( + self.assertEqual(self.node, self.item.Item_getCurrentSiteValue()) + self.assertEqual(None, self.item.Item_getCurrentSiteValue( at_date=DateTime() - 2)) @newSimulationExpectedFailure def test_Item_getCurrentSiteTitle(self): - self.assertEquals(None, self.item.Item_getCurrentSiteTitle()) + self.assertEqual(None, self.item.Item_getCurrentSiteTitle()) line = self._makeSalePackingListLine() - self.assertEquals('Node', self.item.Item_getCurrentSiteTitle()) - self.assertEquals(None, + self.assertEqual('Node', self.item.Item_getCurrentSiteTitle()) + self.assertEqual(None, self.item.Item_getCurrentSiteTitle(at_date=DateTime() - 2)) # with cells @@ -1129,20 +1129,20 @@ class TestItemScripts(ERP5TypeTestCase): @newSimulationExpectedFailure def test_Item_getVariationCategoryList(self): - self.assertEquals([], self.item.Item_getVariationCategoryList()) + self.assertEqual([], self.item.Item_getVariationCategoryList()) self._makeSalePackingListCellWithVariation() - self.assertEquals(['size/small'], self.item.Item_getVariationCategoryList()) - self.assertEquals([], + self.assertEqual(['size/small'], self.item.Item_getVariationCategoryList()) + self.assertEqual([], self.item.Item_getVariationCategoryList(at_date=DateTime() - 2)) @newSimulationExpectedFailure def test_Item_getVariationRangeCategoryItemList(self): - self.assertEquals([], self.item.Item_getVariationRangeCategoryItemList()) + self.assertEqual([], self.item.Item_getVariationRangeCategoryItemList()) self._makeSalePackingListCellWithVariation() - self.assertEquals([['Big', 'size/big'], + self.assertEqual([['Big', 'size/big'], ['Small', 'size/small']], self.item.Item_getVariationRangeCategoryItemList()) - self.assertEquals([], + self.assertEqual([], self.item.Item_getVariationRangeCategoryItemList( at_date=DateTime() - 2)) diff --git a/product/ERP5/tests/testKM.py b/product/ERP5/tests/testKM.py index b10e4ee663..4805cd0d74 100644 --- a/product/ERP5/tests/testKM.py +++ b/product/ERP5/tests/testKM.py @@ -434,7 +434,7 @@ class TestKM(TestKMMixIn): #self.changeSkin('KM') url = '%s/ERP5Site_viewHomeAreaRenderer?gadget_mode=web_front' %self.web_site_url response = self.publish(url, self.auth) - self.failUnless(self.web_front_knowledge_pad.getTitle() in response.getBody()) + self.assertTrue(self.web_front_knowledge_pad.getTitle() in response.getBody()) # Web Front gadgets web_front_gadgets = [km_my_tasks_gadget, km_my_documents_gadget, km_my_contacts_gadget] @@ -445,7 +445,7 @@ class TestKM(TestKMMixIn): # check that gadgets are added to web front page view response = self.publish(url, self.auth) for gadget in web_front_gadgets: - self.failUnless(gadget.getTitle() in response.getBody()) + self.assertTrue(gadget.getTitle() in response.getBody()) def test_05MyTaskGadget(self): """ Check My Task Gadgets """ @@ -483,8 +483,8 @@ class TestKM(TestKMMixIn): self.webpage.getRelativeUrl(), km_my_tasks_box_url) , self.auth)]: - self.failUnless(project.getTitle() in response.getBody()) - self.failUnless(visit.getTitle() in response.getBody()) + self.assertTrue(project.getTitle() in response.getBody()) + self.assertTrue(visit.getTitle() in response.getBody()) def test_06MyDocumentsGadget(self): """ Check My Document Gadgets """ @@ -526,8 +526,8 @@ class TestKM(TestKMMixIn): self.webpage.getRelativeUrl(), km_my_documents_gadget_box_url) , self.auth)]: - self.failUnless(web_page.getTitle() in response.getBody()) - self.failUnless(presentation.getTitle() in response.getBody()) + self.assertTrue(web_page.getTitle() in response.getBody()) + self.assertTrue(presentation.getTitle() in response.getBody()) def test_07MyContactsGadget(self): """ Check My Contacts Gadgets """ @@ -563,7 +563,7 @@ class TestKM(TestKMMixIn): self.webpage.getRelativeUrl(), km_my_contacts_gadget_box_url) , self.auth)]: - self.failUnless(person.getTitle() in response.getBody()) + self.assertTrue(person.getTitle() in response.getBody()) def test_08WebSectionGadget(self): """ Check Web Section Gadgets """ @@ -585,7 +585,7 @@ class TestKM(TestKMMixIn): %(self.web_section_url, self.web_section_knowledge_pad.getRelativeUrl()), self.auth) for gadget in web_section_gadgets: - self.failUnless(gadget.getTitle() in response.getBody()) + self.assertTrue(gadget.getTitle() in response.getBody()) def test_10LatestContentGadget(self): """ Check Latest Content Gadgets """ @@ -626,7 +626,7 @@ class TestKM(TestKMMixIn): presentation.publish() self.tic() self.changeSkin('KM') - self.failUnless(presentation.getTitle() in + self.assertTrue(presentation.getTitle() in self.publish(self.base_url_pattern %(self.web_section_url+'/%s' %latest_docs_subsection.getId(), gadget_view_form_id, @@ -655,7 +655,7 @@ class TestKM(TestKMMixIn): self.web_section_knowledge_pad, km_assigned_member_gadget) self.changeSkin('KM') - self.failUnless('No result' in + self.assertTrue('No result' in self.publish(self.base_url_pattern %(self.web_section_url+'/%s' %assigned_members_subsection.getId(), gadget_view_form_id, @@ -669,7 +669,7 @@ class TestKM(TestKMMixIn): assignment = person.newContent(portal_type = 'Assignment') self.tic() self.changeSkin('KM') - self.failUnless(person.getTitle() in + self.assertTrue(person.getTitle() in self.publish(self.base_url_pattern %(self.web_section_url+'/%s' %assigned_members_subsection.getId(), gadget_view_form_id, @@ -696,7 +696,7 @@ class TestKM(TestKMMixIn): %(self.web_page_url,self.web_section_content_knowledge_pad.getRelativeUrl()), self.auth) for gadget in web_section_content_gadgets: - self.failUnless(gadget.getTitle() in response.getBody()) + self.assertTrue(gadget.getTitle() in response.getBody()) def test_12RelationGadget(self): """ Check Relation Gadgets """ @@ -725,7 +725,7 @@ class TestKM(TestKMMixIn): gadget_view_form_id) # no related docs should exist - self.failUnless('No result.' in relation_form_renderer()) + self.assertTrue('No result.' in relation_form_renderer()) # set related docs similar_doc = portal.web_page_module.newContent( @@ -747,9 +747,9 @@ class TestKM(TestKMMixIn): self.changeSkin('KM') # .. should be in gadget html - self.failUnless(similar_doc.getTitle() in relation_form_renderer()) - self.failUnless(predecessor_doc.getTitle() in relation_form_renderer()) - self.failUnless(successor_doc.getTitle() in relation_form_renderer()) + self.assertTrue(similar_doc.getTitle() in relation_form_renderer()) + self.assertTrue(predecessor_doc.getTitle() in relation_form_renderer()) + self.assertTrue(successor_doc.getTitle() in relation_form_renderer()) def test_15GadgetServerSideFailure(self): """ @@ -762,7 +762,7 @@ class TestKM(TestKMMixIn): url = '%s/ERP5Site_viewHomeAreaRenderer?gadget_mode=web_front' %self.web_site_url response = self.publish(url, self.auth) - self.failUnless(self.web_front_knowledge_pad.getTitle() in response.getBody()) + self.assertTrue(self.web_front_knowledge_pad.getTitle() in response.getBody()) gadget = portal_gadgets.km_latest_documents self.web_front_knowledge_pad.KnowledgePad_addBoxList(**{'uids':[gadget.getUid()]}) @@ -770,25 +770,25 @@ class TestKM(TestKMMixIn): # check that gadgets are added to web front page view response = self.publish(url, self.auth) - self.failUnless(gadget.getTitle() in response.getBody()) + self.assertTrue(gadget.getTitle() in response.getBody()) # set non existent view_form old_gadget_view_form_id = gadget.view_form_id gadget.view_form_id = 'NO_SUCH_FORM_EXISTS' response = self.publish(url, self.auth) - self.failUnless('Server side error' in response.getBody()) + self.assertTrue('Server side error' in response.getBody()) gadget.view_form_id = old_gadget_view_form_id response = self.publish(url, self.auth) - self.failUnless('Server side error' not in response.getBody()) + self.assertTrue('Server side error' not in response.getBody()) # set non existent edit_form old_gadget_edit_form_id = gadget.edit_form_id gadget.edit_form_id = 'NO_SUCH_FORM_EXISTS' response = self.publish(url, self.auth) - self.failUnless('Server side error' in response.getBody()) + self.assertTrue('Server side error' in response.getBody()) gadget.edit_form_id = old_gadget_edit_form_id response = self.publish(url, self.auth) - self.failUnless('Server side error' not in response.getBody()) + self.assertTrue('Server side error' not in response.getBody()) def test_16WebSiteBrowserGadget(self): """ @@ -815,14 +815,14 @@ class TestKM(TestKMMixIn): gadget_view_form_id, self.website.getRelativeUrl(), box_url) - self.failUnless(subsection.getTitle() not in + self.assertTrue(subsection.getTitle() not in self.publish(url, self.auth).getBody()) # make section visible subsection.edit(visible=True) self.tic() self.changeSkin('KM') - self.failUnless(subsection.getTitle() in + self.assertTrue(subsection.getTitle() in self.publish(url, self.auth).getBody()) def test_17AddGadgets(self): @@ -863,7 +863,7 @@ class TestKM(TestKMMixIn): self.changeSkin('KM') assigned_member_list = websection.WebSection_searchAssignmentList(portal_type='Assignment') - self.assertEquals(0, len(websection.WebSection_searchAssignmentList(portal_type='Assignment'))) + self.assertEqual(0, len(websection.WebSection_searchAssignmentList(portal_type='Assignment'))) project = portal.project_module.newContent(portal_type='Project', \ id='test_project') another_project = portal.project_module.newContent(portal_type='Project', \ @@ -882,9 +882,9 @@ class TestKM(TestKMMixIn): self.tic() self.changeSkin('KM') - self.assertEquals(1,\ + self.assertEqual(1,\ len( websection.WebSection_searchAssignmentList(portal_type='Assignment'))) - self.assertEquals(1,\ + self.assertEqual(1,\ len( websection.WebSection_countAssignmentList(portal_type='Assignment'))) class TestKMSearch(TestKMMixIn): diff --git a/product/ERP5/tests/testMRP.py b/product/ERP5/tests/testMRP.py index 2e2ba371b3..0afbd9f122 100644 --- a/product/ERP5/tests/testMRP.py +++ b/product/ERP5/tests/testMRP.py @@ -236,11 +236,11 @@ class TestMRPImplementation(TestMRPMixin): transformation = self.createDefaultTransformation() business_process = self.createSimpleBusinessProcess() - self.assertEquals([business_process.p2], + self.assertEqual([business_process.p2], rule.getHeadProductionPathList(transformation, business_process)) business_process = self.createConcurrentBusinessProcess() - self.assertEquals(set([business_process.p2, business_process.p3]), + self.assertEqual(set([business_process.p2, business_process.p3]), set(rule.getHeadProductionPathList(transformation, business_process))) @newSimulationExpectedFailure @@ -293,7 +293,7 @@ class TestMRPImplementation(TestMRPMixin): ((path_p3,), 'product_module/4', consumed_organisations, 'mrp/p3', 10), ((path_p3,), 'product_module/5', produced_organisations, None, -10)]) movement_list = applied_rule.objectValues() - self.assertEquals(len(expected_value_set), len(movement_list)) + self.assertEqual(len(expected_value_set), len(movement_list)) movement_value_set = set([]) for movement in movement_list: movement_value_set |= set([(tuple(movement.getCausalityList()), @@ -304,7 +304,7 @@ class TestMRPImplementation(TestMRPMixin): movement.getDestination(),), # organisations movement.getTradePhase(), movement.getQuantity())]) - self.assertEquals(expected_value_set, movement_value_set) + self.assertEqual(expected_value_set, movement_value_set) @skip('Unfinished experimental feature') def test_TransformationRule_expand_concurrent(self): @@ -355,7 +355,7 @@ class TestMRPImplementation(TestMRPMixin): ((phase_p3,), 'product_module/4', consumed_organisations, 'mrp/p3', 10), ((phase_p2, phase_p3), 'product_module/5', produced_organisations, None, -10)]) movement_list = applied_rule.objectValues() - self.assertEquals(len(expected_value_set), len(movement_list)) + self.assertEqual(len(expected_value_set), len(movement_list)) movement_value_set = set([]) for movement in movement_list: movement_value_set |= set([(tuple(movement.getCausalityList()), @@ -366,7 +366,7 @@ class TestMRPImplementation(TestMRPMixin): movement.getDestination(),), # organisations movement.getTradePhase(), movement.getQuantity())]) - self.assertEquals(expected_value_set, movement_value_set) + self.assertEqual(expected_value_set, movement_value_set) @skip('Unfinished experimental feature') def test_TransformationRule_expand_reexpand(self): @@ -421,7 +421,7 @@ class TestMRPImplementation(TestMRPMixin): ((phase_p2, phase_p3), 'product_module/5', produced_organisations, None, 1), # Frozen ((phase_p2, phase_p3), 'product_module/5', produced_organisations, None, -11)]) movement_list = applied_rule.objectValues() - self.assertEquals(len(expected_value_set), len(movement_list)) + self.assertEqual(len(expected_value_set), len(movement_list)) movement_value_set = set([]) for movement in movement_list: movement_value_set |= set([(tuple(movement.getCausalityList()), @@ -432,7 +432,7 @@ class TestMRPImplementation(TestMRPMixin): movement.getDestination(),), # organisations movement.getTradePhase(), movement.getQuantity())]) - self.assertEquals(expected_value_set, movement_value_set) + self.assertEqual(expected_value_set, movement_value_set) @skip('Unfinished experimental feature') def test_TransformationSourcingRule_expand(self): @@ -491,7 +491,7 @@ class TestMRPImplementation(TestMRPMixin): expected_value_set = set([ ((phase_p2,), sourcing_resource, organisations, 10)]) movement_list = applied_rule.objectValues() - self.assertEquals(len(expected_value_set), len(movement_list)) + self.assertEqual(len(expected_value_set), len(movement_list)) movement_value_set = set([]) for movement in movement_list: movement_value_set |= set([(tuple(movement.getCausalityList()), @@ -501,7 +501,7 @@ class TestMRPImplementation(TestMRPMixin): movement.getDestinationSection(), movement.getDestination(),), # organisations movement.getQuantity())]) - self.assertEquals(expected_value_set, movement_value_set) + self.assertEqual(expected_value_set, movement_value_set) def test_suite(): diff --git a/product/ERP5/tests/testMilestoneReporting.py b/product/ERP5/tests/testMilestoneReporting.py index 8b5005e730..54da27334a 100644 --- a/product/ERP5/tests/testMilestoneReporting.py +++ b/product/ERP5/tests/testMilestoneReporting.py @@ -68,7 +68,7 @@ class MilestoneReportingMixin: report_html = \ self.portal.project_module.ProjectModule_generateMilestoneReport( from_date=from_date, at_date=at_date) - self.failIf('Site Error' in report_html) + self.assertFalse('Site Error' in report_html) line_list = self.portal.sale_order_module.\ ProjectModule_viewMilestoneReport.listbox.\ @@ -96,7 +96,7 @@ class MilestoneReportingMixin: # Foo Foo Milestone A 2009/10/27 data_line_list = self.getDataLineLineListByCallingMilestoneReport( from_date=DateTime('2009/10/01'), at_date=DateTime('2009/10/31')) - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], project_title='Foo', milestone_title='Foo Milestone A', @@ -143,7 +143,7 @@ class MilestoneReportingMixin: # (this checks that dates are well taken into account) data_line_list = self.getDataLineLineListByCallingMilestoneReport( from_date=DateTime('2009/10/01'), at_date=DateTime('2009/10/31')) - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties(data_line_list[0], project_title='Foo', milestone_title='Foo Milestone A', @@ -154,7 +154,7 @@ class MilestoneReportingMixin: # project names data_line_list = self.getDataLineLineListByCallingMilestoneReport( from_date=DateTime('2009/01/01'), at_date=DateTime('2009/12/31')) - self.assertEquals(4, len(data_line_list)) + self.assertEqual(4, len(data_line_list)) self.checkLineProperties(data_line_list[0], project_title='Bar', milestone_title='Bar Milestone A', diff --git a/product/ERP5/tests/testMovementGroup.py b/product/ERP5/tests/testMovementGroup.py index 7f94e82e1a..2899e27c09 100644 --- a/product/ERP5/tests/testMovementGroup.py +++ b/product/ERP5/tests/testMovementGroup.py @@ -68,8 +68,8 @@ class TestPropertyMovementGroup(MovementGroupTestCase): tested_property_list=('start_date',)) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(1, len(group_list)) - self.assertEquals(dict(start_date=DateTime(2001, 1, 1)), + self.assertEqual(1, len(group_list)) + self.assertEqual(dict(start_date=DateTime(2001, 1, 1)), group_list[0].getGroupEditDict()) def test_property_movement_group_separating(self): @@ -87,10 +87,10 @@ class TestPropertyMovementGroup(MovementGroupTestCase): tested_property_list=('start_date',)) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(2, len(group_list)) - self.assertEquals(1, len([group for group in group_list if + self.assertEqual(2, len(group_list)) + self.assertEqual(1, len([group for group in group_list if group.getGroupEditDict() == dict(start_date=DateTime(2001, 1, 1))])) - self.assertEquals(1, len([group for group in group_list if + self.assertEqual(1, len([group for group in group_list if group.getGroupEditDict() == dict(start_date=DateTime(2001, 1, 2))])) def test_property_movement_group_and_separating(self): @@ -110,11 +110,11 @@ class TestPropertyMovementGroup(MovementGroupTestCase): tested_property_list=('start_date', 'title')) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(2, len(group_list)) - self.assertEquals(1, len([group for group in group_list if + self.assertEqual(2, len(group_list)) + self.assertEqual(1, len([group for group in group_list if group.getGroupEditDict() == dict(title='A', start_date=DateTime(2001, 1, 1))])) - self.assertEquals(1, len([group for group in group_list if + self.assertEqual(1, len([group for group in group_list if group.getGroupEditDict() == dict(title='A', start_date=DateTime(2001, 1, 2))])) @@ -136,8 +136,8 @@ class TestPropertyAssignmentMovementGroup(MovementGroupTestCase): grouping_method='max',) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(1, len(group_list)) - self.assertEquals(dict(start_date=DateTime(2001, 1, 2)), + self.assertEqual(1, len(group_list)) + self.assertEqual(dict(start_date=DateTime(2001, 1, 2)), group_list[0].getGroupEditDict()) def test_property_assignment_movement_group_min(self): @@ -156,8 +156,8 @@ class TestPropertyAssignmentMovementGroup(MovementGroupTestCase): grouping_method='min',) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(1, len(group_list)) - self.assertEquals(dict(start_date=DateTime(2001, 1, 1)), + self.assertEqual(1, len(group_list)) + self.assertEqual(dict(start_date=DateTime(2001, 1, 1)), group_list[0].getGroupEditDict()) def test_property_assignment_movement_group_avg(self): @@ -176,8 +176,8 @@ class TestPropertyAssignmentMovementGroup(MovementGroupTestCase): grouping_method='avg',) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(1, len(group_list)) - self.assertEquals(dict(int_index=2), + self.assertEqual(1, len(group_list)) + self.assertEqual(dict(int_index=2), group_list[0].getGroupEditDict()) def test_property_assignment_movement_group_common_match(self): @@ -196,8 +196,8 @@ class TestPropertyAssignmentMovementGroup(MovementGroupTestCase): grouping_method='common',) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(1, len(group_list)) - self.assertEquals(dict(start_date=DateTime(2001, 1, 1)), + self.assertEqual(1, len(group_list)) + self.assertEqual(dict(start_date=DateTime(2001, 1, 1)), group_list[0].getGroupEditDict()) def test_property_assignment_movement_group_common_doesnot_match(self): @@ -216,8 +216,8 @@ class TestPropertyAssignmentMovementGroup(MovementGroupTestCase): grouping_method='common',) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(1, len(group_list)) - self.assertEquals(dict(), group_list[0].getGroupEditDict()) + self.assertEqual(1, len(group_list)) + self.assertEqual(dict(), group_list[0].getGroupEditDict()) class TestOrderMovementGroup(MovementGroupTestCase): """Tests Order Movement Group - grouping and separating by @@ -242,8 +242,8 @@ class TestOrderMovementGroup(MovementGroupTestCase): movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(1, len(group_list)) - self.assertEquals(dict(causality_list=[order.getRelativeUrl()]), + self.assertEqual(1, len(group_list)) + self.assertEqual(dict(causality_list=[order.getRelativeUrl()]), group_list[0].getGroupEditDict()) def test_order_movement_group_separating(self): @@ -272,10 +272,10 @@ class TestOrderMovementGroup(MovementGroupTestCase): movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(2, len(group_list)) - self.assertEquals(1, len([group for group in group_list if + self.assertEqual(2, len(group_list)) + self.assertEqual(1, len([group for group in group_list if group.getGroupEditDict() == dict(causality_list=[order_1.getRelativeUrl()])])) - self.assertEquals(1, len([group for group in group_list if + self.assertEqual(1, len([group for group in group_list if group.getGroupEditDict() == dict(causality_list=[order_2.getRelativeUrl()])])) class TestOrderMovementGroupDelivery(TestOrderMovementGroup): @@ -333,8 +333,8 @@ class TestDeliveryCausalityAssignmentMovementGroup(MovementGroupTestCase): movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(1, len(group_list)) - self.assertEquals(dict(causality_list=[delivery_1.getRelativeUrl(), + self.assertEqual(1, len(group_list)) + self.assertEqual(dict(causality_list=[delivery_1.getRelativeUrl(), delivery_2.getRelativeUrl()]), group_list[0].getGroupEditDict()) @@ -386,8 +386,8 @@ class TestCategoryMovementGroup(MovementGroupTestCase): tested_property_list=('source',)) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(1, len(group_list)) - self.assertEquals(dict(source_list=['1']), + self.assertEqual(1, len(group_list)) + self.assertEqual(dict(source_list=['1']), group_list[0].getGroupEditDict()) def test_category_movement_group_separating(self): @@ -405,10 +405,10 @@ class TestCategoryMovementGroup(MovementGroupTestCase): tested_property_list=('source',)) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(2, len(group_list)) - self.assertEquals(1, len([group for group in group_list if + self.assertEqual(2, len(group_list)) + self.assertEqual(1, len([group for group in group_list if group.getGroupEditDict() == dict(source_list=['1'])])) - self.assertEquals(1, len([group for group in group_list if + self.assertEqual(1, len([group for group in group_list if group.getGroupEditDict() == dict(source_list=['2'])])) def test_category_movement_group_and_separating(self): @@ -428,11 +428,11 @@ class TestCategoryMovementGroup(MovementGroupTestCase): tested_property_list=('destination', 'source')) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(2, len(group_list)) - self.assertEquals(1, len([group for group in group_list if + self.assertEqual(2, len(group_list)) + self.assertEqual(1, len([group for group in group_list if group.getGroupEditDict() == dict(destination_list=['A'], source_list=['1'])])) - self.assertEquals(1, len([group for group in group_list if + self.assertEqual(1, len([group for group in group_list if group.getGroupEditDict() == dict(destination_list=['A'], source_list=['2'])])) @@ -466,9 +466,9 @@ class TestPropertyGroupingMovementGroup(MovementGroupTestCase): tested_property_list=('start_date',)) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(1, len(group_list)) + self.assertEqual(1, len(group_list)) # This movent group must not assign the properties - self.assertEquals({}, group_list[0].getGroupEditDict()) + self.assertEqual({}, group_list[0].getGroupEditDict()) def test_property_movement_group_separating(self): movement_list = ( self.folder.newContent( @@ -485,10 +485,10 @@ class TestPropertyGroupingMovementGroup(MovementGroupTestCase): tested_property_list=('start_date',)) movement_group_node = self.builder.collectMovement(movement_list) group_list = movement_group_node.getGroupList() - self.assertEquals(2, len(group_list)) + self.assertEqual(2, len(group_list)) for group in group_list: # This movent group must not assign the properties - self.assertEquals({}, group.getGroupEditDict()) + self.assertEqual({}, group.getGroupEditDict()) def test_property_movement_group_and_separating(self): movement_list = ( self.folder.newContent( @@ -519,11 +519,11 @@ class TestPropertyGroupingMovementGroup(MovementGroupTestCase): group_list = movement_group_node.getGroupList() # must not be 4 - self.assertEquals(3, len(group_list)) + self.assertEqual(3, len(group_list)) for group in group_list: # This movent group must not assign the properties - self.assertEquals({}, group.getGroupEditDict()) + self.assertEqual({}, group.getGroupEditDict()) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testNotificationTool.py b/product/ERP5/tests/testNotificationTool.py index 81f1f0fdf0..0c002c9442 100644 --- a/product/ERP5/tests/testNotificationTool.py +++ b/product/ERP5/tests/testNotificationTool.py @@ -194,8 +194,8 @@ class TestNotificationTool(ERP5TypeTestCase): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['userA@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['userA@example.invalid'], mto) def test_02_noSender(self): sequence_list = SequenceList() @@ -234,8 +234,8 @@ class TestNotificationTool(ERP5TypeTestCase): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['site@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['site@example.invalid'], mto) def stepCheckNotificationWithoutMessage(self, sequence=None, sequence_list=None, **kw): @@ -247,8 +247,8 @@ class TestNotificationTool(ERP5TypeTestCase): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['userA@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['userA@example.invalid'], mto) def test_05_noMessage(self): sequence_list = SequenceList() @@ -270,12 +270,12 @@ class TestNotificationTool(ERP5TypeTestCase): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['userA@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['userA@example.invalid'], mto) # Check Message mail_dict = decode_email(messageText) - self.assertEquals(mail_dict['headers']['subject'], 'Subject') - self.assertEquals(mail_dict['body'], 'Message') + self.assertEqual(mail_dict['headers']['subject'], 'Subject') + self.assertEqual(mail_dict['body'], 'Message') self.assertSameSet([], mail_dict['attachment_list']) def test_06_simpleMessage(self): @@ -311,13 +311,13 @@ class TestNotificationTool(ERP5TypeTestCase): self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['userA@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['userA@example.invalid'], mto) # Check Message mail_dict = decode_email(messageText) - self.assertEquals(mail_dict['headers']['subject'], 'Subject') - self.assertEquals(mail_dict['body'], 'Message') + self.assertEqual(mail_dict['headers']['subject'], 'Subject') + self.assertEqual(mail_dict['body'], 'Message') self.assertSameSet([('Attachment 1', 'text/plain', 'Text 1'), ('Attachment 2', 'application/octet-stream', 'Text 2')], mail_dict['attachment_list']) @@ -343,14 +343,14 @@ class TestNotificationTool(ERP5TypeTestCase): self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['userB@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['userB@example.invalid'], mto) previous_message = self.portal.MailHost._previous_message self.assertNotEquals((), previous_message) mfrom, mto, messageText = previous_message - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['userA@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['userA@example.invalid'], mto) def test_08_MultiRecipient(self): sequence_list = SequenceList() @@ -402,12 +402,12 @@ class TestNotificationTool(ERP5TypeTestCase): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['userA@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['userA@example.invalid'], mto) # Check Message mail_dict = decode_email(messageText) - self.assertEquals(mail_dict['headers']['subject'], 'Subject') - self.assertEquals(mail_dict['body'], 'Message') + self.assertEqual(mail_dict['headers']['subject'], 'Subject') + self.assertEqual(mail_dict['body'], 'Message') self.assertSameSet([], mail_dict['attachment_list']) def test_10_PersonNotification(self): @@ -436,12 +436,12 @@ Yes, I will go.""" last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['userA@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['userA@example.invalid'], mto) # Check Message mail_dict = decode_email(messageText) - self.assertEquals(mail_dict['headers']['subject'], 'Subject') - self.assertEquals(mail_dict['body'], message) + self.assertEqual(mail_dict['headers']['subject'], 'Subject') + self.assertEqual(mail_dict['body'], message) self.assertSameSet([], mail_dict['attachment_list']) def test_11_TextMessage(self): @@ -467,12 +467,12 @@ Yes, I will go.""" message_text_format='text/html', message=message) last_message, = self.portal.MailHost._message_list mfrom, mto, messageText = last_message - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['userA@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['userA@example.invalid'], mto) # Check Message mail_dict = decode_email(messageText) - self.assertEquals(mail_dict['headers']['subject'], 'Subject') - self.assertEquals(mail_dict['body'], '<html><body>%s</body></html>' % message) + self.assertEqual(mail_dict['headers']['subject'], 'Subject') + self.assertEqual(mail_dict['body'], '<html><body>%s</body></html>' % message) self.assertSameSet([], mail_dict['attachment_list']) def test_12_HtmlMessage(self): @@ -517,22 +517,22 @@ class TestNotificationToolWithCRM(TestNotificationTool): last_message, = self.portal.MailHost._message_list mfrom, mto, messageText = last_message mail_dict = decode_email(messageText) - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['userA@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['userA@example.invalid'], mto) # check that an event has been created event_list = self.portal.event_module.contentValues() - self.assertEquals(1, len(event_list)) + self.assertEqual(1, len(event_list)) event = event_list[0] - self.assertEquals(mail_dict['headers']['message-id'], + self.assertEqual(mail_dict['headers']['message-id'], event.getSourceReference()) - self.assertEquals('Mail Message', event.getPortalTypeName()) - self.assertEquals('Subject', event.getTitle()) - self.assertEquals('Message', event.getTextContent()) + self.assertEqual('Mail Message', event.getPortalTypeName()) + self.assertEqual('Subject', event.getTitle()) + self.assertEqual('Message', event.getTextContent()) self.assertNotEquals(None, event.getStartDate()) - self.assertEquals(person, event.getDestinationValue()) - self.assertEquals('started', event.getSimulationState()) + self.assertEqual(person, event.getDestinationValue()) + self.assertEqual('started', event.getSimulationState()) def test_suite(): diff --git a/product/ERP5/tests/testOrder.py b/product/ERP5/tests/testOrder.py index 6a87001b49..c1ada282c0 100644 --- a/product/ERP5/tests/testOrder.py +++ b/product/ERP5/tests/testOrder.py @@ -369,14 +369,14 @@ class TestOrderMixin(SubcontentReindexingWrapper): if destination_project is None: destination_project = sequence.get('project') order = sequence.get('order') - self.assertEquals(self.datetime+10, order.getStartDate()) - self.assertEquals(self.datetime+20, order.getStopDate()) - self.assertEquals(source_organisation, order.getSourceValue()) - self.assertEquals(destination_organisation, order.getDestinationValue()) - self.assertEquals(source_organisation, order.getSourceSectionValue()) - self.assertEquals(destination_organisation, order.getDestinationSectionValue()) - self.assertEquals(source_project, order.getSourceProjectValue()) - self.assertEquals(destination_project, order.getDestinationProjectValue()) + self.assertEqual(self.datetime+10, order.getStartDate()) + self.assertEqual(self.datetime+20, order.getStopDate()) + self.assertEqual(source_organisation, order.getSourceValue()) + self.assertEqual(destination_organisation, order.getDestinationValue()) + self.assertEqual(source_organisation, order.getSourceSectionValue()) + self.assertEqual(destination_organisation, order.getDestinationSectionValue()) + self.assertEqual(source_project, order.getSourceProjectValue()) + self.assertEqual(destination_project, order.getDestinationProjectValue()) def stepCreateOrderLine(self,sequence=None, sequence_list=None, **kw): @@ -486,13 +486,13 @@ class TestOrderMixin(SubcontentReindexingWrapper): l = len(vcl) s = sum(map(lambda x: len(x), cell_range)) - self.assertEquals(l,s) + self.assertEqual(l,s) cell_key_list = order_line.getCellKeyList(base_id=base_id) if cell_range == []: - self.assertEquals(len(cell_key_list), 0) + self.assertEqual(len(cell_key_list), 0) else: len_range = map(lambda x: len(x), cell_range) - self.assertEquals(len(cell_key_list), reduce(lambda x,y: x*y, len_range)) + self.assertEqual(len(cell_key_list), reduce(lambda x,y: x*y, len_range)) def stepCompleteOrderLineMatrix(self,sequence=None, sequence_list=None, \ **kw): @@ -525,16 +525,16 @@ class TestOrderMixin(SubcontentReindexingWrapper): cell_key_list = list(order_line.getCellKeyList(base_id=base_id)) cell_key_list.sort() cell_list = order_line.objectValues(portal_type=self.order_cell_portal_type) - self.assertEquals(len(cell_list), len(cell_key_list)) + self.assertEqual(len(cell_list), len(cell_key_list)) price = 100 quantity = 200 for cell_key in cell_key_list: - self.failUnless(order_line.hasCell(base_id=base_id, *cell_key)) + self.assertTrue(order_line.hasCell(base_id=base_id, *cell_key)) cell = order_line.getCell(base_id=base_id, *cell_key) - self.assertEquals(self.order_cell_portal_type, cell.getPortalType()) + self.assertEqual(self.order_cell_portal_type, cell.getPortalType()) # XXX How can I check the cell content ? -# self.assertEquals(price , cell.getProperty('price')) -# self.assertEquals(quantity, cell.getProperty('quantity')) +# self.assertEqual(price , cell.getProperty('price')) +# self.assertEqual(quantity, cell.getProperty('quantity')) # self.failIfDifferentSet(cell.getMembershipCriterionCategoryList(), # cell_key) price += 1 @@ -601,8 +601,8 @@ class TestOrderMixin(SubcontentReindexingWrapper): Check the default price and quantity on the order line. """ order_line = sequence.get('order_line') - self.assertEquals(self.default_quantity, order_line.getQuantity()) - self.assertEquals(self.default_price, order_line.getPrice()) + self.assertEqual(self.default_quantity, order_line.getQuantity()) + self.assertEqual(self.default_price, order_line.getPrice()) def stepCheckOrderLineTotalQuantity(self, sequence=None, \ sequence_list=None, **kw): @@ -617,7 +617,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): base_id = 'movement' cell_key_list = order_line.getCellKeyList(base_id=base_id) if list(cell_key_list) == []: - self.assertEquals(order_line.getQuantity(), \ + self.assertEqual(order_line.getQuantity(), \ order_line.getTotalQuantity()) else: total_quantity = 0 @@ -625,8 +625,8 @@ class TestOrderMixin(SubcontentReindexingWrapper): if order_line.hasCell(base_id = base_id, *cell_key): cell = order_line.getCell(base_id = base_id, *cell_key) total_quantity += cell.getProperty('quantity') - self.assertEquals(total_quantity, order_line.getTotalQuantity()) - self.assertEquals( order_line.getTotalQuantity(fast = 0), + self.assertEqual(total_quantity, order_line.getTotalQuantity()) + self.assertEqual( order_line.getTotalQuantity(fast = 0), order_line.getTotalQuantity(fast = 1) ) self.assertNotEquals(order_line.getTotalQuantity(fast = 1),0) @@ -643,7 +643,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): base_id = 'movement' cell_key_list = order_line.getCellKeyList(base_id=base_id) if list(cell_key_list) == []: - self.assertEquals(order_line.getProperty('price') * + self.assertEqual(order_line.getProperty('price') * order_line.getProperty('quantity'), order_line.getTotalPrice()) else: @@ -653,8 +653,8 @@ class TestOrderMixin(SubcontentReindexingWrapper): cell = order_line.getCell(base_id = base_id, *cell_key) total_price += ( cell.getProperty('quantity') * cell.getProperty('price')) - self.assertEquals(total_price, order_line.getTotalPrice()) - self.assertEquals( order_line.getTotalPrice(fast = 0), + self.assertEqual(total_price, order_line.getTotalPrice()) + self.assertEqual( order_line.getTotalPrice(fast = 0), order_line.getTotalPrice(fast = 1) ) self.assertNotEquals(order_line.getTotalPrice(fast = 1),0) @@ -677,20 +677,20 @@ class TestOrderMixin(SubcontentReindexingWrapper): total_price += ( cell.getProperty('quantity') * cell.getProperty('price')) total_quantity += (cell.getProperty('quantity')) - self.assertEquals(len(portal_catalog( + self.assertEqual(len(portal_catalog( relative_url=order_line.getRelativeUrl())),0) - self.assertEquals(total_price, order_line.getTotalPrice(fast=0)) - self.assertEquals(total_quantity, order_line.getTotalQuantity(fast=0)) - self.assertEquals(0, order_line.getTotalPrice(fast=1)) - self.assertEquals(0, order_line.getTotalQuantity(fast=1)) + self.assertEqual(total_price, order_line.getTotalPrice(fast=0)) + self.assertEqual(total_quantity, order_line.getTotalQuantity(fast=0)) + self.assertEqual(0, order_line.getTotalPrice(fast=1)) + self.assertEqual(0, order_line.getTotalQuantity(fast=1)) self.assertNotEquals(total_price, 0) self.tic() - self.assertEquals(len(portal_catalog(relative_url= + self.assertEqual(len(portal_catalog(relative_url= order_line.getRelativeUrl())),1) - self.assertEquals(total_price, order_line.getTotalPrice(fast=1)) - self.assertEquals(total_price, order_line.getTotalPrice(fast=0)) - self.assertEquals(total_quantity, order_line.getTotalQuantity(fast=1)) - self.assertEquals(total_quantity, order_line.getTotalQuantity(fast=0)) + self.assertEqual(total_price, order_line.getTotalPrice(fast=1)) + self.assertEqual(total_price, order_line.getTotalPrice(fast=0)) + self.assertEqual(total_quantity, order_line.getTotalQuantity(fast=1)) + self.assertEqual(total_quantity, order_line.getTotalQuantity(fast=0)) def stepCheckOrderTotalQuantity(self, sequence=None, sequence_list=None, \ **kw): @@ -708,8 +708,8 @@ class TestOrderMixin(SubcontentReindexingWrapper): total_quantity = 0 for order_line in order_line_list: total_quantity += order_line.getTotalQuantity() - self.assertEquals(total_quantity, order.getTotalQuantity()) - self.assertEquals( order.getTotalQuantity(fast = 0), + self.assertEqual(total_quantity, order.getTotalQuantity()) + self.assertEqual( order.getTotalQuantity(fast = 0), order.getTotalQuantity(fast = 1) ) def stepCheckOrderTotalPrice(self, sequence=None, sequence_list=None, \ @@ -728,8 +728,8 @@ class TestOrderMixin(SubcontentReindexingWrapper): total_price = 0 for order_line in order_line_list: total_price += order_line.getTotalPrice() - self.assertEquals(total_price, order.getTotalPrice()) - self.assertEquals( order.getTotalPrice(fast = 0), + self.assertEqual(total_price, order.getTotalPrice()) + self.assertEqual( order.getTotalPrice(fast = 0), order.getTotalPrice(fast = 1) ) def stepCheckOrderTotalPriceAndQuantityFastParameter(self, @@ -748,14 +748,14 @@ class TestOrderMixin(SubcontentReindexingWrapper): total_price = 0 for order_line in order_line_list: total_price += order_line.getTotalPrice() - self.assertEquals(0, len(portal_catalog(relative_url=order.getRelativeUrl()))) - self.assertEquals(total_price, order.getTotalPrice(fast=0)) + self.assertEqual(0, len(portal_catalog(relative_url=order.getRelativeUrl()))) + self.assertEqual(total_price, order.getTotalPrice(fast=0)) self.assertNotEquals(total_price, 0) - self.assertEquals(0, order.getTotalPrice(fast=1)) + self.assertEqual(0, order.getTotalPrice(fast=1)) self.tic() - self.assertEquals(1, len(portal_catalog(relative_url=order.getRelativeUrl()))) - self.assertEquals(total_price, order.getTotalPrice(fast=1)) - self.assertEquals(total_price, order.getTotalPrice(fast=0)) + self.assertEqual(1, len(portal_catalog(relative_url=order.getRelativeUrl()))) + self.assertEqual(total_price, order.getTotalPrice(fast=1)) + self.assertEqual(total_price, order.getTotalPrice(fast=0)) def stepCheckOrderInitialState(self, sequence=None, sequence_list=None, \ **kw): @@ -763,7 +763,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): Check if the first state of a order is draft. """ order = sequence.get('order') - self.assertEquals('draft', order.getSimulationState()) + self.assertEqual('draft', order.getSimulationState()) def stepCheckOrderLineState(self, sequence=None, sequence_list=None, \ **kw): @@ -772,7 +772,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): """ order = sequence.get('order') order_line = sequence.get('order_line') - self.assertEquals(order.getSimulationState(), order_line.getSimulationState()) + self.assertEqual(order.getSimulationState(), order_line.getSimulationState()) def stepCheckOrderCellState(self, sequence=None, sequence_list=None, \ **kw): @@ -783,11 +783,11 @@ class TestOrderMixin(SubcontentReindexingWrapper): order_line = sequence.get('order_line') cell_list = order_line.objectValues(portal_type=self.order_cell_portal_type) for cell in cell_list: - self.assertEquals(order.getSimulationState(), cell.getSimulationState()) + self.assertEqual(order.getSimulationState(), cell.getSimulationState()) def stepCheckOrderPlanned(self, sequence=None, sequence_list=None, **kw): order = sequence.get('order') - self.assertEquals('planned', order.getSimulationState()) + self.assertEqual('planned', order.getSimulationState()) def checkAcquisition(self, object, acquired_object): """ @@ -795,17 +795,17 @@ class TestOrderMixin(SubcontentReindexingWrapper): """ # packing_list_movement, simulation_movement - self.assertEquals(acquired_object.getStartDate(), object.getStartDate()) - self.assertEquals(acquired_object.getStopDate(), object.getStopDate()) - self.assertEquals(acquired_object.getSourceValue(), \ + self.assertEqual(acquired_object.getStartDate(), object.getStartDate()) + self.assertEqual(acquired_object.getStopDate(), object.getStopDate()) + self.assertEqual(acquired_object.getSourceValue(), \ object.getSourceValue()) - self.assertEquals(acquired_object.getDestinationValue(), \ + self.assertEqual(acquired_object.getDestinationValue(), \ object.getDestinationValue()) - self.assertEquals(acquired_object.getSourceSectionValue(), \ + self.assertEqual(acquired_object.getSourceSectionValue(), \ object.getSourceSectionValue()) - self.assertEquals(acquired_object.getDestinationSectionValue(), \ + self.assertEqual(acquired_object.getDestinationSectionValue(), \ object.getDestinationSectionValue()) def stepCheckOrderLineAcquisition(self, sequence=None, \ @@ -829,16 +829,16 @@ class TestOrderMixin(SubcontentReindexingWrapper): self.checkAcquisition(cell, order_line) # Test resource - self.assertEquals(order_line.getResource(), \ + self.assertEqual(order_line.getResource(), \ cell.getResource()) # Test resource variation cvcl = cell.getVariationCategoryList() olvcl = order_line.getVariationCategoryList() # This test is not valide anymore, because of option variation -# self.assertEquals(len(order_line.getVariationRangeBaseCategoryList()), \ +# self.assertEqual(len(order_line.getVariationRangeBaseCategoryList()), \ # len(cvcl)) for variation_category in cvcl: - self.failUnless(variation_category in olvcl) + self.assertTrue(variation_category in olvcl) def stepCheckOrderSimulation(self, sequence=None, sequence_list=None, **kw): """ @@ -859,18 +859,18 @@ class TestOrderMixin(SubcontentReindexingWrapper): order_state = order.getSimulationState() if order_state in no_applied_rule_state: - self.assertEquals(0, len(related_applied_rule_list)) + self.assertEqual(0, len(related_applied_rule_list)) else: LOG('stepCheckOrderRuleSimulation', 0, 'related_applied_rule_list: %s' % str([x.getObject() for x in related_applied_rule_list])) - self.assertEquals(1, len(related_applied_rule_list)) + self.assertEqual(1, len(related_applied_rule_list)) applied_rule = related_applied_rule_list[0].getObject() sequence.edit(applied_rule=applied_rule) - self.failUnless(applied_rule is not None) + self.assertTrue(applied_rule is not None) # Test if applied rule has a specialise value with passed rule_reference portal_rules = getToolByName(order, 'portal_rules') - self.assertEquals(rule_reference, + self.assertEqual(rule_reference, applied_rule.getSpecialiseReference()) simulation_movement_list = applied_rule.objectValues() @@ -879,7 +879,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): # Count the number of movement in order movement_list = order.getMovementList() # Check if number of movement is equal to number of simulation movement - self.assertEquals(len(movement_list), len(simulation_movement_list)) + self.assertEqual(len(movement_list), len(simulation_movement_list)) # Check if each movement has only one simulation movement related order_movement_list = [x.getDeliveryValue() for x in \ simulation_movement_list] @@ -889,18 +889,18 @@ class TestOrderMixin(SubcontentReindexingWrapper): for simulation_movement in simulation_movement_list: order_movement = simulation_movement.getDeliveryValue() # Test quantity - self.assertEquals(order_movement.getQuantity(), \ + self.assertEqual(order_movement.getQuantity(), \ simulation_movement.getQuantity()) # Test price - self.assertEquals(order_movement.getPrice(), \ + self.assertEqual(order_movement.getPrice(), \ simulation_movement.getPrice()) # Test resource - self.assertEquals(order_movement.getResource(), \ + self.assertEqual(order_movement.getResource(), \ simulation_movement.getResource()) # Test resource variation - self.assertEquals(order_movement.getVariationText(), \ + self.assertEqual(order_movement.getVariationText(), \ simulation_movement.getVariationText()) - self.assertEquals(order_movement.getVariationCategoryList(), \ + self.assertEqual(order_movement.getVariationCategoryList(), \ simulation_movement.getVariationCategoryList()) # XXX Test acquisition self.checkAcquisition(simulation_movement, order_movement) @@ -927,8 +927,8 @@ class TestOrderMixin(SubcontentReindexingWrapper): Test if some portal method are well defined """ order = sequence.get('order') - self.failUnless('Simulation Movement' in order.getPortalMovementTypeList()) - self.failUnless(self.order_line_portal_type in order.getPortalMovementTypeList()) + self.assertTrue('Simulation Movement' in order.getPortalMovementTypeList()) + self.assertTrue(self.order_line_portal_type in order.getPortalMovementTypeList()) def stepCheckDeliveryBuilderPresence(self, sequence=None, sequence_list=None, **kw): @@ -937,7 +937,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): """ delivery_builder = getattr(self.getPortal().portal_deliveries, self.delivery_builder_id) - self.assertEquals('Delivery Builder', delivery_builder.getPortalType()) + self.assertEqual('Delivery Builder', delivery_builder.getPortalType()) def stepCreateOrganisation1(self,sequence=None, sequence_list=None, **kw): """ @@ -993,7 +993,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): source_project_value = project1, destination_project_value = project2 ) order.setPaymentConditionEfficiency(1.0) - self.failUnless('Site Error' not in order.view()) + self.assertTrue('Site Error' not in order.view()) def stepCheckDeliveryBuilding(self, sequence=None, sequence_list=None, **kw): """ @@ -1007,12 +1007,12 @@ class TestOrderMixin(SubcontentReindexingWrapper): packing_list_building_state = 'confirmed' order_state = order.getSimulationState() if order_state != packing_list_building_state: - self.assertEquals(0, len(related_packing_list_list)) + self.assertEqual(0, len(related_packing_list_list)) else: - self.assertEquals(1, len(related_packing_list_list)) + self.assertEqual(1, len(related_packing_list_list)) packing_list = related_packing_list_list[0].getObject() - self.failUnless(packing_list is not None) + self.assertTrue(packing_list is not None) sequence.edit(packing_list = packing_list) applied_rule = related_applied_rule_list[0].getObject() @@ -1020,7 +1020,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): # Test that packing list is confirmed packing_list_state = packing_list.getSimulationState() - self.assertEquals(packing_list_building_state, packing_list_state) + self.assertEqual(packing_list_building_state, packing_list_state) # First, test if each Simulation Movement is related to a Packing List # Movement @@ -1028,23 +1028,23 @@ class TestOrderMixin(SubcontentReindexingWrapper): packing_list_relative_url = packing_list.getRelativeUrl() for simulation_movement in simulation_movement_list: order_movement_list = simulation_movement.getDeliveryValueList() - self.failUnless(len(order_movement_list), 1) + self.assertTrue(len(order_movement_list), 1) order_movement = order_movement_list[0] - self.failUnless(order_movement is not None) - self.failUnless(order_movement.getRelativeUrl().\ + self.assertTrue(order_movement is not None) + self.assertTrue(order_movement.getRelativeUrl().\ startswith(order_relative_url)) rule_list = simulation_movement.objectValues() - self.failUnless(len(rule_list), 1) + self.assertTrue(len(rule_list), 1) delivering_rule = rule_list[0] - self.failUnless(delivering_rule.getSpecialiseValue().getPortalType(), + self.assertTrue(delivering_rule.getSpecialiseValue().getPortalType(), 'Delivering Rule') child_simulation_movement_list = delivering_rule.objectValues() - self.failUnless(len(child_simulation_movement_list), 1) + self.assertTrue(len(child_simulation_movement_list), 1) packing_list_movement_list = child_simulation_movement_list[0].getDeliveryValueList() - self.failUnless(len(packing_list_movement_list), 1) + self.assertTrue(len(packing_list_movement_list), 1) packing_list_movement = packing_list_movement_list[0] - self.failUnless(packing_list_movement is not None) - self.failUnless(packing_list_movement.getRelativeUrl().\ + self.assertTrue(packing_list_movement is not None) + self.assertTrue(packing_list_movement.getRelativeUrl().\ startswith(packing_list_relative_url)) # Then, test if each packing list movement is equals to the sum of somes @@ -1064,7 +1064,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): for packing_list_movement in packing_list_movement_list: related_simulation_movement_list = packing_list_movement.\ getDeliveryRelatedValueList(portal_type='Simulation Movement') - self.failUnless(len(related_simulation_movement_list)>0) + self.assertTrue(len(related_simulation_movement_list)>0) quantity = 0 total_price = 0 packing_list_movement_quantity = packing_list_movement.getQuantity() @@ -1073,31 +1073,31 @@ class TestOrderMixin(SubcontentReindexingWrapper): total_price += related_simulation_movement.getPrice() *\ related_simulation_movement.getQuantity() # Test resource - self.assertEquals(packing_list_movement.getResource(), \ + self.assertEqual(packing_list_movement.getResource(), \ related_simulation_movement.getResource()) # Test resource variation - self.assertEquals(packing_list_movement.getVariationText(), \ + self.assertEqual(packing_list_movement.getVariationText(), \ related_simulation_movement.getVariationText()) - self.assertEquals(packing_list_movement.getVariationCategoryList(), \ + self.assertEqual(packing_list_movement.getVariationCategoryList(), \ related_simulation_movement.getVariationCategoryList()) # Test acquisition self.checkAcquisition(packing_list_movement, related_simulation_movement) # Test delivery ratio - self.assertEquals(related_simulation_movement.getQuantity() /\ + self.assertEqual(related_simulation_movement.getQuantity() /\ packing_list_movement_quantity, \ related_simulation_movement.getDeliveryRatio()) - self.assertEquals(quantity, packing_list_movement.getQuantity()) + self.assertEqual(quantity, packing_list_movement.getQuantity()) # Test price - self.assertEquals(total_price / quantity, packing_list_movement.getPrice()) + self.assertEqual(total_price / quantity, packing_list_movement.getPrice()) sequence.edit(packing_list=packing_list) # Finally, test Packing List getTotalQuantity and getTotalPrice - self.assertEquals(order.getTotalQuantity(), packing_list.getTotalQuantity()) - self.assertEquals(order.getTotalPrice(), packing_list.getTotalPrice()) + self.assertEqual(order.getTotalQuantity(), packing_list.getTotalQuantity()) + self.assertEqual(order.getTotalPrice(), packing_list.getTotalPrice()) def stepModifyOrderStartDate(self, sequence=None, sequence_list=None, \ **kw): @@ -1215,8 +1215,8 @@ class TestOrderMixin(SubcontentReindexingWrapper): order.getUid() result = sql_connection.manage_test(sql) simulation_state_list = [x['simulation_state'] for x in result] - self.assertEquals(1, len(simulation_state_list)) - self.assertEquals(order.getSimulationState(), + self.assertEqual(1, len(simulation_state_list)) + self.assertEqual(order.getSimulationState(), simulation_state_list[0]) def stepCheckCataloguedSimulation(self, sequence=None, @@ -1232,8 +1232,8 @@ class TestOrderMixin(SubcontentReindexingWrapper): sim_mvt.getUid() result = sql_connection.manage_test(sql) simulation_state_list = [x['simulation_state'] for x in result] - self.assertEquals(1, len(simulation_state_list)) - self.assertEquals(order.getSimulationState(), + self.assertEqual(1, len(simulation_state_list)) + self.assertEqual(order.getSimulationState(), simulation_state_list[0]) def stepPackingListBuilderAlarm(self, sequence=None, @@ -1291,8 +1291,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): # new_quantity = 0.0 # if new_price == None: # new_price = 0.0 -# self.assertEquals(new_quantity, cell.getProperty('quantity')) -# self.assertEquals(new_price, cell.getProperty('price')) +# self.assertEqual(new_quantity, cell.getProperty('quantity')) +# self.assertEqual(new_price, cell.getProperty('price')) # # # XXX test getTotalPrice on OrderLine @@ -1441,7 +1441,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): # if cell is not None: # # Then, store new properties # cell.edit(price=price) -# self.assertEquals(price, cell.getProperty('price')) +# self.assertEqual(price, cell.getProperty('price')) # # # for new_quantity, new_price in [(None, 346), (123, None), (None, None), \ # # (quantity, price)]: @@ -1865,7 +1865,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): # Test if confirmed order can not be modificated anymore. # """ # if not run: return -# self.failUnless(1==2) +# self.assertTrue(1==2) def test_15_deliveryBuilder(self, quiet=0, run=run_all_test): """ @@ -2132,7 +2132,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): # Test if packing list get some properties from order. # """ # if not run: return -# self.failUnless(1==2) +# self.assertTrue(1==2) def test_18_SimulationStateIndexation(self, quiet=0, run=run_all_test): """ @@ -2180,29 +2180,29 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): order = order_module.newContent(portal_type=self.order_portal_type, specialise=self.business_process) # No line, no movement - self.assertEquals(0, len(order.getMovementList())) + self.assertEqual(0, len(order.getMovementList())) # One line is considered as a movement order_line = order.newContent(portal_type=self.order_line_portal_type) - self.assertEquals(1, len(order.getMovementList())) + self.assertEqual(1, len(order.getMovementList())) # If a sub line is created, its parent should not be considered # as a movement sub_order_line = order_line.newContent( portal_type=self.order_line_portal_type) - self.assertEquals(1, len(order.getMovementList())) + self.assertEqual(1, len(order.getMovementList())) # Create another subline to be sure it increases the line count sub_order_line = order_line.newContent( portal_type=self.order_line_portal_type) - self.assertEquals(2, len(order.getMovementList())) + self.assertEqual(2, len(order.getMovementList())) # Create recursively sub lines, and check that the ovement number # is still the same. for i in range(5): sub_order_line = sub_order_line.newContent( portal_type=self.order_line_portal_type) - self.assertEquals(2, len(order.getMovementList())) + self.assertEqual(2, len(order.getMovementList())) # Create a variated resource resource_module = portal.getDefaultModule(self.resource_portal_type) @@ -2226,7 +2226,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): # Check that those cells increase the movement count sub_order_line.setResourceValue(resource) sub_order_line.setVariationCategoryList(order_line_vcl) - self.assertEquals(1, len(order.getMovementList())) + self.assertEqual(1, len(order.getMovementList())) base_id = 'movement' cell_key_list = list(sub_order_line.getCellKeyList(base_id=base_id)) @@ -2235,12 +2235,12 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): cell = sub_order_line.newCell(base_id=base_id, portal_type=self.order_cell_portal_type, *cell_key) - self.assertEquals(2-1+len(cell_key_list), len(order.getMovementList())) + self.assertEqual(2-1+len(cell_key_list), len(order.getMovementList())) # Check that cells defined on a non leaf line are not returned. order_line.setResourceValue(resource) order_line.setVariationCategoryList(order_line_vcl) - self.assertEquals(2-1+len(cell_key_list), len(order.getMovementList())) + self.assertEqual(2-1+len(cell_key_list), len(order.getMovementList())) base_id = 'movement' cell_key_list = list(order_line.getCellKeyList(base_id=base_id)) @@ -2249,7 +2249,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): cell = order_line.newCell(base_id=base_id, portal_type=self.order_cell_portal_type, *cell_key) - self.assertEquals(2-1+len(cell_key_list), len(order.getMovementList())) + self.assertEqual(2-1+len(cell_key_list), len(order.getMovementList())) # Make sure that portal_type argument works correctly. self.assertEqual(len(order.getMovementList(portal_type='Sale Order Line')), @@ -2287,10 +2287,10 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): destination_value=section, specialise=self.business_process) # No line, no movement - self.assertEquals(order.getTotalQuantity(fast=0), 0) - self.assertEquals(order.getTotalQuantity(fast=1), 0) - self.assertEquals(order.getTotalPrice(fast=0), 0) - self.assertEquals(order.getTotalPrice(fast=1), 0) + self.assertEqual(order.getTotalQuantity(fast=0), 0) + self.assertEqual(order.getTotalQuantity(fast=1), 0) + self.assertEqual(order.getTotalPrice(fast=0), 0) + self.assertEqual(order.getTotalPrice(fast=1), 0) # Create a variated resource resource_module = portal.getDefaultModule(self.resource_portal_type) @@ -2307,17 +2307,17 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): quantity=3) self.tic() - self.assertEquals(order_line.isMovement(), True) + self.assertEqual(order_line.isMovement(), True) - self.assertEquals(order.getTotalQuantity(fast=0), 3) - self.assertEquals(order.getTotalQuantity(fast=1), 3) - self.assertEquals(order.getTotalPrice(fast=0), 6) - self.assertEquals(order.getTotalPrice(fast=1), 6) + self.assertEqual(order.getTotalQuantity(fast=0), 3) + self.assertEqual(order.getTotalQuantity(fast=1), 3) + self.assertEqual(order.getTotalPrice(fast=0), 6) + self.assertEqual(order.getTotalPrice(fast=1), 6) - self.assertEquals(order_line.getTotalQuantity(fast=0), 3) - self.assertEquals(order_line.getTotalQuantity(fast=1), 3) - self.assertEquals(order_line.getTotalPrice(fast=0), 6) - self.assertEquals(order_line.getTotalPrice(fast=1), 6) + self.assertEqual(order_line.getTotalQuantity(fast=0), 3) + self.assertEqual(order_line.getTotalQuantity(fast=1), 3) + self.assertEqual(order_line.getTotalPrice(fast=0), 6) + self.assertEqual(order_line.getTotalPrice(fast=1), 6) # add cell to line, line is not a movement anymore order_line.setVariationCategoryList(order_line_vcl) @@ -2334,42 +2334,42 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): variation_category_list=cell_key) self.tic() - self.assertEquals(order_line.isMovement(), False) - self.assertEquals(cell.isMovement(), True) + self.assertEqual(order_line.isMovement(), False) + self.assertEqual(cell.isMovement(), True) - self.assertEquals(order.getTotalQuantity(fast=0), 4) - self.assertEquals(order.getTotalQuantity(fast=1), 4) - self.assertEquals(order.getTotalPrice(fast=0), 12) - self.assertEquals(order.getTotalPrice(fast=1), 12) + self.assertEqual(order.getTotalQuantity(fast=0), 4) + self.assertEqual(order.getTotalQuantity(fast=1), 4) + self.assertEqual(order.getTotalPrice(fast=0), 12) + self.assertEqual(order.getTotalPrice(fast=1), 12) - self.assertEquals(order_line.getTotalQuantity(fast=0), 4) - self.assertEquals(order_line.getTotalQuantity(fast=1), 4) - self.assertEquals(order_line.getTotalPrice(fast=0), 12) - self.assertEquals(order_line.getTotalPrice(fast=1), 12) + self.assertEqual(order_line.getTotalQuantity(fast=0), 4) + self.assertEqual(order_line.getTotalQuantity(fast=1), 4) + self.assertEqual(order_line.getTotalPrice(fast=0), 12) + self.assertEqual(order_line.getTotalPrice(fast=1), 12) - self.assertEquals(cell.getTotalQuantity(), 4) - self.assertEquals(cell.getTotalPrice(), 12) + self.assertEqual(cell.getTotalQuantity(), 4) + self.assertEqual(cell.getTotalPrice(), 12) # if cell has no price, the total price is None, but a default value can be # provided cell.setPrice(None) self.tic() - self.assertEquals(order_line.isMovement(), False) - self.assertEquals(cell.isMovement(), True) + self.assertEqual(order_line.isMovement(), False) + self.assertEqual(cell.isMovement(), True) - self.assertEquals(order.getTotalQuantity(fast=0), 4) - self.assertEquals(order.getTotalQuantity(fast=1), 4) - self.assertEquals(order.getTotalPrice(fast=0), 0) - self.assertEquals(order.getTotalPrice(fast=1), 0) + self.assertEqual(order.getTotalQuantity(fast=0), 4) + self.assertEqual(order.getTotalQuantity(fast=1), 4) + self.assertEqual(order.getTotalPrice(fast=0), 0) + self.assertEqual(order.getTotalPrice(fast=1), 0) - self.assertEquals(order_line.getTotalQuantity(fast=0), 4) - self.assertEquals(order_line.getTotalQuantity(fast=1), 4) - self.assertEquals(order_line.getTotalPrice(fast=0), 0) - self.assertEquals(order_line.getTotalPrice(fast=1), 0) + self.assertEqual(order_line.getTotalQuantity(fast=0), 4) + self.assertEqual(order_line.getTotalQuantity(fast=1), 4) + self.assertEqual(order_line.getTotalPrice(fast=0), 0) + self.assertEqual(order_line.getTotalPrice(fast=1), 0) - self.assertEquals(cell.getTotalQuantity(), 4) - self.assertEquals(cell.getTotalPrice(), 0) + self.assertEqual(cell.getTotalQuantity(), 4) + self.assertEqual(cell.getTotalPrice(), 0) # restore the price on the line cell.setPrice(3) @@ -2382,52 +2382,52 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): quantity=5) self.tic() - self.assertEquals(order_line.isMovement(), False) - self.assertEquals(cell.isMovement(), False) - self.assertEquals(sub_order_line.isMovement(), True) + self.assertEqual(order_line.isMovement(), False) + self.assertEqual(cell.isMovement(), False) + self.assertEqual(sub_order_line.isMovement(), True) - self.assertEquals(order.getTotalQuantity(fast=0), 5) - self.assertEquals(order.getTotalQuantity(fast=1), 5) - self.assertEquals(order.getTotalPrice(fast=0), 20) - self.assertEquals(order.getTotalPrice(fast=1), 20) + self.assertEqual(order.getTotalQuantity(fast=0), 5) + self.assertEqual(order.getTotalQuantity(fast=1), 5) + self.assertEqual(order.getTotalPrice(fast=0), 20) + self.assertEqual(order.getTotalPrice(fast=1), 20) - self.assertEquals(order_line.getTotalQuantity(fast=0), 5) - self.assertEquals(order_line.getTotalQuantity(fast=1), 5) - self.assertEquals(order_line.getTotalPrice(fast=0), 20) - self.assertEquals(order_line.getTotalPrice(fast=1), 20) + self.assertEqual(order_line.getTotalQuantity(fast=0), 5) + self.assertEqual(order_line.getTotalQuantity(fast=1), 5) + self.assertEqual(order_line.getTotalPrice(fast=0), 20) + self.assertEqual(order_line.getTotalPrice(fast=1), 20) - self.assertEquals(cell.getTotalQuantity(), 0) - self.assertEquals(cell.getTotalPrice(), 0) + self.assertEqual(cell.getTotalQuantity(), 0) + self.assertEqual(cell.getTotalPrice(), 0) - self.assertEquals(sub_order_line.getTotalQuantity(fast=0), 5) - self.assertEquals(sub_order_line.getTotalQuantity(fast=1), 5) - self.assertEquals(sub_order_line.getTotalPrice(fast=0), 20) - self.assertEquals(sub_order_line.getTotalPrice(fast=1), 20) + self.assertEqual(sub_order_line.getTotalQuantity(fast=0), 5) + self.assertEqual(sub_order_line.getTotalQuantity(fast=1), 5) + self.assertEqual(sub_order_line.getTotalPrice(fast=0), 20) + self.assertEqual(sub_order_line.getTotalPrice(fast=1), 20) # if this line has no price, getTotalPrice returns 0 sub_order_line.setPrice(None) self.tic() - self.assertEquals(order_line.isMovement(), False) - self.assertEquals(cell.isMovement(), False) - self.assertEquals(sub_order_line.isMovement(), True) + self.assertEqual(order_line.isMovement(), False) + self.assertEqual(cell.isMovement(), False) + self.assertEqual(sub_order_line.isMovement(), True) - self.assertEquals(order.getTotalQuantity(fast=0), 5) - self.assertEquals(order.getTotalQuantity(fast=1), 5) - self.assertEquals(order.getTotalPrice(fast=0), 0) - self.assertEquals(order.getTotalPrice(fast=1), 0) + self.assertEqual(order.getTotalQuantity(fast=0), 5) + self.assertEqual(order.getTotalQuantity(fast=1), 5) + self.assertEqual(order.getTotalPrice(fast=0), 0) + self.assertEqual(order.getTotalPrice(fast=1), 0) - self.assertEquals(order_line.getTotalQuantity(fast=0), 5) - self.assertEquals(order_line.getTotalQuantity(fast=1), 5) - self.assertEquals(order_line.getTotalPrice(fast=0), 0) - self.assertEquals(order_line.getTotalPrice(fast=1), 0) + self.assertEqual(order_line.getTotalQuantity(fast=0), 5) + self.assertEqual(order_line.getTotalQuantity(fast=1), 5) + self.assertEqual(order_line.getTotalPrice(fast=0), 0) + self.assertEqual(order_line.getTotalPrice(fast=1), 0) - self.assertEquals(cell.getTotalQuantity(), 0) - self.assertEquals(cell.getTotalPrice(), 0) + self.assertEqual(cell.getTotalQuantity(), 0) + self.assertEqual(cell.getTotalPrice(), 0) - self.assertEquals(sub_order_line.getTotalQuantity(fast=0), 5) - self.assertEquals(sub_order_line.getTotalQuantity(fast=1), 5) - self.assertEquals(sub_order_line.getTotalPrice(fast=0), 0) - self.assertEquals(sub_order_line.getTotalPrice(fast=1), 0) + self.assertEqual(sub_order_line.getTotalQuantity(fast=0), 5) + self.assertEqual(sub_order_line.getTotalQuantity(fast=1), 5) + self.assertEqual(sub_order_line.getTotalPrice(fast=0), 0) + self.assertEqual(sub_order_line.getTotalPrice(fast=1), 0) # restore price on the sub line sub_order_line.setPrice(4) @@ -2447,68 +2447,68 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): variation_category_list=cell_key) self.tic() - self.assertEquals(order_line.isMovement(), False) - self.assertEquals(cell.isMovement(), False) - self.assertEquals(sub_order_line.isMovement(), False) - self.assertEquals(sub_cell.isMovement(), True) + self.assertEqual(order_line.isMovement(), False) + self.assertEqual(cell.isMovement(), False) + self.assertEqual(sub_order_line.isMovement(), False) + self.assertEqual(sub_cell.isMovement(), True) - self.assertEquals(order.getTotalQuantity(fast=0), 6) - self.assertEquals(order.getTotalQuantity(fast=1), 6) - self.assertEquals(order.getTotalPrice(fast=0), 30) - self.assertEquals(order.getTotalPrice(fast=1), 30) + self.assertEqual(order.getTotalQuantity(fast=0), 6) + self.assertEqual(order.getTotalQuantity(fast=1), 6) + self.assertEqual(order.getTotalPrice(fast=0), 30) + self.assertEqual(order.getTotalPrice(fast=1), 30) - self.assertEquals(order_line.getTotalQuantity(fast=0), 6) - self.assertEquals(order_line.getTotalQuantity(fast=1), 6) - self.assertEquals(order_line.getTotalPrice(fast=0), 30) - self.assertEquals(order_line.getTotalPrice(fast=1), 30) + self.assertEqual(order_line.getTotalQuantity(fast=0), 6) + self.assertEqual(order_line.getTotalQuantity(fast=1), 6) + self.assertEqual(order_line.getTotalPrice(fast=0), 30) + self.assertEqual(order_line.getTotalPrice(fast=1), 30) - self.assertEquals(cell.getTotalQuantity(), 0) - self.assertEquals(cell.getTotalPrice(), 0) + self.assertEqual(cell.getTotalQuantity(), 0) + self.assertEqual(cell.getTotalPrice(), 0) - self.assertEquals(sub_order_line.getTotalQuantity(fast=0), 6) - self.assertEquals(sub_order_line.getTotalQuantity(fast=1), 6) - self.assertEquals(sub_order_line.getTotalPrice(fast=0), 30) - self.assertEquals(sub_order_line.getTotalPrice(fast=1), 30) + self.assertEqual(sub_order_line.getTotalQuantity(fast=0), 6) + self.assertEqual(sub_order_line.getTotalQuantity(fast=1), 6) + self.assertEqual(sub_order_line.getTotalPrice(fast=0), 30) + self.assertEqual(sub_order_line.getTotalPrice(fast=1), 30) - self.assertEquals(sub_cell.getTotalQuantity(), 6) - self.assertEquals(sub_cell.getTotalPrice(), 30) + self.assertEqual(sub_cell.getTotalQuantity(), 6) + self.assertEqual(sub_cell.getTotalPrice(), 30) # delete sub_line, cell is movement again order_line.manage_delObjects([sub_order_line.getId()]) self.tic() - self.assertEquals(order_line.isMovement(), False) - self.assertEquals(cell.isMovement(), True) + self.assertEqual(order_line.isMovement(), False) + self.assertEqual(cell.isMovement(), True) - self.assertEquals(order.getTotalQuantity(fast=0), 4) - self.assertEquals(order.getTotalQuantity(fast=1), 4) - self.assertEquals(order.getTotalPrice(fast=0), 12) - self.assertEquals(order.getTotalPrice(fast=1), 12) + self.assertEqual(order.getTotalQuantity(fast=0), 4) + self.assertEqual(order.getTotalQuantity(fast=1), 4) + self.assertEqual(order.getTotalPrice(fast=0), 12) + self.assertEqual(order.getTotalPrice(fast=1), 12) - self.assertEquals(order_line.getTotalQuantity(fast=0), 4) - self.assertEquals(order_line.getTotalQuantity(fast=1), 4) - self.assertEquals(order_line.getTotalPrice(fast=0), 12) - self.assertEquals(order_line.getTotalPrice(fast=1), 12) + self.assertEqual(order_line.getTotalQuantity(fast=0), 4) + self.assertEqual(order_line.getTotalQuantity(fast=1), 4) + self.assertEqual(order_line.getTotalPrice(fast=0), 12) + self.assertEqual(order_line.getTotalPrice(fast=1), 12) - self.assertEquals(cell.getTotalQuantity(), 4) - self.assertEquals(cell.getTotalPrice(), 12) + self.assertEqual(cell.getTotalQuantity(), 4) + self.assertEqual(cell.getTotalPrice(), 12) # delete cell, line is movement again order_line.manage_delObjects([cell.getId()]) order_line.setVariationCategoryList([]) self.tic() - self.assertEquals(order_line.isMovement(), True) + self.assertEqual(order_line.isMovement(), True) - self.assertEquals(order.getTotalQuantity(fast=0), 3) - self.assertEquals(order.getTotalQuantity(fast=1), 3) - self.assertEquals(order.getTotalPrice(fast=0), 6) - self.assertEquals(order.getTotalPrice(fast=1), 6) + self.assertEqual(order.getTotalQuantity(fast=0), 3) + self.assertEqual(order.getTotalQuantity(fast=1), 3) + self.assertEqual(order.getTotalPrice(fast=0), 6) + self.assertEqual(order.getTotalPrice(fast=1), 6) - self.assertEquals(order_line.getTotalQuantity(fast=0), 3) - self.assertEquals(order_line.getTotalQuantity(fast=1), 3) - self.assertEquals(order_line.getTotalPrice(fast=0), 6) - self.assertEquals(order_line.getTotalPrice(fast=1), 6) + self.assertEqual(order_line.getTotalQuantity(fast=0), 3) + self.assertEqual(order_line.getTotalQuantity(fast=1), 3) + self.assertEqual(order_line.getTotalPrice(fast=0), 6) + self.assertEqual(order_line.getTotalPrice(fast=1), 6) def stepCreateSubOrderLine(self,sequence=None, sequence_list=None, **kw): """ @@ -2622,48 +2622,48 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): resource_value=resource, quantity=10, price=3) - self.assertEquals(10, line.getTotalQuantity()) - self.assertEquals(10 * 3, line.getTotalPrice()) - self.assertEquals(10, order.getTotalQuantity()) - self.assertEquals(10 * 3, order.getTotalPrice()) + self.assertEqual(10, line.getTotalQuantity()) + self.assertEqual(10 * 3, line.getTotalPrice()) + self.assertEqual(10, order.getTotalQuantity()) + self.assertEqual(10 * 3, order.getTotalPrice()) line.setVariationCategoryList(['size/Baby', 'size/Child/32']) - self.assertEquals(0, line.getTotalQuantity()) - self.assertEquals(0, line.getTotalPrice()) - self.assertEquals(0, order.getTotalQuantity()) - self.assertEquals(0, order.getTotalPrice()) + self.assertEqual(0, line.getTotalQuantity()) + self.assertEqual(0, line.getTotalPrice()) + self.assertEqual(0, order.getTotalQuantity()) + self.assertEqual(0, order.getTotalPrice()) self.assertTrue(line.hasInRange('size/Baby', base_id='movement')) cell_baby = line.newCell('size/Baby', base_id='movement', portal_type=self.order_cell_portal_type) - self.assertEquals(0, cell_baby.getProperty("quantity")) - self.assertEquals(0, cell_baby.getQuantity()) + self.assertEqual(0, cell_baby.getProperty("quantity")) + self.assertEqual(0, cell_baby.getQuantity()) self.assertFalse(cell_baby.hasProperty('quantity')) cell_baby.edit(quantity=10, price=4, variation_category_list=['size/Baby'], mapped_value_property_list=['quantity', 'price'], edit_order=[]) - self.assertEquals(10, cell_baby.getQuantity()) - self.assertEquals(4, cell_baby.getPrice()) + self.assertEqual(10, cell_baby.getQuantity()) + self.assertEqual(4, cell_baby.getPrice()) self.assertTrue(line.hasInRange('size/Child/32', base_id='movement')) cell_child_32 = line.newCell('size/Child/32', base_id='movement', portal_type=self.order_cell_portal_type) - self.assertEquals(0, cell_child_32.getQuantity()) + self.assertEqual(0, cell_child_32.getQuantity()) cell_child_32.edit(quantity=20, price=5, variation_category_list=['size/Child/32'], mapped_value_property_list=['quantity', 'price'], edit_order=[]) - self.assertEquals(20, cell_child_32.getQuantity()) - self.assertEquals(5, cell_child_32.getPrice()) + self.assertEqual(20, cell_child_32.getQuantity()) + self.assertEqual(5, cell_child_32.getPrice()) - self.assertEquals(10 + 20, line.getTotalQuantity()) - self.assertEquals(10*4 + 20*5, line.getTotalPrice()) + self.assertEqual(10 + 20, line.getTotalQuantity()) + self.assertEqual(10*4 + 20*5, line.getTotalPrice()) - self.assertEquals(10 + 20, order.getTotalQuantity()) - self.assertEquals(10*4 + 20*5, order.getTotalPrice()) + self.assertEqual(10 + 20, order.getTotalQuantity()) + self.assertEqual(10*4 + 20*5, order.getTotalPrice()) def test_order_payment_condition_copied(self): # Payment Condition should be copied in the packing list @@ -2690,7 +2690,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): price=3) # set properties, on the default payment condition order.setDefaultPaymentConditionQuantity(10) - self.assertEquals(1, len(order.contentValues( + self.assertEqual(1, len(order.contentValues( portal_type='Payment Condition'))) order.confirm() @@ -2700,7 +2700,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): related_packing_list = order.getCausalityRelatedValue( portal_type=self.packing_list_portal_type) self.assertNotEquals(related_packing_list, None) - self.assertEquals(1, len(related_packing_list.contentValues( + self.assertEqual(1, len(related_packing_list.contentValues( portal_type='Payment Condition'))) def test_Order_viewAsODT(self): @@ -2738,7 +2738,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): self.fail(''.join(err_list)) # The name of the printout is the reference of the order content_disposition = self.portal.REQUEST.RESPONSE.getHeader('content-disposition') - self.assertEquals(content_disposition, 'attachment; filename="OrderReference.odt"') + self.assertEqual(content_disposition, 'attachment; filename="OrderReference.odt"') def test_Order_viewAsODT_person(self): # test order printout with a person as destination @@ -2973,7 +2973,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): # XXX: hard coding a selection_name is bad selection_name = 'SaleOrder_view_listbox_selection' - self.assertEquals(selection_name, + self.assertEqual(selection_name, sale_order.SaleOrder_view.listbox.get_value('selection_name')) # activate report tree diff --git a/product/ERP5/tests/testPackingList.py b/product/ERP5/tests/testPackingList.py index 2742530a5c..68ca7390ed 100644 --- a/product/ERP5/tests/testPackingList.py +++ b/product/ERP5/tests/testPackingList.py @@ -172,24 +172,24 @@ class TestPackingListMixin(TestOrderMixin): """ packing_list = sequence.get('packing_list') order = sequence.get('order') - self.assertEquals(packing_list.getCausalityValue(), order) - self.assertEquals(packing_list.getSource(), order.getSource()) - self.assertEquals(packing_list.getDestination(), order.getDestination()) - self.assertEquals(packing_list.getDestinationSection(), + self.assertEqual(packing_list.getCausalityValue(), order) + self.assertEqual(packing_list.getSource(), order.getSource()) + self.assertEqual(packing_list.getDestination(), order.getDestination()) + self.assertEqual(packing_list.getDestinationSection(), order.getDestinationSection()) - self.assertEquals(packing_list.getSourceSection(), + self.assertEqual(packing_list.getSourceSection(), order.getSourceSection()) - self.assertEquals(packing_list.getSourceDecision(), + self.assertEqual(packing_list.getSourceDecision(), order.getSourceDecision()) - self.assertEquals(packing_list.getDestinationAdministration(), + self.assertEqual(packing_list.getDestinationAdministration(), order.getDestinationAdministration()) - self.assertEquals(packing_list.getSourceAdministration(), + self.assertEqual(packing_list.getSourceAdministration(), order.getSourceAdministration()) - self.assertEquals(packing_list.getPriceCurrency(), + self.assertEqual(packing_list.getPriceCurrency(), order.getPriceCurrency()) - self.assertEquals(packing_list.getDestinationProject(), + self.assertEqual(packing_list.getDestinationProject(), order.getDestinationProject()) - self.assertEquals(packing_list.getSourceProject(), + self.assertEqual(packing_list.getSourceProject(), order.getSourceProject()) def stepCheckPackingListIsDivergent(self, sequence=None, sequence_list=None, @@ -199,7 +199,7 @@ class TestPackingListMixin(TestOrderMixin): """ if packing_list is None: packing_list = sequence.get('packing_list') - self.failIf('Site Error' in packing_list.view()) + self.assertFalse('Site Error' in packing_list.view()) self.assertTrue(packing_list.isDivergent()) def stepCheckNewPackingListIsDivergent(self, sequence=None, sequence_list=None, **kw): @@ -214,25 +214,25 @@ class TestPackingListMixin(TestOrderMixin): Test if packing list is calculating """ packing_list = sequence.get('packing_list') - self.assertEquals('calculating',packing_list.getCausalityState()) + self.assertEqual('calculating',packing_list.getCausalityState()) def stepCheckPackingListIsSolved(self, sequence=None, sequence_list=None, **kw): """ Test if packing list is solved """ packing_list = sequence.get('packing_list') - self.assertEquals('solved',packing_list.getCausalityState()) + self.assertEqual('solved',packing_list.getCausalityState()) def stepCheckNewPackingListIsSolved(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('new_packing_list') - self.assertEquals('solved', packing_list.getCausalityState()) + self.assertEqual('solved', packing_list.getCausalityState()) def stepCheckPackingListIsDiverged(self, sequence=None, sequence_list=None, **kw): """ Test if packing list is divergent """ packing_list = sequence.get('packing_list') - self.assertEquals('diverged', packing_list.getCausalityState()) + self.assertEqual('diverged', packing_list.getCausalityState()) def stepCheckPackingListIsNotDivergent(self, sequence=None, sequence_list=None, **kw): """ @@ -357,7 +357,7 @@ class TestPackingListMixin(TestOrderMixin): order = sequence.get('order') packing_list_list = order.getCausalityRelatedValueList( portal_type=self.packing_list_portal_type) - self.assertEquals(2,len(packing_list_list)) + self.assertEqual(2,len(packing_list_list)) packing_list1 = None packing_list2 = None for packing_list in packing_list_list: @@ -368,10 +368,10 @@ class TestPackingListMixin(TestOrderMixin): sequence.edit(new_packing_list=packing_list2) for line in packing_list1.objectValues( portal_type= self.packing_list_line_portal_type): - self.assertEquals(self.default_quantity-1,line.getQuantity()) + self.assertEqual(self.default_quantity-1,line.getQuantity()) for line in packing_list2.objectValues( portal_type= self.packing_list_line_portal_type): - self.assertEquals(1,line.getQuantity()) + self.assertEqual(1,line.getQuantity()) def stepCheckPackingListSplittedTwoTimes(self, sequence=None, sequence_list=None, **kw): """ @@ -380,7 +380,7 @@ class TestPackingListMixin(TestOrderMixin): order = sequence.get('order') packing_list_list = order.getCausalityRelatedValueList( portal_type=self.packing_list_portal_type) - self.assertEquals(2,len(packing_list_list)) + self.assertEqual(2,len(packing_list_list)) packing_list1 = None packing_list2 = None for packing_list in packing_list_list: @@ -390,10 +390,10 @@ class TestPackingListMixin(TestOrderMixin): packing_list2 = packing_list for line in packing_list1.objectValues( portal_type= self.packing_list_line_portal_type): - self.assertEquals(self.default_quantity-2,line.getQuantity()) + self.assertEqual(self.default_quantity-2,line.getQuantity()) for line in packing_list2.objectValues( portal_type= self.packing_list_line_portal_type): - self.assertEquals(2,line.getQuantity()) + self.assertEqual(2,line.getQuantity()) def stepCheckPackingListNotSplitted(self, sequence=None, sequence_list=None, **kw): """ @@ -402,18 +402,18 @@ class TestPackingListMixin(TestOrderMixin): order = sequence.get('order') packing_list_list = order.getCausalityRelatedValueList( portal_type=self.packing_list_portal_type) - self.assertEquals(1,len(packing_list_list)) + self.assertEqual(1,len(packing_list_list)) packing_list1 = sequence.get('packing_list') last_delta = sequence.get('last_delta', 0.0) for line in packing_list1.objectValues( portal_type= self.packing_list_line_portal_type): - self.assertEquals(self.default_quantity + last_delta, + self.assertEqual(self.default_quantity + last_delta, line.getQuantity()) simulation_list = line.getDeliveryRelatedValueList( portal_type='Simulation Movement') - self.assertEquals(len(simulation_list),1) + self.assertEqual(len(simulation_list),1) simulation_movement = simulation_list[0] - self.assertEquals(self.default_quantity + last_delta, + self.assertEqual(self.default_quantity + last_delta, simulation_movement.getCorrectedQuantity()) def stepCheckPackingListNotSolved(self, sequence=None, sequence_list=None, **kw): @@ -424,20 +424,20 @@ class TestPackingListMixin(TestOrderMixin): order = sequence.get('order') packing_list_list = order.getCausalityRelatedValueList( portal_type=self.packing_list_portal_type) - self.assertEquals(1,len(packing_list_list)) + self.assertEqual(1,len(packing_list_list)) packing_list1 = sequence.get('packing_list') last_delta = sequence.get('last_delta', 0.0) for line in packing_list1.objectValues( portal_type= self.packing_list_line_portal_type): - self.assertEquals(self.default_quantity + last_delta, + self.assertEqual(self.default_quantity + last_delta, line.getQuantity()) simulation_list = line.getDeliveryRelatedValueList( portal_type='Simulation Movement') - self.assertEquals(len(simulation_list),1) + self.assertEqual(len(simulation_list),1) simulation_movement = simulation_list[0] # Here we don't add last_delta, as the solver didn't do its work. - self.assertEquals(self.default_quantity, + self.assertEqual(self.default_quantity, simulation_movement.getCorrectedQuantity()) def stepChangePackingListDestination(self, sequence=None, @@ -464,11 +464,11 @@ class TestPackingListMixin(TestOrderMixin): """ applied_rule = sequence.get('applied_rule') simulation_movement_list = applied_rule.objectValues() - self.assertEquals(len(simulation_movement_list),1) + self.assertEqual(len(simulation_movement_list),1) org3 = sequence.get('organisation3') for simulation_movement in simulation_movement_list: simulation_movement = simulation_movement.objectValues()[0].objectValues()[0] - self.assertEquals(simulation_movement.getDestinationValue(),org3) + self.assertEqual(simulation_movement.getDestinationValue(),org3) def stepChangePackingListStartDate(self, sequence=None, sequence_list=None, **kw): """ @@ -483,12 +483,12 @@ class TestPackingListMixin(TestOrderMixin): """ applied_rule = sequence.get('applied_rule') simulation_movement_list = applied_rule.objectValues() - self.assertEquals(len(simulation_movement_list),1) + self.assertEqual(len(simulation_movement_list),1) delivery_applied_rule = simulation_movement_list[0].objectValues()[0] simulation_movement_list = delivery_applied_rule.objectValues() - self.assertEquals(len(simulation_movement_list),1) + self.assertEqual(len(simulation_movement_list),1) for simulation_movement in simulation_movement_list: - self.assertEquals(simulation_movement.getStartDate(),self.datetime + 15) + self.assertEqual(simulation_movement.getStartDate(),self.datetime + 15) def stepCheckSimulationQuantityUpdated(self,sequence=None, sequence_list=None, **kw): """ @@ -496,10 +496,10 @@ class TestPackingListMixin(TestOrderMixin): """ applied_rule = sequence.get('applied_rule') simulation_movement_list = applied_rule.objectValues() - self.assertEquals(len(simulation_movement_list),1) + self.assertEqual(len(simulation_movement_list),1) for simulation_movement in simulation_movement_list: simulation_movement = simulation_movement.objectValues()[0].objectValues()[0] - self.assertEquals(simulation_movement.getQuantity() + + self.assertEqual(simulation_movement.getQuantity() + simulation_movement.getDeliveryError(), self.default_quantity) @@ -509,10 +509,10 @@ class TestPackingListMixin(TestOrderMixin): """ applied_rule = sequence.get('applied_rule') simulation_movement_list = applied_rule.objectValues() - self.assertEquals(len(simulation_movement_list),2) + self.assertEqual(len(simulation_movement_list),2) for simulation_movement in simulation_movement_list: simulation_movement = simulation_movement.objectValues()[0].objectValues()[0] - self.assertEquals(simulation_movement.getQuantity() + + self.assertEqual(simulation_movement.getQuantity() + simulation_movement.getDeliveryError(), self.default_quantity) @@ -550,23 +550,23 @@ class TestPackingListMixin(TestOrderMixin): """ applied_rule = sequence.get('applied_rule') simulation_movement_list = applied_rule.objectValues() - self.assertEquals(len(simulation_movement_list),1) + self.assertEqual(len(simulation_movement_list),1) order_line = sequence.get('order_line') packing_list = sequence.get('packing_list') packing_list_line = sequence.get('packing_list_line') for simulation_movement in simulation_movement_list: - self.assertEquals(simulation_movement.getDeliveryValue(), order_line) - self.assertEquals(packing_list_line.getCausalityValue(), + self.assertEqual(simulation_movement.getDeliveryValue(), order_line) + self.assertEqual(packing_list_line.getCausalityValue(), order_line) rule_list = simulation_movement.objectValues() - self.failUnless(len(rule_list), 1) + self.assertTrue(len(rule_list), 1) delivering_rule = rule_list[0] - self.failUnless(delivering_rule.getSpecialiseValue().getPortalType(), + self.assertTrue(delivering_rule.getSpecialiseValue().getPortalType(), 'Delivering Rule') child_simulation_movement_list = delivering_rule.objectValues() - self.failUnless(len(child_simulation_movement_list), 1) + self.assertTrue(len(child_simulation_movement_list), 1) child_simulation_movement = child_simulation_movement_list[0] - self.assertEquals(child_simulation_movement.getDeliveryValue(), + self.assertEqual(child_simulation_movement.getDeliveryValue(), packing_list_line) def stepCheckSimulationDisconnected(self,sequence=None, sequence_list=None, **kw): @@ -575,10 +575,10 @@ class TestPackingListMixin(TestOrderMixin): """ applied_rule = sequence.get('applied_rule') simulation_movement_list = applied_rule.objectValues() - self.assertEquals(len(simulation_movement_list),1) + self.assertEqual(len(simulation_movement_list),1) for simulation_movement in simulation_movement_list: child_simulation_movement = simulation_movement.objectValues()[0].objectValues()[0] - self.assertEquals(child_simulation_movement.getDeliveryValue(),None) + self.assertEqual(child_simulation_movement.getDeliveryValue(),None) def stepCheckTwoSimulationLines(self, sequence): """ @@ -586,7 +586,7 @@ class TestPackingListMixin(TestOrderMixin): line(s) """ simulation_movement_list = self._getSPLSimulationMovementList(sequence) - self.assertEquals(len(simulation_movement_list),2) + self.assertEqual(len(simulation_movement_list),2) def _getSPLSimulationMovementList(self, sequence): """ Get the simulation movement lines from sales packing list movements """ @@ -629,7 +629,7 @@ class TestPackingListMixin(TestOrderMixin): Modify start_date on only one simulation line related to SPL lines """ simulation_movement_list = self._getSPLSimulationMovementList(sequence) - self.assertEquals(len(simulation_movement_list), + self.assertEqual(len(simulation_movement_list), len(sequence['resource_list'])) simulation_movement_list[-1].recordProperty('start_date') simulation_movement_list[-1].edit(start_date=self.datetime+15) @@ -723,14 +723,14 @@ class TestPackingListMixin(TestOrderMixin): Look if the packing list has new previsions """ packing_list_line = sequence.get('packing_list_line') - self.assertEquals(packing_list_line.getQuantity(),self.default_quantity-1) + self.assertEqual(packing_list_line.getQuantity(),self.default_quantity-1) def stepCheckPackingListLineWithNewQuantityPrevisionForMergedLine(self,sequence=None, sequence_list=None, **kw): """ Look if the packing list has new previsions """ packing_list_line = sequence.get('packing_list_line') - self.assertEquals(packing_list_line.getQuantity(),(self.default_quantity-1)*2) + self.assertEqual(packing_list_line.getQuantity(),(self.default_quantity-1)*2) def stepCheckPackingListLineWithNewResource(self,sequence=None, sequence_list=None, **kw): """ @@ -738,18 +738,18 @@ class TestPackingListMixin(TestOrderMixin): """ packing_list_line = sequence.get('packing_list_line') new_resource = sequence.get('resource') - self.assertEquals(packing_list_line.getQuantity(), self.default_quantity*2) - self.assertEquals(packing_list_line.getResourceValue(), new_resource) + self.assertEqual(packing_list_line.getQuantity(), self.default_quantity*2) + self.assertEqual(packing_list_line.getResourceValue(), new_resource) simulation_line_list = packing_list_line.getDeliveryRelatedValueList() order_line_list = sum([x.getParentValue().getParentValue().getDeliveryList() for x in simulation_line_list], []) - self.assertEquals(sorted(packing_list_line.getCausalityList()), + self.assertEqual(sorted(packing_list_line.getCausalityList()), sorted(order_line_list)) def stepCheckPackingListLineWithPreviousResource(self, sequence=None): packing_list_line = sequence.get('packing_list_line') old_resource = sequence['resource_list'][-2] - self.assertEquals(packing_list_line.getResourceValue(), old_resource) + self.assertEqual(packing_list_line.getResourceValue(), old_resource) def stepCheckPackingListLineWithSameResource(self,sequence=None, sequence_list=None, **kw): """ @@ -759,9 +759,9 @@ class TestPackingListMixin(TestOrderMixin): packing_list_line = old_packing_list_line.aq_parent[str(int(old_packing_list_line.getId())-1)] resource = sequence.get('resource') for line in sequence.get('packing_list').getMovementList(): - self.assertEquals(line.getResourceValue(), resource) - self.assertEquals(line.getQuantity(), self.default_quantity) - self.assertEquals(line.getCausalityList(), + self.assertEqual(line.getResourceValue(), resource) + self.assertEqual(line.getQuantity(), self.default_quantity) + self.assertEqual(line.getCausalityList(), [x.getParentValue().getParentValue().getDelivery() for x in line.getDeliveryRelatedValueList()]) @@ -774,11 +774,11 @@ class TestPackingListMixin(TestOrderMixin): packing_list = sequence.get('packing_list') LOG('CheckNewPackingList, self.datetime+15',0,self.datetime+15) LOG('CheckNewPackingList, packing_list.getStartDate',0,packing_list.getStartDate()) - self.assertEquals(packing_list_line.getQuantity(),self.default_quantity) - self.assertEquals(packing_list.getStartDate(),self.datetime+15) + self.assertEqual(packing_list_line.getQuantity(),self.default_quantity) + self.assertEqual(packing_list.getStartDate(),self.datetime+15) simulation_movement_list = applied_rule.objectValues() resource_list = sequence.get('resource_list') - self.assertEquals(len(simulation_movement_list),len(resource_list)) + self.assertEqual(len(simulation_movement_list),len(resource_list)) delivery_value_list = [] for simulation_movement in simulation_movement_list: # self.assertNotEquals(simulation_movement.getDeliveryValue(),None) @@ -787,7 +787,7 @@ class TestPackingListMixin(TestOrderMixin): delivery_value_list.append(delivery_value_list) # new_packing_list = delivery_value.getParent() # self.assertNotEquals(new_packing_list.getUid(),packing_list.getUid()) - self.assertEquals(len(delivery_value_list),len(resource_list)) + self.assertEqual(len(delivery_value_list),len(resource_list)) def stepCheckNewSplitPackingListAfterStartDateAdopt(self,sequence=None, sequence_list=None, **kw): """ @@ -800,13 +800,13 @@ class TestPackingListMixin(TestOrderMixin): new_packing_list = self.portal.sale_packing_list_module[str(int(packing_list.getId())-1)] new_packing_list_line = [x for x in new_packing_list.getMovementList() if x.getQuantity()][0] - self.assertEquals(packing_list_line.getQuantity(),self.default_quantity) - self.assertEquals(packing_list.getStartDate(),self.datetime+10) - self.assertEquals(new_packing_list_line.getQuantity(),self.default_quantity) - self.assertEquals(new_packing_list.getStartDate(),self.datetime+15) + self.assertEqual(packing_list_line.getQuantity(),self.default_quantity) + self.assertEqual(packing_list.getStartDate(),self.datetime+10) + self.assertEqual(new_packing_list_line.getQuantity(),self.default_quantity) + self.assertEqual(new_packing_list.getStartDate(),self.datetime+15) simulation_movement_list = applied_rule.objectValues() resource_list = sequence.get('resource_list') - self.assertEquals(len(simulation_movement_list),len(resource_list)) + self.assertEqual(len(simulation_movement_list),len(resource_list)) delivery_value_list = [] for simulation_movement in simulation_movement_list: # self.assertNotEquals(simulation_movement.getDeliveryValue(),None) @@ -815,7 +815,7 @@ class TestPackingListMixin(TestOrderMixin): delivery_value_list.append(delivery_value_list) # new_packing_list = delivery_value.getParent() # self.assertNotEquals(new_packing_list.getUid(),packing_list.getUid()) - self.assertEquals(len(delivery_value_list),len(resource_list)) + self.assertEqual(len(delivery_value_list),len(resource_list)) def stepAddPackingListContainer(self,sequence=None, packing_list=None,sequence_list=None, **kw): @@ -860,8 +860,8 @@ class TestPackingListMixin(TestOrderMixin): Checks that quantity is set correctly on the container_line. """ container_line = sequence.get('container_line') - self.assertEquals(self.default_quantity - 1, container_line.getQuantity()) - self.assertEquals(self.default_quantity - 1, + self.assertEqual(self.default_quantity - 1, container_line.getQuantity()) + self.assertEqual(self.default_quantity - 1, container_line.getTotalQuantity()) def stepSetContainerLineFullQuantity(self,sequence=None, sequence_list=None, @@ -895,8 +895,8 @@ class TestPackingListMixin(TestOrderMixin): quantity = line.getQuantity() container_line.edit(quantity=quantity) container_line.immediateReindexObject() - self.assertEquals(quantity, container_line.getQuantity()) - self.assertEquals(quantity, container_line.getTotalQuantity()) + self.assertEqual(quantity, container_line.getQuantity()) + self.assertEqual(quantity, container_line.getTotalQuantity()) # with variation elif line.hasCellContent(): vcl = line.getVariationCategoryList() @@ -916,15 +916,15 @@ class TestPackingListMixin(TestOrderMixin): predicate_category_list=cell_key, variation_category_list=cell_key) cell.immediateReindexObject() - self.assertEquals(old_cell.getQuantity(), cell.getQuantity()) - self.assertEquals(old_cell.getTotalQuantity(), cell.getTotalQuantity()) + self.assertEqual(old_cell.getQuantity(), cell.getQuantity()) + self.assertEqual(old_cell.getTotalQuantity(), cell.getTotalQuantity()) - self.assertEquals(line.getQuantity(), container_line.getQuantity()) - self.assertEquals(line.getTotalQuantity(), container_line.getTotalQuantity()) + self.assertEqual(line.getQuantity(), container_line.getQuantity()) + self.assertEqual(line.getTotalQuantity(), container_line.getTotalQuantity()) # quantity is 1 on the container itself - self.assertEquals(1, container.getQuantity()) - self.assertEquals(1, container.getTotalQuantity()) + self.assertEqual(1, container.getQuantity()) + self.assertEqual(1, container.getTotalQuantity()) def stepCheckPackingListIsNotPacked(self,sequence=None, sequence_list=None, **kw): """ @@ -933,7 +933,7 @@ class TestPackingListMixin(TestOrderMixin): """ packing_list = sequence.get('packing_list') self.assertFalse(packing_list.isPacked()) - self.assertEquals('missing', packing_list.getContainerState()) + self.assertEqual('missing', packing_list.getContainerState()) def stepCheckPackingListIsPacked(self,sequence=None, sequence_list=None, packing_list=None,**kw): @@ -945,7 +945,7 @@ class TestPackingListMixin(TestOrderMixin): packing_list = sequence.get('packing_list') self.commit() self.assertTrue(packing_list.isPacked()) - self.assertEquals('packed', packing_list.getContainerState()) + self.assertEqual('packed', packing_list.getContainerState()) def stepCheckNewPackingListIsPacked(self,sequence=None, sequence_list=None, **kw): """ @@ -1469,7 +1469,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : return pl = self.getPortal().getDefaultModule(self.packing_list_portal_type ).newContent(portal_type=self.packing_list_portal_type) - self.failUnless(hasattr(pl, 'getPriceCurrency')) + self.assertTrue(hasattr(pl, 'getPriceCurrency')) def test_PackingList_viewAsODT(self): # tests packing list printout @@ -1758,13 +1758,13 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : # check it's possible to sort by reference reference_result = packing_list.getMovementList(sort_on= [('reference', 'descending')]) - self.assertEquals(reference_result, [line_ddd, line_ccc, + self.assertEqual(reference_result, [line_ddd, line_ccc, line_bbb_cell_bbb, line_bbb_cell_aaa, line_aaa]) # check it's possible to sort by int_index int_index_result = packing_list.getMovementList(sort_on= [('int_index', 'ascending')]) - self.assertEquals(int_index_result, [line_bbb_cell_aaa, line_bbb_cell_bbb, + self.assertEqual(int_index_result, [line_bbb_cell_aaa, line_bbb_cell_bbb, line_aaa, line_ddd, line_ccc]) def test_subcontent_reindexing_container_line_cell(self): @@ -1802,7 +1802,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : source_project_value = project1, destination_project_value = project2 ) order.setPaymentConditionEfficiency(1.0) - self.failUnless('Site Error' not in order.view()) + self.assertTrue('Site Error' not in order.view()) def testTransferOfOwnership(self, quiet=quiet): @@ -1923,9 +1923,9 @@ class TestSolvingPackingList(TestPackingListMixin, ERP5TypeTestCase): new_packing_list = filter(lambda x:x != packing_list, order.getCausalityRelatedValueList( portal_type=packing_list.getPortalType()))[0] - self.assertEquals(len(packing_list.getMovementList()), + self.assertEqual(len(packing_list.getMovementList()), len(order.getMovementList()) - 10) - self.assertEquals(len(new_packing_list.getMovementList()), 10) + self.assertEqual(len(new_packing_list.getMovementList()), 10) def test_01_PackingListDecreaseQuantity(self, quiet=quiet): """ diff --git a/product/ERP5/tests/testPasswordTool.py b/product/ERP5/tests/testPasswordTool.py index a367a6f329..81f33cff19 100644 --- a/product/ERP5/tests/testPasswordTool.py +++ b/product/ERP5/tests/testPasswordTool.py @@ -107,7 +107,7 @@ class TestPasswordTool(ERP5TypeTestCase): """ Check existence of password tool """ - self.failUnless(self.getPasswordTool() is not None) + self.assertTrue(self.getPasswordTool() is not None) def stepCheckUserLogin(self, sequence=None, sequence_list=None, **kw): """ @@ -150,7 +150,7 @@ class TestPasswordTool(ERP5TypeTestCase): Check mail has not been sent after fill in wrong the form password """ last_message = self.portal.MailHost._last_message - self.assertEquals((), last_message) + self.assertEqual((), last_message) def stepCheckMailSent(self, sequence=None, sequence_list=None, **kw): """ @@ -159,8 +159,8 @@ class TestPasswordTool(ERP5TypeTestCase): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('Portal Administrator <site@example.invalid>', mfrom) - self.assertEquals(['userA@example.invalid'], mto) + self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) + self.assertEqual(['userA@example.invalid'], mto) def stepGoToRandomAddress(self, sequence=None, sequence_list=None, **kw): """ @@ -318,16 +318,16 @@ class TestPasswordTool(ERP5TypeTestCase): self._assertUserExists('userA', 'passwordA') self._assertUserExists('userB', 'passwordB') - self.assertEquals(0, len(self.portal.portal_password._password_request_dict)) + self.assertEqual(0, len(self.portal.portal_password._password_request_dict)) self.portal.portal_password.mailPasswordResetRequest(user_login="userA") - self.assertEquals(1, len(self.portal.portal_password._password_request_dict)) + self.assertEqual(1, len(self.portal.portal_password._password_request_dict)) key_a = self.portal.portal_password._password_request_dict.keys()[0] self.tic() self.portal.portal_password.mailPasswordResetRequest(user_login="userB") possible_key_list =\ self.portal.portal_password._password_request_dict.keys() - self.assertEquals(2, len(possible_key_list)) + self.assertEqual(2, len(possible_key_list)) key_b = [k for k in possible_key_list if k != key_a][0] self.tic() @@ -364,12 +364,12 @@ class TestPasswordTool(ERP5TypeTestCase): self._assertUserExists('userZ ', 'passwordZ') - self.assertEquals(0, len(self.portal.portal_password._password_request_dict)) + self.assertEqual(0, len(self.portal.portal_password._password_request_dict)) # No reset should be send if trailing space is not entered self.portal.portal_password.mailPasswordResetRequest(user_login="userZ") - self.assertEquals(0, len(self.portal.portal_password._password_request_dict)) + self.assertEqual(0, len(self.portal.portal_password._password_request_dict)) self.portal.portal_password.mailPasswordResetRequest(user_login="userZ ") - self.assertEquals(1, len(self.portal.portal_password._password_request_dict)) + self.assertEqual(1, len(self.portal.portal_password._password_request_dict)) key_a = self.portal.portal_password._password_request_dict.keys()[0] self.tic() diff --git a/product/ERP5/tests/testPayroll.py b/product/ERP5/tests/testPayroll.py index f7be317de8..081e62d0d1 100644 --- a/product/ERP5/tests/testPayroll.py +++ b/product/ERP5/tests/testPayroll.py @@ -588,9 +588,9 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): movement_dict = paysheet.updateAggregatedAmountList() movement_to_delete = movement_dict['movement_to_delete_list'] movement_to_add = movement_dict['movement_to_add_list'] - self.assertEquals(len(movement_to_delete), + self.assertEqual(len(movement_to_delete), expected_movement_to_delete_count) - # self.assertEquals(len(movement_to_add), expected_movement_to_add_count) + # self.assertEqual(len(movement_to_add), expected_movement_to_add_count) def stepCheckUpdateAggregatedAmountListReturn(self, sequence=None, **kw): paysheet = sequence.get('paysheet') @@ -708,11 +708,11 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): service = paysheet_line.getResourceTitle() if service == 'Urssaf': cell1 = paysheet_line.getCell('contribution_share/employee') - self.assertEquals(cell1.getQuantity(), 3000) - self.assertEquals(cell1.getPrice(), 0.1) + self.assertEqual(cell1.getQuantity(), 3000) + self.assertEqual(cell1.getPrice(), 0.1) cell2 = paysheet_line.getCell('contribution_share/employer') - self.assertEquals(cell2.getQuantity(), 3000) - self.assertEquals(cell2.getPrice(), 0.5) + self.assertEqual(cell2.getQuantity(), 3000) + self.assertEqual(cell2.getPrice(), 0.5) elif service == 'Labour': self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) else: @@ -725,11 +725,11 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): service = paysheet_line.getResourceTitle() if service == 'Urssaf': cell1 = paysheet_line.getCell('contribution_share/employee') - self.assertEquals(cell1.getQuantity(), 4000) - self.assertEquals(cell1.getPrice(), 0.1) + self.assertEqual(cell1.getQuantity(), 4000) + self.assertEqual(cell1.getPrice(), 0.1) cell2 = paysheet_line.getCell('contribution_share/employer') - self.assertEquals(cell2.getQuantity(), 4000) - self.assertEquals(cell2.getPrice(), 0.5) + self.assertEqual(cell2.getQuantity(), 4000) + self.assertEqual(cell2.getPrice(), 0.5) elif service == 'Labour': self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) elif service == 'Bonus': @@ -746,11 +746,11 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): cell1 = paysheet_line.getCell('contribution_share/employee') # XXX-Aurel quantity from model line is multiply by total price of labour line # price remains None - self.assertEquals(cell1.getQuantity(), -300000) - self.assertEquals(cell1.getPrice(), None) + self.assertEqual(cell1.getQuantity(), -300000) + self.assertEqual(cell1.getPrice(), None) cell2 = paysheet_line.getCell('contribution_share/employer') - self.assertEquals(cell2.getQuantity(), -600000) - self.assertEquals(cell2.getPrice(), None) + self.assertEqual(cell2.getQuantity(), -600000) + self.assertEqual(cell2.getPrice(), None) elif service == 'Labour': self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) else: @@ -765,30 +765,30 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): if paysheet_line.getSalaryRange() == 'france/slice_0_to_200': cell1 = paysheet_line.getCell('contribution_share/employee', 'salary_range/france/slice_0_to_200') - self.assertEquals(cell1.getQuantity(), 200) - self.assertEquals(cell1.getPrice(), 0.1) + self.assertEqual(cell1.getQuantity(), 200) + self.assertEqual(cell1.getPrice(), 0.1) cell2 = paysheet_line.getCell('contribution_share/employer', 'salary_range/france/slice_0_to_200') - self.assertEquals(cell2.getQuantity(), 200) - self.assertEquals(cell2.getPrice(), 0.2) + self.assertEqual(cell2.getQuantity(), 200) + self.assertEqual(cell2.getPrice(), 0.2) elif paysheet_line.getSalaryRange() == 'france/slice_200_to_400': cell3 = paysheet_line.getCell('contribution_share/employee', 'salary_range/france/slice_200_to_400') - self.assertEquals(cell3.getQuantity(), 200) - self.assertEquals(cell3.getPrice(), 0.3) + self.assertEqual(cell3.getQuantity(), 200) + self.assertEqual(cell3.getPrice(), 0.3) cell4 = paysheet_line.getCell('contribution_share/employer', 'salary_range/france/slice_200_to_400') - self.assertEquals(cell4.getQuantity(), 200) - self.assertEquals(cell4.getPrice(), 0.4) + self.assertEqual(cell4.getQuantity(), 200) + self.assertEqual(cell4.getPrice(), 0.4) elif paysheet_line.getSalaryRange() == 'france/slice_400_to_5000': cell5 = paysheet_line.getCell('contribution_share/employee', 'salary_range/france/slice_400_to_5000') - self.assertEquals(cell5.getQuantity(), 2600) - self.assertEquals(cell5.getPrice(), 0.5) + self.assertEqual(cell5.getQuantity(), 2600) + self.assertEqual(cell5.getPrice(), 0.5) cell6 = paysheet_line.getCell('contribution_share/employer', 'salary_range/france/slice_400_to_5000') - self.assertEquals(cell6.getQuantity(), 2600) - self.assertEquals(cell6.getPrice(), 0.6) + self.assertEqual(cell6.getQuantity(), 2600) + self.assertEqual(cell6.getPrice(), 0.6) else: self.fail("Unknown salary range for line %s" % paysheet_line.getTitle()) elif service == 'Labour': @@ -805,30 +805,30 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): if paysheet_line.getSalaryRange() == 'france/slice_0_to_200': cell1 = paysheet_line.getCell('contribution_share/employee', 'salary_range/france/slice_0_to_200') - self.assertEquals(cell1.getQuantity(), 200) - self.assertEquals(cell1.getPrice(), 0.1) + self.assertEqual(cell1.getQuantity(), 200) + self.assertEqual(cell1.getPrice(), 0.1) cell2 = paysheet_line.getCell('contribution_share/employer', 'salary_range/france/slice_0_to_200') - self.assertEquals(cell2.getQuantity(), 200) - self.assertEquals(cell2.getPrice(), 0.2) + self.assertEqual(cell2.getQuantity(), 200) + self.assertEqual(cell2.getPrice(), 0.2) elif paysheet_line.getSalaryRange() == 'france/slice_200_to_400': cell3 = paysheet_line.getCell('contribution_share/employee', 'salary_range/france/slice_200_to_400') - self.assertEquals(cell3.getQuantity(), 200) - self.assertEquals(cell3.getPrice(), 0.3) + self.assertEqual(cell3.getQuantity(), 200) + self.assertEqual(cell3.getPrice(), 0.3) cell4 = paysheet_line.getCell('contribution_share/employer', 'salary_range/france/slice_200_to_400') - self.assertEquals(cell4.getQuantity(), 200) - self.assertEquals(cell4.getPrice(), 0.4) + self.assertEqual(cell4.getQuantity(), 200) + self.assertEqual(cell4.getPrice(), 0.4) elif paysheet_line.getSalaryRange() == 'france/slice_400_to_5000': cell5 = paysheet_line.getCell('contribution_share/employee', 'salary_range/france/slice_400_to_5000') - self.assertEquals(cell5.getQuantity(), 2600) - self.assertEquals(cell5.getPrice(), 0.5) + self.assertEqual(cell5.getQuantity(), 2600) + self.assertEqual(cell5.getPrice(), 0.5) cell6 = paysheet_line.getCell('contribution_share/employer', 'salary_range/france/slice_400_to_5000') - self.assertEquals(cell6.getQuantity(), 2600) - self.assertEquals(cell6.getPrice(), 0.6) + self.assertEqual(cell6.getQuantity(), 2600) + self.assertEqual(cell6.getPrice(), 0.6) else: self.fail("Unknown salary range for line %s" % paysheet_line.getTitle()) elif service == 'Labour': @@ -847,21 +847,21 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): if paysheet_line.getSalaryRange() == 'france/slice_200_to_400': cell1 = paysheet_line.getCell('contribution_share/employee', 'salary_range/france/slice_200_to_400') - self.assertEquals(cell1.getQuantity(), 200) - self.assertEquals(cell1.getPrice(), 0.1) + self.assertEqual(cell1.getQuantity(), 200) + self.assertEqual(cell1.getPrice(), 0.1) cell2 = paysheet_line.getCell('contribution_share/employer', 'salary_range/france/slice_200_to_400') - self.assertEquals(cell2.getQuantity(), 200) - self.assertEquals(cell2.getPrice(), 0.2) + self.assertEqual(cell2.getQuantity(), 200) + self.assertEqual(cell2.getPrice(), 0.2) elif paysheet_line.getSalaryRange() == 'france/slice_600_to_800': cell3 = paysheet_line.getCell('contribution_share/employee', 'salary_range/france/slice_600_to_800') - self.assertEquals(cell3.getQuantity(), 200) - self.assertEquals(cell3.getPrice(), 0.3) + self.assertEqual(cell3.getQuantity(), 200) + self.assertEqual(cell3.getPrice(), 0.3) cell4 = paysheet_line.getCell('contribution_share/employer', 'salary_range/france/slice_600_to_800') - self.assertEquals(cell4.getQuantity(), 200) - self.assertEquals(cell4.getPrice(), 0.4) + self.assertEqual(cell4.getQuantity(), 200) + self.assertEqual(cell4.getPrice(), 0.4) else: self.fail("Unknown salary range for line %s" % paysheet_line.getTitle()) elif service == 'Labour': @@ -879,37 +879,37 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): if paysheet_line.getSalaryRange() == 'france/slice_0_to_200': cell1 = paysheet_line.getCell('contribution_share/employee', 'salary_range/france/slice_0_to_200') - self.assertEquals(cell1.getQuantity(), 200) - self.assertEquals(cell1.getPrice(), 0.1) + self.assertEqual(cell1.getQuantity(), 200) + self.assertEqual(cell1.getPrice(), 0.1) cell2 = paysheet_line.getCell('contribution_share/employer', 'salary_range/france/slice_0_to_200') - self.assertEquals(cell2.getQuantity(), 200) - self.assertEquals(cell2.getPrice(), 0.2) + self.assertEqual(cell2.getQuantity(), 200) + self.assertEqual(cell2.getPrice(), 0.2) elif paysheet_line.getSalaryRange() == 'france/slice_200_to_400': cell3 = paysheet_line.getCell('contribution_share/employee', 'salary_range/france/slice_200_to_400') - self.assertEquals(cell3.getQuantity(), 200) - self.assertEquals(cell3.getPrice(), 0.3) + self.assertEqual(cell3.getQuantity(), 200) + self.assertEqual(cell3.getPrice(), 0.3) cell4 = paysheet_line.getCell('contribution_share/employer', 'salary_range/france/slice_200_to_400') - self.assertEquals(cell4.getQuantity(), 200) - self.assertEquals(cell4.getPrice(), 0.4) + self.assertEqual(cell4.getQuantity(), 200) + self.assertEqual(cell4.getPrice(), 0.4) elif paysheet_line.getSalaryRange() == 'france/slice_400_to_5000': cell5 = paysheet_line.getCell('contribution_share/employee', 'salary_range/france/slice_400_to_5000') - self.assertEquals(cell5.getQuantity(), 2600) - self.assertEquals(cell5.getPrice(), 0.5) + self.assertEqual(cell5.getQuantity(), 2600) + self.assertEqual(cell5.getPrice(), 0.5) cell6 = paysheet_line.getCell('contribution_share/employer', 'salary_range/france/slice_400_to_5000') - self.assertEquals(cell6.getQuantity(), 2600) - self.assertEquals(cell6.getPrice(), 0.6) + self.assertEqual(cell6.getQuantity(), 2600) + self.assertEqual(cell6.getPrice(), 0.6) else: cell1 = paysheet_line.getCell('contribution_share/employee') - self.assertEquals(cell1.getQuantity(), 3000) - self.assertEquals(cell1.getPrice(), 0.1) + self.assertEqual(cell1.getQuantity(), 3000) + self.assertEqual(cell1.getPrice(), 0.1) cell2 = paysheet_line.getCell('contribution_share/employer') - self.assertEquals(cell2.getQuantity(), 3000) - self.assertEquals(cell2.getPrice(), 0.5) + self.assertEqual(cell2.getQuantity(), 3000) + self.assertEqual(cell2.getPrice(), 0.5) elif service == 'Labour': self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) else: @@ -922,20 +922,20 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): service = paysheet_line.getResourceTitle() if service == 'Urssaf': cell1 = paysheet_line.getCell('contribution_share/employee') - self.assertEquals(cell1.getQuantity(), 3000) - self.assertEquals(cell1.getPrice(), 0.1) + self.assertEqual(cell1.getQuantity(), 3000) + self.assertEqual(cell1.getPrice(), 0.1) cell2 = paysheet_line.getCell('contribution_share/employer') - self.assertEquals(cell2.getQuantity(), 3000) - self.assertEquals(cell2.getPrice(), 0.5) + self.assertEqual(cell2.getQuantity(), 3000) + self.assertEqual(cell2.getPrice(), 0.5) elif service == 'Labour': self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) elif service == 'Sickness Insurance': cell1 = paysheet_line.getCell('contribution_share/employee') - self.assertEquals(cell1.getQuantity(), 3000) - self.assertEquals(cell1.getPrice(), 0.4) + self.assertEqual(cell1.getQuantity(), 3000) + self.assertEqual(cell1.getPrice(), 0.4) cell2 = paysheet_line.getCell('contribution_share/employer') - self.assertEquals(cell2.getQuantity(), 3000) - self.assertEquals(cell2.getPrice(), 0.3) + self.assertEqual(cell2.getQuantity(), 3000) + self.assertEqual(cell2.getPrice(), 0.3) else: self.fail("Unknown service for line %s" % paysheet_line.getTitle()) @@ -946,20 +946,20 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): service = paysheet_line.getResourceTitle() if service == 'Urssaf': cell1 = paysheet_line.getCell('contribution_share/employee') - self.assertEquals(cell1.getQuantity(), 3000) - self.assertEquals(cell1.getPrice(), 0.1) + self.assertEqual(cell1.getQuantity(), 3000) + self.assertEqual(cell1.getPrice(), 0.1) cell2 = paysheet_line.getCell('contribution_share/employer') - self.assertEquals(cell2.getQuantity(), 3000) - self.assertEquals(cell2.getPrice(), 0.5) + self.assertEqual(cell2.getQuantity(), 3000) + self.assertEqual(cell2.getPrice(), 0.5) elif service == 'Labour': self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) elif service == 'Old Age Insurance': cell1 = paysheet_line.getCell('contribution_share/employee') - self.assertEquals(cell1.getQuantity(), 3000) - self.assertEquals(cell1.getPrice(), 0.5) + self.assertEqual(cell1.getQuantity(), 3000) + self.assertEqual(cell1.getPrice(), 0.5) cell2 = paysheet_line.getCell('contribution_share/employer') - self.assertEquals(cell2.getQuantity(), 3000) - self.assertEquals(cell2.getPrice(), 0.8) + self.assertEqual(cell2.getQuantity(), 3000) + self.assertEqual(cell2.getPrice(), 0.8) else: self.fail("Unknown service for line %s" % paysheet_line.getTitle()) @@ -968,8 +968,8 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): movement_dict = paysheet.updateAggregatedAmountList() movement_to_delete = movement_dict['movement_to_delete_list'] movement_to_add = movement_dict['movement_to_add_list'] - self.assertEquals(len(movement_to_delete), 0) - self.assertEquals(len(movement_to_add), 0) + self.assertEqual(len(movement_to_delete), 0) + self.assertEqual(len(movement_to_add), 0) def stepCreateUrssafRoubaixOrganisation(self, sequence=None, **kw): node = self.createOrganisation() @@ -1011,9 +1011,9 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): service = paysheet_line.getResourceTitle() if service == 'Urssaf': cell1 = paysheet_line.getCell('contribution_share/employee') - self.assertEquals(cell1.getSourceSectionValue(), urssaf_roubaix) + self.assertEqual(cell1.getSourceSectionValue(), urssaf_roubaix) cell2 = paysheet_line.getCell('contribution_share/employer') - self.assertEquals(cell2.getSourceSectionValue(), urssaf_roubaix) + self.assertEqual(cell2.getSourceSectionValue(), urssaf_roubaix) elif service == 'Labour': pass else: @@ -1043,34 +1043,34 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): employer = sequence.get('employer') employee = sequence.get('employee') currency = sequence.get('price_currency') - self.assertEquals(paysheet.getSourceSectionValue(), employee) - self.assertEquals(paysheet.getDestinationSectionValue(), employer) - self.assertEquals(paysheet.getPriceCurrencyValue(), currency) - self.assertEquals(paysheet.getDefaultPaymentConditionTradeDate(), 'custom') - self.assertEquals(paysheet.getDefaultPaymentConditionPaymentDate(), + self.assertEqual(paysheet.getSourceSectionValue(), employee) + self.assertEqual(paysheet.getDestinationSectionValue(), employer) + self.assertEqual(paysheet.getPriceCurrencyValue(), currency) + self.assertEqual(paysheet.getDefaultPaymentConditionTradeDate(), 'custom') + self.assertEqual(paysheet.getDefaultPaymentConditionPaymentDate(), DateTime(2009,05,25)) - self.assertEquals(paysheet.getWorkTimeAnnotationLineQuantity(), 151.67) - self.assertEquals(paysheet.getWorkTimeAnnotationLineQuantityUnit(), + self.assertEqual(paysheet.getWorkTimeAnnotationLineQuantity(), 151.67) + self.assertEqual(paysheet.getWorkTimeAnnotationLineQuantityUnit(), 'time/hours') def stepCheckPaysheetContainNoAnnotationLine(self, sequence=None, **kw): paysheet = sequence.get('paysheet') - self.assertEquals(len(paysheet.contentValues(portal_type=\ + self.assertEqual(len(paysheet.contentValues(portal_type=\ 'Annotation Line')), 0) def stepCheckPaysheetContainOneAnnotationLine(self, sequence=None, **kw): paysheet = sequence.get('paysheet') - self.assertEquals(len(paysheet.contentValues(portal_type=\ + self.assertEqual(len(paysheet.contentValues(portal_type=\ 'Annotation Line')), 1) def stepCheckPaysheetContainNoPaymentCondition(self, sequence=None, **kw): paysheet = sequence.get('paysheet') - self.assertEquals(len(paysheet.contentValues(portal_type=\ + self.assertEqual(len(paysheet.contentValues(portal_type=\ 'Payment Condition')), 0) def stepCheckPaysheetContainOnePaymentCondition(self, sequence=None, **kw): paysheet = sequence.get('paysheet') - self.assertEquals(len(paysheet.contentValues(portal_type=\ + self.assertEqual(len(paysheet.contentValues(portal_type=\ 'Payment Condition')), 1) def stepCreateModelTree(self, sequence=None, **kw): @@ -1290,7 +1290,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): # paysheet should contain only two lines (labour and urssaf, but not # intermediate urssaf - self.assertEquals(len(paysheet.contentValues(portal_type=\ + self.assertEqual(len(paysheet.contentValues(portal_type=\ 'Pay Sheet Line')), 2) # check amounts @@ -1299,13 +1299,13 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): service = paysheet_line.getResourceTitle() if service == 'Urssaf': cell1 = paysheet_line.getCell('contribution_share/employee') - self.assertEquals(cell1.getQuantity(), 600) # here it's 600 of tax + self.assertEqual(cell1.getQuantity(), 600) # here it's 600 of tax # because of the intermediate line (3000*0.2) - self.assertEquals(cell1.getPrice(), 0.1) + self.assertEqual(cell1.getPrice(), 0.1) cell2 = paysheet_line.getCell('contribution_share/employer') - self.assertEquals(cell2.getQuantity(), 600) # here it's 600 of tax + self.assertEqual(cell2.getQuantity(), 600) # here it's 600 of tax # because of the intermediate line (3000*0.2) - self.assertEquals(cell2.getPrice(), 0.5) + self.assertEqual(cell2.getPrice(), 0.5) elif service == 'Labour': self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) else: @@ -1335,11 +1335,11 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): service = paysheet_line.getResourceTitle() if service == 'Urssaf': cell1 = paysheet_line.getCell('contribution_share/employee') - self.assertEquals(cell1.getQuantity(), 3000) - self.assertEquals(cell1.getPrice(), 0.2) + self.assertEqual(cell1.getQuantity(), 3000) + self.assertEqual(cell1.getPrice(), 0.2) cell2 = paysheet_line.getCell('contribution_share/employer') - self.assertEquals(cell2.getQuantity(), 3000) - self.assertEquals(cell2.getPrice(), 0.6) + self.assertEqual(cell2.getQuantity(), 3000) + self.assertEqual(cell2.getPrice(), 0.6) elif service == 'Labour': self.assertEqual(paysheet_line.getTotalPrice(), 3000.0) else: @@ -1357,15 +1357,15 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): def stepCheckPaysheetConsistency(self, sequence=None, **kw): paysheet = sequence.get('paysheet') - self.assertEquals([], paysheet.checkConsistency()) + self.assertEqual([], paysheet.checkConsistency()) def stepCheckModelConsistency(self, sequence=None, **kw): model = sequence.get('model') - self.assertEquals([], model.checkConsistency()) + self.assertEqual([], model.checkConsistency()) def stepCheckServiceConsistency(self, sequence=None, **kw): service = sequence.get('urssaf_service') - self.assertEquals([], service.checkConsistency()) + self.assertEqual([], service.checkConsistency()) def stepAddPredicateOnOldAgeInsuranceModelLineForSinglePerson(self, sequence=None, **kw): @@ -1429,24 +1429,24 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): model_reference_dict = model_employee.getInheritanceReferenceDict( paysheet, portal_type_list=('Annotation Line',)) - self.assertEquals(len(model_reference_dict), 3) # there is 4 model but two + self.assertEqual(len(model_reference_dict), 3) # there is 4 model but two # models have the same # reference. - self.assertEquals(model_reference_dict.has_key(model_employee_url), True) - self.assertEquals(model_reference_dict[model_employee_url], + self.assertEqual(model_reference_dict.has_key(model_employee_url), True) + self.assertEqual(model_reference_dict[model_employee_url], ['over_time_duration']) - self.assertEquals(model_reference_dict.has_key(model_company_url), True) - self.assertEquals(model_reference_dict[model_company_url], + self.assertEqual(model_reference_dict.has_key(model_company_url), True) + self.assertEqual(model_reference_dict[model_company_url], ['worked_time_duration']) - self.assertEquals(model_reference_dict.has_key(model_company_alt_url), True) - self.assertEquals(model_reference_dict[model_company_alt_url], + self.assertEqual(model_reference_dict.has_key(model_company_alt_url), True) + self.assertEqual(model_reference_dict[model_company_alt_url], ['social_insurance']) self.assertNotEquals(model_reference_dict.has_key(model_country_url), True) # check the object list : object_list = paysheet.getInheritedObjectValueList(portal_type_list=\ ('Annotation Line',)) - self.assertEquals(len(object_list), 3) # one line have the same reference + self.assertEqual(len(object_list), 3) # one line have the same reference # than another, so each reference # should be prensent only one time # in the list @@ -1467,11 +1467,11 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): sequence=None, **kw): paysheet = sequence.get('paysheet') # when pay sheet has no line, the script returns an empty list - self.assertEquals(len(paysheet.PaySheetTransaction_getMovementList()), 0) + self.assertEqual(len(paysheet.PaySheetTransaction_getMovementList()), 0) # we add a line, then it is returned in the list line = self.createPaysheetLine(paysheet) - self.assertEquals(len(paysheet.PaySheetTransaction_getMovementList()), 1) + self.assertEqual(len(paysheet.PaySheetTransaction_getMovementList()), 1) # if the line has cells with different tax categories, new properties are # added to this line. @@ -1493,14 +1493,14 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): cell1.setQuantity(5.0) movement_list = paysheet.PaySheetTransaction_getMovementList() - self.assertEquals(1, len(movement_list)) + self.assertEqual(1, len(movement_list)) movement = movement_list[0] - self.assertEquals(2, movement.employee_price) - self.assertEquals(3, movement.employee_quantity) - self.assertEquals(2*3, movement.employee_total_price) - self.assertEquals(4, movement.employer_price) - self.assertEquals(5, movement.employer_quantity) - self.assertEquals(4*5, movement.employer_total_price) + self.assertEqual(2, movement.employee_price) + self.assertEqual(3, movement.employee_quantity) + self.assertEqual(2*3, movement.employee_total_price) + self.assertEqual(4, movement.employer_price) + self.assertEqual(5, movement.employer_quantity) + self.assertEqual(4*5, movement.employer_total_price) def stepCheckModelWithoutRefValidity(self, sequence=None, **kw): ''' @@ -1545,16 +1545,16 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): # if no reference, we don't care about dates sub_object_list = paysheet.getInheritedObjectValueList(portal_type_list) - self.assertEquals(len(paysheet.contentValues(\ + self.assertEqual(len(paysheet.contentValues(\ portal_type='Pay Sheet Line')), 0) # calculate the pay sheet paysheet.applyTransformation() self.tic() - self.assertEquals(len(paysheet.contentValues( + self.assertEqual(len(paysheet.contentValues( portal_type='Pay Sheet Line')), 1) # check values on the paysheet # XXX-Aurel : no price here - self.assertEquals(paysheet.contentValues()[0].getQuantity(), 10000) + self.assertEqual(paysheet.contentValues()[0].getQuantity(), 10000) def stepCheckModelWithoutDateValidity(self, sequence=None, **kw): ''' @@ -1591,16 +1591,16 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): portal_type_list = ['Pay Sheet Model Line',] # check the paysheet contail no lines before calculation - self.assertEquals(len(paysheet_without_date.contentValues(\ + self.assertEqual(len(paysheet_without_date.contentValues(\ portal_type='Pay Sheet Line')), 0) # calculate the pay sheet paysheet_without_date.applyTransformation() self.tic() - self.assertEquals(len(paysheet_without_date.contentValues(\ + self.assertEqual(len(paysheet_without_date.contentValues(\ portal_type='Pay Sheet Line')), 1) # check values on the paysheet_without_date # XXX-Aurel getTotalPrice is None as no price defined on the model - self.assertEquals(paysheet_without_date.contentValues()[0].getQuantity(), + self.assertEqual(paysheet_without_date.contentValues()[0].getQuantity(), 10000) # create a paysheet with dates @@ -1615,16 +1615,16 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): portal_type_list = ['Pay Sheet Model Line',] # check the paysheet contains no lines before calculation - self.assertEquals(len(paysheet_with_date.contentValues(\ + self.assertEqual(len(paysheet_with_date.contentValues(\ portal_type='Pay Sheet Line')), 0) # calculate the pay sheet paysheet_with_date.applyTransformation() self.tic() # after calculation, paysheet contains one line, because the model applies. - self.assertEquals(len(paysheet_with_date.contentValues(\ + self.assertEqual(len(paysheet_with_date.contentValues(\ portal_type='Pay Sheet Line')), 1) # XXX-Aurel same as previous one - self.assertEquals(paysheet_without_date.contentValues()[0].getQuantity(), + self.assertEqual(paysheet_without_date.contentValues()[0].getQuantity(), 10000) def stepCheckModelDateValidity(self, sequence=None, **kw): @@ -1683,17 +1683,17 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): paysheet.PaySheetTransaction_applyModel() self.tic() - self.assertEquals(len(paysheet.contentValues(\ + self.assertEqual(len(paysheet.contentValues(\ portal_type='Pay Sheet Line')), 0) # calculate the pay sheet paysheet.applyTransformation() self.tic() # XXX-Aurel Why it is one as the model should not apply since date are not in the range ?? - self.assertEquals(len(paysheet.contentValues(\ + self.assertEqual(len(paysheet.contentValues(\ portal_type='Pay Sheet Line')), 1) # check values on the paysheet, if it's model_2, the total_price # should be 30000. - # self.assertEquals(paysheet.contentValues()[0].getTotalPrice(), 30000) + # self.assertEqual(paysheet.contentValues()[0].getTotalPrice(), 30000) def stepCheckModelVersioning(self, sequence=None, **kw): ''' @@ -1748,12 +1748,12 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): effective_model = specialise_value.getEffectiveModel(\ start_date=paysheet.getStartDate(), stop_date=paysheet.getStopDate()) - self.assertEquals(effective_model, model_2) + self.assertEqual(effective_model, model_2) # check the effective model tree list effective_value_list = specialise_value.findEffectiveSpecialiseValueList(\ context=paysheet) - self.assertEquals(effective_value_list, [model_2]) + self.assertEqual(effective_value_list, [model_2]) def stepCreateModelLineZeroPrice(self, sequence=None, **kw): '''Test the creation of lines when the price is set to zero: the line should @@ -1913,14 +1913,14 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): model_1.setSpecialiseValue(model_4) model_4.setSpecialiseValue(model_6) paysheet.PaySheetTransaction_applyModel() - self.assertEquals([model_2], + self.assertEqual([model_2], specialise_value.findEffectiveSpecialiseValueList(context=paysheet)) model_1.setSpecialiseValue(None) model_2.setSpecialiseValue(model_5) model_5.setSpecialiseValue(model_6) paysheet.PaySheetTransaction_applyModel() - self.assertEquals([model_2, model_5, model_7], + self.assertEqual([model_2, model_5, model_7], specialise_value.findEffectiveSpecialiseValueList(context=paysheet)) def stepCheckPropertiesAreCopiedFromModelLineToPaySheetLine(self, @@ -1940,11 +1940,11 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): self.assertNotEquals(prop_from_model_line, None) prop_from_paysheet_line = getattr(paysheet_line, prop, None) # check the property is the same on model_line and paysheet_line - self.assertEquals(prop_from_model_line, prop_from_paysheet_line) + self.assertEqual(prop_from_model_line, prop_from_paysheet_line) break # check that for each model line, we foud a corresponding paysheet_line - self.assertEquals(line_found, True) + self.assertEqual(line_found, True) def stepSetProperiesOnModelLines(self, sequence=None, **kw): model = sequence.get('model') @@ -1964,7 +1964,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase): result = form.listbox.get_value('default', render_format='list', REQUEST=self.portal.REQUEST) - self.assertEquals(precision, self.portal.REQUEST.get('precision')) + self.assertEqual(precision, self.portal.REQUEST.get('precision')) report_section.popReport(self.portal) class TestPayroll(TestPayrollMixin): @@ -2547,7 +2547,7 @@ class TestPayroll(TestPayrollMixin): # AccountingTransactionModule_getPaySheetMovementMirrorSectionItemList is # used in the report dialog to display possible organisations. - self.assertEquals( + self.assertEqual( [('', ''), (other_provider.getTitle(), other_provider.getRelativeUrl()), (provider.getTitle(), provider.getRelativeUrl())], @@ -2565,11 +2565,11 @@ class TestPayroll(TestPayrollMixin): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewPaySheetLineReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) # base_unit_quantity for EUR is set to 0.001 in the created currencies, so the # precision is 3. Editable Fields will reuse this precision. @@ -2757,11 +2757,11 @@ class TestPayroll(TestPayrollMixin): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewPaySheetLineReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(6, len(data_line_list)) + self.assertEqual(6, len(data_line_list)) self.checkLineProperties(data_line_list[0], id=1, @@ -2955,11 +2955,11 @@ class TestPayroll(TestPayrollMixin): report_section_list = self.getReportSectionList( self.portal.accounting_module, 'AccountingTransactionModule_viewNetSalaryReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) # base_unit_quantity for EUR is set to 0.001 in the created currencies, so the # precision is 3. Editable Fields will reuse this precision. @@ -3222,29 +3222,29 @@ class TestPayroll(TestPayrollMixin): self.tic() accounting_line_list = ps.contentValues( portal_type='Pay Sheet Transaction Line') - self.assertEquals(len(accounting_line_list), 4) + self.assertEqual(len(accounting_line_list), 4) line = [l for l in accounting_line_list if l.getDestinationValue() == self.account_payroll_wages_expense][0] - self.assertEquals(2050, line.getDestinationDebit()) - self.assertEquals(employer, line.getDestinationSectionValue()) + self.assertEqual(2050, line.getDestinationDebit()) + self.assertEqual(employer, line.getDestinationSectionValue()) line = [l for l in accounting_line_list if l.getDestinationValue() == self.account_net_wages][0] - self.assertEquals(2050 - 205, line.getDestinationCredit()) - self.assertEquals(employer, line.getDestinationSectionValue()) - self.assertEquals(employee, line.getSourceSectionValue()) + self.assertEqual(2050 - 205, line.getDestinationCredit()) + self.assertEqual(employer, line.getDestinationSectionValue()) + self.assertEqual(employee, line.getSourceSectionValue()) line = [l for l in accounting_line_list if l.getDestinationValue() == self.account_payroll_taxes_expense][0] - self.assertEquals(410, line.getDestinationDebit()) - self.assertEquals(employer, line.getDestinationSectionValue()) + self.assertEqual(410, line.getDestinationDebit()) + self.assertEqual(employer, line.getDestinationSectionValue()) line = [l for l in accounting_line_list if l.getDestinationValue() == self.account_payroll_taxes][0] - self.assertEquals(410 + 205, line.getDestinationCredit()) - self.assertEquals(employer, line.getDestinationSectionValue()) - self.assertEquals(provider, line.getSourceSectionValue()) + self.assertEqual(410 + 205, line.getDestinationCredit()) + self.assertEqual(employer, line.getDestinationSectionValue()) + self.assertEqual(provider, line.getSourceSectionValue()) def test_modelWithoutReferenceValidity(self): ''' Check that if no REFERENCE are defined on a model, the behavior is @@ -3341,9 +3341,9 @@ class TestPayroll(TestPayrollMixin): # model 2 gets cell values from model 1 (see test_07_model_getCell) model_2_cell = model_2.getCell('salary_range/france/slice_a') - self.failIf(model_2_cell is None) - self.assertEquals(1, model_2_cell.getQuantityRangeMin()) - self.assertEquals(2, model_2_cell.getQuantityRangeMax()) + self.assertFalse(model_2_cell is None) + self.assertEqual(1, model_2_cell.getQuantityRangeMin()) + self.assertEqual(2, model_2_cell.getQuantityRangeMax()) # model 2 can override values model_2.edit(variation_settings_category_list=('salary_range/france',)) @@ -3352,17 +3352,17 @@ class TestPayroll(TestPayrollMixin): base_id='cell') cell.setQuantityRangeMin(3) cell.setQuantityRangeMax(4) - self.assertEquals(3, + self.assertEqual(3, model_2.getCell('salary_range/france/slice_a').getQuantityRangeMin()) - self.assertEquals(4, + self.assertEqual(4, model_2.getCell('salary_range/france/slice_a').getQuantityRangeMax()) # when unsetting variation settings category on this model will acquire # again values from specialised model model_2.edit(variation_settings_category_list=()) - self.assertEquals(1, + self.assertEqual(1, model_2.getCell('salary_range/france/slice_a').getQuantityRangeMin()) - self.assertEquals(2, + self.assertEqual(2, model_2.getCell('salary_range/france/slice_a').getQuantityRangeMax()) def test_complexModelInheritanceScheme(self): diff --git a/product/ERP5/tests/testPayroll_l10n_fr.py b/product/ERP5/tests/testPayroll_l10n_fr.py index 637f5bcffc..70e141dbab 100644 --- a/product/ERP5/tests/testPayroll_l10n_fr.py +++ b/product/ERP5/tests/testPayroll_l10n_fr.py @@ -63,7 +63,7 @@ class TestPayroll_l10n_fr(TestPayrollMixin): 'Pay Sheet Transaction') paysheet_list = paysheet_module.contentValues(portal_type=\ 'Pay Sheet Transaction') - self.assertEquals(len(paysheet_list), 2) # 2 paysheet have been created + self.assertEqual(len(paysheet_list), 2) # 2 paysheet have been created # for this test # set nice date on paysheet (ie. one paysheet per month) @@ -84,13 +84,13 @@ class TestPayroll_l10n_fr(TestPayrollMixin): # - 200 to 400 # - 400 to 5000 # the salary is of 3000 - self.assertEquals(400, # 200 from the 1st paysheet + 200 from the 2e + self.assertEqual(400, # 200 from the 1st paysheet + 200 from the 2e paysheet_list[1].PaySheetTransaction_getYearToDateSlice( base_contribution, 'salary_range/france/slice_0_to_200')) - self.assertEquals(400, # 200 from the 1st paysheet + 200 from the 2e + self.assertEqual(400, # 200 from the 1st paysheet + 200 from the 2e paysheet_list[1].PaySheetTransaction_getYearToDateSlice(\ base_contribution, 'salary_range/france/slice_200_to_400')) - self.assertEquals(5200, # (3000 - 400)*2 + self.assertEqual(5200, # (3000 - 400)*2 paysheet_list[1].PaySheetTransaction_getYearToDateSlice(\ base_contribution, 'salary_range/france/slice_400_to_5000')) diff --git a/product/ERP5/tests/testPerson.py b/product/ERP5/tests/testPerson.py index d9262fbd3c..58efcb09b5 100644 --- a/product/ERP5/tests/testPerson.py +++ b/product/ERP5/tests/testPerson.py @@ -77,7 +77,7 @@ class TestPerson(ERP5TypeTestCase): person_copy_obj = person_module[person_copy_id] ## because we copy/paste Person object in the same ERP5 ## instance its reference must be resetted - self.assertEquals(person_copy_obj.getReference(), None) + self.assertEqual(person_copy_obj.getReference(), None) ## set object as if installed from bt5 (simulate it) request = self.app.REQUEST @@ -87,37 +87,37 @@ class TestPerson(ERP5TypeTestCase): person_copy_obj = person_module[person_copy_id] ## because we setup Person object from business template ## its reference must NOT be resetted - self.assertEquals(person_copy_obj.getReference(), person.getReference()) + self.assertEqual(person_copy_obj.getReference(), person.getReference()) # title & first_name, last_name def testEmptyTitle(self): p = self._makeOne() - self.assertEquals('', p.getTitle()) + self.assertEqual('', p.getTitle()) def testSetFirstName(self): p = self._makeOne() p.setFirstName('first') - self.assertEquals('first', p.getFirstName()) + self.assertEqual('first', p.getFirstName()) def testSetLastName(self): p = self._makeOne(id='person') p.setLastName('last') - self.assertEquals('last', p.getLastName()) + self.assertEqual('last', p.getLastName()) def testTitleFromFirstLastName(self): p = self._makeOne(id='person') p.setFirstName('first') p.setLastName('last') - self.assertEquals('first last', p.getTitle()) + self.assertEqual('first last', p.getTitle()) def testEditFirstNameLastName(self): # using 'edit' method p = self._makeOne(id='person') p.edit( first_name='first', last_name='last' ) - self.assertEquals('first', p.getFirstName()) - self.assertEquals('last', p.getLastName()) - self.assertEquals('first last', p.getTitle()) + self.assertEqual('first', p.getFirstName()) + self.assertEqual('last', p.getLastName()) + self.assertEqual('first last', p.getTitle()) def testEditTitleFirstNameLastName(self): p = self._makeOne(id='person') @@ -128,13 +128,13 @@ class TestPerson(ERP5TypeTestCase): def testGetTitleOrId(self): p = self._makeOne(id='person') - self.assertEquals('person', p.getTitleOrId()) - self.assertEquals('person', p.title_or_id()) + self.assertEqual('person', p.getTitleOrId()) + self.assertEqual('person', p.title_or_id()) p.edit( first_name='first', last_name='last', ) - self.assertEquals('first last', p.getTitleOrId()) - self.assertEquals('first last', p.title_or_id()) + self.assertEqual('first last', p.getTitleOrId()) + self.assertEqual('first last', p.title_or_id()) def testHasTitle(self): p = self._makeOne(id='person') @@ -166,14 +166,14 @@ class TestPerson(ERP5TypeTestCase): p = self._makeOne(id='person') p._setEncodedPassword('pass_A', format='A') p._setEncodedPassword('pass_B', format='B') - self.assertEquals('pass_A', p.getPassword(format='A')) - self.assertEquals('pass_B', p.getPassword(format='B')) + self.assertEqual('pass_A', p.getPassword(format='A')) + self.assertEqual('pass_B', p.getPassword(format='B')) - self.assertEquals(None, p.getPassword(format='unknown')) - self.assertEquals('default', p.getPassword('default', format='unknown')) + self.assertEqual(None, p.getPassword(format='unknown')) + self.assertEqual('default', p.getPassword('default', format='unknown')) - self.assertEquals(None, p.getPassword()) - self.assertEquals('default', p.getPassword('default')) + self.assertEqual(None, p.getPassword()) + self.assertEqual('default', p.getPassword('default')) def testPreferenceInteractionWorkflow(self): """ when setting reference, a script create preference is diff --git a/product/ERP5/tests/testPredicate.py b/product/ERP5/tests/testPredicate.py index 1e0e89c350..b7eba35177 100644 --- a/product/ERP5/tests/testPredicate.py +++ b/product/ERP5/tests/testPredicate.py @@ -113,7 +113,7 @@ class TestPredicateMixIn(ERP5TypeTestCase): predicate_folder = self.getPortal().newContent( portal_type = 'Folder', id = PREDICATE_FOLDER_NAME) - self.failUnless('Predicate' in [x.id for x in + self.assertTrue('Predicate' in [x.id for x in predicate_folder.allowedContentTypes()]) return predicate_folder @@ -256,7 +256,7 @@ class TestPredicateMixIn(ERP5TypeTestCase): """Assert the predicate is true on the document.""" doc = sequence.get('doc') predicate = sequence.get('predicate') - self.failUnless(predicate.test(doc)) + self.assertTrue(predicate.test(doc)) def stepAssertPredicateFalse(self, sequence=None, **kw) : """Assert the predicate is false on the document.""" @@ -275,7 +275,7 @@ class TestPredicates(TestPredicateMixIn): from Products.ERP5Type.interfaces import IPredicate from Products.ERP5Type.Core.Predicate import Predicate predicate = self.createPredicate() - self.failUnless(IPredicate.providedBy(predicate)) + self.assertTrue(IPredicate.providedBy(predicate)) from zope.interface.verify import verifyClass verifyClass(IPredicate, Predicate) @@ -358,11 +358,11 @@ class TestPredicates(TestPredicateMixIn): # script). This method must return a boolean value. pred = self.createPredicate(test_method_id='true_method') self.assertTrue(pred.test(doc)) - self.assertEquals([True], calls) + self.assertEqual([True], calls) pred = self.createPredicate(test_method_id='false_method') self.assertFalse(pred.test(doc)) - self.assertEquals([True, False], calls) + self.assertEqual([True, False], calls) # the use of method id can be mixed with category membership, both will # have to be true for the predicate to be true. @@ -372,7 +372,7 @@ class TestPredicates(TestPredicateMixIn): membership_criterion_category_list= ['region/europe/western_europe/france']) self.assertTrue(pred.test(doc)) - self.assertEquals([True, False, True], calls) + self.assertEqual([True, False, True], calls) pred = self.createPredicate( test_method_id='false_method', @@ -380,7 +380,7 @@ class TestPredicates(TestPredicateMixIn): membership_criterion_category_list= ['region/europe/western_europe/france']) self.assertFalse(pred.test(doc)) - self.assertEquals([True, False, True, False], calls) + self.assertEqual([True, False, True, False], calls) pred = self.createPredicate( test_method_id='true_method', @@ -389,7 +389,7 @@ class TestPredicates(TestPredicateMixIn): self.assertFalse(pred.test(doc)) # Note that if the document is not member of the category, the test_method # is not called. - self.assertEquals([True, False, True, False], calls) + self.assertEqual([True, False, True, False], calls) def test_Predicate_getMembershipCriterionCategoryList(self): @@ -402,7 +402,7 @@ class TestPredicates(TestPredicateMixIn): getCategoryChildCompactLogicalPathItemList(base=1)[:] pred = self.createPredicate( membership_criterion_base_category_list=['region'], ) - self.failUnless(('europe/western_europe', 'region/europe/western_europe') in + self.assertTrue(('europe/western_europe', 'region/europe/western_europe') in [tuple(x) for x in pred.Predicate_getMembershipCriterionCategoryList()], pred.Predicate_getMembershipCriterionCategoryList(),) @@ -413,13 +413,13 @@ class TestPredicates(TestPredicateMixIn): # note that the id of the actual base category is displayed in the first # item too, for making it clear in the UI that it's the content of a # category used for another base category. - self.failUnless(('region/europe/western_europe', + self.assertTrue(('region/europe/western_europe', 'source_region/region/europe/western_europe') in [tuple(x) for x in pred.Predicate_getMembershipCriterionCategoryList()], pred.Predicate_getMembershipCriterionCategoryList(),) source_region_chile_list_after = self.portal.portal_categories.source_region.\ getCategoryChildCompactLogicalPathItemList(base=1)[:] - self.assertEquals(source_region_chile_list_before, source_region_chile_list_after) + self.assertEqual(source_region_chile_list_before, source_region_chile_list_after) def test_PredicateFusion(self, quiet=QUIET, run=RUN_ALL_TESTS): @@ -568,14 +568,14 @@ class TestPredicates(TestPredicateMixIn): self.tic() # check that if we define the same filter than on predicate we get same result - self.assertEquals(len(predicate.searchResults()), 2) + self.assertEqual(len(predicate.searchResults()), 2) self.assertSameSet(set([x.getObject() for x in predicate.searchResults(portal_type=['Person', 'Organisation'])]), set([fabien, nexedi])) # check that it's possible to filter results - self.assertEquals([x.getObject() for x in \ + self.assertEqual([x.getObject() for x in \ predicate.searchResults(portal_type='Person')], [fabien]) - self.assertEquals([x.getObject() for x in \ + self.assertEqual([x.getObject() for x in \ predicate.searchResults(portal_type='Organisation')], [nexedi]) # check that if the filter define more properties, we cannot have more than diff --git a/product/ERP5/tests/testProductionOrder.py b/product/ERP5/tests/testProductionOrder.py index 1b1f625f29..33bb9a89b9 100644 --- a/product/ERP5/tests/testProductionOrder.py +++ b/product/ERP5/tests/testProductionOrder.py @@ -264,7 +264,7 @@ class TestProductionOrderMixin(TestOrderMixin): 'invalidate_action' ) - self.assertEquals('invalidated',transformation.getValidationState()) + self.assertEqual('invalidated',transformation.getValidationState()) def stepValidateTransformation(self, sequence=None, sequence_list=None, **kw): @@ -277,7 +277,7 @@ class TestProductionOrderMixin(TestOrderMixin): 'validate_action' ) - self.assertEquals('validated',transformation.getValidationState()) + self.assertEqual('validated',transformation.getValidationState()) def stepCreateEmptyTransformation(self, sequence=None, sequence_list=None, **kw): @@ -564,7 +564,7 @@ class TestProductionOrderMixin(TestOrderMixin): portal_type='Simulation Movement') produced_movement = order_simulation_movement.contentValues()[0].contentValues()[0] - self.assertEquals( + self.assertEqual( want_produced_quantity, produced_movement.getQuantity() ) @@ -576,12 +576,12 @@ class TestProductionOrderMixin(TestOrderMixin): production_delivery_movement = [q for q in transformation_rule.contentValues() \ if q.getId().startswith('pr')][0] - self.assertEquals( + self.assertEqual( want_consume_for_production, consumption_movement.getQuantity() ) - self.assertEquals( + self.assertEqual( want_produced_quantity, production_delivery_movement.getQuantity() ) @@ -590,7 +590,7 @@ class TestProductionOrderMixin(TestOrderMixin): consume_delivery_movement = transformation_sourcing_rule.contentValues()[0] - self.assertEquals( + self.assertEqual( want_consume_for_production, consume_delivery_movement.getQuantity() ) @@ -607,7 +607,7 @@ class TestProductionOrderMixin(TestOrderMixin): order_simulation_movement_list = applied_rule.contentValues() # XXX: hardcode - self.assertEquals( + self.assertEqual( 1, len(order_simulation_movement_list) ) @@ -622,7 +622,7 @@ class TestProductionOrderMixin(TestOrderMixin): consumed_movement = [q for q in transformation_applied_rule.contentValues() \ if q.getId().startswith('cr')][0] - self.assertEquals( + self.assertEqual( consumed_movement.getQuantity(), self.quantity_after_efficiency_calculation ) @@ -632,7 +632,7 @@ class TestProductionOrderMixin(TestOrderMixin): consumption_delivery_movement = [q for q in transformation_sourcing_rule.contentValues() \ if q.getId().startswith('ts')][0] - self.assertEquals( + self.assertEqual( consumption_delivery_movement.getQuantity(), self.quantity_after_efficiency_calculation ) @@ -643,12 +643,12 @@ class TestProductionOrderMixin(TestOrderMixin): self.assertNotEquals(None, transformation) - self.assertEquals(order_line.getSpecialiseValue(), transformation) + self.assertEqual(order_line.getSpecialiseValue(), transformation) def stepCheckOrderLineTransformationIsNotSet(self, sequence=None, sequence_list=None, **kw): order_line = sequence.get('order_line') - self.assertEquals(order_line.getSpecialiseValue(), None) + self.assertEqual(order_line.getSpecialiseValue(), None) def stepRemoveResourceFromOrderLine(self, sequence=None, sequence_list=None, **kw): order_line = sequence.get('order_line') @@ -667,15 +667,15 @@ class TestProductionOrderMixin(TestOrderMixin): no_applied_rule_state = ('draft', 'auto_planned') order_state = order.getSimulationState() if order_state in no_applied_rule_state: - self.assertEquals(0, len(related_applied_rule_list)) + self.assertEqual(0, len(related_applied_rule_list)) else: - self.assertEquals(1, len(related_applied_rule_list)) + self.assertEqual(1, len(related_applied_rule_list)) applied_rule = related_applied_rule_list[0].getObject() sequence.edit(applied_rule=applied_rule) - self.failUnless(applied_rule is not None) + self.assertTrue(applied_rule is not None) # Test if applied rule has a specialise value with default_order_rule # XXX hardcoded value - self.assertEquals('default_production_order_rule', \ + self.assertEqual('default_production_order_rule', \ applied_rule.getSpecialiseReference()) simulation_movement_list = applied_rule.objectValues() @@ -685,7 +685,7 @@ class TestProductionOrderMixin(TestOrderMixin): LOG('checkObjectAttributes object.getPath',0,object.getPath()) for value, attribute in attribute_list: try: - self.assertEquals(value, + self.assertEqual(value, getattr(object, attribute)()) except AssertionError: LOG('Raise Assertion error',0,'') @@ -707,12 +707,12 @@ class TestProductionOrderMixin(TestOrderMixin): sequence_list=sequence_list, **kw) # Test simulation movement generated related to order line simulation_movement_list = sequence.get('simulation_movement_list') - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) order_line = sequence.get('order_line') related_simulation_movement_list = order_line.getDeliveryRelatedValueList() - self.assertEquals(1, len(related_simulation_movement_list)) + self.assertEqual(1, len(related_simulation_movement_list)) related_simulation_movement = related_simulation_movement_list[0] - self.assertEquals(related_simulation_movement, + self.assertEqual(related_simulation_movement, simulation_movement_list[0]) production_organisation1 = sequence.get('production_organisation1') # XXX FIXME test date @@ -729,24 +729,24 @@ class TestProductionOrderMixin(TestOrderMixin): (production_organisation1, 'getSourceSectionValue'))) # Test next applied rule applied_rule_list = related_simulation_movement.objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) - self.assertEquals('default_delivering_rule', \ + self.assertEqual("Applied Rule", applied_rule.getPortalType()) + self.assertEqual('default_delivering_rule', \ applied_rule.getSpecialiseReference()) # Test next applied rule simulation_movement_list = applied_rule.objectValues() - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) simulation_movement = simulation_movement_list[0] applied_rule_list = simulation_movement.objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) - self.assertEquals('default_transformation_rule', \ + self.assertEqual("Applied Rule", applied_rule.getPortalType()) + self.assertEqual('default_transformation_rule', \ applied_rule.getSpecialiseReference()) # Test deeper simulation simulation_movement_list = applied_rule.objectValues() - self.assertEquals(2, len(simulation_movement_list)) + self.assertEqual(2, len(simulation_movement_list)) # Test consumed movement transformation = sequence.get('transformation') consumed_movement_id = 'cr_%s_1_%s' % (transformation.getId(), @@ -830,12 +830,12 @@ class TestProductionOrderMixin(TestOrderMixin): sequence_list=sequence_list, **kw) # Test simulation movement generated related to order line simulation_movement_list = sequence.get('simulation_movement_list') - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) order_line = sequence.get('order_line') related_simulation_movement_list = order_line.getDeliveryRelatedValueList() - self.assertEquals(1, len(related_simulation_movement_list)) + self.assertEqual(1, len(related_simulation_movement_list)) related_simulation_movement = related_simulation_movement_list[0] - self.assertEquals(related_simulation_movement, + self.assertEqual(related_simulation_movement, simulation_movement_list[0]) production_organisation1 = sequence.get('production_organisation1') # XXX FIXME test date @@ -852,15 +852,15 @@ class TestProductionOrderMixin(TestOrderMixin): (production_organisation1, 'getSourceSectionValue'))) # Test next applied rule applied_rule_list = related_simulation_movement.objectValues()[0].objectValues()[0].objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) - self.assertEquals('default_transformation_rule', \ + self.assertEqual("Applied Rule", applied_rule.getPortalType()) + self.assertEqual('default_transformation_rule', \ applied_rule.getSpecialiseReference()) # Test deeper simulation simulation_movement_list = list(applied_rule.objectValues()) # FIXME - self.assertEquals(3, len(simulation_movement_list)) + self.assertEqual(3, len(simulation_movement_list)) # Test produced resource produced_movement = applied_rule.pr resource = sequence.get('resource') @@ -874,7 +874,7 @@ class TestProductionOrderMixin(TestOrderMixin): (production_organisation1, 'getDestinationSectionValue'), (None, 'getSourceValue'), (None, 'getSourceSectionValue'))) - self.assertEquals(0, len(produced_movement.objectValues())) + self.assertEqual(0, len(produced_movement.objectValues())) simulation_movement_list.remove(produced_movement) # All code before is a stupid copy (except movement count) @@ -898,7 +898,7 @@ class TestProductionOrderMixin(TestOrderMixin): (None, 'getDestinationSectionValue'), (production_organisation1, 'getSourceValue'), (production_organisation1, 'getSourceSectionValue'))) - self.assertEquals(0, len(operation_movement.objectValues())) + self.assertEqual(0, len(operation_movement.objectValues())) # Check component movement self.checkObjectAttributes( component_movement, ( @@ -909,16 +909,16 @@ class TestProductionOrderMixin(TestOrderMixin): (None, 'getDestinationSectionValue'), (production_organisation1, 'getSourceValue'), (production_organisation1, 'getSourceSectionValue'))) - self.assertEquals(1, len(component_movement.objectValues())) + self.assertEqual(1, len(component_movement.objectValues())) # Test supply applied rule applied_rule = component_movement.objectValues()[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) - self.assertEquals('default_transformation_sourcing_rule', \ + self.assertEqual("Applied Rule", applied_rule.getPortalType()) + self.assertEqual('default_transformation_sourcing_rule', \ applied_rule.getSpecialiseReference()) # Test supply movement simulation_movement_list = applied_rule.objectValues() # FIXME - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) # Test supply resource supply_movement = applied_rule.ts supply_organisation1 = sequence.get('supply_organisation1') @@ -931,7 +931,7 @@ class TestProductionOrderMixin(TestOrderMixin): (production_organisation1, 'getDestinationSectionValue'), (supply_organisation1, 'getSourceValue'), (supply_organisation1, 'getSourceSectionValue'))) - self.assertEquals(0, len(supply_movement.objectValues())) + self.assertEqual(0, len(supply_movement.objectValues())) sequence.edit( produced_movement = produced_movement, @@ -1029,12 +1029,12 @@ class TestProductionOrderMixin(TestOrderMixin): sequence_list=sequence_list, **kw) # Test simulation movement generated related to order line simulation_movement_list = sequence.get('simulation_movement_list') - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) order_line = sequence.get('order_line') related_simulation_movement_list = order_line.getDeliveryRelatedValueList() - self.assertEquals(1, len(related_simulation_movement_list)) + self.assertEqual(1, len(related_simulation_movement_list)) related_simulation_movement = related_simulation_movement_list[0] - self.assertEquals(related_simulation_movement, + self.assertEqual(related_simulation_movement, simulation_movement_list[0]) production_organisation1 = sequence.get('production_organisation1') # XXX FIXME test date @@ -1051,25 +1051,25 @@ class TestProductionOrderMixin(TestOrderMixin): (production_organisation1, 'getSourceSectionValue'))) # Test next applied rule applied_rule_list = related_simulation_movement.objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) - self.assertEquals('default_delivering_rule', \ + self.assertEqual("Applied Rule", applied_rule.getPortalType()) + self.assertEqual('default_delivering_rule', \ applied_rule.getSpecialiseReference()) # Test next applied rule simulation_movement_list = applied_rule.objectValues() - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) simulation_movement = simulation_movement_list[0] applied_rule_list = simulation_movement.objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) - self.assertEquals('default_transformation_rule', \ + self.assertEqual("Applied Rule", applied_rule.getPortalType()) + self.assertEqual('default_transformation_rule', \ applied_rule.getSpecialiseReference()) # Test deeper simulation simulation_movement_list = list(applied_rule.objectValues()) # FIXME - self.assertEquals(4, len(simulation_movement_list)) + self.assertEqual(4, len(simulation_movement_list)) # Test produced resource produced_movement = applied_rule.pr resource = sequence.get('resource') @@ -1083,7 +1083,7 @@ class TestProductionOrderMixin(TestOrderMixin): (production_organisation1, 'getDestinationSectionValue'), (None, 'getSourceValue'), (None, 'getSourceSectionValue'))) - self.assertEquals(0, len(produced_movement.objectValues())) + self.assertEqual(0, len(produced_movement.objectValues())) # Get modified resource (test later) modified_movement = applied_rule.mr_1 @@ -1110,7 +1110,7 @@ class TestProductionOrderMixin(TestOrderMixin): (None, 'getDestinationSectionValue'), (production_organisation1, 'getSourceValue'), (production_organisation1, 'getSourceSectionValue'))) - self.assertEquals(0, len(operation_movement.objectValues())) + self.assertEqual(0, len(operation_movement.objectValues())) # Check component movement self.checkObjectAttributes( component_movement, ( @@ -1121,16 +1121,16 @@ class TestProductionOrderMixin(TestOrderMixin): (None, 'getDestinationSectionValue'), (production_organisation1, 'getSourceValue'), (production_organisation1, 'getSourceSectionValue'))) - self.assertEquals(1, len(component_movement.objectValues())) + self.assertEqual(1, len(component_movement.objectValues())) # Test supply applied rule applied_rule = component_movement.objectValues()[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) - self.assertEquals('default_transformation_sourcing_rule', \ + self.assertEqual("Applied Rule", applied_rule.getPortalType()) + self.assertEqual('default_transformation_sourcing_rule', \ applied_rule.getSpecialiseReference()) # Test supply movement simulation_movement_list = applied_rule.objectValues() # FIXME - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) # Test supply resource supply_movement = applied_rule.ts supply_organisation1 = sequence.get('supply_organisation1') @@ -1143,7 +1143,7 @@ class TestProductionOrderMixin(TestOrderMixin): (production_organisation1, 'getDestinationSectionValue'), (supply_organisation1, 'getSourceValue'), (supply_organisation1, 'getSourceSectionValue'))) - self.assertEquals(0, len(supply_movement.objectValues())) + self.assertEqual(0, len(supply_movement.objectValues())) # Test modified movement resource = sequence.get('resource') @@ -1157,16 +1157,16 @@ class TestProductionOrderMixin(TestOrderMixin): (production_organisation1, 'getSourceSectionValue'), (None, 'getDestinationValue'), (None, 'getDestinationSectionValue'))) - self.assertEquals(1, len(modified_movement.objectValues())) + self.assertEqual(1, len(modified_movement.objectValues())) # Test next applied rule applied_rule_list = modified_movement.objectValues() applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) - self.assertEquals('default_transformation_sourcing_rule', \ + self.assertEqual("Applied Rule", applied_rule.getPortalType()) + self.assertEqual('default_transformation_sourcing_rule', \ applied_rule.getSpecialiseReference()) # Test deeper simulation simulation_movement_list = list(applied_rule.objectValues()) - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) # Test produced resource sourcing_movement = simulation_movement_list[0] resource = sequence.get('resource') @@ -1182,18 +1182,18 @@ class TestProductionOrderMixin(TestOrderMixin): (production_organisation2, 'getSourceValue'), # XXX (production_organisation2, 'getSourceSectionValue'))) )) - self.assertEquals(1, len(sourcing_movement.objectValues())) + self.assertEqual(1, len(sourcing_movement.objectValues())) # Test next applied rule applied_rule_list = sourcing_movement.objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) - self.assertEquals('default_transformation_rule', \ + self.assertEqual("Applied Rule", applied_rule.getPortalType()) + self.assertEqual('default_transformation_rule', \ applied_rule.getSpecialiseReference()) # Test deeper simulation simulation_movement_list = list(applied_rule.objectValues()) # FIXME - self.assertEquals(3, len(simulation_movement_list)) + self.assertEqual(3, len(simulation_movement_list)) # Test produced resource produced_movement = applied_rule.pr resource = sequence.get('resource') @@ -1207,7 +1207,7 @@ class TestProductionOrderMixin(TestOrderMixin): # XXX (production_organisation2, 'getDestinationSectionValue'), (None, 'getSourceValue'), (None, 'getSourceSectionValue'))) - self.assertEquals(0, len(produced_movement.objectValues())) + self.assertEqual(0, len(produced_movement.objectValues())) simulation_movement_list.remove(produced_movement) # All code before is a stupid copy (except movement count) @@ -1231,7 +1231,7 @@ class TestProductionOrderMixin(TestOrderMixin): (production_organisation2, 'getSourceValue'), # XXX (production_organisation2, 'getSourceSectionValue'))) )) - self.assertEquals(0, len(operation_movement.objectValues())) + self.assertEqual(0, len(operation_movement.objectValues())) # Check component movement self.checkObjectAttributes( component_movement, ( @@ -1243,16 +1243,16 @@ class TestProductionOrderMixin(TestOrderMixin): (production_organisation2, 'getSourceValue'), # XXX (production_organisation2, 'getSourceSectionValue'))) )) - self.assertEquals(1, len(component_movement.objectValues())) + self.assertEqual(1, len(component_movement.objectValues())) # Test supply applied rule applied_rule = component_movement.objectValues()[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) - self.assertEquals('default_transformation_sourcing_rule', \ + self.assertEqual("Applied Rule", applied_rule.getPortalType()) + self.assertEqual('default_transformation_sourcing_rule', \ applied_rule.getSpecialiseReference()) # Test supply movement simulation_movement_list = applied_rule.objectValues() # FIXME - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) # Test supply resource supply_movement = applied_rule.ts supply_organisation2 = sequence.get('supply_organisation2') @@ -1266,7 +1266,7 @@ class TestProductionOrderMixin(TestOrderMixin): (supply_organisation2, 'getSourceValue'), # XXX (supply_organisation2, 'getSourceSectionValue'))) )) - self.assertEquals(0, len(supply_movement.objectValues())) + self.assertEqual(0, len(supply_movement.objectValues())) SOURCING_ORDER_SEQUENCE = '\ CreateProductionOrganisation1 \ @@ -1470,7 +1470,7 @@ class TestProductionOrder(TestProductionOrderMixin, ERP5TypeTestCase): pasted_sc = sequence.get('pasted_sc') pasted_supply_node = pasted_sc.contentValues(portal_type='Supply Node')[0] pasted_supply_link = pasted_sc.contentValues(portal_type='Supply Link')[0] - self.assertEquals(pasted_supply_node.getRelativeUrl(), + self.assertEqual(pasted_supply_node.getRelativeUrl(), pasted_supply_link.getDestination()) def test_07_testTransformationInteractionProductionOrderLine(self, quiet=0, run=run_all_test): @@ -1786,7 +1786,7 @@ class TestProductionOrder(TestProductionOrderMixin, ERP5TypeTestCase): supply_node = empty_supply_chain.contentValues(portal_type='Supply Node')[0] supply_link = supply_chain.contentValues(portal_type='Supply Link')[0] - self.assertEquals(supply_node.getRelativeUrl(), + self.assertEqual(supply_node.getRelativeUrl(), supply_link.getDestination()) def test_51_testCutPasteInAnotherContainer(self, quiet=0, run=run_all_test): diff --git a/product/ERP5/tests/testProductionOrderApparel.py b/product/ERP5/tests/testProductionOrderApparel.py index cb9bb0ffd8..eaf78bcc51 100644 --- a/product/ERP5/tests/testProductionOrderApparel.py +++ b/product/ERP5/tests/testProductionOrderApparel.py @@ -159,7 +159,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): # XXX: rc user from testOrder is not able to doActionFor ??? transformation.invalidate() - self.assertEquals('invalidated',transformation.getValidationState()) + self.assertEqual('invalidated',transformation.getValidationState()) def stepValidateTransformation(self, sequence=None, sequence_list=None, **kw): @@ -167,7 +167,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): # XXX: rc user from testOrder is not able to doActionFor ??? transformation.validate() - self.assertEquals('validated',transformation.getValidationState()) + self.assertEqual('validated',transformation.getValidationState()) def stepCreateTransformation(self, sequence=None, sequence_list=None, **kw): @@ -279,12 +279,12 @@ class TestProductionOrderApparelMixin(TestOrderMixin): self.assertNotEquals(None, transformation) - self.assertEquals(order_line.getSpecialiseValue(), transformation) + self.assertEqual(order_line.getSpecialiseValue(), transformation) def stepCheckOrderLineTransformationIsNotSet(self, sequence=None, sequence_list=None, **kw): order_line = sequence.get('order_line') - self.assertEquals(order_line.getSpecialiseValue(), None) + self.assertEqual(order_line.getSpecialiseValue(), None) def stepRemoveResourceFromOrderLine(self, sequence=None, sequence_list=None, **kw): order_line = sequence.get('order_line') @@ -303,16 +303,16 @@ class TestProductionOrderApparelMixin(TestOrderMixin): no_applied_rule_state = ('draft', 'auto_planned') order_state = order.getSimulationState() if order_state in no_applied_rule_state: - self.assertEquals(0, len(related_applied_rule_list)) + self.assertEqual(0, len(related_applied_rule_list)) else: - self.assertEquals(1, len(related_applied_rule_list)) + self.assertEqual(1, len(related_applied_rule_list)) applied_rule = related_applied_rule_list[0].getObject() sequence.edit(applied_rule=applied_rule) - self.failUnless(applied_rule is not None) + self.assertTrue(applied_rule is not None) # Test if applied rule has a specialise value with default_order_rule portal_rules = getToolByName(order, 'portal_rules') # XXX hardcoded value - self.assertEquals('default_production_order_rule', \ + self.assertEqual('default_production_order_rule', \ applied_rule.getSpecialiseReference()) simulation_movement_list = applied_rule.objectValues() @@ -322,7 +322,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): LOG('checkObjectAttributes object.getPath',0,object.getPath()) for value, attribute in attribute_list: try: - self.assertEquals(value, + self.assertEqual(value, getattr(object, attribute)()) except AssertionError: LOG('Raise Assertion error',0,'') @@ -341,12 +341,12 @@ class TestProductionOrderApparelMixin(TestOrderMixin): sequence_list=sequence_list, **kw) # Test simulation movement generated related to order line simulation_movement_list = sequence.get('simulation_movement_list') - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) order_line = sequence.get('order_line') related_simulation_movement_list = order_line.getDeliveryRelatedValueList() - self.assertEquals(1, len(related_simulation_movement_list)) + self.assertEqual(1, len(related_simulation_movement_list)) related_simulation_movement = related_simulation_movement_list[0] - self.assertEquals(related_simulation_movement, + self.assertEqual(related_simulation_movement, simulation_movement_list[0]) production_organisation1 = sequence.get('production_organisation1') # XXX FIXME test date @@ -363,26 +363,26 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (production_organisation1, 'getSourceSectionValue'))) # Test next applied rule applied_rule_list = related_simulation_movement.objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) + self.assertEqual("Applied Rule", applied_rule.getPortalType()) portal_rules = getToolByName(applied_rule, 'portal_rules') - self.assertEquals('default_delivering_rule', \ + self.assertEqual('default_delivering_rule', \ applied_rule.getSpecialiseReference()) # Test next applied rule simulation_movement_list = applied_rule.objectValues() - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) simulation_movement = simulation_movement_list[0] applied_rule_list = simulation_movement.objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) + self.assertEqual("Applied Rule", applied_rule.getPortalType()) portal_rules = getToolByName(applied_rule, 'portal_rules') - self.assertEquals('default_transformation_rule', \ + self.assertEqual('default_transformation_rule', \ applied_rule.getSpecialiseReference()) # Test deeper simulation simulation_movement_list = applied_rule.objectValues() - self.assertEquals(2, len(simulation_movement_list)) + self.assertEqual(2, len(simulation_movement_list)) # Test consumed movement transformation = sequence.get('transformation') consumed_movement_id = 'cr_%s_1_%s' % (transformation.getId(), @@ -463,12 +463,12 @@ class TestProductionOrderApparelMixin(TestOrderMixin): sequence_list=sequence_list, **kw) # Test simulation movement generated related to order line simulation_movement_list = sequence.get('simulation_movement_list') - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) order_line = sequence.get('order_line') related_simulation_movement_list = order_line.getDeliveryRelatedValueList() - self.assertEquals(1, len(related_simulation_movement_list)) + self.assertEqual(1, len(related_simulation_movement_list)) related_simulation_movement = related_simulation_movement_list[0] - self.assertEquals(related_simulation_movement, + self.assertEqual(related_simulation_movement, simulation_movement_list[0]) production_organisation1 = sequence.get('production_organisation1') # XXX FIXME test date @@ -485,16 +485,16 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (production_organisation1, 'getSourceSectionValue'))) # Test next applied rule applied_rule_list = related_simulation_movement.objectValues()[0].objectValues()[0].objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) + self.assertEqual("Applied Rule", applied_rule.getPortalType()) portal_rules = getToolByName(applied_rule, 'portal_rules') - self.assertEquals('default_transformation_rule', \ + self.assertEqual('default_transformation_rule', \ applied_rule.getSpecialiseReference()) # Test deeper simulation simulation_movement_list = list(applied_rule.objectValues()) # FIXME - self.assertEquals(3, len(simulation_movement_list)) + self.assertEqual(3, len(simulation_movement_list)) # Test produced resource produced_movement = applied_rule.pr resource = sequence.get('resource') @@ -508,7 +508,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (production_organisation1, 'getDestinationSectionValue'), (None, 'getSourceValue'), (None, 'getSourceSectionValue'))) - self.assertEquals(0, len(produced_movement.objectValues())) + self.assertEqual(0, len(produced_movement.objectValues())) simulation_movement_list.remove(produced_movement) # All code before is a stupid copy (except movement count) @@ -532,7 +532,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (None, 'getDestinationSectionValue'), (production_organisation1, 'getSourceValue'), (production_organisation1, 'getSourceSectionValue'))) - self.assertEquals(0, len(operation_movement.objectValues())) + self.assertEqual(0, len(operation_movement.objectValues())) # Check component movement self.checkObjectAttributes( component_movement, ( @@ -543,17 +543,17 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (None, 'getDestinationSectionValue'), (production_organisation1, 'getSourceValue'), (production_organisation1, 'getSourceSectionValue'))) - self.assertEquals(1, len(component_movement.objectValues())) + self.assertEqual(1, len(component_movement.objectValues())) # Test supply applied rule applied_rule = component_movement.objectValues()[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) + self.assertEqual("Applied Rule", applied_rule.getPortalType()) portal_rules = getToolByName(applied_rule, 'portal_rules') - self.assertEquals('default_transformation_sourcing_rule', \ + self.assertEqual('default_transformation_sourcing_rule', \ applied_rule.getSpecialiseReference()) # Test supply movement simulation_movement_list = applied_rule.objectValues() # FIXME - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) # Test supply resource supply_movement = applied_rule.ts supply_organisation1 = sequence.get('supply_organisation1') @@ -566,7 +566,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (production_organisation1, 'getDestinationSectionValue'), (supply_organisation1, 'getSourceValue'), (supply_organisation1, 'getSourceSectionValue'))) - self.assertEquals(0, len(supply_movement.objectValues())) + self.assertEqual(0, len(supply_movement.objectValues())) sequence.edit( produced_movement = produced_movement, @@ -661,12 +661,12 @@ class TestProductionOrderApparelMixin(TestOrderMixin): sequence_list=sequence_list, **kw) # Test simulation movement generated related to order line simulation_movement_list = sequence.get('simulation_movement_list') - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) order_line = sequence.get('order_line') related_simulation_movement_list = order_line.getDeliveryRelatedValueList() - self.assertEquals(1, len(related_simulation_movement_list)) + self.assertEqual(1, len(related_simulation_movement_list)) related_simulation_movement = related_simulation_movement_list[0] - self.assertEquals(related_simulation_movement, + self.assertEqual(related_simulation_movement, simulation_movement_list[0]) production_organisation1 = sequence.get('production_organisation1') # XXX FIXME test date @@ -683,27 +683,27 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (production_organisation1, 'getSourceSectionValue'))) # Test next applied rule applied_rule_list = related_simulation_movement.objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) + self.assertEqual("Applied Rule", applied_rule.getPortalType()) portal_rules = getToolByName(applied_rule, 'portal_rules') - self.assertEquals('default_delivering_rule', \ + self.assertEqual('default_delivering_rule', \ applied_rule.getSpecialiseReference()) # Test next applied rule simulation_movement_list = applied_rule.objectValues() - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) simulation_movement = simulation_movement_list[0] applied_rule_list = simulation_movement.objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) + self.assertEqual("Applied Rule", applied_rule.getPortalType()) portal_rules = getToolByName(applied_rule, 'portal_rules') - self.assertEquals('default_transformation_rule', \ + self.assertEqual('default_transformation_rule', \ applied_rule.getSpecialiseReference()) # Test deeper simulation simulation_movement_list = list(applied_rule.objectValues()) # FIXME - self.assertEquals(4, len(simulation_movement_list)) + self.assertEqual(4, len(simulation_movement_list)) # Test produced resource produced_movement = applied_rule.pr resource = sequence.get('resource') @@ -717,7 +717,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (production_organisation1, 'getDestinationSectionValue'), (None, 'getSourceValue'), (None, 'getSourceSectionValue'))) - self.assertEquals(0, len(produced_movement.objectValues())) + self.assertEqual(0, len(produced_movement.objectValues())) # Get modified resource (test later) modified_movement = applied_rule.mr_1 @@ -744,7 +744,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (None, 'getDestinationSectionValue'), (production_organisation1, 'getSourceValue'), (production_organisation1, 'getSourceSectionValue'))) - self.assertEquals(0, len(operation_movement.objectValues())) + self.assertEqual(0, len(operation_movement.objectValues())) # Check component movement self.checkObjectAttributes( component_movement, ( @@ -755,17 +755,17 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (None, 'getDestinationSectionValue'), (production_organisation1, 'getSourceValue'), (production_organisation1, 'getSourceSectionValue'))) - self.assertEquals(1, len(component_movement.objectValues())) + self.assertEqual(1, len(component_movement.objectValues())) # Test supply applied rule applied_rule = component_movement.objectValues()[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) + self.assertEqual("Applied Rule", applied_rule.getPortalType()) portal_rules = getToolByName(applied_rule, 'portal_rules') - self.assertEquals('default_transformation_sourcing_rule', \ + self.assertEqual('default_transformation_sourcing_rule', \ applied_rule.getSpecialiseReference()) # Test supply movement simulation_movement_list = applied_rule.objectValues() # FIXME - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) # Test supply resource supply_movement = applied_rule.ts supply_organisation1 = sequence.get('supply_organisation1') @@ -778,7 +778,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (production_organisation1, 'getDestinationSectionValue'), (supply_organisation1, 'getSourceValue'), (supply_organisation1, 'getSourceSectionValue'))) - self.assertEquals(0, len(supply_movement.objectValues())) + self.assertEqual(0, len(supply_movement.objectValues())) # Test modified movement resource = sequence.get('resource') @@ -792,17 +792,17 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (production_organisation1, 'getSourceSectionValue'), (None, 'getDestinationValue'), (None, 'getDestinationSectionValue'))) - self.assertEquals(1, len(modified_movement.objectValues())) + self.assertEqual(1, len(modified_movement.objectValues())) # Test next applied rule applied_rule_list = modified_movement.objectValues() applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) + self.assertEqual("Applied Rule", applied_rule.getPortalType()) portal_rules = getToolByName(applied_rule, 'portal_rules') - self.assertEquals('default_transformation_sourcing_rule', \ + self.assertEqual('default_transformation_sourcing_rule', \ applied_rule.getSpecialiseReference()) # Test deeper simulation simulation_movement_list = list(applied_rule.objectValues()) - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) # Test produced resource sourcing_movement = simulation_movement_list[0] resource = sequence.get('resource') @@ -818,19 +818,19 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (production_organisation2, 'getSourceValue'), # XXX (production_organisation2, 'getSourceSectionValue'))) )) - self.assertEquals(1, len(sourcing_movement.objectValues())) + self.assertEqual(1, len(sourcing_movement.objectValues())) # Test next applied rule applied_rule_list = sourcing_movement.objectValues() - self.assertEquals(1, len(applied_rule_list)) + self.assertEqual(1, len(applied_rule_list)) applied_rule = applied_rule_list[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) + self.assertEqual("Applied Rule", applied_rule.getPortalType()) portal_rules = getToolByName(applied_rule, 'portal_rules') - self.assertEquals('default_transformation_rule', \ + self.assertEqual('default_transformation_rule', \ applied_rule.getSpecialiseReference()) # Test deeper simulation simulation_movement_list = list(applied_rule.objectValues()) # FIXME - self.assertEquals(3, len(simulation_movement_list)) + self.assertEqual(3, len(simulation_movement_list)) # Test produced resource produced_movement = applied_rule.pr resource = sequence.get('resource') @@ -844,7 +844,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): # XXX (production_organisation2, 'getDestinationSectionValue'), (None, 'getSourceValue'), (None, 'getSourceSectionValue'))) - self.assertEquals(0, len(produced_movement.objectValues())) + self.assertEqual(0, len(produced_movement.objectValues())) simulation_movement_list.remove(produced_movement) # All code before is a stupid copy (except movement count) @@ -868,7 +868,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (production_organisation2, 'getSourceValue'), # XXX (production_organisation2, 'getSourceSectionValue'))) )) - self.assertEquals(0, len(operation_movement.objectValues())) + self.assertEqual(0, len(operation_movement.objectValues())) # Check component movement self.checkObjectAttributes( component_movement, ( @@ -880,17 +880,17 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (production_organisation2, 'getSourceValue'), # XXX (production_organisation2, 'getSourceSectionValue'))) )) - self.assertEquals(1, len(component_movement.objectValues())) + self.assertEqual(1, len(component_movement.objectValues())) # Test supply applied rule applied_rule = component_movement.objectValues()[0] - self.assertEquals("Applied Rule", applied_rule.getPortalType()) + self.assertEqual("Applied Rule", applied_rule.getPortalType()) portal_rules = getToolByName(applied_rule, 'portal_rules') - self.assertEquals('default_transformation_sourcing_rule', \ + self.assertEqual('default_transformation_sourcing_rule', \ applied_rule.getSpecialiseReference()) # Test supply movement simulation_movement_list = applied_rule.objectValues() # FIXME - self.assertEquals(1, len(simulation_movement_list)) + self.assertEqual(1, len(simulation_movement_list)) # Test supply resource supply_movement = applied_rule.ts supply_organisation2 = sequence.get('supply_organisation2') @@ -904,7 +904,7 @@ class TestProductionOrderApparelMixin(TestOrderMixin): (supply_organisation2, 'getSourceValue'), # XXX (supply_organisation2, 'getSourceSectionValue'))) )) - self.assertEquals(0, len(supply_movement.objectValues())) + self.assertEqual(0, len(supply_movement.objectValues())) SOURCING_ORDER_SEQUENCE = '\ CreateProductionOrganisation1 \ @@ -1108,7 +1108,7 @@ class TestProductionOrderApparel(TestProductionOrderApparelMixin, ERP5TypeTestCa pasted_sc = sequence.get('pasted_sc') pasted_supply_node = pasted_sc.contentValues(portal_type='Supply Node')[0] pasted_supply_link = pasted_sc.contentValues(portal_type='Supply Link')[0] - self.assertEquals(pasted_supply_node.getRelativeUrl(), + self.assertEqual(pasted_supply_node.getRelativeUrl(), pasted_supply_link.getDestination()) def test_07_testTransformationInteractionProductionOrderLine(self, quiet=0, run=run_all_test): @@ -1259,7 +1259,7 @@ class TestProductionOrderApparel(TestProductionOrderApparelMixin, ERP5TypeTestCa supply_node = empty_supply_chain.contentValues(portal_type='Supply Node')[0] supply_link = supply_chain.contentValues(portal_type='Supply Link')[0] - self.assertEquals(supply_node.getRelativeUrl(), + self.assertEqual(supply_node.getRelativeUrl(), supply_link.getDestination()) def test_51_testCutPasteInAnotherContainer(self, quiet=0, run=run_all_test): diff --git a/product/ERP5/tests/testProductionPackingList.py b/product/ERP5/tests/testProductionPackingList.py index 7de419c010..93b295acf3 100644 --- a/product/ERP5/tests/testProductionPackingList.py +++ b/product/ERP5/tests/testProductionPackingList.py @@ -73,82 +73,82 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking def stepSetReadyProducedDeliveryPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('produced_delivery_packing_list') self.modifyPackingListState('set_ready_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'ready') + self.assertEqual(packing_list.getSimulationState(), 'ready') def stepStartProducedDeliveryPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('produced_delivery_packing_list') self.modifyPackingListState('start_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'started') + self.assertEqual(packing_list.getSimulationState(), 'started') def stepStopProducedDeliveryPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('produced_delivery_packing_list') self.modifyPackingListState('stop_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'stopped') + self.assertEqual(packing_list.getSimulationState(), 'stopped') def stepDeliverProducedDeliveryPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('produced_delivery_packing_list') self.modifyPackingListState('deliver_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'delivered') + self.assertEqual(packing_list.getSimulationState(), 'delivered') def stepSetReadySupplyDeliveryPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('supply_delivery_packing_list') self.modifyPackingListState('set_ready_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'ready') + self.assertEqual(packing_list.getSimulationState(), 'ready') def stepStartSupplyDeliveryPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('supply_delivery_packing_list') self.modifyPackingListState('start_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'started') + self.assertEqual(packing_list.getSimulationState(), 'started') def stepStopSupplyDeliveryPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('supply_delivery_packing_list') self.modifyPackingListState('stop_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'stopped') + self.assertEqual(packing_list.getSimulationState(), 'stopped') def stepDeliverSupplyDeliveryPackingList(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('supply_delivery_packing_list') self.modifyPackingListState('deliver_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'delivered') + self.assertEqual(packing_list.getSimulationState(), 'delivered') def stepSetReadyProducedReport(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('produced_report') self.modifyPackingListState('set_ready_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'ready') + self.assertEqual(packing_list.getSimulationState(), 'ready') def stepStartProducedReport(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('produced_report') self.modifyPackingListState('start_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'started') + self.assertEqual(packing_list.getSimulationState(), 'started') def stepStopProducedReport(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('produced_report') self.modifyPackingListState('stop_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'stopped') + self.assertEqual(packing_list.getSimulationState(), 'stopped') def stepDeliverProducedReport(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('produced_report') self.modifyPackingListState('deliver_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'delivered') + self.assertEqual(packing_list.getSimulationState(), 'delivered') def stepSetReadyConsumedReport(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('consumed_report') self.modifyPackingListState('set_ready_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'ready') + self.assertEqual(packing_list.getSimulationState(), 'ready') def stepStartConsumedReport(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('consumed_report') self.modifyPackingListState('start_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'started') + self.assertEqual(packing_list.getSimulationState(), 'started') def stepStopConsumedReport(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('consumed_report') self.modifyPackingListState('stop_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'stopped') + self.assertEqual(packing_list.getSimulationState(), 'stopped') def stepDeliverConsumedReport(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('consumed_report') self.modifyPackingListState('deliver_action', sequence=sequence, packing_list=packing_list) - self.assertEquals(packing_list.getSimulationState(), 'delivered') + self.assertEqual(packing_list.getSimulationState(), 'delivered') def stepDecreaseProducedDeliveryPackingListQuantity(self, sequence=None, sequence_list=None, **kw): packing_list = sequence.get('produced_delivery_packing_list') @@ -193,32 +193,32 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking operation_report = operation_movement.getDeliveryValue().getParentValue() component_report = component_movement.getDeliveryValue().getParentValue() - self.assertEquals(operation_report, component_report) + self.assertEqual(operation_report, component_report) consumed_report = operation_report # checks that simulations are same # TODO: resources, quantities, dates, ... - self.assertEquals( + self.assertEqual( produced_delivery_movement.getSimulationState(), produced_delivery_packing_list.getSimulationState() ) - self.assertEquals( + self.assertEqual( supply_movement.getSimulationState(), supply_delivery_packing_list.getSimulationState() ) - self.assertEquals( + self.assertEqual( produced_movement.getSimulationState(), produced_report.getSimulationState() ) - self.assertEquals( + self.assertEqual( component_movement.getSimulationState(), consumed_report.getSimulationState() ) - self.assertEquals( + self.assertEqual( operation_movement.getSimulationState(), consumed_report.getSimulationState() ) @@ -234,7 +234,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('produced_delivery_packing_list') - self.assertEquals( + self.assertEqual( 'confirmed', packing_list.getSimulationState() ) @@ -243,7 +243,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('produced_delivery_packing_list') - self.assertEquals( + self.assertEqual( 'delivered', packing_list.getSimulationState() ) @@ -252,7 +252,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('supply_delivery_packing_list') - self.assertEquals( + self.assertEqual( 'delivered', packing_list.getSimulationState() ) @@ -261,7 +261,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('produced_report') - self.assertEquals( + self.assertEqual( 'delivered', packing_list.getSimulationState() ) @@ -270,7 +270,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('consumed_report') - self.assertEquals( + self.assertEqual( 'delivered', packing_list.getSimulationState() ) @@ -279,7 +279,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('produced_delivery_packing_list') - self.assertEquals( + self.assertEqual( 'solved', packing_list.getCausalityState() ) @@ -288,7 +288,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('produced_delivery_packing_list') - self.assertEquals( + self.assertEqual( 'diverged', packing_list.getCausalityState() ) @@ -297,7 +297,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('produced_delivery_packing_list') - self.assertEquals( + self.assertEqual( 'calculating', packing_list.getCausalityState() ) @@ -306,7 +306,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('supply_delivery_packing_list') - self.assertEquals( + self.assertEqual( 'calculating', packing_list.getCausalityState() ) @@ -315,7 +315,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('supply_delivery_packing_list') - self.assertEquals( + self.assertEqual( 'confirmed', packing_list.getSimulationState() ) @@ -324,7 +324,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('supply_delivery_packing_list') - self.assertEquals( + self.assertEqual( 'solved', packing_list.getCausalityState() ) @@ -333,7 +333,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('supply_delivery_packing_list') - self.assertEquals( + self.assertEqual( 'diverged', packing_list.getCausalityState() ) @@ -342,7 +342,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('produced_report') - self.assertEquals( + self.assertEqual( 'confirmed', packing_list.getSimulationState() ) @@ -351,7 +351,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('produced_report') - self.assertEquals( + self.assertEqual( 'solved', packing_list.getCausalityState() ) @@ -360,7 +360,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('produced_report') - self.assertEquals( + self.assertEqual( 'diverged', packing_list.getCausalityState() ) @@ -369,7 +369,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('consumed_report') - self.assertEquals( + self.assertEqual( 'confirmed', packing_list.getSimulationState() ) @@ -378,7 +378,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('consumed_report') - self.assertEquals( + self.assertEqual( 'solved', packing_list.getCausalityState() ) @@ -387,7 +387,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking sequence_list=None, **kw): packing_list = sequence.get('consumed_report') - self.assertEquals( + self.assertEqual( 'diverged', packing_list.getCausalityState() ) diff --git a/product/ERP5/tests/testProject.py b/product/ERP5/tests/testProject.py index a29fadcfeb..2d5c41001a 100644 --- a/product/ERP5/tests/testProject.py +++ b/product/ERP5/tests/testProject.py @@ -137,27 +137,27 @@ class TestProject(ERP5TypeTestCase): self.tic() # Script Used for Task Tab task_line_list = project.Project_getSourceProjectRelatedTaskList() - self.assertEquals(1, len(task_line_list)) - self.assertEquals(task_line_list[0], task.default_task_line) + self.assertEqual(1, len(task_line_list)) + self.assertEqual(task_line_list[0], task.default_task_line) # Script Used for Task Report Tab # It shows planned tasks also. task_line_list = project.Project_getSourceProjectRelatedTaskReportList() - self.assertEquals(1, len(task_line_list)) - self.assertEquals(task_line_list[0], task.default_task_line) + self.assertEqual(1, len(task_line_list)) + self.assertEqual(task_line_list[0], task.default_task_line) task.confirm() self.tic() # Script Used for Task Tab keep only showing tasks. task_line_list = project.Project_getSourceProjectRelatedTaskList() - self.assertEquals(1, len(task_line_list)) - self.assertEquals(task_line_list[0], task.default_task_line) + self.assertEqual(1, len(task_line_list)) + self.assertEqual(task_line_list[0], task.default_task_line) # Script Used for Task Report Tab # It shows planned tasks also. task_line_list = project.Project_getSourceProjectRelatedTaskReportList() - self.assertEquals(1, len(task_line_list)) + self.assertEqual(1, len(task_line_list)) self.assertNotEquals(task_line_list[0], task.default_task_line) self.assertNotEquals(task_line_list[0].getCausalityRelatedValue(), task.default_task_line) diff --git a/product/ERP5/tests/testQueryModule.py b/product/ERP5/tests/testQueryModule.py index f13774da19..5149a7814b 100644 --- a/product/ERP5/tests/testQueryModule.py +++ b/product/ERP5/tests/testQueryModule.py @@ -57,29 +57,29 @@ class TestQueryModule(ERP5TypeTestCase): # check the action is visible action_list = self.portal.portal_actions.listFilteredActionsFor( self.doc).get('object_action') - self.assertEquals(1, len([ai for ai in + self.assertEqual(1, len([ai for ai in action_list if ai['name'] == 'Post a Query'])) def test_jump_query_action_visible(self): action_list = self.portal.portal_actions.listFilteredActionsFor( self.doc).get('object_jump') - self.assertEquals(1, len([ai for ai in + self.assertEqual(1, len([ai for ai in action_list if ai['name'] == 'Queries'])) def test_post_query(self): self.doc.Base_postQuery(description='question ?') - self.assertEquals(len(self.portal.query_module), 1) + self.assertEqual(len(self.portal.query_module), 1) query = self.portal.query_module.contentValues()[0] - self.assertEquals(self.doc, query.getAgentValue()) - self.assertEquals('Person', query.getTitle()) - self.assertEquals('posted', query.getValidationState()) + self.assertEqual(self.doc, query.getAgentValue()) + self.assertEqual('Person', query.getTitle()) + self.assertEqual('posted', query.getValidationState()) def test_reply_query(self): self.doc.Base_postQuery(description='question ?') query = self.portal.query_module.contentValues()[0] self.portal.portal_workflow.doActionFor( query, 'answer_action') - self.assertEquals('answered', query.getValidationState()) + self.assertEqual('answered', query.getValidationState()) def test_reply_query_with_persons(self): @@ -122,13 +122,13 @@ class TestQueryModule(ERP5TypeTestCase): newSecurityManager(None, owner_user) self.portal.portal_workflow.doActionFor(query, 'answer_action') - self.assertEquals('answered', query.getValidationState()) + self.assertEqual('answered', query.getValidationState()) # this should have sent an email from owner_user to question_user last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, messageText = last_message - self.assertEquals('owner_user@example.invalid', mfrom) - self.assertEquals(['question_user@example.invalid'], mto) + self.assertEqual('owner_user@example.invalid', mfrom) + self.assertEqual(['question_user@example.invalid'], mto) self.assertTrue('Query' in messageText, messageText) diff --git a/product/ERP5/tests/testRSS.py b/product/ERP5/tests/testRSS.py index 90dbbea7cb..14539cce6d 100644 --- a/product/ERP5/tests/testRSS.py +++ b/product/ERP5/tests/testRSS.py @@ -88,8 +88,8 @@ class TestRSS(ERP5TypeTestCase): Check we have people. """ module = self.portal.person_module - self.assertEquals(module.one.getTitle(), "One") - self.assertEquals(module.two.getTitle(), "Two") + self.assertEqual(module.one.getTitle(), "One") + self.assertEqual(module.two.getTitle(), "Two") def test_01_renderRSS(self, quiet=0, run=run_all_test): """ @@ -108,32 +108,32 @@ class TestRSS(ERP5TypeTestCase): doc = parseString(feed_string) rss = doc.childNodes[0] channel = rss.getElementsByTagName('channel')[0] - self.assertEquals(len(rss.getElementsByTagName('channel')), 1) - self.assertEquals(len(channel.getElementsByTagName('item')), 2) + self.assertEqual(len(rss.getElementsByTagName('channel')), 1) + self.assertEqual(len(channel.getElementsByTagName('item')), 2) titles = [getNodeContent(n) for n in channel.getElementsByTagName('title')] titles.sort() - self.assertEquals(titles, ['One', 'Persons', 'Two']) # there is channel title and person titles + self.assertEqual(titles, ['One', 'Persons', 'Two']) # there is channel title and person titles item = channel.getElementsByTagName('item')[0] # the two person, because we have default sorting in form - self.assertEquals(getSubnodeContent(item, 'title'), 'Two') - self.assertEquals(getSubnodeContent(item, 'description'), 'Person Two') - self.assertEquals(getSubnodeContent(item, 'author'), 'seb') + self.assertEqual(getSubnodeContent(item, 'title'), 'Two') + self.assertEqual(getSubnodeContent(item, 'description'), 'Person Two') + self.assertEqual(getSubnodeContent(item, 'author'), 'seb') expected_link = '%s/view' %two.absolute_url() - self.assertEquals(getSubnodeContent(item, 'link'), expected_link) - self.assertEquals(len(item.getElementsByTagName('pubDate')), 1) + self.assertEqual(getSubnodeContent(item, 'link'), expected_link) + self.assertEqual(len(item.getElementsByTagName('pubDate')), 1) # is date formatted correctly? - self.assertEquals(two.getCreationDate().rfc822(), getSubnodeContent(item, 'pubDate')) + self.assertEqual(two.getCreationDate().rfc822(), getSubnodeContent(item, 'pubDate')) item = channel.getElementsByTagName('item')[1] # the one person - self.assertEquals(getSubnodeContent(item, 'title'), 'One') - self.assertEquals(getSubnodeContent(item, 'description'), 'Person One') - self.assertEquals(getSubnodeContent(item, 'author'), 'seb') + self.assertEqual(getSubnodeContent(item, 'title'), 'One') + self.assertEqual(getSubnodeContent(item, 'description'), 'Person One') + self.assertEqual(getSubnodeContent(item, 'author'), 'seb') expected_link = '%s/view' %one.absolute_url() - self.assertEquals(getSubnodeContent(item, 'link'), expected_link) - self.assertEquals(len(item.getElementsByTagName('pubDate')), 1) + self.assertEqual(getSubnodeContent(item, 'link'), expected_link) + self.assertEqual(len(item.getElementsByTagName('pubDate')), 1) # is date formatted correctly? - self.assertEquals(one.getCreationDate().rfc822(), getSubnodeContent(item, 'pubDate')) + self.assertEqual(one.getCreationDate().rfc822(), getSubnodeContent(item, 'pubDate')) def test_02_renderRSS(self, quiet=0, run=run_all_test): """ @@ -181,32 +181,32 @@ class TestRSS(ERP5TypeTestCase): doc = parseString(feed_string) rss = doc.childNodes[0] channel = rss.getElementsByTagName('channel')[0] - self.assertEquals(len(rss.getElementsByTagName('channel')), 1) - self.assertEquals(len(channel.getElementsByTagName('item')), 2) + self.assertEqual(len(rss.getElementsByTagName('channel')), 1) + self.assertEqual(len(channel.getElementsByTagName('item')), 2) titles = [getNodeContent(n) for n in channel.getElementsByTagName('title')] titles.sort() - self.assertEquals(titles, ['One', 'Persons', 'Two']) # there is channel title and person titles + self.assertEqual(titles, ['One', 'Persons', 'Two']) # there is channel title and person titles item = channel.getElementsByTagName('item')[0] # the two person, because we have default sorting in form - self.assertEquals(getSubnodeContent(item, 'title'), 'Two') - self.assertEquals(getSubnodeContent(item, 'description'), 'Person Two') - self.assertEquals(getSubnodeContent(item, 'author'), 'seb') + self.assertEqual(getSubnodeContent(item, 'title'), 'Two') + self.assertEqual(getSubnodeContent(item, 'description'), 'Person Two') + self.assertEqual(getSubnodeContent(item, 'author'), 'seb') expected_link = two.absolute_url() - self.assertEquals(getSubnodeContent(item, 'link'), expected_link) - self.assertEquals(len(item.getElementsByTagName('pubDate')), 1) + self.assertEqual(getSubnodeContent(item, 'link'), expected_link) + self.assertEqual(len(item.getElementsByTagName('pubDate')), 1) # is date formatted correctly? - self.assertEquals(two.getCreationDate().rfc822(), getSubnodeContent(item, 'pubDate')) + self.assertEqual(two.getCreationDate().rfc822(), getSubnodeContent(item, 'pubDate')) item = channel.getElementsByTagName('item')[1] # the one person - self.assertEquals(getSubnodeContent(item, 'title'), 'One') - self.assertEquals(getSubnodeContent(item, 'description'), 'Person One') - self.assertEquals(getSubnodeContent(item, 'author'), 'seb') + self.assertEqual(getSubnodeContent(item, 'title'), 'One') + self.assertEqual(getSubnodeContent(item, 'description'), 'Person One') + self.assertEqual(getSubnodeContent(item, 'author'), 'seb') expected_link = one.absolute_url() - self.assertEquals(getSubnodeContent(item, 'link'), expected_link) - self.assertEquals(len(item.getElementsByTagName('pubDate')), 1) + self.assertEqual(getSubnodeContent(item, 'link'), expected_link) + self.assertEqual(len(item.getElementsByTagName('pubDate')), 1) # is date formatted correctly? - self.assertEquals(one.getCreationDate().rfc822(), getSubnodeContent(item, 'pubDate')) + self.assertEqual(one.getCreationDate().rfc822(), getSubnodeContent(item, 'pubDate')) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5/tests/testResource.py b/product/ERP5/tests/testResource.py index e36b3819bd..5016bcf57a 100644 --- a/product/ERP5/tests/testResource.py +++ b/product/ERP5/tests/testResource.py @@ -619,7 +619,7 @@ class TestResource(ERP5TypeTestCase): self.tic() # Check resource price self.logMessage("Check product price...", tab=1) - self.assertEquals(config['price'], product.getPrice()) + self.assertEqual(config['price'], product.getPrice()) def test_10_getPriceWithOptions(self, quiet=quiet, run=run_all_test): """ @@ -694,19 +694,19 @@ class TestResource(ERP5TypeTestCase): self.tic() # Check resource price self.logMessage("Check product price without option...", tab=1) - self.assertEquals(1, product.getPrice(context=supply_line)) + self.assertEqual(1, product.getPrice(context=supply_line)) # Check resource option price self.logMessage("Check product price with option: %s..." % \ 'industrial_phase/phase1', tab=1) - self.assertEquals(3, product.getPrice( + self.assertEqual(3, product.getPrice( categories=['industrial_phase/phase1'])) self.logMessage("Check product price with option: %s..." % \ 'industrial_phase/phase2', tab=1) - self.assertEquals(8, product.getPrice( + self.assertEqual(8, product.getPrice( categories=['industrial_phase/phase2'])) self.logMessage("Check product price with options: %s..." % \ 'industrial_phase/phase1 industrial_phase/phase2', tab=1) - self.assertEquals(10, product.getPrice( + self.assertEqual(10, product.getPrice( categories=['industrial_phase/phase1', 'industrial_phase/phase2'])) @@ -760,7 +760,7 @@ class TestResource(ERP5TypeTestCase): self.logMessage("Check product %s with destination section %s" % \ (product.getTitle(), node.getTitle()), tab=1) - self.assertEquals(base_price, + self.assertEqual(base_price, product.getPrice( categories=['destination_section/%s' % node.getRelativeUrl()])) @@ -973,11 +973,11 @@ class TestResource(ERP5TypeTestCase): portal_type=self.sale_order_line_portal_type, resource_value=product) self.tic() - self.assertEquals(sale_order_line.getPrice(), 400.0) + self.assertEqual(sale_order_line.getPrice(), 400.0) sale_order.setDestinationSectionValue(orga2) self.tic() sale_order_line.setPrice(None) - self.assertEquals(sale_order_line.getPrice(), 200.0) + self.assertEqual(sale_order_line.getPrice(), 200.0) # Create purchase order and check price purchase_order = purchase_order_module.newContent( portal_type="Purchase Order", @@ -987,11 +987,11 @@ class TestResource(ERP5TypeTestCase): portal_type="Purchase Order Line", resource_value=product) self.tic() - self.assertEquals(purchase_order_line.getPrice(), 40.0) + self.assertEqual(purchase_order_line.getPrice(), 40.0) purchase_order.setSourceSectionValue(orga2) self.tic() purchase_order_line.setPrice(None) - self.assertEquals(purchase_order_line.getPrice(), 20.0) + self.assertEqual(purchase_order_line.getPrice(), 20.0) # Create internal packing list and check price internal_packing_list = internal_packing_list_module.newContent( portal_type="Internal Packing List", @@ -1001,11 +1001,11 @@ class TestResource(ERP5TypeTestCase): portal_type="Internal Packing List Line", resource_value=product) self.tic() - self.assertEquals(internal_packing_list_line.getPrice(), 4.0) + self.assertEqual(internal_packing_list_line.getPrice(), 4.0) internal_packing_list.setDestinationSectionValue(orga2) self.tic() internal_packing_list_line.setPrice(None) - self.assertEquals(internal_packing_list_line.getPrice(), 2.0) + self.assertEqual(internal_packing_list_line.getPrice(), 2.0) def testGetPriceWithQuantityUnit(self): resource = self.portal.getDefaultModule(self.product_portal_type)\ @@ -1021,8 +1021,8 @@ class TestResource(ERP5TypeTestCase): portal_type=self.sale_order_line_portal_type, resource_value=resource, quantity=5) - self.assertEquals(1000, sale_order_line.getPrice()) - self.assertEquals(5000, sale_order_line.getTotalPrice()) + self.assertEqual(1000, sale_order_line.getPrice()) + self.assertEqual(5000, sale_order_line.getTotalPrice()) # if we give the quantity unit in grams sale_order_line = sale_order.newContent( @@ -1030,8 +1030,8 @@ class TestResource(ERP5TypeTestCase): resource_value=resource, quantity=5000, quantity_unit_value=self.quantity_unit_gram) - self.assertEquals(1, sale_order_line.getPrice()) - self.assertEquals(5000, sale_order_line.getTotalPrice()) + self.assertEqual(1, sale_order_line.getPrice()) + self.assertEqual(5000, sale_order_line.getTotalPrice()) def testGetPriceWithPriceCurrency(self): currency_module = self.portal.getDefaultModule("Currency") @@ -1058,14 +1058,14 @@ class TestResource(ERP5TypeTestCase): resource_value=resource, quantity=5) # order and supply lines uses different currency, price does not apply - self.assertEquals(None, sale_order_line.getPrice()) + self.assertEqual(None, sale_order_line.getPrice()) # set the same currency sale_order.setPriceCurrencyValue(currency) # price applies - self.assertEquals(1000, sale_order_line.getPrice()) - self.assertEquals(5000, sale_order_line.getTotalPrice()) + self.assertEqual(1000, sale_order_line.getPrice()) + self.assertEqual(5000, sale_order_line.getTotalPrice()) def testQuantityPrecision(self): """test how to define quantity precision on resources. @@ -1073,11 +1073,11 @@ class TestResource(ERP5TypeTestCase): resource = self.portal.getDefaultModule(self.product_portal_type)\ .newContent(portal_type=self.product_portal_type) # default is 1 - self.assertEquals(1, resource.getBaseUnitQuantity()) - self.assertEquals(0, resource.getQuantityPrecision()) + self.assertEqual(1, resource.getBaseUnitQuantity()) + self.assertEqual(0, resource.getQuantityPrecision()) # quantity precision is calculated using base quantity unit resource.setBaseUnitQuantity(0.001) - self.assertEquals(3, resource.getQuantityPrecision()) + self.assertEqual(3, resource.getQuantityPrecision()) def test_defaultSupplyLineAfterClone(self): """Check that default supply line is properly set up after clone""" @@ -1125,17 +1125,17 @@ class TestResource(ERP5TypeTestCase): internal_supply_line_source_reference='test_source_reference_on_internal_supply_line', internal_supply_line_destination_reference='test_destination_reference_on_internal_supply_line', ) - self.assertEquals(resource.getPurchaseSupplyLineSourceReference(), + self.assertEqual(resource.getPurchaseSupplyLineSourceReference(), 'test_source_reference_on_purchase_supply_line') - self.assertEquals(resource.getPurchaseSupplyLineDestinationReference(), + self.assertEqual(resource.getPurchaseSupplyLineDestinationReference(), 'test_destination_reference_on_purchase_supply_line') - self.assertEquals(resource.getSaleSupplyLineSourceReference(), + self.assertEqual(resource.getSaleSupplyLineSourceReference(), 'test_source_reference_on_sale_supply_line') - self.assertEquals(resource.getSaleSupplyLineDestinationReference(), + self.assertEqual(resource.getSaleSupplyLineDestinationReference(), 'test_destination_reference_on_sale_supply_line') - self.assertEquals(resource.getInternalSupplyLineSourceReference(), + self.assertEqual(resource.getInternalSupplyLineSourceReference(), 'test_source_reference_on_internal_supply_line') - self.assertEquals(resource.getInternalSupplyLineDestinationReference(), + self.assertEqual(resource.getInternalSupplyLineDestinationReference(), 'test_destination_reference_on_internal_supply_line') def testQuantityUnitOnMovement(self): diff --git a/product/ERP5/tests/testReturnedSalePackingList.py b/product/ERP5/tests/testReturnedSalePackingList.py index 631dfaf99c..25de77aeca 100644 --- a/product/ERP5/tests/testReturnedSalePackingList.py +++ b/product/ERP5/tests/testReturnedSalePackingList.py @@ -138,26 +138,26 @@ class ReturnedSalePackingListMixin(TestPackingListMixin): organisation = sequence.get('organisation1') organisation3 = sequence.get('organisation3') - self.assertEquals(organisation3, returned_packing_list.getSourceValue()) - self.assertEquals(organisation3, returned_packing_list.getSourceSectionValue()) - self.assertEquals(organisation, returned_packing_list.getDestinationValue()) - self.assertEquals(organisation, returned_packing_list.getDestinationSectionValue()) - self.assertEquals(organisation3, returned_packing_list.getSourceDecisionValue()) - self.assertEquals(organisation, returned_packing_list.getDestinationDecisionValue()) - self.assertEquals(organisation3, returned_packing_list.getSourceAdministrationValue()) - self.assertEquals(organisation, returned_packing_list.getDestinationAdministrationValue()) + self.assertEqual(organisation3, returned_packing_list.getSourceValue()) + self.assertEqual(organisation3, returned_packing_list.getSourceSectionValue()) + self.assertEqual(organisation, returned_packing_list.getDestinationValue()) + self.assertEqual(organisation, returned_packing_list.getDestinationSectionValue()) + self.assertEqual(organisation3, returned_packing_list.getSourceDecisionValue()) + self.assertEqual(organisation, returned_packing_list.getDestinationDecisionValue()) + self.assertEqual(organisation3, returned_packing_list.getSourceAdministrationValue()) + self.assertEqual(organisation, returned_packing_list.getDestinationAdministrationValue()) returned_packing_list_line_list = returned_packing_list.objectValues( portal_type=self.returned_packing_list_line_portal_type) - self.assertEquals(1, len(returned_packing_list_line_list)) + self.assertEqual(1, len(returned_packing_list_line_list)) returned_packing_list_line = returned_packing_list_line_list[0] - self.assertEquals(self.returned_packing_list_line_portal_type, + self.assertEqual(self.returned_packing_list_line_portal_type, returned_packing_list_line.getPortalType()) resource = sequence.get('resource') created_resource = returned_packing_list_line.getResourceValue() - self.assertEquals(resource, created_resource) - self.assertEquals(200, returned_packing_list_line.getQuantity()) + self.assertEqual(resource, created_resource) + self.assertEqual(200, returned_packing_list_line.getQuantity()) def stepCheckReturnedPackingListDeleting(self, sequence=None, sequence_list=None, **kw): @@ -167,7 +167,7 @@ class ReturnedSalePackingListMixin(TestPackingListMixin): returned_packing_list = sequence.get('returned_packing_list') returned_packing_list_line_list = returned_packing_list.objectValues( portal_type=self.returned_packing_list_line_portal_type) - self.assertEquals(1, len(returned_packing_list_line_list)) + self.assertEqual(1, len(returned_packing_list_line_list)) returned_packing_list_line = returned_packing_list_line_list[0] # delete a line returned_packing_list.manage_delObjects([returned_packing_list_line.getId()]) @@ -175,9 +175,9 @@ class ReturnedSalePackingListMixin(TestPackingListMixin): portal_catalog = self.getCatalogTool() returned_packing_list_uid = returned_packing_list.getUid() found_rpl = portal_catalog(uid=returned_packing_list_uid) - self.assertEquals(1, len(found_rpl)) + self.assertEqual(1, len(found_rpl)) rpl = found_rpl[0].getObject() - self.assertEquals(0, len(rpl.objectValues( + self.assertEqual(0, len(rpl.objectValues( portal_type=self.returned_packing_list_line_portal_type))) # delete a delivery @@ -185,7 +185,7 @@ class ReturnedSalePackingListMixin(TestPackingListMixin): [returned_packing_list.getId(),]) found_rpl = portal_catalog(uid=returned_packing_list_uid) - self.assertEquals(0, len(found_rpl)) + self.assertEqual(0, len(found_rpl)) def stepConfirmReturnedPackingList(self, sequence=None, sequence_list=None, **kw): returned_packing_list = sequence.get('returned_packing_list') @@ -206,23 +206,23 @@ class ReturnedSalePackingListMixin(TestPackingListMixin): def stepCheckConfirmedReturnedPackingList(self, sequence=None, sequence_list=None, **kw): returned_packing_list = sequence.get('returned_packing_list') - self.assertEquals('confirmed', returned_packing_list.getSimulationState()) + self.assertEqual('confirmed', returned_packing_list.getSimulationState()) def stepCheckShippedReturnedPackingList(self, sequence=None, sequence_list=None, **kw): returned_packing_list = sequence.get('returned_packing_list') - self.assertEquals('started', returned_packing_list.getSimulationState()) + self.assertEqual('started', returned_packing_list.getSimulationState()) def stepCheckReceivedReturnedPackingList(self, sequence=None, sequence_list=None, **kw): returned_packing_list = sequence.get('returned_packing_list') - self.assertEquals('stopped', returned_packing_list.getSimulationState()) + self.assertEqual('stopped', returned_packing_list.getSimulationState()) def stepCheckDeliveredReturnedPackingList(self, sequence=None, sequence_list=None, **kw): returned_packing_list = sequence.get('returned_packing_list') - self.assertEquals('delivered', returned_packing_list.getSimulationState()) + self.assertEqual('delivered', returned_packing_list.getSimulationState()) def _getInventoryModule(self): @@ -257,13 +257,13 @@ class ReturnedSalePackingListMixin(TestPackingListMixin): quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=first_date) - self.assertEquals(2000, quantity) + self.assertEqual(2000, quantity) view_date = DateTime(self.view_stock_date) quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=view_date) - self.assertEquals(2000, quantity) + self.assertEqual(2000, quantity) def stepCheckReturnedInventory(self, sequence=None, sequence_list=None, **kw): """ @@ -279,13 +279,13 @@ class ReturnedSalePackingListMixin(TestPackingListMixin): quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=date) - self.assertEquals(2200, quantity) + self.assertEqual(2200, quantity) shipping_date = DateTime(self.shipping_date_string) quantity = self.getSimulationTool().getInventory(node_uid=node_uid, resource=resource_url, to_date=shipping_date) - self.assertEquals(2000, quantity) + self.assertEqual(2000, quantity) def stepCheckReturnedPackingLineEmptyCell(self, sequence=None, \ @@ -354,7 +354,7 @@ class ReturnedSalePackingListMixin(TestPackingListMixin): returned_packing_list_line.setCellRange(line_vcl, base_id=base_id) self.tic() - self.assertEquals(2, len(variation_category_list)) + self.assertEqual(2, len(variation_category_list)) cell_key_list = list(returned_packing_list_line.getCellKeyList(base_id=base_id)) self.assertNotEquals(0, len(cell_key_list)) @@ -369,7 +369,7 @@ class ReturnedSalePackingListMixin(TestPackingListMixin): self.commit() cell_list = returned_packing_list_line.objectValues( portal_type=self.returned_packing_list_cell_portal_type) - self.assertEquals(2, len(cell_list)) + self.assertEqual(2, len(cell_list)) sequence.edit(returned_packing_list_with_cell=returned_packing_list) @@ -381,14 +381,14 @@ class ReturnedSalePackingListMixin(TestPackingListMixin): rplwc = sequence.get('returned_packing_list_with_cell') rplwc_line_list = rplwc.objectValues( portal_type=self.returned_packing_list_line_portal_type) - self.assertEquals(1, len(rplwc_line_list)) + self.assertEqual(1, len(rplwc_line_list)) rplwc_line = rplwc_line_list[0] vcl = rplwc_line.getVariationCategoryList(omit_optional_variation=1) - self.assertEquals(2, len(vcl)) + self.assertEqual(2, len(vcl)) cell_list = rplwc_line.objectValues( portal_type=self.returned_packing_list_cell_portal_type) - self.assertEquals(2, len(cell_list)) + self.assertEqual(2, len(cell_list)) def stepCheckReturnedPackingListWithCellDeleting(self, sequence=None, @@ -399,21 +399,21 @@ class ReturnedSalePackingListMixin(TestPackingListMixin): rplwc = sequence.get('returned_packing_list_with_cell') rplwc_line_list = rplwc.objectValues( portal_type=self.returned_packing_list_line_portal_type) - self.assertEquals(1, len(rplwc_line_list)) + self.assertEqual(1, len(rplwc_line_list)) rplwc_line = rplwc_line_list[0] vcl = rplwc_line.getVariationCategoryList(omit_optional_variation=1) - self.assertEquals(2, len(vcl)) + self.assertEqual(2, len(vcl)) cell_list = rplwc_line.objectValues( portal_type=self.returned_packing_list_cell_portal_type) - self.assertEquals(2, len(cell_list)) + self.assertEqual(2, len(cell_list)) # delete cells rplwc_line.deleteContent(map(lambda x: x.getId(), cell_list)) self.commit() cell_list = rplwc_line.objectValues( ortal_type=self.returned_packing_list_cell_portal_type) - self.assertEquals(0, len(cell_list)) + self.assertEqual(0, len(cell_list)) def stepCheckReturnedPackingListIsNotDivergent(self, sequence=None, sequence_list=None, **kw): diff --git a/product/ERP5/tests/testRule.py b/product/ERP5/tests/testRule.py index 50144b33c6..7d7bbebd7a 100644 --- a/product/ERP5/tests/testRule.py +++ b/product/ERP5/tests/testRule.py @@ -129,9 +129,9 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) : delivery_rule.validate() self.tic() - self.assertEquals(self.getRuleTool().countFolder( + self.assertEqual(self.getRuleTool().countFolder( validation_state="validated")[0][0], 1) - self.assertEquals(len(self.getRuleTool().searchRuleList(self.sm)), 0) + self.assertEqual(len(self.getRuleTool().searchRuleList(self.sm)), 0) def test_02_WrongTestMethod(self): """ @@ -145,9 +145,9 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) : delivery_rule.validate() self.tic() - self.assertEquals(self.getRuleTool().countFolder( + self.assertEqual(self.getRuleTool().countFolder( validation_state="validated")[0][0], 1) - self.assertEquals(len(self.getRuleTool().searchRuleList(self.sm)), 0) + self.assertEqual(len(self.getRuleTool().searchRuleList(self.sm)), 0) def test_03_GoodTestMethod(self): """ @@ -161,9 +161,9 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) : delivery_rule.validate() self.tic() - self.assertEquals(self.getRuleTool().countFolder( + self.assertEqual(self.getRuleTool().countFolder( validation_state="validated")[0][0], 1) - self.assertEquals(len(self.getRuleTool().searchRuleList(self.sm)), 1) + self.assertEqual(len(self.getRuleTool().searchRuleList(self.sm)), 1) def test_04_NotValidatedRule(self): """ @@ -179,9 +179,9 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) : delivery_rule.invalidate() self.tic() - self.assertEquals(self.getRuleTool().countFolder( + self.assertEqual(self.getRuleTool().countFolder( validation_state="validated")[0][0], 0) - self.assertEquals(len(self.getRuleTool().searchRuleList(self.sm)), 0) + self.assertEqual(len(self.getRuleTool().searchRuleList(self.sm)), 0) def test_06_WrongDateRange(self): """ @@ -198,9 +198,9 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) : delivery_rule.validate() self.tic() - self.assertEquals(self.getRuleTool().countFolder( + self.assertEqual(self.getRuleTool().countFolder( validation_state="validated")[0][0], 1) - self.assertEquals(len(self.getRuleTool().searchRuleList(self.sm)), 0) + self.assertEqual(len(self.getRuleTool().searchRuleList(self.sm)), 0) def test_07_GoodDateRange(self): """ @@ -217,9 +217,9 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) : delivery_rule.validate() self.tic() - self.assertEquals(self.getRuleTool().countFolder( + self.assertEqual(self.getRuleTool().countFolder( validation_state="validated")[0][0], 1) - self.assertEquals(len(self.getRuleTool().searchRuleList(self.sm)), 1) + self.assertEqual(len(self.getRuleTool().searchRuleList(self.sm)), 1) def test_070_direct_criteria_specification(self): """ @@ -380,7 +380,7 @@ return context.generatePredicate( self.pl.updateSimulation(create_root=1) self.tic() root_applied_rule, = self.pl.getCausalityRelatedValueList() - self.assertEquals(root_applied_rule.getSpecialise(), + self.assertEqual(root_applied_rule.getSpecialise(), delivery_rule_2.getRelativeUrl()) self.getSimulationTool()._delObject(root_applied_rule.getId()) @@ -393,7 +393,7 @@ return context.generatePredicate( self.pl.updateSimulation(create_root=1) self.tic() root_applied_rule, = self.pl.getCausalityRelatedValueList() - self.assertEquals(root_applied_rule.getSpecialise(), + self.assertEqual(root_applied_rule.getSpecialise(), delivery_rule_1.getRelativeUrl()) self.getSimulationTool()._delObject(root_applied_rule.getId()) @@ -431,12 +431,12 @@ return context.generatePredicate( # check that only one invoicing rule (higher version) was applied root_applied_rule, = self.pl.getCausalityRelatedValueList() - self.assertEquals(root_applied_rule.getSpecialise(), + self.assertEqual(root_applied_rule.getSpecialise(), delivery_rule.getRelativeUrl()) movement, = root_applied_rule.objectValues() applied_rule, = movement.objectValues() - self.assertEquals(applied_rule.getSpecialise(), + self.assertEqual(applied_rule.getSpecialise(), invoicing_rule_2.getRelativeUrl()) # increase version of other rule, clean simulation and check again @@ -449,12 +449,12 @@ return context.generatePredicate( # check that only one invoicing rule (higher version) was applied root_applied_rule, = self.pl.getCausalityRelatedValueList() - self.assertEquals(root_applied_rule.getSpecialise(), + self.assertEqual(root_applied_rule.getSpecialise(), delivery_rule.getRelativeUrl()) movement, = root_applied_rule.objectValues() applied_rule, = movement.objectValues() - self.assertEquals(applied_rule.getSpecialise(), + self.assertEqual(applied_rule.getSpecialise(), invoicing_rule_1.getRelativeUrl()) self.getSimulationTool()._delObject(root_applied_rule.getId()) @@ -487,19 +487,19 @@ return context.generatePredicate( root_applied_rule, = self.pl.getCausalityRelatedValueList() # check that no invoicing rule was applied - self.assertEquals(root_applied_rule.getSpecialise(), + self.assertEqual(root_applied_rule.getSpecialise(), delivery_rule.getRelativeUrl()) movement, = root_applied_rule.objectValues() - self.assertEquals(movement.objectCount(), 0) + self.assertEqual(movement.objectCount(), 0) # change rule script so that it matches and test again invoicing_rule_1.setTestMethodId('invoice_rule_script') root_applied_rule.expand() self.tic() - self.assertEquals(list(root_applied_rule.objectValues()), [movement]) + self.assertEqual(list(root_applied_rule.objectValues()), [movement]) invoicing_rule_1_applied_rule, = movement.objectValues() - self.assertEquals(invoicing_rule_1_applied_rule.getSpecialise(), + self.assertEqual(invoicing_rule_1_applied_rule.getSpecialise(), invoicing_rule_1.getRelativeUrl()) # add more invoicing_rule and test that nothing is changed @@ -516,13 +516,13 @@ return context.generatePredicate( root_applied_rule.expand() self.tic() - self.assertEquals(list(root_applied_rule.objectValues()), [movement]) + self.assertEqual(list(root_applied_rule.objectValues()), [movement]) applied_rule_1, applied_rule_2 = sorted(movement.objectValues(), key=lambda x: x.getSpecialiseReference()) # check the 1st applied rule is an application of invoicing_rule_1 - self.assertEquals(applied_rule_1.getSpecialise(), + self.assertEqual(applied_rule_1.getSpecialise(), invoicing_rule_n.getRelativeUrl()) - self.assertEquals(applied_rule_2.getSpecialise(), + self.assertEqual(applied_rule_2.getSpecialise(), invoicing_rule_2.getRelativeUrl()) self.getSimulationTool()._delObject(root_applied_rule.getId()) @@ -555,22 +555,22 @@ return context.generatePredicate( root_applied_rule, = self.pl.getCausalityRelatedValueList() # check that the invoicing rule was applied - self.assertEquals(root_applied_rule.getSpecialise(), + self.assertEqual(root_applied_rule.getSpecialise(), delivery_rule.getRelativeUrl()) movement, = root_applied_rule.objectValues() applied_rule, = movement.objectValues() - self.assertEquals(applied_rule.getSpecialise(), + self.assertEqual(applied_rule.getSpecialise(), invoicing_rule_1.getRelativeUrl()) # invalidate the rule and test that it is gone invoicing_rule_1.invalidate() self.tic() - self.assertEquals(invoicing_rule_1.getValidationState(), 'invalidated') + self.assertEqual(invoicing_rule_1.getValidationState(), 'invalidated') root_applied_rule.expand() self.tic() - self.assertEquals(list(root_applied_rule.objectValues()), [movement]) - self.assertEquals(movement.objectCount(), 0) + self.assertEqual(list(root_applied_rule.objectValues()), [movement]) + self.assertEqual(movement.objectCount(), 0) # change the test method to one that fails, and test that the rule is # removed @@ -578,8 +578,8 @@ return context.generatePredicate( root_applied_rule.expand() self.tic() - self.assertEquals(list(root_applied_rule.objectValues()), [movement]) - self.assertEquals(movement.objectCount(), 0) + self.assertEqual(list(root_applied_rule.objectValues()), [movement]) + self.assertEqual(movement.objectCount(), 0) # change the test to one that succeeds, revalidate, expand, add a delivery # relation, change the test method to one that fails, expand, and test @@ -587,13 +587,13 @@ return context.generatePredicate( invoicing_rule_1.setTestMethodId('invoice_rule_script') invoicing_rule_1.validate() self.tic() - self.assertEquals(invoicing_rule_1.getValidationState(), 'validated') + self.assertEqual(invoicing_rule_1.getValidationState(), 'validated') root_applied_rule.expand() self.tic() - self.assertEquals(list(root_applied_rule.objectValues()), [movement]) + self.assertEqual(list(root_applied_rule.objectValues()), [movement]) applied_rule, = movement.objectValues() - self.assertEquals(applied_rule.getSpecialise(), + self.assertEqual(applied_rule.getSpecialise(), invoicing_rule_1.getRelativeUrl()) sub_movement, = applied_rule.objectValues() @@ -603,12 +603,12 @@ return context.generatePredicate( root_applied_rule.expand() self.tic() - self.assertEquals(list(root_applied_rule.objectValues()), [movement]) - self.assertEquals(list(movement.objectValues()), [applied_rule]) - self.assertEquals(applied_rule.getSpecialise(), + self.assertEqual(list(root_applied_rule.objectValues()), [movement]) + self.assertEqual(list(movement.objectValues()), [applied_rule]) + self.assertEqual(applied_rule.getSpecialise(), invoicing_rule_1.getRelativeUrl()) - self.assertEquals(list(applied_rule.objectValues()), [sub_movement]) - self.assertEquals(sub_movement.getDelivery(), self.pl.line.getRelativeUrl()) + self.assertEqual(list(applied_rule.objectValues()), [sub_movement]) + self.assertEqual(sub_movement.getDelivery(), self.pl.line.getRelativeUrl()) self.getSimulationTool()._delObject(root_applied_rule.getId()) self.tic() @@ -645,11 +645,11 @@ return context.generatePredicate( root_applied_rule, = self.pl.getCausalityRelatedValueList() # check that the invoicing rule 2 was applied - self.assertEquals(root_applied_rule.getSpecialise(), + self.assertEqual(root_applied_rule.getSpecialise(), delivery_rule.getRelativeUrl()) movement, = root_applied_rule.objectValues() applied_rule, = movement.objectValues() - self.assertEquals(applied_rule.getSpecialise(), + self.assertEqual(applied_rule.getSpecialise(), invoicing_rule_2.getRelativeUrl()) # change the test method to one that fails, and test that the rule is @@ -658,9 +658,9 @@ return context.generatePredicate( root_applied_rule.expand() self.tic() - self.assertEquals(list(root_applied_rule.objectValues()), [movement]) + self.assertEqual(list(root_applied_rule.objectValues()), [movement]) applied_rule, = movement.objectValues() - self.assertEquals(applied_rule.getSpecialise(), + self.assertEqual(applied_rule.getSpecialise(), invoicing_rule_1.getRelativeUrl()) # change the test of invoicing rule 2 to one that succeeds, add a delivery @@ -671,12 +671,12 @@ return context.generatePredicate( root_applied_rule.expand() self.tic() - self.assertEquals(list(root_applied_rule.objectValues()), [movement]) - self.assertEquals(list(movement.objectValues()), [applied_rule]) - self.assertEquals(applied_rule.getSpecialise(), + self.assertEqual(list(root_applied_rule.objectValues()), [movement]) + self.assertEqual(list(movement.objectValues()), [applied_rule]) + self.assertEqual(applied_rule.getSpecialise(), invoicing_rule_1.getRelativeUrl()) - self.assertEquals(list(applied_rule.objectValues()), [sub_movement]) - self.assertEquals(sub_movement.getDelivery(), self.pl.line.getRelativeUrl()) + self.assertEqual(list(applied_rule.objectValues()), [sub_movement]) + self.assertEqual(sub_movement.getDelivery(), self.pl.line.getRelativeUrl()) self.getSimulationTool()._delObject(root_applied_rule.getId()) self.tic() diff --git a/product/ERP5/tests/testSimulationElementPerformance.py b/product/ERP5/tests/testSimulationElementPerformance.py index 3c6fce7c82..2a5b01ef1d 100644 --- a/product/ERP5/tests/testSimulationElementPerformance.py +++ b/product/ERP5/tests/testSimulationElementPerformance.py @@ -422,33 +422,33 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): for order in module.contentValues(portal_type='Sale Order'): order.edit(destination_decision=destination_decision, destination_administration=destination_administration) - self.assertEquals(order.getDestinationDecision(), destination_decision) - self.assertEquals(order.getDestinationAdministration(), + self.assertEqual(order.getDestinationDecision(), destination_decision) + self.assertEqual(order.getDestinationAdministration(), destination_administration) def stepPlanSaleOrders(self, sequence=None, sequence_list=None, **kw): portal = self.getPortal() module = portal.sale_order_module for order in module.contentValues(portal_type='Sale Order'): - self.assertEquals(order.getSimulationState(), 'draft') + self.assertEqual(order.getSimulationState(), 'draft') order.plan() - self.assertEquals(order.getSimulationState(), 'planned') + self.assertEqual(order.getSimulationState(), 'planned') def stepOrderSaleOrders(self, sequence=None, sequence_list=None, **kw): portal = self.getPortal() module = portal.sale_order_module for order in module.contentValues(portal_type='Sale Order'): - self.assertEquals(order.getSimulationState(), 'planned') + self.assertEqual(order.getSimulationState(), 'planned') order.order() - self.assertEquals(order.getSimulationState(), 'ordered') + self.assertEqual(order.getSimulationState(), 'ordered') def stepConfirmSaleOrders(self, sequence=None, sequence_list=None, **kw): portal = self.getPortal() module = portal.sale_order_module for order in module.contentValues(portal_type='Sale Order'): - self.assertEquals(order.getSimulationState(), 'ordered') + self.assertEqual(order.getSimulationState(), 'ordered') order.confirm() - self.assertEquals(order.getSimulationState(), 'confirmed') + self.assertEqual(order.getSimulationState(), 'confirmed') def stepCheckSaleOrderSimulation(self, sequence=None, sequence_list=None, **kw): @@ -459,29 +459,29 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): destination_decision = sequence.get('destination_decision') destination_administration = sequence.get('destination_administration') resource = sequence.get('resource') - self.assertEquals(module.objectCount(), number_of_sale_orders) + self.assertEqual(module.objectCount(), number_of_sale_orders) for order in module.contentValues(portal_type='Sale Order'): causality_list = order.getCausalityRelatedValueList(portal_type='Applied Rule') - self.assertEquals(len(causality_list), 1) + self.assertEqual(len(causality_list), 1) applied_rule = causality_list[0] - self.assertEquals(applied_rule.getPortalType(), 'Applied Rule') + self.assertEqual(applied_rule.getPortalType(), 'Applied Rule') rule = applied_rule.getSpecialiseValue() self.assertNotEquals(rule, None) - self.assertEquals(rule.getReference(), + self.assertEqual(rule.getReference(), 'test_order_root_simulation_rule') - self.assertEquals(applied_rule.objectCount(), + self.assertEqual(applied_rule.objectCount(), number_of_sale_order_lines) for simulation_movement in applied_rule.objectValues(): - self.assertEquals(simulation_movement.getPortalType(), + self.assertEqual(simulation_movement.getPortalType(), 'Simulation Movement') - self.assertEquals(simulation_movement.getQuantity(), 1.0) - self.assertEquals(simulation_movement.getResource(), resource) - self.assertEquals(set(simulation_movement.getCausalityList()), set(( + self.assertEqual(simulation_movement.getQuantity(), 1.0) + self.assertEqual(simulation_movement.getResource(), resource) + self.assertEqual(set(simulation_movement.getCausalityList()), set(( 'business_process_module/test_bp/order_path', 'business_process_module/test_bp/order'))) - self.assertEquals(simulation_movement.getDestinationDecision(), + self.assertEqual(simulation_movement.getDestinationDecision(), destination_decision) - self.assertEquals(simulation_movement.getDestinationAdministration(), + self.assertEqual(simulation_movement.getDestinationAdministration(), destination_administration) def stepCheckBuiltSalePackingLists(self, sequence=None, sequence_list=None, @@ -493,26 +493,26 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): destination_decision = sequence.get('destination_decision') destination_administration = sequence.get('destination_administration') resource = sequence.get('resource') - self.assertEquals(module.objectCount(), number_of_sale_orders) + self.assertEqual(module.objectCount(), number_of_sale_orders) for packing_list in module.contentValues(): - self.assertEquals(packing_list.getSimulationState(), 'confirmed') - self.assertEquals(packing_list.getCausalityState(), 'solved') - self.assertEquals(packing_list.getDestinationDecision(), + self.assertEqual(packing_list.getSimulationState(), 'confirmed') + self.assertEqual(packing_list.getCausalityState(), 'solved') + self.assertEqual(packing_list.getDestinationDecision(), destination_decision) - self.assertEquals(packing_list.getDestinationAdministration(), + self.assertEqual(packing_list.getDestinationAdministration(), destination_administration) - self.assertEquals(packing_list.objectCount(), 1) + self.assertEqual(packing_list.objectCount(), 1) for line in packing_list.objectValues(): - self.assertEquals(line.getResource(), resource) + self.assertEqual(line.getResource(), resource) self.assertAlmostEquals(line.getQuantity(), 1.0 * number_of_sale_order_lines) simulation_movement_list = line.getDeliveryRelatedValueList() - self.assertEquals(len(simulation_movement_list), + self.assertEqual(len(simulation_movement_list), number_of_sale_order_lines) for simulation_movement in simulation_movement_list: - self.assertEquals(simulation_movement.getPortalType(), + self.assertEqual(simulation_movement.getPortalType(), 'Simulation Movement') - self.assertEquals(set(simulation_movement.getCausalityList()), set(( + self.assertEqual(set(simulation_movement.getCausalityList()), set(( 'business_process_module/test_bp/deliver_path', 'business_process_module/test_bp/deliver'))) @@ -520,19 +520,19 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): **kw): portal = self.getPortal() module = portal.accounting_module - self.assertEquals(module.objectCount(), 1) + self.assertEqual(module.objectCount(), 1) number_of_sale_orders = sequence.get('number_of_sale_orders') number_of_sale_order_lines = sequence.get('number_of_sale_order_lines') number_of_additional_sale_packing_list_lines \ = sequence.get('number_of_additional_sale_packing_list_lines') for invoice in module.contentValues(): - self.assertEquals(invoice.getSimulationState(), 'confirmed') - self.assertEquals(invoice.getCausalityState(), 'solved') - self.assertEquals(invoice.objectCount(), 2) + self.assertEqual(invoice.getSimulationState(), 'confirmed') + self.assertEqual(invoice.getCausalityState(), 'solved') + self.assertEqual(invoice.objectCount(), 2) invoice_line_list = invoice.objectValues(sort_on='resource') commodity_invoice_line = invoice_line_list[0] - self.assertEquals(commodity_invoice_line.getResource(), + self.assertEqual(commodity_invoice_line.getResource(), 'product_module/commodity') self.assertAlmostEquals(commodity_invoice_line.getQuantity(), 1.0 * (number_of_sale_order_lines \ @@ -540,19 +540,19 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): * number_of_sale_orders) simulation_movement_list \ = commodity_invoice_line.getDeliveryRelatedValueList() - self.assertEquals(len(simulation_movement_list), + self.assertEqual(len(simulation_movement_list), (number_of_sale_order_lines \ + number_of_additional_sale_packing_list_lines) \ * number_of_sale_orders) for simulation_movement in simulation_movement_list: - self.assertEquals(simulation_movement.getPortalType(), + self.assertEqual(simulation_movement.getPortalType(), 'Simulation Movement') - self.assertEquals(set(simulation_movement.getCausalityList()), set(( + self.assertEqual(set(simulation_movement.getCausalityList()), set(( 'business_process_module/test_bp/invoice_path', 'business_process_module/test_bp/invoice'))) tax_invoice_line = invoice_line_list[1] - self.assertEquals(tax_invoice_line.getResource(), + self.assertEqual(tax_invoice_line.getResource(), 'service_module/vat_low') self.assertAlmostEquals(tax_invoice_line.getQuantity(), commodity_invoice_line.getPrice() \ @@ -561,14 +561,14 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): * number_of_sale_orders) simulation_movement_list \ = tax_invoice_line.getDeliveryRelatedValueList() - self.assertEquals(len(simulation_movement_list), + self.assertEqual(len(simulation_movement_list), (number_of_sale_order_lines \ + number_of_additional_sale_packing_list_lines) \ * number_of_sale_orders) for simulation_movement in simulation_movement_list: - self.assertEquals(simulation_movement.getPortalType(), + self.assertEqual(simulation_movement.getPortalType(), 'Simulation Movement') - self.assertEquals(set(simulation_movement.getCausalityList()), set(( + self.assertEqual(set(simulation_movement.getCausalityList()), set(( 'business_process_module/test_bp/invoice_path', 'business_process_module/test_bp/invoice', 'sale_trade_condition_module/test_stc/vat_low'))) @@ -577,19 +577,19 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): **kw): portal = self.getPortal() module = portal.accounting_module - self.assertEquals(module.objectCount(), 1) + self.assertEqual(module.objectCount(), 1) number_of_sale_orders = sequence.get('number_of_sale_orders') number_of_sale_order_lines = sequence.get('number_of_sale_order_lines') number_of_additional_sale_packing_list_lines \ = sequence.get('number_of_additional_sale_packing_list_lines') for invoice in module.contentValues(): - self.assertEquals(invoice.getSimulationState(), 'confirmed') - self.assertEquals(invoice.getCausalityState(), 'solved') - self.assertEquals(invoice.objectCount(), 4) + self.assertEqual(invoice.getSimulationState(), 'confirmed') + self.assertEqual(invoice.getCausalityState(), 'solved') + self.assertEqual(invoice.objectCount(), 4) invoice_line_list = invoice.objectValues(sort_on='resource') commodity_invoice_line = invoice_line_list[0] - self.assertEquals(commodity_invoice_line.getResource(), + self.assertEqual(commodity_invoice_line.getResource(), 'product_module/commodity') self.assertAlmostEquals(commodity_invoice_line.getQuantity(), 1.0 * (number_of_sale_order_lines \ @@ -597,37 +597,37 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): * number_of_sale_orders) simulation_movement_list \ = commodity_invoice_line.getDeliveryRelatedValueList() - self.assertEquals(len(simulation_movement_list), + self.assertEqual(len(simulation_movement_list), (number_of_sale_order_lines \ + number_of_additional_sale_packing_list_lines) \ * number_of_sale_orders) for simulation_movement in simulation_movement_list: - self.assertEquals(simulation_movement.getPortalType(), + self.assertEqual(simulation_movement.getPortalType(), 'Simulation Movement') - self.assertEquals(set(simulation_movement.getCausalityList()), set(( + self.assertEqual(set(simulation_movement.getCausalityList()), set(( 'business_process_module/test_bp/invoice_path', 'business_process_module/test_bp/invoice'))) luxury_invoice_line = invoice_line_list[1] - self.assertEquals(luxury_invoice_line.getResource(), + self.assertEqual(luxury_invoice_line.getResource(), 'product_module/luxury') self.assertAlmostEquals(luxury_invoice_line.getQuantity(), 1.0 * number_of_additional_sale_packing_list_lines \ * number_of_sale_orders) simulation_movement_list \ = luxury_invoice_line.getDeliveryRelatedValueList() - self.assertEquals(len(simulation_movement_list), + self.assertEqual(len(simulation_movement_list), number_of_additional_sale_packing_list_lines \ * number_of_sale_orders) for simulation_movement in simulation_movement_list: - self.assertEquals(simulation_movement.getPortalType(), + self.assertEqual(simulation_movement.getPortalType(), 'Simulation Movement') - self.assertEquals(set(simulation_movement.getCausalityList()), set(( + self.assertEqual(set(simulation_movement.getCausalityList()), set(( 'business_process_module/test_bp/invoice_path', 'business_process_module/test_bp/invoice'))) high_tax_invoice_line = invoice_line_list[2] - self.assertEquals(high_tax_invoice_line.getResource(), + self.assertEqual(high_tax_invoice_line.getResource(), 'service_module/vat_high') self.assertAlmostEquals(high_tax_invoice_line.getQuantity(), luxury_invoice_line.getPrice() \ @@ -635,19 +635,19 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): * number_of_sale_orders) simulation_movement_list \ = high_tax_invoice_line.getDeliveryRelatedValueList() - self.assertEquals(len(simulation_movement_list), + self.assertEqual(len(simulation_movement_list), number_of_additional_sale_packing_list_lines \ * number_of_sale_orders) for simulation_movement in simulation_movement_list: - self.assertEquals(simulation_movement.getPortalType(), + self.assertEqual(simulation_movement.getPortalType(), 'Simulation Movement') - self.assertEquals(set(simulation_movement.getCausalityList()), set(( + self.assertEqual(set(simulation_movement.getCausalityList()), set(( 'business_process_module/test_bp/invoice_path', 'business_process_module/test_bp/invoice', 'sale_trade_condition_module/test_stc/vat_high'))) low_tax_invoice_line = invoice_line_list[3] - self.assertEquals(low_tax_invoice_line.getResource(), + self.assertEqual(low_tax_invoice_line.getResource(), 'service_module/vat_low') self.assertAlmostEquals(low_tax_invoice_line.getQuantity(), commodity_invoice_line.getPrice() \ @@ -656,14 +656,14 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): * number_of_sale_orders) simulation_movement_list \ = low_tax_invoice_line.getDeliveryRelatedValueList() - self.assertEquals(len(simulation_movement_list), + self.assertEqual(len(simulation_movement_list), (number_of_sale_order_lines \ + number_of_additional_sale_packing_list_lines) \ * number_of_sale_orders) for simulation_movement in simulation_movement_list: - self.assertEquals(simulation_movement.getPortalType(), + self.assertEqual(simulation_movement.getPortalType(), 'Simulation Movement') - self.assertEquals(set(simulation_movement.getCausalityList()), set(( + self.assertEqual(set(simulation_movement.getCausalityList()), set(( 'business_process_module/test_bp/invoice_path', 'business_process_module/test_bp/invoice', 'sale_trade_condition_module/test_stc/vat_low'))) @@ -673,14 +673,14 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): portal = self.getPortal() module = portal.sale_packing_list_module for packing_list in module.contentValues(): - self.assertEquals(packing_list.getCausalityState(), 'solved') + self.assertEqual(packing_list.getCausalityState(), 'solved') def stepCheckDivergedSalePackingLists(self, sequence=None, sequence_list=None, **kw): portal = self.getPortal() module = portal.sale_packing_list_module for packing_list in module.contentValues(): - self.assertEquals(packing_list.getCausalityState(), 'diverged') + self.assertEqual(packing_list.getCausalityState(), 'diverged') def stepCheckSalePackingListSimulation(self, sequence=None, sequence_list=None, **kw): @@ -691,34 +691,34 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): destination_decision = sequence.get('destination_decision') destination_administration = sequence.get('destination_administration') for packing_list in module.contentValues(portal_type='Sale Packing List'): - self.assertEquals(packing_list.getCausalityState(), 'solved') + self.assertEqual(packing_list.getCausalityState(), 'solved') causality_list = packing_list.getCausalityRelatedValueList(portal_type='Applied Rule') - self.assertEquals(len(causality_list), 1) + self.assertEqual(len(causality_list), 1) applied_rule = causality_list[0] - self.assertEquals(applied_rule.getPortalType(), 'Applied Rule') + self.assertEqual(applied_rule.getPortalType(), 'Applied Rule') rule = applied_rule.getSpecialiseValue() self.assertNotEquals(rule, None) - self.assertEquals(rule.getReference(), + self.assertEqual(rule.getReference(), 'test_delivery_root_simulation_rule') - self.assertEquals(applied_rule.objectCount(), + self.assertEqual(applied_rule.objectCount(), number_of_additional_sale_packing_list_lines) for simulation_movement in applied_rule.objectValues(): - self.assertEquals(simulation_movement.getPortalType(), + self.assertEqual(simulation_movement.getPortalType(), 'Simulation Movement') delivery_list = simulation_movement.getDeliveryValueList() - self.assertEquals(len(delivery_list), 1) + self.assertEqual(len(delivery_list), 1) delivery = delivery_list[0] - self.assertEquals(delivery.getPortalType(), 'Sale Packing List Line') - self.assertEquals(simulation_movement.getQuantity(), + self.assertEqual(delivery.getPortalType(), 'Sale Packing List Line') + self.assertEqual(simulation_movement.getQuantity(), delivery.getQuantity()) - self.assertEquals(simulation_movement.getResource(), + self.assertEqual(simulation_movement.getResource(), delivery.getResource()) - self.assertEquals(set(simulation_movement.getCausalityList()), set(( + self.assertEqual(set(simulation_movement.getCausalityList()), set(( 'business_process_module/test_bp/deliver_path', 'business_process_module/test_bp/deliver'))) - self.assertEquals(simulation_movement.getDestinationDecision(), + self.assertEqual(simulation_movement.getDestinationDecision(), destination_decision) - self.assertEquals(simulation_movement.getDestinationAdministration(), + self.assertEqual(simulation_movement.getDestinationAdministration(), destination_administration) def stepSetSolverTargetToDestinationAdministration(self, sequence=None, @@ -733,7 +733,7 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): module = portal.sale_packing_list_module for packing_list in module.contentValues(portal_type='Sale Packing List'): divergence = packing_list.getDivergenceList()[0] - self.assertEquals(divergence.tested_property, solver_target) + self.assertEqual(divergence.tested_property, solver_target) packing_list.activate().SalePackingList_solveForTesting( solver_target, divergence.prevision_value) # XXX: Because divergence is ignored for 'destination_decision', @@ -754,7 +754,7 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): module = portal.sale_packing_list_module for packing_list in module.contentValues(portal_type='Sale Packing List'): divergence = packing_list.getDivergenceList()[0] - self.assertEquals(divergence.tested_property, solver_target) + self.assertEqual(divergence.tested_property, solver_target) packing_list.activate().SalePackingList_solveForTesting( solver_target, divergence.decision_value) # Make sure that the same taget is not used again. @@ -775,18 +775,18 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): portal = self.getPortal() module = portal.sale_packing_list_module for packing_list in module.contentValues(portal_type='Sale Packing List'): - self.assertEquals(packing_list.getSimulationState(), 'confirmed') + self.assertEqual(packing_list.getSimulationState(), 'confirmed') packing_list.stop() - self.assertEquals(packing_list.getSimulationState(), 'stopped') + self.assertEqual(packing_list.getSimulationState(), 'stopped') def stepDeliverSalePackingLists(self, sequence=None, sequence_list=None, **kw): portal = self.getPortal() module = portal.sale_packing_list_module for packing_list in module.contentValues(portal_type='Sale Packing List'): - self.assertEquals(packing_list.getSimulationState(), 'stopped') + self.assertEqual(packing_list.getSimulationState(), 'stopped') packing_list.deliver() - self.assertEquals(packing_list.getSimulationState(), 'delivered') + self.assertEqual(packing_list.getSimulationState(), 'delivered') def stepTestResult(self, sequence=None, sequence_list=None, **kw): measurable = sequence.get('measurable') diff --git a/product/ERP5/tests/testSpellChecking.py b/product/ERP5/tests/testSpellChecking.py index e850576d10..3c67e102ca 100644 --- a/product/ERP5/tests/testSpellChecking.py +++ b/product/ERP5/tests/testSpellChecking.py @@ -134,10 +134,10 @@ class TestSpellChecking(ERP5TypeTestCase): Simple test for Aspell class. """ # check a well spelled world - self.assertEquals(self.validate_spell('cancelled'), {}) - self.assertEquals(self.validate_spell('globally enabled'), {}) - self.assertEquals(self.validate_spell('http://www.erp5.com'), {}) - self.assertEquals(self.validate_spell('2010/11/20'), {}) + self.assertEqual(self.validate_spell('cancelled'), {}) + self.assertEqual(self.validate_spell('globally enabled'), {}) + self.assertEqual(self.validate_spell('http://www.erp5.com'), {}) + self.assertEqual(self.validate_spell('2010/11/20'), {}) # check some suggestion are given for a small mistake self.assertNotEquals(self.validate_spell('canceled'), {}) diff --git a/product/ERP5/tests/testSupply.py b/product/ERP5/tests/testSupply.py index 94cb34b9bf..3234b83638 100644 --- a/product/ERP5/tests/testSupply.py +++ b/product/ERP5/tests/testSupply.py @@ -267,9 +267,9 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper, # check supply line in predicate table result = self.catalog_tool(**kw) - self.assertEquals(1, len(result) ) + self.assertEqual(1, len(result) ) result = result[0] - self.assertEquals(result.start_date_range_min, original_date.toZone('UTC')) + self.assertEqual(result.start_date_range_min, original_date.toZone('UTC')) # set new date on supply... supply.edit(start_date_range_min=new_date) @@ -277,9 +277,9 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper, # ...and check supply line result = self.catalog_tool(**kw) - self.assertEquals(1, len(result) ) + self.assertEqual(1, len(result) ) result = result[0] - self.assertEquals(result.start_date_range_min, new_date.toZone('UTC')) + self.assertEqual(result.start_date_range_min, new_date.toZone('UTC')) def test_SupplyLineApplied(self): @@ -317,9 +317,9 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper, supply.validate() supply_line = self._makeSupplyLine(supply) supply_line.setSourceReference('my_source_reference') - self.assertEquals(supply_line.getSourceReference(), 'my_source_reference') + self.assertEqual(supply_line.getSourceReference(), 'my_source_reference') supply_line.setDestinationReference('my_destination_reference') - self.assertEquals(supply_line.getDestinationReference(), 'my_destination_reference') + self.assertEqual(supply_line.getDestinationReference(), 'my_destination_reference') def test_subcontent_reindexing_supply(self): """Tests, that modification on Supply are propagated to children""" diff --git a/product/ERP5/tests/testTask.py b/product/ERP5/tests/testTask.py index 3ddf11002a..794f30020a 100644 --- a/product/ERP5/tests/testTask.py +++ b/product/ERP5/tests/testTask.py @@ -248,7 +248,7 @@ class TestTaskMixin: description="This is a very simple task. You can do it quickly.", specialise=self.business_process) # Check if no task lines are created at the start - self.assertEquals(len(task.contentValues()), 0) + self.assertEqual(len(task.contentValues()), 0) sequence.edit(task=task) def stepCreateCurrency(self, sequence, **kw) : @@ -322,7 +322,7 @@ class TestTaskMixin: title=str(self), specialise=self.business_process) # Check if no task lines are created at the start - self.assertEquals(len(task_report.contentValues()), 0) + self.assertEqual(len(task_report.contentValues()), 0) sequence.edit(task_report = task_report) def stepFillTaskReportWithData(self, sequence=None, sequence_list=None, **kw): @@ -377,28 +377,28 @@ class TestTaskMixin: """ task = sequence.get('task') task_report = sequence.get('task_report') - self.assertEquals('confirmed', task_report.getSimulationState()) - self.assertEquals(task.getSource(), task_report.getSource()) - self.assertEquals(task.getSourceSection(), task_report.getSourceSection()) - self.assertEquals(task.getSourceProject(), task_report.getSourceProject()) - self.assertEquals(task.getDestination(), task_report.getDestination()) - self.assertEquals(task.getDestinationSection(), + self.assertEqual('confirmed', task_report.getSimulationState()) + self.assertEqual(task.getSource(), task_report.getSource()) + self.assertEqual(task.getSourceSection(), task_report.getSourceSection()) + self.assertEqual(task.getSourceProject(), task_report.getSourceProject()) + self.assertEqual(task.getDestination(), task_report.getDestination()) + self.assertEqual(task.getDestinationSection(), task_report.getDestinationSection()) - self.assertEquals(task.getDestinationDecision(), + self.assertEqual(task.getDestinationDecision(), task_report.getDestinationDecision()) - self.assertEquals(task.getTitle(), + self.assertEqual(task.getTitle(), task_report.getTitle()) - self.assertEquals(task.getDescription(), + self.assertEqual(task.getDescription(), task_report.getDescription()) - self.assertEquals(task.getPredecessor(), task_report.getPredecessor()) - self.assertEquals(task.getDescription(), task_report.getDescription()) - self.assertEquals(task.getPriceCurrency(), task_report.getPriceCurrency()) - self.assertEquals(len(task_report.contentValues()), 1) + self.assertEqual(task.getPredecessor(), task_report.getPredecessor()) + self.assertEqual(task.getDescription(), task_report.getDescription()) + self.assertEqual(task.getPriceCurrency(), task_report.getPriceCurrency()) + self.assertEqual(len(task_report.contentValues()), 1) task_report_line = task_report.contentValues()[0] - self.assertEquals(task.getTaskLineResource(), task_report_line.getResource()) - self.assertEquals(task.getTaskLineQuantity(), task_report_line.getQuantity()) - self.assertEquals(task.getTaskLinePrice(), task_report_line.getPrice()) - self.assertEquals(task.getTaskLineRequirement(), + self.assertEqual(task.getTaskLineResource(), task_report_line.getResource()) + self.assertEqual(task.getTaskLineQuantity(), task_report_line.getQuantity()) + self.assertEqual(task.getTaskLinePrice(), task_report_line.getPrice()) + self.assertEqual(task.getTaskLineRequirement(), task_report_line.getRequirement()) def stepCreateTaskLine(self, sequence=None, sequence_list=None, **kw): @@ -434,7 +434,7 @@ class TestTaskMixin: task_report = sequence.get('task_report') task_content_list = task.contentValues() self.assertNotEquals(len(task_content_list), 0) - self.assertEquals(len(task_report.contentValues()), + self.assertEqual(len(task_report.contentValues()), len(task_content_list)) # Task report values not tested @@ -514,30 +514,30 @@ class TestTaskMixin: """ task = sequence.get('task') task_report = sequence.get('task_report') - self.assertEquals('confirmed', task_report.getSimulationState()) - self.assertEquals(task.getSource(), task_report.getSource()) - self.assertEquals(task.getSourceSection(), task_report.getSourceSection()) - self.assertEquals(task.getSourceProject(), task_report.getSourceProject()) - self.assertEquals(task.getDestination(), task_report.getDestination()) - self.assertEquals(task.getDestinationSection(), + self.assertEqual('confirmed', task_report.getSimulationState()) + self.assertEqual(task.getSource(), task_report.getSource()) + self.assertEqual(task.getSourceSection(), task_report.getSourceSection()) + self.assertEqual(task.getSourceProject(), task_report.getSourceProject()) + self.assertEqual(task.getDestination(), task_report.getDestination()) + self.assertEqual(task.getDestinationSection(), task_report.getDestinationSection()) - self.assertEquals(task.getDestinationDecision(), + self.assertEqual(task.getDestinationDecision(), task_report.getDestinationDecision()) - self.assertEquals(task.getTitle(), + self.assertEqual(task.getTitle(), task_report.getTitle()) - self.assertEquals(task.getDescription(), + self.assertEqual(task.getDescription(), task_report.getDescription()) - self.assertEquals(task.getPredecessor(), task_report.getPredecessor()) - self.assertEquals(task.getDescription(), task_report.getDescription()) - self.assertEquals(len(task_report.contentValues()), 2) + self.assertEqual(task.getPredecessor(), task_report.getPredecessor()) + self.assertEqual(task.getDescription(), task_report.getDescription()) + self.assertEqual(len(task_report.contentValues()), 2) for task_report_line in task_report.contentValues(): - self.assertEquals(task.contentValues()[0].getResource(), + self.assertEqual(task.contentValues()[0].getResource(), task_report_line.getResource()) - self.assertEquals(task.contentValues()[0].getQuantity(), + self.assertEqual(task.contentValues()[0].getQuantity(), task_report_line.getQuantity()) - self.assertEquals(task.contentValues()[0].getPrice(), + self.assertEqual(task.contentValues()[0].getPrice(), task_report_line.getPrice()) - self.assertEquals(task.contentValues()[0].getRequirement(), + self.assertEqual(task.contentValues()[0].getRequirement(), task_report_line.getRequirement()) class TestTask(TestTaskMixin, ERP5TypeTestCase): @@ -737,22 +737,22 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase): sequence('CreateResource') (source, destination) = sequence.get('organisation_list') check_result = task.checkConsistency() - self.assertEquals(len(check_result), 4) + self.assertEqual(len(check_result), 4) task.setDestinationValue(destination) task.setSourceValue(source) check_result = task.checkConsistency() - self.assertEquals(len(check_result), 2) + self.assertEqual(len(check_result), 2) task.setStartDate(DateTime()) task.setStopDate(DateTime() + 1) check_result = task.checkConsistency() - self.assertEquals(len(check_result), 1) + self.assertEqual(len(check_result), 1) resource = sequence.get('resource_list')[0] task.edit(task_line_resource_value = resource, task_line_quantity = self.default_quantity, task_line_price = self.default_price, ) check_result = task.checkConsistency() - self.assertEquals(len(check_result), 0) + self.assertEqual(len(check_result), 0) finally: portal_type.setTypePropertySheetList(original_property_sheet_list) diff --git a/product/ERP5/tests/testTaskReportDivergence.py b/product/ERP5/tests/testTaskReportDivergence.py index 2ce6c56df9..52e5cacbb3 100644 --- a/product/ERP5/tests/testTaskReportDivergence.py +++ b/product/ERP5/tests/testTaskReportDivergence.py @@ -48,21 +48,21 @@ class TestTaskReportDivergenceMixin(TestTaskMixin, SecurityTestCase): Test if task report is calculating """ task_report = sequence.get('task_report') - self.assertEquals('calculating', task_report.getCausalityState()) + self.assertEqual('calculating', task_report.getCausalityState()) def stepCheckTaskReportIsDiverged(self, sequence=None, sequence_list=None, **kw): """ Test if task report is in diverged state """ task_report = sequence.get('task_report') - self.assertEquals('diverged', task_report.getCausalityState()) + self.assertEqual('diverged', task_report.getCausalityState()) def stepCheckTaskReportIsSolved(self, sequence=None, sequence_list=None, **kw): """ Test if task report is in solved state """ task_report = sequence.get('task_report') - self.assertEquals('solved', task_report.getCausalityState()) + self.assertEqual('solved', task_report.getCausalityState()) def stepChangeTaskReportLineQuantity(self, sequence=None, sequence_list=None, **kw): @@ -110,7 +110,7 @@ class TestTaskReportDivergenceMixin(TestTaskMixin, SecurityTestCase): def stepChangeCommentOnTaskReport(self, sequence=None, **kw): task_report = sequence.get('task_report') task_report.edit(comment='foo') - self.assertEquals('foo', task_report.getComment()) + self.assertEqual('foo', task_report.getComment()) def stepAcceptDateDecision(self, sequence=None, **kw): task_report = sequence.get('task_report') @@ -132,7 +132,7 @@ class TestTaskReportDivergenceMixin(TestTaskMixin, SecurityTestCase): logical (the comment remains) is true """ task_report = sequence.get('task_report') - self.assertEquals('foo', task_report.getComment()) + self.assertEqual('foo', task_report.getComment()) def stepCloneTaskReportAndDoWfTransitions(self, sequence=None, **kw): """ @@ -143,12 +143,12 @@ class TestTaskReportDivergenceMixin(TestTaskMixin, SecurityTestCase): self.login('alex') cloned_task_report = task_report.Base_createCloneDocument(batch_mode=1) self.tic() - self.assertEquals(cloned_task_report.getCausalityState(), 'draft') - self.assertEquals(cloned_task_report.getSimulationState(), 'draft') + self.assertEqual(cloned_task_report.getCausalityState(), 'draft') + self.assertEqual(cloned_task_report.getSimulationState(), 'draft') self.assertUserCanPassWorkflowTransition('alex', 'confirm_action', cloned_task_report) cloned_task_report.confirm() self.tic() - self.assertEquals(cloned_task_report.getCausalityState(), 'draft') + self.assertEqual(cloned_task_report.getCausalityState(), 'draft') self.assertUserCanPassWorkflowTransition('alex', 'start_action', cloned_task_report) self.assertUserCanPassWorkflowTransition('alex', 'stop_action', cloned_task_report) @@ -300,17 +300,17 @@ class TestTaskReportDivergence(TestTaskReportDivergenceMixin, ERP5TypeTestCase) task_report = sequence.get('task_report') task_line_1 = task_report.contentValues()[0] task_line_2 = task_report.contentValues()[1] - self.assertEquals( + self.assertEqual( sequence.get('task_report_start_date'), task_report.getStartDate()) - self.assertEquals( + self.assertEqual( sequence.get('task_report_stop_date'), task_report.getStopDate()) - self.assertEquals( + self.assertEqual( sequence.get('task_report_line_1_start_date'), task_line_1.getStartDate()) - self.assertEquals( + self.assertEqual( sequence.get('task_report_line_1_stop_date'), task_line_1.getStopDate()) - self.assertEquals( + self.assertEqual( sequence.get('task_report_line_2_start_date'), task_line_2.getStartDate()) - self.assertEquals( + self.assertEqual( sequence.get('task_report_line_2_stop_date'), task_line_2.getStopDate()) @expectedFailure diff --git a/product/ERP5/tests/testTaskReporting.py b/product/ERP5/tests/testTaskReporting.py index d8abf7c24b..3632204302 100644 --- a/product/ERP5/tests/testTaskReporting.py +++ b/product/ERP5/tests/testTaskReporting.py @@ -203,7 +203,7 @@ class TestTaskReporting(TestTaskReportingMixin): report_section_list = self.getReportSectionList( self.portal.project_module.Project_1, 'Project_viewMonthlyReport') - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] @@ -212,7 +212,7 @@ class TestTaskReporting(TestTaskReportingMixin): # 2009-07 3 # Project1 # Project1/Line1 3 - self.assertEquals(3, len(data_line_list)) + self.assertEqual(3, len(data_line_list)) self.checkLineProperties(data_line_list[0], **{'person_module/Person_1': 3.0, }) @@ -295,11 +295,11 @@ class TestTaskReporting(TestTaskReportingMixin): report_section_list = self.getReportSectionList( self.portal.project_module.Project_1, 'Project_viewMonthlyReport') - self.assertEquals(2, len(report_section_list)) + self.assertEqual(2, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(9, len(data_line_list)) + self.assertEqual(9, len(data_line_list)) self.checkLineProperties(data_line_list[0], **{'person_module/Person_1': 3.0, 'person_module/Person_2': 6.5, diff --git a/product/ERP5/tests/testTemplate.py b/product/ERP5/tests/testTemplate.py index 6e454fd58e..234d513a1a 100644 --- a/product/ERP5/tests/testTemplate.py +++ b/product/ERP5/tests/testTemplate.py @@ -169,7 +169,7 @@ class TestTemplate(ERP5TypeTestCase): self.tic() # created preference is reused to store template - self.assertEquals('enabled', user_preference.getPreferenceState()) + self.assertEqual('enabled', user_preference.getPreferenceState()) self.assertEqual(len(user_preference.objectIds()), 1) def test_TemplateCreatePreferenceWithExistingNonAuthorizedPreference(self): @@ -200,8 +200,8 @@ class TestTemplate(ERP5TypeTestCase): preference_id = [x for x in new_preference_id_list if x not in preference_id_list][0] preference = self.portal.portal_preferences._getOb(preference_id) - self.assertEquals('Preference', preference.getPortalType()) - self.assertEquals('enabled', preference.getPreferenceState()) + self.assertEqual('Preference', preference.getPortalType()) + self.assertEqual('enabled', preference.getPreferenceState()) self.assertEqual(len(preference.objectIds()), 1) @@ -261,7 +261,7 @@ class TestTemplate(ERP5TypeTestCase): self.tic() # created preference is reused to store template - self.assertEquals('enabled', user_preference.getPreferenceState()) + self.assertEqual('enabled', user_preference.getPreferenceState()) self.assertEqual(len(user_preference.objectIds()), 1) def test_TemplateCreatePreference(self): @@ -269,7 +269,7 @@ class TestTemplate(ERP5TypeTestCase): active_user_preference_list = [p for p in self.portal.portal_preferences._getSortedPreferenceList() if p.getPriority() == Priority.USER] - self.assertEquals([], active_user_preference_list) + self.assertEqual([], active_user_preference_list) preference_id_list = list(self.portal.portal_preferences.objectIds()) document = self.portal.foo_module.newContent(portal_type='Foo') @@ -284,10 +284,10 @@ class TestTemplate(ERP5TypeTestCase): preference_id = [x for x in new_preference_id_list if x not in preference_id_list][0] preference = self.portal.portal_preferences._getOb(preference_id) - self.assertEquals('Preference', preference.getPortalType()) - self.assertEquals('Document Template Container', preference.getTitle()) - self.assertEquals(Priority.USER, preference.getPriority()) - self.assertEquals('enabled', preference.getPreferenceState()) + self.assertEqual('Preference', preference.getPortalType()) + self.assertEqual('Document Template Container', preference.getTitle()) + self.assertEqual(Priority.USER, preference.getPriority()) + self.assertEqual('enabled', preference.getPreferenceState()) self.assertEqual(len(preference.objectIds()), 1) @@ -308,7 +308,7 @@ class TestTemplate(ERP5TypeTestCase): active_user_preference_list = [p for p in self.portal.portal_preferences._getSortedPreferenceList() if p.getPriority() == Priority.USER] - self.assertEquals([], active_user_preference_list) + self.assertEqual([], active_user_preference_list) preference_id_list = list(self.portal.portal_preferences.objectIds()) @@ -332,8 +332,8 @@ class TestTemplate(ERP5TypeTestCase): preference_id_list][0] preference = self.portal.portal_preferences._getOb(preference_id) - self.assertEquals('Preference', preference.getPortalType()) - self.assertEquals('enabled', preference.getPreferenceState()) + self.assertEqual('Preference', preference.getPortalType()) + self.assertEqual('enabled', preference.getPreferenceState()) self.assertEqual(len(preference.objectIds()), 2) def _testTemplateNotIndexable(self, document, additional_role_list=[]): @@ -362,9 +362,9 @@ class TestTemplate(ERP5TypeTestCase): self.assertFalse(template.isIndexable) # Because they are not indexable, they cannot be found by catalog - self.assertEquals(0, len(self.portal.portal_catalog(uid=template.getUid()))) + self.assertEqual(0, len(self.portal.portal_catalog(uid=template.getUid()))) template_line = template.objectValues()[0] - self.assertEquals(0, + self.assertEqual(0, len(self.portal.portal_catalog(uid=template_line.getUid()))) # change the title, because creating another template with same title will diff --git a/product/ERP5/tests/testTemplateTool.py b/product/ERP5/tests/testTemplateTool.py index 542f8b144a..149d460b25 100644 --- a/product/ERP5/tests/testTemplateTool.py +++ b/product/ERP5/tests/testTemplateTool.py @@ -94,13 +94,13 @@ class TestTemplateTool(ERP5TypeTestCase): def checkFolderReindexAllActivityNotPresent(self): message_list = [m for m in self.portal.portal_activities.getMessageList() if m.method_id == 'Folder_reindexAll'] - self.assertEquals(len(message_list), 0) + self.assertEqual(len(message_list), 0) def testUpdateBT5FromRepository(self, quiet=quiet, run=run_all_test): """ Test the list of bt5 returned for upgrade """ # edit bt5 revision so that it will be marked as updatable bt_list = self.templates_tool.searchFolder(title='erp5_base') - self.assertEquals(len(bt_list), 1) + self.assertEqual(len(bt_list), 1) erp5_base = bt_list[0].getObject() try: erp5_base.edit(revision=0) @@ -122,8 +122,8 @@ class TestTemplateTool(ERP5TypeTestCase): def test_download_http(self): test_web = self.portal.portal_templates.download( 'http://www.erp5.org/dists/snapshot/test_bt5/test_web.bt5') - self.assertEquals(test_web.getPortalType(), 'Business Template') - self.assertEquals(test_web.getTitle(), 'test_web') + self.assertEqual(test_web.getPortalType(), 'Business Template') + self.assertEqual(test_web.getTitle(), 'test_web') self.assertTrue(test_web.getRevision()) def _svn_setup_ssl(self): @@ -146,8 +146,8 @@ class TestTemplateTool(ERP5TypeTestCase): self._svn_setup_ssl() bt5_url = 'https://svn.erp5.org/repos/public/erp5/trunk/bt5/test_web' test_web = self.portal.portal_templates.download(bt5_url) - self.assertEquals(test_web.getPortalType(), 'Business Template') - self.assertEquals(test_web.getTitle(), 'test_web') + self.assertEqual(test_web.getPortalType(), 'Business Template') + self.assertEqual(test_web.getTitle(), 'test_web') self.assertTrue(test_web.getRevision()) def test_updateBusinessTemplateFromUrl_simple(self): @@ -166,7 +166,7 @@ class TestTemplateTool(ERP5TypeTestCase): template_tool.updateBusinessTemplateFromUrl(url) new_bt = template_tool.getInstalledBusinessTemplate('erp5_csv_style') self.assertNotEquals(old_bt, new_bt) - self.assertEquals('erp5_csv_style', new_bt.getTitle()) + self.assertEqual('erp5_csv_style', new_bt.getTitle()) # Test Another time with definning an ID old_bt = new_bt @@ -174,22 +174,22 @@ class TestTemplateTool(ERP5TypeTestCase): template_tool.updateBusinessTemplateFromUrl(url, id="new_erp5_csv_style") new_bt = template_tool.getInstalledBusinessTemplate('erp5_csv_style') self.assertNotEquals(old_bt, new_bt) - self.assertEquals('erp5_csv_style', new_bt.getTitle()) - self.assertEquals('new_erp5_csv_style', new_bt.getId()) + self.assertEqual('erp5_csv_style', new_bt.getTitle()) + self.assertEqual('new_erp5_csv_style', new_bt.getId()) # Test if the new instance with same revision is not installed. old_bt = new_bt template_tool.updateBusinessTemplateFromUrl(url, id="not_installed_bt5") new_bt = template_tool.getInstalledBusinessTemplate('erp5_csv_style') - self.assertEquals(old_bt, new_bt) - self.assertEquals('erp5_csv_style', new_bt.getTitle()) - self.assertEquals('new_erp5_csv_style', new_bt.getId()) + self.assertEqual(old_bt, new_bt) + self.assertEqual('erp5_csv_style', new_bt.getTitle()) + self.assertEqual('new_erp5_csv_style', new_bt.getId()) not_installed_bt5 = getattr(template_tool, "not_installed_bt5", None) self.assertNotEquals(not_installed_bt5, None) - self.assertEquals('erp5_csv_style', not_installed_bt5.getTitle()) - self.assertEquals(not_installed_bt5.getInstallationState(), + self.assertEqual('erp5_csv_style', not_installed_bt5.getTitle()) + self.assertEqual(not_installed_bt5.getInstallationState(), "not_installed") - self.assertEquals(not_installed_bt5.getRevision(), new_bt.getRevision()) + self.assertEqual(not_installed_bt5.getRevision(), new_bt.getRevision()) def test_updateBusinessTemplateFromUrl_keep_list(self): """ @@ -207,7 +207,7 @@ class TestTemplateTool(ERP5TypeTestCase): erp5_test = getattr(self.portal.portal_skins, 'erp5_test', None) self.assertNotEquals(None, erp5_test) test_file = getattr(erp5_test, 'test_file', None) - self.assertEquals(None, test_file) + self.assertEqual(None, test_file) def test_updateBusinessTemplateFromUrl_after_before_script(self): """ @@ -244,15 +244,15 @@ class TestTemplateTool(ERP5TypeTestCase): after_triggered_bt5_id_list=after_triggered_bt5_id_list) bt = template_tool.getInstalledBusinessTemplate('test_html_style') self.assertNotEquals(None, bt) - self.assertEquals(bt.getDescription(), 'MODIFIED') - self.assertEquals(bt.getChangeLog(), 'MODIFIED') - self.assertEquals(portal.getTitle(), 'MODIFIED') + self.assertEqual(bt.getDescription(), 'MODIFIED') + self.assertEqual(bt.getChangeLog(), 'MODIFIED') + self.assertEqual(portal.getTitle(), 'MODIFIED') def test_updateBusinessTemplateFromUrl_stringCastingBug(self): pt = self.getTemplateTool() template = pt.newContent(portal_type='Business Template') - self.failUnless(template.getBuildingState() == 'draft') - self.failUnless(template.getInstallationState() == 'not_installed') + self.assertTrue(template.getBuildingState() == 'draft') + self.assertTrue(template.getInstallationState() == 'not_installed') title = 'install_casting_to_int_bug_check' template.edit(title=title, version='1.0', @@ -268,7 +268,7 @@ class TestTemplateTool(ERP5TypeTestCase): if os.path.exists(template_path): shutil.rmtree(template_path) template.export(path=template_path, local=1) - self.failUnless(os.path.exists(template_path)) + self.assertTrue(os.path.exists(template_path)) # setup version '9' first_revision = '9' @@ -293,15 +293,15 @@ class TestTemplateTool(ERP5TypeTestCase): def test_CompareVersions(self): """Tests compare version on template tool. """ compareVersions = self.getPortal().portal_templates.compareVersions - self.assertEquals(0, compareVersions('1', '1')) - self.assertEquals(0, compareVersions('1.2', '1.2')) - self.assertEquals(0, compareVersions('1.2rc3', '1.2rc3')) - self.assertEquals(0, compareVersions('1.0.0', '1.0')) + self.assertEqual(0, compareVersions('1', '1')) + self.assertEqual(0, compareVersions('1.2', '1.2')) + self.assertEqual(0, compareVersions('1.2rc3', '1.2rc3')) + self.assertEqual(0, compareVersions('1.0.0', '1.0')) - self.assertEquals(-1, compareVersions('1.0', '1.0.1')) - self.assertEquals(-1, compareVersions('1.0rc1', '1.0')) - self.assertEquals(-1, compareVersions('1.0a', '1.0.1')) - self.assertEquals(-1, compareVersions('1.1', '2.0')) + self.assertEqual(-1, compareVersions('1.0', '1.0.1')) + self.assertEqual(-1, compareVersions('1.0rc1', '1.0')) + self.assertEqual(-1, compareVersions('1.0a', '1.0.1')) + self.assertEqual(-1, compareVersions('1.1', '2.0')) def test_CompareVersionStrings(self): """Test compareVersionStrings on template tool""" @@ -317,14 +317,14 @@ class TestTemplateTool(ERP5TypeTestCase): self.assertNotEquals(None, self.getPortal()\ .portal_templates.getInstalledBusinessTemplate('erp5_core')) - self.assertEquals(None, self.getPortal()\ + self.assertEqual(None, self.getPortal()\ .portal_templates.getInstalledBusinessTemplate('erp5_toto')) def test_getInstalledBusinessTemplateRevision(self): self.assertTrue(300 < self.getPortal()\ .portal_templates.getInstalledBusinessTemplateRevision('erp5_core')) - self.assertEquals(None, self.getPortal()\ + self.assertEqual(None, self.getPortal()\ .portal_templates.getInstalledBusinessTemplateRevision('erp5_toto')) def test_getInstalledBusinessTemplateList(self): @@ -332,11 +332,11 @@ class TestTemplateTool(ERP5TypeTestCase): bt5_list = templates_tool.getInstalledBusinessTemplateList() another_bt_list = [i for i in templates_tool.contentValues() \ if i.getInstallationState() == 'installed'] - self.assertEquals(len(bt5_list), len(another_bt_list)) + self.assertEqual(len(bt5_list), len(another_bt_list)) for bt in bt5_list: - self.failUnless(bt in another_bt_list) + self.assertTrue(bt in another_bt_list) - self.assertEquals(bt5_list, + self.assertEqual(bt5_list, templates_tool._getInstalledBusinessTemplateList()) def test_getInstalledBusinessTemplateTitleList(self): @@ -346,13 +346,13 @@ class TestTemplateTool(ERP5TypeTestCase): if i.getInstallationState() == 'installed'] bt5_list.sort() another_bt_list.sort() - self.assertEquals(bt5_list, another_bt_list) + self.assertEqual(bt5_list, another_bt_list) for bt in bt5_list: - self.failUnless(bt in another_bt_list) + self.assertTrue(bt in another_bt_list) new_list = templates_tool._getInstalledBusinessTemplateList(only_title=1) new_list.sort() - self.assertEquals(bt5_list, new_list) + self.assertEqual(bt5_list, new_list) def test_getBusinessTemplateUrl(self): """ Test if this method can find which repository is the business @@ -371,25 +371,25 @@ class TestTemplateTool(ERP5TypeTestCase): getBusinessTemplateUrl = template_tool.getBusinessTemplateUrl # Test Exists - self.assertEquals(getBusinessTemplateUrl(url_list, exist_bt5), + self.assertEqual(getBusinessTemplateUrl(url_list, exist_bt5), 'https://svn.erp5.org/repos/public/erp5/trunk/bt5/erp5_base') - self.assertEquals(getBusinessTemplateUrl(url_list[1:], exist_bt5), + self.assertEqual(getBusinessTemplateUrl(url_list[1:], exist_bt5), 'http://www.erp5.org/dists/snapshot/bt5/erp5_base.bt5') - self.assertEquals(getBusinessTemplateUrl(url_list[2:], exist_bt5), + self.assertEqual(getBusinessTemplateUrl(url_list[2:], exist_bt5), 'http://www.erp5.org/dists/release/5.4.5/bt5/erp5_base.bt5') INSTANCE_HOME = getConfiguration().instancehome local_bt = None if os.path.exists(INSTANCE_HOME + "/bt5/erp5_base"): local_bt = 'file://' + INSTANCE_HOME + "/bt5/erp5_base" - self.assertEquals(getBusinessTemplateUrl(url_list[3:], exist_bt5), local_bt) - self.assertEquals(getBusinessTemplateUrl(url_list[4:], exist_bt5), None) + self.assertEqual(getBusinessTemplateUrl(url_list[3:], exist_bt5), local_bt) + self.assertEqual(getBusinessTemplateUrl(url_list[4:], exist_bt5), None) # Test Not exists - self.assertEquals(getBusinessTemplateUrl(url_list, not_exist_bt5), None) - self.assertEquals(getBusinessTemplateUrl(url_list[1:], not_exist_bt5), None) - self.assertEquals(getBusinessTemplateUrl(url_list[2:], not_exist_bt5), None) - self.assertEquals(getBusinessTemplateUrl(url_list[3:], not_exist_bt5), None) - self.assertEquals(getBusinessTemplateUrl(url_list[4:], not_exist_bt5), None) + self.assertEqual(getBusinessTemplateUrl(url_list, not_exist_bt5), None) + self.assertEqual(getBusinessTemplateUrl(url_list[1:], not_exist_bt5), None) + self.assertEqual(getBusinessTemplateUrl(url_list[2:], not_exist_bt5), None) + self.assertEqual(getBusinessTemplateUrl(url_list[3:], not_exist_bt5), None) + self.assertEqual(getBusinessTemplateUrl(url_list[4:], not_exist_bt5), None) def test_resolveBusinessTemplateListDependency(self): """ Test API able to return a complete list of bt5s to setup a sub set of @@ -426,19 +426,19 @@ class TestTemplateTool(ERP5TypeTestCase): bt5_id_list = ['baz'] bt5_list = template_tool.resolveBusinessTemplateListDependency(bt5_id_list) - self.assertEquals([(repository, 'foo.bt5'), + self.assertEqual([(repository, 'foo.bt5'), (repository, 'bar.bt5'), (repository, 'baz.bt5')], bt5_list) bt5_id_list = ['foo'] bt5_list = template_tool.resolveBusinessTemplateListDependency( bt5_id_list) - self.assertEquals([(repository, 'foo.bt5')], bt5_list) + self.assertEqual([(repository, 'foo.bt5')], bt5_list) bt5_id_list = ['biz', 'end'] bt5_list = template_tool.resolveBusinessTemplateListDependency(bt5_id_list) - self.assertEquals([(repository, 'foo.bt5'), + self.assertEqual([(repository, 'foo.bt5'), (repository, 'a.bt5'), (repository, 'bar.bt5'), (repository, 'b.bt5'), @@ -466,18 +466,18 @@ class TestTemplateTool(ERP5TypeTestCase): bt5_name = 'erp5_odt_style' self.tic() bt = self.templates_tool.getInstalledBusinessTemplate(bt5_name, strict=True) - self.assertEquals(bt, None) + self.assertEqual(bt, None) operation_log = \ self.templates_tool.installBusinessTemplateListFromRepository([bt5_name]) self.assertTrue("Installed %s with" % bt5_name in operation_log[-1]) bt = self.templates_tool.getInstalledBusinessTemplate(bt5_name, strict=True) self.assertNotEquals(bt, None) - self.assertEquals(bt.getTitle(), bt5_name) + self.assertEqual(bt.getTitle(), bt5_name) # Repeat operation, the bt5 should be ignored self.templates_tool.installBusinessTemplateListFromRepository([bt5_name]) bt_old = self.templates_tool.getInstalledBusinessTemplate(bt5_name, strict=True) - self.assertEquals(bt.getId(), bt_old.getId()) + self.assertEqual(bt.getId(), bt_old.getId()) # Repeat operation, new bt5 should be inslalled due only_newer = False operation_log = self.templates_tool.installBusinessTemplateListFromRepository( @@ -496,7 +496,7 @@ class TestTemplateTool(ERP5TypeTestCase): template_tool = self.portal.portal_templates self.tic() bt = template_tool.getInstalledBusinessTemplate(bt5_name) - self.assertEquals(bt, None) + self.assertEqual(bt, None) operation_log = template_tool.installBusinessTemplateListFromRepository([bt5_name], only_newer=False, update_catalog=0) @@ -517,7 +517,7 @@ class TestTemplateTool(ERP5TypeTestCase): only_newer=False, update_catalog=1) self.assertTrue("Installed %s with" % bt5_name in operation_log[-1]) bt = template_tool.getInstalledBusinessTemplate(bt5_name) - self.assertEquals(bt.getTitle(), bt5_name) + self.assertEqual(bt.getTitle(), bt5_name) self.commit() self.checkFolderReindexAllActivityPresense() self.tic() @@ -528,7 +528,7 @@ class TestTemplateTool(ERP5TypeTestCase): self.assertTrue("Installed %s with" % bt5_name in operation_log[-1]) bt = template_tool.getInstalledBusinessTemplate(bt5_name) self.assertNotEquals(bt, None) - self.assertEquals(bt.getTitle(), bt5_name) + self.assertEqual(bt.getTitle(), bt5_name) self.commit() self.checkFolderReindexAllActivityNotPresent() self.tic() @@ -548,20 +548,20 @@ class TestTemplateTool(ERP5TypeTestCase): self.tic() for bt5_name in bt5_name_list: bt = self.templates_tool.getInstalledBusinessTemplate(bt5_name) - self.assertEquals(bt, None) + self.assertEqual(bt, None) self.templates_tool.installBusinessTemplateListFromRepository( bt5_name_list, activate=True) for bt5_name in bt5_name_list: bt = self.templates_tool.getInstalledBusinessTemplate(bt5_name) - self.assertEquals(bt, None) + self.assertEqual(bt, None) self.tic() for bt5_name in bt5_name_list: bt = self.templates_tool.getInstalledBusinessTemplate(bt5_name) self.assertNotEquals(bt, None) - self.assertEquals(bt.getTitle(), bt5_name) + self.assertEqual(bt.getTitle(), bt5_name) def test_installBusinessTemplatesFromRepository_install_dependency(self): """Test if dependencies are automatically installed properly @@ -576,12 +576,12 @@ class TestTemplateTool(ERP5TypeTestCase): self.tic() for bt5_name in bt5_name_list: bt = template_tool.getInstalledBusinessTemplate(bt5_name) - self.assertEquals(bt, None) + self.assertEqual(bt, None) bt = template_tool.getInstalledBusinessTemplate("erp5_configurator") - self.assertEquals(bt, None) + self.assertEqual(bt, None) bt = template_tool.getInstalledBusinessTemplate("erp5_workflow") - self.assertEquals(bt, None) + self.assertEqual(bt, None) self.assertRaises(BusinessTemplateMissingDependency, template_tool.installBusinessTemplateListFromRepository, @@ -594,7 +594,7 @@ class TestTemplateTool(ERP5TypeTestCase): for bt5_name in bt5_name_list: bt = template_tool.getInstalledBusinessTemplate(bt5_name) - self.assertEquals(bt, None) + self.assertEqual(bt, None) dependency_list = template_tool.getDependencyList( (repository, bt5_name)) self.assertNotEquals(dependency_list, []) diff --git a/product/ERP5/tests/testTradeCondition.py b/product/ERP5/tests/testTradeCondition.py index ea0d5aa274..4dd1001b0b 100644 --- a/product/ERP5/tests/testTradeCondition.py +++ b/product/ERP5/tests/testTradeCondition.py @@ -109,11 +109,11 @@ class TestApplyTradeCondition(TradeConditionTestCase): self.order.Order_applyTradeCondition(self.trade_condition, force=1) - self.assertEquals(self.vendor, self.order.getSourceSectionValue()) - self.assertEquals(self.vendor, self.order.getSourceValue()) - self.assertEquals(self.client, self.order.getDestinationSectionValue()) - self.assertEquals(self.client, self.order.getDestinationValue()) - self.assertEquals(self.currency, self.order.getPriceCurrencyValue()) + self.assertEqual(self.vendor, self.order.getSourceSectionValue()) + self.assertEqual(self.vendor, self.order.getSourceValue()) + self.assertEqual(self.client, self.order.getDestinationSectionValue()) + self.assertEqual(self.client, self.order.getDestinationValue()) + self.assertEqual(self.currency, self.order.getPriceCurrencyValue()) def test_apply_trade_condition_keep_categories(self): # source section & source are set on the order, not on the TC @@ -130,11 +130,11 @@ class TestApplyTradeCondition(TradeConditionTestCase): self.order.Order_applyTradeCondition(self.trade_condition, force=1) # Applying the TC keeps values on the order - self.assertEquals(self.vendor, self.order.getSourceSectionValue()) - self.assertEquals(self.vendor, self.order.getSourceValue()) - self.assertEquals(self.client, self.order.getDestinationSectionValue()) - self.assertEquals(self.client, self.order.getDestinationValue()) - self.assertEquals(self.currency, self.order.getPriceCurrencyValue()) + self.assertEqual(self.vendor, self.order.getSourceSectionValue()) + self.assertEqual(self.vendor, self.order.getSourceValue()) + self.assertEqual(self.client, self.order.getDestinationSectionValue()) + self.assertEqual(self.client, self.order.getDestinationValue()) + self.assertEqual(self.currency, self.order.getPriceCurrencyValue()) def test_apply_trade_condition_set_categories_with_hierarchy(self): trade_condition_source = self.trade_condition_module.newContent( @@ -155,11 +155,11 @@ class TestApplyTradeCondition(TradeConditionTestCase): self.order.Order_applyTradeCondition(self.trade_condition, force=1) - self.assertEquals(self.vendor, self.order.getSourceSectionValue()) - self.assertEquals(self.vendor, self.order.getSourceValue()) - self.assertEquals(self.client, self.order.getDestinationSectionValue()) - self.assertEquals(self.client, self.order.getDestinationValue()) - self.assertEquals(self.currency, self.order.getPriceCurrencyValue()) + self.assertEqual(self.vendor, self.order.getSourceSectionValue()) + self.assertEqual(self.vendor, self.order.getSourceValue()) + self.assertEqual(self.client, self.order.getDestinationSectionValue()) + self.assertEqual(self.client, self.order.getDestinationValue()) + self.assertEqual(self.currency, self.order.getPriceCurrencyValue()) def test_apply_trade_condition_copy_subobjects(self): self.trade_condition.setPaymentConditionTradeDate('custom') @@ -168,8 +168,8 @@ class TestApplyTradeCondition(TradeConditionTestCase): self.order.Order_applyTradeCondition(self.trade_condition, force=1) - self.assertEquals('custom', self.order.getPaymentConditionTradeDate()) - self.assertEquals(DateTime(2001, 01, 01), + self.assertEqual('custom', self.order.getPaymentConditionTradeDate()) + self.assertEqual(DateTime(2001, 01, 01), self.order.getPaymentConditionPaymentDate()) def test_apply_twice_trade_condition_copy_subobjects(self): @@ -178,13 +178,13 @@ class TestApplyTradeCondition(TradeConditionTestCase): self.order.setSpecialiseValue(self.trade_condition) self.order.Order_applyTradeCondition(self.trade_condition, force=1) - self.assertEquals(1, len(self.order.contentValues( + self.assertEqual(1, len(self.order.contentValues( portal_type='Payment Condition'))) - self.assertEquals('custom', self.order.getPaymentConditionTradeDate()) - self.assertEquals(DateTime(2001, 01, 01), + self.assertEqual('custom', self.order.getPaymentConditionTradeDate()) + self.assertEqual(DateTime(2001, 01, 01), self.order.getPaymentConditionPaymentDate()) self.order.Order_applyTradeCondition(self.trade_condition, force=1) - self.assertEquals(1, len(self.order.contentValues( + self.assertEqual(1, len(self.order.contentValues( portal_type='Payment Condition'))) def test_apply_trade_condition_copy_subobjects_with_hierarchy(self): @@ -200,8 +200,8 @@ class TestApplyTradeCondition(TradeConditionTestCase): self.order.Order_applyTradeCondition(self.trade_condition, force=1) - self.assertEquals('custom', self.order.getPaymentConditionTradeDate()) - self.assertEquals(DateTime(2001, 01, 01), + self.assertEqual('custom', self.order.getPaymentConditionTradeDate()) + self.assertEqual(DateTime(2001, 01, 01), self.order.getPaymentConditionPaymentDate()) def test_apply_trade_condition_twice_update_order(self): @@ -216,13 +216,13 @@ class TestApplyTradeCondition(TradeConditionTestCase): self.order.Order_applyTradeCondition(self.trade_condition, force=1) - self.assertEquals(self.vendor, self.order.getSourceSectionValue()) - self.assertEquals(self.vendor, self.order.getSourceValue()) - self.assertEquals(self.client, self.order.getDestinationSectionValue()) - self.assertEquals(self.client, self.order.getDestinationValue()) - self.assertEquals(self.currency, self.order.getPriceCurrencyValue()) - self.assertEquals('custom', self.order.getPaymentConditionTradeDate()) - self.assertEquals(DateTime(2001, 01, 01), + self.assertEqual(self.vendor, self.order.getSourceSectionValue()) + self.assertEqual(self.vendor, self.order.getSourceValue()) + self.assertEqual(self.client, self.order.getDestinationSectionValue()) + self.assertEqual(self.client, self.order.getDestinationValue()) + self.assertEqual(self.currency, self.order.getPriceCurrencyValue()) + self.assertEqual('custom', self.order.getPaymentConditionTradeDate()) + self.assertEqual(DateTime(2001, 01, 01), self.order.getPaymentConditionPaymentDate()) new_vendor = self.portal.organisation_module.newContent( @@ -235,13 +235,13 @@ class TestApplyTradeCondition(TradeConditionTestCase): payment_condition_payment_date=DateTime(2002, 2, 2)) self.order.Order_applyTradeCondition(new_trade_condition, force=1) - self.assertEquals(new_vendor, self.order.getSourceSectionValue()) - self.assertEquals(self.vendor, self.order.getSourceValue()) - self.assertEquals(self.client, self.order.getDestinationSectionValue()) - self.assertEquals(self.client, self.order.getDestinationValue()) - self.assertEquals(self.currency, self.order.getPriceCurrencyValue()) - self.assertEquals('custom', self.order.getPaymentConditionTradeDate()) - self.assertEquals(DateTime(2002, 02, 02), + self.assertEqual(new_vendor, self.order.getSourceSectionValue()) + self.assertEqual(self.vendor, self.order.getSourceValue()) + self.assertEqual(self.client, self.order.getDestinationSectionValue()) + self.assertEqual(self.client, self.order.getDestinationValue()) + self.assertEqual(self.currency, self.order.getPriceCurrencyValue()) + self.assertEqual('custom', self.order.getPaymentConditionTradeDate()) + self.assertEqual(DateTime(2002, 02, 02), self.order.getPaymentConditionPaymentDate()) @@ -259,11 +259,11 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase): supply_line = self.trade_condition.newContent( portal_type=self.supply_line_type) - self.assertEquals(self.vendor, supply_line.getSourceValue()) - self.assertEquals(self.vendor, supply_line.getSourceSectionValue()) - self.assertEquals(self.client, supply_line.getDestinationValue()) - self.assertEquals(self.client, supply_line.getDestinationSectionValue()) - self.assertEquals(self.currency, supply_line.getPriceCurrencyValue()) + self.assertEqual(self.vendor, supply_line.getSourceValue()) + self.assertEqual(self.vendor, supply_line.getSourceSectionValue()) + self.assertEqual(self.client, supply_line.getDestinationValue()) + self.assertEqual(self.client, supply_line.getDestinationSectionValue()) + self.assertEqual(self.currency, supply_line.getPriceCurrencyValue()) def test_movement_price_assignment(self): # supply line from the trade condition apply to the movements in order @@ -279,7 +279,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase): line = self.order.newContent(portal_type=self.order_line_type, resource_value=self.resource, quantity=1) - self.assertEquals(123, line.getPrice()) + self.assertEqual(123, line.getPrice()) def test_supply_line_priority(self): # supply lines from related trade condition should have priority over @@ -306,7 +306,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase): resource_value=self.resource, quantity=1) # using the supply line inside trade condition - self.assertEquals(2, line.getPrice()) + self.assertEqual(2, line.getPrice()) def test_supply_cell_priority(self): # supply lines from related trade condition should have priority over @@ -351,7 +351,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase): line = self.order.newContent(portal_type=self.order_line_type, resource_value=self.variated_resource,) - self.assertEquals(None, line.getPrice()) + self.assertEqual(None, line.getPrice()) line.setVariationBaseCategoryList(['size']) line.setVariationCategoryList(['size/small']) line.updateCellRange(base_id='movement') @@ -359,7 +359,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase): cell = line.newCell(base_id='movement', *['size/small']) cell.setQuantity(1) - self.assertEquals(2, cell.getPrice()) + self.assertEqual(2, cell.getPrice()) def test_supply_line_in_invalidated_trade_condition_does_not_apply(self): # supply lines from supply modules @@ -387,7 +387,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase): resource_value=self.resource, quantity=1) # not using the supply line inside trade condition - self.assertEquals(1, line.getPrice()) + self.assertEqual(1, line.getPrice()) # TODO: move to testSupplyLine ! (which does not exist yet) def test_supply_line_section(self): @@ -422,7 +422,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase): resource_value=self.resource, quantity=1) # using the supply line with section defined - self.assertEquals(2, line.getPrice()) + self.assertEqual(2, line.getPrice()) class TestEffectiveTradeCondition(TradeConditionTestCase): @@ -449,7 +449,7 @@ class TestEffectiveTradeCondition(TradeConditionTestCase): version='002') self.tic() - self.assertEquals(other_trade_condition, + self.assertEqual(other_trade_condition, self.trade_condition.getEffectiveModel( start_date=DateTime('2009/06/01'), stop_date=DateTime('2009/06/01'))) @@ -470,7 +470,7 @@ class TestEffectiveTradeCondition(TradeConditionTestCase): self.trade_condition.setEffectiveDate('2009/01/01') self.trade_condition.setExpirationDate('2009/12/31') self.tic() - self.assertEquals(self.trade_condition, + self.assertEqual(self.trade_condition, self.trade_condition.getEffectiveModel( start_date=DateTime('2009/06/01'), stop_date=DateTime('2009/06/01'))) @@ -481,7 +481,7 @@ class TestEffectiveTradeCondition(TradeConditionTestCase): self.trade_condition.setEffectiveDate(None) self.trade_condition.setExpirationDate(None) self.tic() - self.assertEquals(self.trade_condition, + self.assertEqual(self.trade_condition, self.trade_condition.getEffectiveModel( start_date=DateTime('2009/06/01'), stop_date=DateTime('2009/06/01'))) @@ -489,7 +489,7 @@ class TestEffectiveTradeCondition(TradeConditionTestCase): self.trade_condition.setEffectiveDate(None) self.trade_condition.setExpirationDate('2009/12/31') self.tic() - self.assertEquals(self.trade_condition, + self.assertEqual(self.trade_condition, self.trade_condition.getEffectiveModel( start_date=DateTime('2009/06/01'), stop_date=DateTime('2009/06/01'))) @@ -497,7 +497,7 @@ class TestEffectiveTradeCondition(TradeConditionTestCase): self.trade_condition.setEffectiveDate('2009/01/01') self.trade_condition.setExpirationDate(None) self.tic() - self.assertEquals(self.trade_condition, + self.assertEqual(self.trade_condition, self.trade_condition.getEffectiveModel( start_date=DateTime('2009/06/01'), stop_date=DateTime('2009/06/01'))) @@ -505,9 +505,9 @@ class TestEffectiveTradeCondition(TradeConditionTestCase): def test_getEffectiveModel_return_self_when_no_reference(self): # when no reference defined, getEffectiveModel returns the trade condition. self.trade_condition.setReference(None) - self.assertEquals(self.trade_condition, + self.assertEqual(self.trade_condition, self.trade_condition.getEffectiveModel()) - self.assertEquals(self.trade_condition, + self.assertEqual(self.trade_condition, self.trade_condition.getEffectiveModel(start_date=DateTime(), stop_date=DateTime())) diff --git a/product/ERP5/tests/testTradeModelLine.py b/product/ERP5/tests/testTradeModelLine.py index dc4476d0cb..689caff5b9 100644 --- a/product/ERP5/tests/testTradeModelLine.py +++ b/product/ERP5/tests/testTradeModelLine.py @@ -469,7 +469,7 @@ class TestTradeModelLine(TestTradeModelLineMixin): str(rounded_total_price + rounded_tax_price + rounded_discount_price)) self.assertEqual(str(abs(line_dict['vat'])), str(rounded_tax_price)) - self.assertEquals(str(abs(line_dict['income_expense'])), + self.assertEqual(str(abs(line_dict['income_expense'])), str(rounded_total_price + rounded_discount_price)) def buildPackingLists(self): @@ -911,7 +911,7 @@ return lambda *args, **kw: 1""") packing_list = order.getCausalityRelatedValue( portal_type=self.packing_list_portal_type) self.assertNotEquals(packing_list, None) - self.assertEquals(1000, packing_list.getTotalPrice()) + self.assertEqual(1000, packing_list.getTotalPrice()) packing_list.start() packing_list.stop() @@ -922,41 +922,41 @@ return lambda *args, **kw: 1""") invoice = packing_list.getCausalityRelatedValue( portal_type=self.invoice_portal_type) self.assertNotEquals(invoice, None) - self.assertEquals(2, len(invoice.getMovementList())) - self.assertEquals(1150, invoice.getTotalPrice()) - self.assertEquals([], invoice.getDivergenceList()) + self.assertEqual(2, len(invoice.getMovementList())) + self.assertEqual(1150, invoice.getTotalPrice()) + self.assertEqual([], invoice.getDivergenceList()) invoice.start() self.tic() - self.assertEquals([], invoice.getDivergenceList()) + self.assertEqual([], invoice.getDivergenceList()) accounting_line_list = invoice.getMovementList( portal_type=self.invoice_transaction_line_portal_type) - self.assertEquals(3, len(accounting_line_list)) + self.assertEqual(3, len(accounting_line_list)) receivable_movement_list = [m for m in accounting_line_list if m.getSourceValue() == self.receivable_account] - self.assertEquals(1, len(receivable_movement_list)) + self.assertEqual(1, len(receivable_movement_list)) receivable_movement = receivable_movement_list[0] - self.assertEquals(receivable_movement.getDestinationValue(), + self.assertEqual(receivable_movement.getDestinationValue(), self.payable_account) - self.assertEquals(1150, receivable_movement.getSourceDebit()) + self.assertEqual(1150, receivable_movement.getSourceDebit()) collected_movement_list = [m for m in accounting_line_list if m.getSourceValue() == self.collected_tax_account] - self.assertEquals(1, len(collected_movement_list)) + self.assertEqual(1, len(collected_movement_list)) collected_movement = collected_movement_list[0] - self.assertEquals(collected_movement.getDestinationValue(), + self.assertEqual(collected_movement.getDestinationValue(), self.refundable_tax_account) - self.assertEquals(150, collected_movement.getSourceCredit()) + self.assertEqual(150, collected_movement.getSourceCredit()) income_movement_list = [m for m in accounting_line_list if m.getSourceValue() == self.income_account] - self.assertEquals(1, len(income_movement_list)) + self.assertEqual(1, len(income_movement_list)) income_movement = income_movement_list[0] - self.assertEquals(income_movement.getDestinationValue(), + self.assertEqual(income_movement.getDestinationValue(), self.expense_account) - self.assertEquals(1000, income_movement.getSourceCredit()) + self.assertEqual(1000, income_movement.getSourceCredit()) def test_BuildTradeModelLineAndAccountingFromInvoice(self): business_process = self.createBusinessProcess() @@ -996,41 +996,41 @@ return lambda *args, **kw: 1""") invoice.confirm() self.tic() - self.assertEquals(2, len(invoice.getMovementList())) - self.assertEquals(1150, invoice.getTotalPrice()) - self.assertEquals([], invoice.getDivergenceList()) + self.assertEqual(2, len(invoice.getMovementList())) + self.assertEqual(1150, invoice.getTotalPrice()) + self.assertEqual([], invoice.getDivergenceList()) invoice.start() self.tic() - self.assertEquals([], invoice.getDivergenceList()) + self.assertEqual([], invoice.getDivergenceList()) accounting_line_list = invoice.getMovementList( portal_type=self.invoice_transaction_line_portal_type) - self.assertEquals(3, len(accounting_line_list)) + self.assertEqual(3, len(accounting_line_list)) receivable_movement_list = [m for m in accounting_line_list if m.getSourceValue() == self.receivable_account] - self.assertEquals(1, len(receivable_movement_list)) + self.assertEqual(1, len(receivable_movement_list)) receivable_movement = receivable_movement_list[0] - self.assertEquals(receivable_movement.getDestinationValue(), + self.assertEqual(receivable_movement.getDestinationValue(), self.payable_account) - self.assertEquals(1150, receivable_movement.getSourceDebit()) + self.assertEqual(1150, receivable_movement.getSourceDebit()) collected_movement_list = [m for m in accounting_line_list if m.getSourceValue() == self.collected_tax_account] - self.assertEquals(1, len(collected_movement_list)) + self.assertEqual(1, len(collected_movement_list)) collected_movement = collected_movement_list[0] - self.assertEquals(collected_movement.getDestinationValue(), + self.assertEqual(collected_movement.getDestinationValue(), self.refundable_tax_account) - self.assertEquals(150, collected_movement.getSourceCredit()) + self.assertEqual(150, collected_movement.getSourceCredit()) income_movement_list = [m for m in accounting_line_list if m.getSourceValue() == self.income_account] - self.assertEquals(1, len(income_movement_list)) + self.assertEqual(1, len(income_movement_list)) income_movement = income_movement_list[0] - self.assertEquals(income_movement.getDestinationValue(), + self.assertEqual(income_movement.getDestinationValue(), self.expense_account) - self.assertEquals(1000, income_movement.getSourceCredit()) + self.assertEqual(1000, income_movement.getSourceCredit()) def test_tradeModelLineWithTargetLevelSetting(self): """ diff --git a/product/ERP5/tests/testTradeReports.py b/product/ERP5/tests/testTradeReports.py index 8a707f4de7..56bb73cf15 100644 --- a/product/ERP5/tests/testTradeReports.py +++ b/product/ERP5/tests/testTradeReports.py @@ -203,7 +203,7 @@ class TestTradeReports(ERP5ReportTestCase): inventory.deliver() # sanity check - self.assertEquals(simulation_state, inventory.getSimulationState()) + self.assertEqual(simulation_state, inventory.getSimulationState()) return inventory @reindex @@ -218,10 +218,10 @@ class TestTradeReports(ERP5ReportTestCase): quantity=values["quantity"], price=values["price"]) - self.assertEquals(sale_order.getSimulationState(), 'draft') + self.assertEqual(sale_order.getSimulationState(), 'draft') if cancel: sale_order.cancel() - self.assertEquals(sale_order.getSimulationState(), 'cancelled') + self.assertEqual(sale_order.getSimulationState(), 'cancelled') return sale_order @@ -293,11 +293,11 @@ class TestTradeReports(ERP5ReportTestCase): request['simulation_state'] = ['cancelled', 'draft'] report_section_list = self.getReportSectionList(self.sale_order_module, 'OrderModule_viewOrderReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(0, len(data_line_list)) + self.assertEqual(0, len(data_line_list)) # # Year 2005 + 2006, all documents @@ -307,17 +307,17 @@ class TestTradeReports(ERP5ReportTestCase): report_section_list = self.getReportSectionList(self.sale_order_module, 'OrderModule_viewOrderReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] stat_line_list = [l for l in line_list if l.isStatLine()] - self.assertEquals(6, len(data_line_list)) - self.assertEquals(1, len(stat_line_list)) + self.assertEqual(6, len(data_line_list)) + self.assertEqual(1, len(stat_line_list)) # test columns values line = data_line_list[0] - self.assertEquals(line.column_id_list, ['client', + self.assertEqual(line.column_id_list, ['client', 'product', 'Amount 2005', 'Quantity 2005', @@ -429,13 +429,13 @@ class TestTradeReports(ERP5ReportTestCase): request['section_category'] = 'group/g2' report_section_list = self.getReportSectionList(self.sale_order_module, 'OrderModule_viewOrderReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] stat_line_list = [l for l in line_list if l.isStatLine()] - self.assertEquals(3, len(data_line_list)) - self.assertEquals(1, len(stat_line_list)) + self.assertEqual(3, len(data_line_list)) + self.assertEqual(1, len(stat_line_list)) # First organisation d = {'Amount 2006': 75.0, 'Amount 2007': 9.0, @@ -494,10 +494,10 @@ class TestTradeReports(ERP5ReportTestCase): request['simulation_state'] = ['cancelled', 'draft'] report_section_list = self.getReportSectionList(self.sale_order_module, 'OrderModule_viewOrderReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties(data_line_list[0], **{'Amount 2006-05': 11*3 + 7*6, @@ -516,7 +516,7 @@ class TestTradeReports(ERP5ReportTestCase): 'client': 'Organisation_2', 'total amount': 5*3 + 6}) - self.failUnless(line_list[-1].isStatLine()) + self.assertTrue(line_list[-1].isStatLine()) self.checkLineProperties(line_list[-1], **{'Amount 2006-05': 11*3 + 7*6, 'Amount 2006-06': None, @@ -536,13 +536,13 @@ class TestTradeReports(ERP5ReportTestCase): request['section_category'] = 'group/g2' report_section_list = self.getReportSectionList(self.sale_order_module, 'OrderModule_viewOrderReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] stat_line_list = [l for l in line_list if l.isStatLine()] - self.assertEquals(3, len(data_line_list)) - self.assertEquals(1, len(stat_line_list)) + self.assertEqual(3, len(data_line_list)) + self.assertEqual(1, len(stat_line_list)) # First organisation d = {'Amount 2006': 75.0, 'Amount 2007': 9.0, @@ -599,13 +599,13 @@ class TestTradeReports(ERP5ReportTestCase): request['section_category'] = 'group/g3' report_section_list = self.getReportSectionList(self.sale_order_module, 'OrderModule_viewOrderReport') - self.assertEquals(1, len(report_section_list)) + self.assertEqual(1, len(report_section_list)) line_list = self.getListBoxLineList(report_section_list[0]) data_line_list = [l for l in line_list if l.isDataLine()] stat_line_list = [l for l in line_list if l.isStatLine()] - self.assertEquals(0, len(data_line_list)) - self.assertEquals(1, len(stat_line_list)) + self.assertEqual(0, len(data_line_list)) + self.assertEqual(1, len(stat_line_list)) # stat line d = {'Amount 2006': None, 'Amount 2007': None, @@ -708,7 +708,7 @@ class TestTradeReports(ERP5ReportTestCase): render_format='list', REQUEST=request) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(0, len(data_line_list)) + self.assertEqual(0, len(data_line_list)) ################################ # Middle date ################################ @@ -720,7 +720,7 @@ class TestTradeReports(ERP5ReportTestCase): render_format='list', REQUEST=self.portal.REQUEST) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) # test columns values line = data_line_list[0] @@ -748,7 +748,7 @@ class TestTradeReports(ERP5ReportTestCase): render_format='list', REQUEST=self.portal.REQUEST) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(4, len(data_line_list)) + self.assertEqual(4, len(data_line_list)) self.checkLineProperties( data_line_list[0], @@ -869,7 +869,7 @@ class TestTradeReports(ERP5ReportTestCase): data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties( data_line_list[0], @@ -900,7 +900,7 @@ class TestTradeReports(ERP5ReportTestCase): data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(3, len(data_line_list)) + self.assertEqual(3, len(data_line_list)) self.checkLineProperties( data_line_list[0], resource_title='product_A', @@ -937,7 +937,7 @@ class TestTradeReports(ERP5ReportTestCase): data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(3, len(data_line_list)) + self.assertEqual(3, len(data_line_list)) self.checkLineProperties( data_line_list[0], resource_title='product_B', @@ -977,7 +977,7 @@ class TestTradeReports(ERP5ReportTestCase): data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties( data_line_list[0], resource_title='product_A', @@ -1000,7 +1000,7 @@ class TestTradeReports(ERP5ReportTestCase): data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(1, len(data_line_list)) + self.assertEqual(1, len(data_line_list)) self.checkLineProperties( data_line_list[0], resource_title='product_B', @@ -1023,7 +1023,7 @@ class TestTradeReports(ERP5ReportTestCase): data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(2, len(data_line_list)) + self.assertEqual(2, len(data_line_list)) self.checkLineProperties( data_line_list[0], resource_title='variated product', @@ -1053,7 +1053,7 @@ class TestTradeReports(ERP5ReportTestCase): data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(0, len(data_line_list)) + self.assertEqual(0, len(data_line_list)) def test_Folder_generateWorkflowReport(self): @@ -1098,13 +1098,13 @@ class TestTradeReports(ERP5ReportTestCase): # call the report first, it will set selection report_html = \ self.portal.sale_order_module.Folder_generateWorkflowReport() - self.failIf('Site Error' in report_html) + self.assertFalse('Site Error' in report_html) line_list = self.portal.sale_order_module.Folder_viewWorkflowReport.listbox.\ get_value('default', render_format='list', REQUEST=self.portal.REQUEST) data_line_list = [l for l in line_list if l.isDataLine()] - self.assertEquals(8, len(data_line_list)) + self.assertEqual(8, len(data_line_list)) order_workflow_name = 'Sale Order - Order Workflow' causality_workflow_name = 'Sale Order - Causality Workflow' self.checkLineProperties(data_line_list[0], diff --git a/product/ERP5/tests/testTransformation.py b/product/ERP5/tests/testTransformation.py index 05ce6a28e8..77746d6188 100644 --- a/product/ERP5/tests/testTransformation.py +++ b/product/ERP5/tests/testTransformation.py @@ -121,9 +121,9 @@ class TestTransformation(TestTransformationMixin, BaseTestUnitConversion): resource_value=component, quantity=2) aggregated_amount_list = transformation.getAggregatedAmountList() - self.assertEquals(len(aggregated_amount_list), 1) + self.assertEqual(len(aggregated_amount_list), 1) aggregated_amount = aggregated_amount_list[0] - self.assertEquals(aggregated_amount.quantity, 2) + self.assertEqual(aggregated_amount.quantity, 2) def test_01_getAggregatedAmountListWithVariatedProperty(self): """ @@ -327,17 +327,17 @@ class TestTransformation(TestTransformationMixin, BaseTestUnitConversion): amount_list = transformation.getAggregatedAmountList(temp_amount) # fabric + button + sewing - self.assertEquals(len(amount_list), 3) + self.assertEqual(len(amount_list), 3) for amount in amount_list: resource = amount.getResource() if resource == fabric.getRelativeUrl(): - self.assertEquals(amount.getVariationCategoryList(), [colour]) - self.assertEquals(amount.getQuantity(), (i+1)*swimsuit_quantity) + self.assertEqual(amount.getVariationCategoryList(), [colour]) + self.assertEqual(amount.getQuantity(), (i+1)*swimsuit_quantity) elif resource == button.getRelativeUrl(): - self.assertEquals(amount.getVariationCategoryList(), [size]) - self.assertEquals(amount.getQuantity(), button_number*swimsuit_quantity) + self.assertEqual(amount.getVariationCategoryList(), [size]) + self.assertEqual(amount.getQuantity(), button_number*swimsuit_quantity) elif resource == "operation/sewing": - self.assertEquals(amount.getQuantity(), n*swimsuit_quantity) + self.assertEqual(amount.getQuantity(), n*swimsuit_quantity) else: self.fail("Invalid Resource: %s" % resource) n += 1 @@ -355,11 +355,11 @@ class TestTransformation(TestTransformationMixin, BaseTestUnitConversion): button.getRelativeUrl(), "operation/sewing"], ) - self.assertEquals(len(inv), + self.assertEqual(len(inv), len(transformation) * len(self.size_category_list) \ * len(self.colour_category_list)) - self.assertEquals(len(self.getSimulationTool().getInventoryList( + self.assertEqual(len(self.getSimulationTool().getInventoryList( node_uid=self.node.getUid(), transformed_resource=[fabric.getRelativeUrl(), button.getRelativeUrl(), @@ -378,20 +378,20 @@ class TestTransformation(TestTransformationMixin, BaseTestUnitConversion): "operation/sewing"], variation_text=variation_text, ) - self.assertEquals(len(inv), len(transformation)) + self.assertEqual(len(inv), len(transformation)) for line in inv: - self.assertEquals(line.getVariationText(), variation_text) - self.assertEquals(line.getResource(), swimsuit.getRelativeUrl()) + self.assertEqual(line.getVariationText(), variation_text) + self.assertEqual(line.getResource(), swimsuit.getRelativeUrl()) transformed_resource = line.transformed_resource_relative_url if transformed_resource == fabric.getRelativeUrl(): - self.assertEquals(line.transformed_variation_text, colour) - self.assertEquals(line.total_quantity, (i+1)*swimsuit_quantity) + self.assertEqual(line.transformed_variation_text, colour) + self.assertEqual(line.total_quantity, (i+1)*swimsuit_quantity) elif transformed_resource == button.getRelativeUrl(): - self.assertEquals(line.transformed_variation_text, size) - self.assertEquals(line.total_quantity, button_number*swimsuit_quantity) + self.assertEqual(line.transformed_variation_text, size) + self.assertEqual(line.total_quantity, button_number*swimsuit_quantity) elif transformed_resource == "operation/sewing": - self.assertEquals(line.total_quantity, n*swimsuit_quantity) - self.assertEquals(line.transformed_variation_text, "") + self.assertEqual(line.total_quantity, n*swimsuit_quantity) + self.assertEqual(line.transformed_variation_text, "") else: self.fail("Invalid Transformed Resource: %s" % transformed_resource) n += 1 @@ -414,15 +414,15 @@ class TestTransformation(TestTransformationMixin, BaseTestUnitConversion): # add transformations lines and check the don't acquire the resource operation = transformation.newContent(portal_type='Transformation Operation') - self.assertEquals(operation.getResource(), None) + self.assertEqual(operation.getResource(), None) optional_resource = transformation.newContent(portal_type=\ 'Transformation Optional Resource') - self.assertEquals(optional_resource.getResource(), None) + self.assertEqual(optional_resource.getResource(), None) transformed_resource = transformation.newContent(portal_type=\ 'Transformation Transformed Resource') - self.assertEquals(transformed_resource.getResource(), None) + self.assertEqual(transformed_resource.getResource(), None) def test_suite(): import unittest diff --git a/product/ERP5/tests/testTranslation.py b/product/ERP5/tests/testTranslation.py index d4f01c9619..953c8d0d72 100644 --- a/product/ERP5/tests/testTranslation.py +++ b/product/ERP5/tests/testTranslation.py @@ -278,21 +278,21 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase): self.tic() self.portal.Localizer._default_language = 'fr' - self.assertEquals(item.getTranslatedValidationStateTitle(), 'Draft') + self.assertEqual(item.getTranslatedValidationStateTitle(), 'Draft') item.validate() - self.assertEquals(item.getTranslatedValidationStateTitle(), "En bon usage") - self.assertEquals(organisation.getTranslatedValidationStateTitle(), + self.assertEqual(item.getTranslatedValidationStateTitle(), "En bon usage") + self.assertEqual(organisation.getTranslatedValidationStateTitle(), 'Validé') # Now run indexation of translations. self.portal.ERP5Site_updateTranslationTable() self.tic() # Ckeck queries with translated workflow state title generated with # getMessageIdWithContext - self.assertEquals(1, len(self.portal.portal_catalog( + self.assertEqual(1, len(self.portal.portal_catalog( translated_validation_state_title="En bon usage"))) - self.assertEquals(1, len(self.portal.portal_catalog( + self.assertEqual(1, len(self.portal.portal_catalog( translated_validation_state_title="En bon usage", portal_type='Item'))) - self.assertEquals(0, len(self.portal.portal_catalog( + self.assertEqual(0, len(self.portal.portal_catalog( translated_validation_state_title="En bon usage", portal_type='Organisation'))) @@ -340,7 +340,7 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase): assert(len(self.portal.portal_catalog(portal_type=portal_type_id)) == 1) result = self.portal.portal_catalog(portal_type=portal_type_id, translated_simulation_state_title='!="%s in context"' % state_title) - self.assertEquals(len(result), 0) + self.assertEqual(len(result), 0) finally: # Clean the new context message message_catalog.message_del(getMessageIdWithContext(state_title, @@ -416,8 +416,8 @@ class TestTranslation(ERP5TypeTestCase): self._cleanUpTranslations() # test clean-up actually worked erp5_ui = self.portal.Localizer.erp5_ui - self.assertEquals(erp5_ui.gettext('Person', lang=self.lang), 'Person') - self.assertEquals(erp5_ui.gettext('Draft', lang=self.lang), 'Draft') + self.assertEqual(erp5_ui.gettext('Person', lang=self.lang), 'Person') + self.assertEqual(erp5_ui.gettext('Draft', lang=self.lang), 'Draft') # erase created objects for module in (self.portal.person_module, self.portal.organisation_module): @@ -430,7 +430,7 @@ class TestTranslation(ERP5TypeTestCase): def test_Localizer_translation(self): # basically, test afterSetUp worked... erp5_ui = self.portal.Localizer.erp5_ui - self.assertEquals(erp5_ui.gettext('Person', lang=self.lang), 'Personne') + self.assertEqual(erp5_ui.gettext('Person', lang=self.lang), 'Personne') def translate_by_zpt(self, domain, *words): zpt_template = """ @@ -446,12 +446,12 @@ class TestTranslation(ERP5TypeTestCase): def test_ZPT_translation(self): results = self.translate_by_zpt('erp5_ui', 'Person', 'Draft') - self.assertEquals(results, ['Personne', 'Brouillon']) + self.assertEqual(results, ['Personne', 'Brouillon']) def test_ZPT_translation_with_domain_alias(self): # test with a translation domain alias results = self.translate_by_zpt('ui', 'Person', 'Draft') - self.assertEquals(results, ['Personne', 'Brouillon']) + self.assertEqual(results, ['Personne', 'Brouillon']) def test_portal_type_and_state_title_translation_on_portal_catalog(self): # make sure we can search by "translated_validation_state_title" and @@ -463,15 +463,15 @@ class TestTranslation(ERP5TypeTestCase): portal_type='Organisation') self.tic() - self.assertEquals(set([person_1, person_2]), + self.assertEqual(set([person_1, person_2]), set([x.getObject() for x in self.portal.portal_catalog(translated_portal_type='Personne')])) - self.assertEquals(set([person_2, organisation]), + self.assertEqual(set([person_2, organisation]), set([x.getObject() for x in self.portal.portal_catalog(translated_validation_state_title='Brouillon', portal_type=('Person', 'Organisation'))])) - self.assertEquals([person_2], + self.assertEqual([person_2], [x.getObject() for x in self.portal.portal_catalog(translated_validation_state_title='Brouillon', translated_portal_type='Personne')]) diff --git a/product/ERP5/tests/testTrashTool.py b/product/ERP5/tests/testTrashTool.py index b35307cd8c..c82267d2b1 100644 --- a/product/ERP5/tests/testTrashTool.py +++ b/product/ERP5/tests/testTrashTool.py @@ -69,7 +69,7 @@ class TestTrashTool(ERP5TypeTestCase): """ pc = self.getCategoryTool() base_category = pc.newContent(portal_type = 'Base Category') - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) sequence.edit(bc_id=base_category.getId()) def stepAddCategories(self, sequence=None, sequence_list=None, **kw): @@ -79,11 +79,11 @@ class TestTrashTool(ERP5TypeTestCase): bc_id = sequence.get('bc_id') pc = self.getCategoryTool() base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) category_list = [] for i in xrange(10): category = base_category.newContent(portal_type='Category') - self.failUnless(category is not None) + self.assertTrue(category is not None) category_list.append(category.getId()) sequence.edit(category_id_list=category_list) @@ -101,7 +101,7 @@ class TestTrashTool(ERP5TypeTestCase): """ Check existence of trash tool """ - self.failUnless(self.getTrashTool() is not None) + self.assertTrue(self.getTrashTool() is not None) def stepCreateTrashBin(self, sequence=None, sequence_list=None, **kw): """ @@ -115,10 +115,10 @@ class TestTrashTool(ERP5TypeTestCase): n = n + 1 bt_id = 'fake_id_%s' %(n) bt = pt.newContent(id=bt_id, portal_type="Business Template") - self.failUnless(bt is not None) + self.assertTrue(bt is not None) trashbin = trash.newTrashBin(bt_title='fake_bin', bt=bt) - self.failUnless(trashbin is not None) - self.failUnless('fake_bin' in trashbin.getId()) + self.assertTrue(trashbin is not None) + self.assertTrue('fake_bin' in trashbin.getId()) sequence.edit(trash_id=trashbin.getId()) def stepCheckTrashBinIndexable(self, sequence=None, sequence_list=None, **kw ): @@ -128,8 +128,8 @@ class TestTrashTool(ERP5TypeTestCase): trash_id = sequence.get('trash_id') trash = self.getTrashTool() trashbin = trash._getOb(trash_id, None) - self.failUnless(trashbin is not None) - self.failUnless(trashbin.isIndexable) + self.assertTrue(trashbin is not None) + self.assertTrue(trashbin.isIndexable) def stepCheckObjectNotBackup(self, sequence=None, sequence_list=None, **kw): """ @@ -138,7 +138,7 @@ class TestTrashTool(ERP5TypeTestCase): trash_id = sequence.get('trash_id') trash = self.getTrashTool() trashbin = trash._getOb(trash_id, None) - self.failUnless(trashbin is not None) + self.assertTrue(trashbin is not None) self.assertEqual(len(list(trashbin.objectIds())), 0) def stepCheckObjectBackupWithoutSubObjects(self, sequence=None, sequence_list=None, **kw): @@ -148,9 +148,9 @@ class TestTrashTool(ERP5TypeTestCase): trash_id = sequence.get('trash_id') trash = self.getTrashTool() trashbin = trash._getOb(trash_id, None) - self.failUnless(trashbin is not None) + self.assertTrue(trashbin is not None) trashbin_objects_list = list(trashbin.objectValues()) - self.failUnless(len(trashbin_objects_list) > 0) + self.assertTrue(len(trashbin_objects_list) > 0) self.assertEqual(len(trashbin_objects_list), 1) # get portal_catogories trash folder obj = trashbin_objects_list[0] @@ -176,11 +176,11 @@ class TestTrashTool(ERP5TypeTestCase): trash_id = sequence.get('trash_id') trash = self.getTrashTool() trashbin = trash._getOb(trash_id, None) - self.failUnless(trashbin is not None) + self.assertTrue(trashbin is not None) # get category trash folder bc_id = sequence.get('bc_id') trashbin_objects_list = list(trashbin.objectValues()) - self.failUnless(len(trashbin_objects_list) > 0) + self.assertTrue(len(trashbin_objects_list) > 0) self.assertEqual(len(trashbin_objects_list), 1) obj = trashbin_objects_list[0] self.assertEqual(obj.getId(), 'portal_categories_items') @@ -199,10 +199,10 @@ class TestTrashTool(ERP5TypeTestCase): self.assertNotEqual(len(subcat_objects_list), 0) categ_id_list = sequence.get('category_id_list') for id in subcat_objects_list: - self.failUnless(id in categ_id_list) + self.assertTrue(id in categ_id_list) cat = cat_object._getOb(id, None) - self.failUnless(cat is not None) - self.failUnless(cat.isIndexable, 0) + self.assertTrue(cat is not None) + self.assertTrue(cat.isIndexable, 0) self.assertEqual(cat.getPortalType(), 'Category') def stepCheckFolderObjectBackup(self, sequence=None, sequence_list=None, **kw): @@ -212,10 +212,10 @@ class TestTrashTool(ERP5TypeTestCase): trash_id = sequence.get('trash_id') trash = self.getTrashTool() trashbin = trash._getOb(trash_id, None) - self.failUnless(trashbin is not None) + self.assertTrue(trashbin is not None) bc_id = sequence.get('bc_id') trashbin_objects_list = list(trashbin.objectValues()) - self.failUnless(len(trashbin_objects_list) > 0) + self.assertTrue(len(trashbin_objects_list) > 0) self.assertEqual(len(trashbin_objects_list), 1) obj = trashbin_objects_list[0] self.assertEqual(obj.getId(), 'portal_skins_items') @@ -227,19 +227,19 @@ class TestTrashTool(ERP5TypeTestCase): skin = skin_objects_list[0] self.assertEqual(skin.id, 'erp5_core') from OFS.Folder import Folder - self.failUnless(isinstance(skin, Folder)) + self.assertTrue(isinstance(skin, Folder)) # get image folder skin_objects_list = list(skin.objectValues()) self.assertEqual(len(skin_objects_list), 1) skin = skin_objects_list[0] self.assertEqual(skin.id, 'image') - self.failUnless(skin.getPortalType(), "Trash Folder") + self.assertTrue(skin.getPortalType(), "Trash Folder") # get file f_objects_list = list(skin.objectValues()) self.assertEqual(len(f_objects_list), 1) f = f_objects_list[0] self.assertEqual(f.getId(), 'file') - self.failUnless(f.getPortalType(), "Trash Folder") + self.assertTrue(f.getPortalType(), "Trash Folder") def stepBackupObjectsWithSave(self, sequence=None, sequence_list=None, **kw): @@ -253,12 +253,12 @@ class TestTrashTool(ERP5TypeTestCase): bc_id = sequence.get('bc_id') pc = self.getCategoryTool() base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) subobjects_ids = base_category.objectIds() bc_path = base_category.getPath().split('/')[2:-1] # check backup backup_subobjects_ids = trash.backupObject(trashbin, bc_path, bc_id, save=1) - self.failUnless(backup_subobjects_ids.keys().sort() == list(subobjects_ids).sort()) + self.assertTrue(backup_subobjects_ids.keys().sort() == list(subobjects_ids).sort()) def stepBackupFolderObjectsWithSave(self, sequence=None, sequence_list=None, **kw): """ @@ -283,12 +283,12 @@ class TestTrashTool(ERP5TypeTestCase): bc_id = sequence.get('bc_id') pc = self.getCategoryTool() base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) subobjects_ids = base_category.objectIds() bc_path = base_category.getPath().split('/')[1:-1] # check backup backup_subobjects_ids = trash.backupObject(trashbin, bc_path, bc_id, save=0) - self.failUnless(backup_subobjects_ids.keys().sort() == list(subobjects_ids).sort()) + self.assertTrue(backup_subobjects_ids.keys().sort() == list(subobjects_ids).sort()) def stepBackupObjectsWithKeepingSubobjects(self, sequence=None, sequence_list=None, **kw): """ @@ -301,7 +301,7 @@ class TestTrashTool(ERP5TypeTestCase): bc_id = sequence.get('bc_id') pc = self.getCategoryTool() base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) subobjects_ids = base_category.objectIds() bc_path = base_category.getPath().split('/')[2:-1] # check backup @@ -331,11 +331,11 @@ class TestTrashTool(ERP5TypeTestCase): bc_id = sequence.get('bc_id') pc = self.getCategoryTool() base_category = pc._getOb(bc_id, None) - self.failUnless(base_category is not None) + self.assertTrue(base_category is not None) cat = base_category._getOb(cat_id, None) - self.failUnless(cat is not None) + self.assertTrue(cat is not None) subcat = cat.newContent(portal_type='Category') - self.failUnless(subcat is not None) + self.assertTrue(subcat is not None) sequence.edit(subcat_path=subcat.getPath()) # tests diff --git a/product/ERP5/tests/testUrl.py b/product/ERP5/tests/testUrl.py index 56f6c95bfd..09fda7f009 100644 --- a/product/ERP5/tests/testUrl.py +++ b/product/ERP5/tests/testUrl.py @@ -58,46 +58,46 @@ class TestUrl(ERP5TypeTestCase): url_without_port = 'localhost/test_client' url_crawler.setUrlString(url_without_port) self.tic() - self.assertEquals('%s://%s' % (url_protocol, url_without_port), + self.assertEqual('%s://%s' % (url_protocol, url_without_port), url_crawler.asURL()) full_url_without_port = '%s://localhost/test_client' % url_protocol url_crawler.setUrlString(full_url_without_port) self.tic() - self.assertEquals(full_url_without_port, url_crawler.asURL()) + self.assertEqual(full_url_without_port, url_crawler.asURL()) full_url_with_port = '%s://localhost:8191/test_client' % url_protocol url_crawler.setUrlString(full_url_with_port) self.tic() - self.assertEquals(full_url_with_port, url_crawler.asURL()) + self.assertEqual(full_url_with_port, url_crawler.asURL()) url_with_port = 'localhost:8191/test_client' url_crawler.setUrlString(url_with_port) self.tic() - self.assertEquals('%s://%s' % (url_protocol, url_with_port), + self.assertEqual('%s://%s' % (url_protocol, url_with_port), url_crawler.asURL()) production_url = 'www.example.com/foo' url_crawler.setUrlString(production_url) self.tic() - self.assertEquals('%s://%s' % (url_protocol, production_url), + self.assertEqual('%s://%s' % (url_protocol, production_url), url_crawler.asURL()) production_url_with_port = 'www.example.com:8191/foo' url_crawler.setUrlString(production_url_with_port) self.tic() - self.assertEquals('%s://%s' % (url_protocol, production_url_with_port), + self.assertEqual('%s://%s' % (url_protocol, production_url_with_port), url_crawler.asURL()) production_url_with_protocol = '%s://www.example.com/foo' % url_protocol url_crawler.setUrlString(production_url_with_protocol) self.tic() - self.assertEquals(production_url_with_protocol, url_crawler.asURL()) + self.assertEqual(production_url_with_protocol, url_crawler.asURL()) production_url_with_port = '%s://www.example.com:8191/foo' % url_protocol url_crawler.setUrlString(production_url) self.tic() - self.assertEquals('%s://%s' % (url_protocol, production_url), + self.assertEqual('%s://%s' % (url_protocol, production_url), url_crawler.asURL()) diff --git a/product/ERP5/tests/testWebCrawler.py b/product/ERP5/tests/testWebCrawler.py index 704c79139c..f4572a6c50 100644 --- a/product/ERP5/tests/testWebCrawler.py +++ b/product/ERP5/tests/testWebCrawler.py @@ -187,11 +187,11 @@ class TestWebCrawler(ERP5TypeTestCase): web_page_portal_type = 'Web Page' web_page_module = self.portal.getDefaultModule(web_page_portal_type) web_page = web_page_module.newContent(portal_type=web_page_portal_type) - self.assertEquals(web_page.getContentBaseURL(), '') + self.assertEqual(web_page.getContentBaseURL(), '') web_page.fromURL('http://www.example.com') - self.assertEquals(web_page.getContentBaseURL(), 'http://www.example.com') + self.assertEqual(web_page.getContentBaseURL(), 'http://www.example.com') web_page.fromURL('http://www.example.com/section/sub_section') - self.assertEquals(web_page.getContentBaseURL(), + self.assertEqual(web_page.getContentBaseURL(), 'http://www.example.com/section') text_content = """<html> <head> @@ -211,8 +211,8 @@ class TestWebCrawler(ERP5TypeTestCase): </body> </html>""" web_page.edit(text_content=text_content) - self.assertEquals(web_page.getContentBaseURL(), "http://www.example.com") - self.assertEquals(web_page.getContentNormalisedURLList(), + self.assertEqual(web_page.getContentBaseURL(), "http://www.example.com") + self.assertEqual(web_page.getContentNormalisedURLList(), ["http://www.example.com/I%20don't%20care%20I%20put%20what/%20I%20want/", 'http://www.example.com/section', 'http://www.example.com/section2', @@ -227,10 +227,10 @@ class TestWebCrawler(ERP5TypeTestCase): </html>""" web_page.edit(text_content=text_content) web_page.fromURL('http://www.example.com/#fffff') - self.assertEquals(web_page.getContentBaseURL(), "http://www.example.com") - self.assertEquals(web_page.getContentNormalisedURLList(), + self.assertEqual(web_page.getContentBaseURL(), "http://www.example.com") + self.assertEqual(web_page.getContentNormalisedURLList(), ['http://www.example.com/section2',]) - self.assertEquals(web_page.asNormalisedURL(), + self.assertEqual(web_page.asNormalisedURL(), 'http://www.example.com/#fffff') def test_02_crawlWebSite(self): @@ -252,19 +252,19 @@ class TestWebCrawler(ERP5TypeTestCase): # + 3 Web Sections # + 1 absolute link to home_page # + 1 relative link from home_page to another web page - self.assertEquals(len(web_crawler), 6) - self.assertEquals(len(self.portal.portal_url_registry._getMappingDict()), + self.assertEqual(len(web_crawler), 6) + self.assertEqual(len(self.portal.portal_url_registry._getMappingDict()), 6) date_before = web_crawler.getModificationDate() web_crawler.crawlContent() self.tic() # Nothing happens, portal_url_registry keep crawling twice # the same url - self.assertEquals(len(web_crawler), 6) - self.assertEquals(len(self.portal.portal_url_registry._getMappingDict()), + self.assertEqual(len(web_crawler), 6) + self.assertEqual(len(self.portal.portal_url_registry._getMappingDict()), 6) # not modified - self.assertEquals(date_before, web_crawler.getModificationDate()) + self.assertEqual(date_before, web_crawler.getModificationDate()) new_web_crawler = web_crawler_module.newContent( portal_type=external_source_portal_type, @@ -283,7 +283,7 @@ class TestWebCrawler(ERP5TypeTestCase): self.tic() new_web_crawler.crawlContent() self.tic() - self.assertEquals(len(web_crawler), 6) + self.assertEqual(len(web_crawler), 6) def test_suite(): diff --git a/product/ERP5/tests/testWebDavSupport.py b/product/ERP5/tests/testWebDavSupport.py index 5636a7b9bb..d79cfe2ab8 100644 --- a/product/ERP5/tests/testWebDavSupport.py +++ b/product/ERP5/tests/testWebDavSupport.py @@ -124,10 +124,10 @@ class TestWebDavSupport(ERP5TypeTestCase): self.assertEqual(response.getStatus(), httplib.CREATED) document_module = self.getDocumentModule() - self.failUnless(filename in document_module.objectIds()) - self.assertEquals(document_module[filename].getPortalType(), 'Presentation') + self.assertTrue(filename in document_module.objectIds()) + self.assertEqual(document_module[filename].getPortalType(), 'Presentation') file_object.seek(0) - self.assertEquals(document_module[filename].getData(), file_object.read()) + self.assertEqual(document_module[filename].getData(), file_object.read()) def test_GET_on_contributionTool(self): """Get a document through Contribution Tool. @@ -157,8 +157,8 @@ class TestWebDavSupport(ERP5TypeTestCase): request_method='GET', stdin=StringIO(), basic=self.authentication) - self.assertEquals(response.getStatus(), httplib.OK) - self.assertEquals(response.getBody(), document.getData(), + self.assertEqual(response.getStatus(), httplib.OK) + self.assertEqual(response.getBody(), document.getData(), 'Error in getting data, get:%r' % response.getHeader('content-type')) def test_PUT_on_web_page(self): @@ -174,8 +174,8 @@ class TestWebDavSupport(ERP5TypeTestCase): self.assertEqual(response.getStatus(), httplib.CREATED) web_page_module = self.getWebPageModule() - self.failUnless(filename in web_page_module.objectIds()) - self.assertEquals(web_page_module[filename].getPortalType(), 'Web Page') + self.assertTrue(filename in web_page_module.objectIds()) + self.assertEqual(web_page_module[filename].getPortalType(), 'Web Page') # Edit a new document via FTP/DAV text_content= """<html> @@ -195,12 +195,12 @@ class TestWebDavSupport(ERP5TypeTestCase): stdin=StringIO(iso_text_content), basic=self.authentication) self.assertEqual(response.getStatus(), httplib.NO_CONTENT) - self.assertEquals(web_page_module[filename].getData(), iso_text_content) + self.assertEqual(web_page_module[filename].getData(), iso_text_content) # Convert to base format and run conversion into utf-8 self.tic() # Content-Type header is replaced if sonversion encoding succeed new_text_content = text_content.replace('charset=iso-8859-1', 'charset=utf-8') - self.assertEquals(web_page_module[filename].getTextContent(), new_text_content) + self.assertEqual(web_page_module[filename].getTextContent(), new_text_content) def test_GET_on_document(self): """Get data from document in webdav @@ -225,8 +225,8 @@ class TestWebDavSupport(ERP5TypeTestCase): stdin=StringIO(), basic=self.authentication) - self.assertEquals(response.getStatus(), httplib.OK) - self.assertEquals(response.getBody(), document.getData(), + self.assertEqual(response.getStatus(), httplib.OK) + self.assertEqual(response.getBody(), document.getData(), 'Error in getting data, get:%r' % response.getHeader('content-type')) def test_PROPFIND_on_document(self): @@ -249,18 +249,18 @@ class TestWebDavSupport(ERP5TypeTestCase): stdin=StringIO(), basic=self.authentication) - self.assertEquals(response.getStatus(), httplib.MULTI_STATUS) + self.assertEqual(response.getStatus(), httplib.MULTI_STATUS) xml_metadata_string = response.getBody() xml_metadata = etree.fromstring(xml_metadata_string) - self.assertEquals(xml_metadata.find('{DAV:}response/{DAV:}href').text, + self.assertEqual(xml_metadata.find('{DAV:}response/{DAV:}href').text, document.getPath()) - self.assertEquals(xml_metadata.find( + self.assertEqual(xml_metadata.find( '{DAV:}response/{DAV:}propstat/{DAV:}prop/'\ '{DAV:}getcontenttype').text, document.getContentType()) # Outputed string is not reproductable for comparaison. # So we need to parse the date and use the same format - self.assertEquals(DateTime(xml_metadata.find('{DAV:}response/'\ + self.assertEqual(DateTime(xml_metadata.find('{DAV:}response/'\ '{DAV:}propstat/{DAV:}prop/{DAV:}getlastmodified')\ .text).ISO8601(), document.bobobase_modification_time().toZone('UTC').ISO8601()) @@ -287,10 +287,10 @@ class TestWebDavSupport(ERP5TypeTestCase): stdin=StringIO(), basic=self.authentication) - self.assertEquals(response.getStatus(), httplib.MULTI_STATUS) + self.assertEqual(response.getStatus(), httplib.MULTI_STATUS) xml_metadata_string = response.getBody() xml_metadata = etree.fromstring(xml_metadata_string) - self.assertEquals(xml_metadata.find( + self.assertEqual(xml_metadata.find( '{DAV:}response/{DAV:}propstat/{DAV:}prop/{DAV:}creationdate').text, document.getCreationDate().HTML4()) diff --git a/product/ERP5/tests/testWorklist.py b/product/ERP5/tests/testWorklist.py index 1a2c5c5196..d578f07368 100644 --- a/product/ERP5/tests/testWorklist.py +++ b/product/ERP5/tests/testWorklist.py @@ -144,7 +144,7 @@ class TestWorklist(ERP5TypeTestCase): return result def getWorklistDocumentCountFromActionName(self, action_name): - self.assertEquals(action_name[-1], ')') + self.assertEqual(action_name[-1], ')') left_parenthesis_offset = action_name.rfind('(') self.assertNotEquals(left_parenthesis_offset, -1) return int(action_name[left_parenthesis_offset + 1:-1]) @@ -206,9 +206,9 @@ class TestWorklist(ERP5TypeTestCase): def checkWorklist(self, result, name, count, url_parameter_dict=None): entry_list = [x for x in result if x['name'].startswith(name)] - self.assertEquals(len(entry_list), count and 1) + self.assertEqual(len(entry_list), count and 1) if count: - self.assertEquals(count, + self.assertEqual(count, self.getWorklistDocumentCountFromActionName(entry_list[0]['name'])) if not entry_list: return @@ -222,7 +222,7 @@ class TestWorklist(ERP5TypeTestCase): self.module_selection_name) for parameter, value in url_parameter_dict.iteritems(): self.assertTrue(parameter in selection_parameter_dict) - self.assertEquals(value, selection_parameter_dict[parameter]) + self.assertEqual(value, selection_parameter_dict[parameter]) def test_01_permission(self, quiet=0, run=run_all_test): """ @@ -262,7 +262,7 @@ class TestWorklist(ERP5TypeTestCase): self.logMessage("Check %s worklist" % user_id) self.login(user_id) result = workflow_tool.listActions(object=document) - self.assertEquals(result, []) + self.assertEqual(result, []) for role, user_id_list in (('Assignor', ('foo', 'manager')), ('Assignee', ('foo', 'bar'))): diff --git a/product/ERP5/tests/testXHTML.py b/product/ERP5/tests/testXHTML.py index 602c67b90f..71f12bf0f1 100644 --- a/product/ERP5/tests/testXHTML.py +++ b/product/ERP5/tests/testXHTML.py @@ -146,7 +146,7 @@ class TestXHTMLMixin(ERP5TypeTestCase): if selection_name in ("",None) and \ form_path not in self.FORM_LISTBOX_EMPTY_SELECTION_PATH_LIST: error_list.append(form_path) - self.assertEquals(error_list, []) + self.assertEqual(error_list, []) def test_duplicatingSelectionNameInListbox(self): """ @@ -184,7 +184,7 @@ class TestXHTMLMixin(ERP5TypeTestCase): stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True).communicate(body) except OSError, e: raise OSError, '%r\n%r' % (os.environ, e) - self.assertEquals(stdout, '', 'jsl result of %s : %s' % (check_path, stdout)) + self.assertEqual(stdout, '', 'jsl result of %s : %s' % (check_path, stdout)) portal_skins_path = '%s/portal_skins' % self.portal.getId() for path in path_list: check_path = '%s/%s' % (portal_skins_path, path) @@ -199,7 +199,7 @@ class TestXHTMLMixin(ERP5TypeTestCase): tool, obj_metatypes=['Script (Python)'], search_sub=1): if script.errors!=(): # we need to add script id as well in test failure - self.assertEquals('%s : %s' %(script_path, script.errors), ()) + self.assertEqual('%s : %s' %(script_path, script.errors), ()) def test_SkinItemId(self): """ @@ -228,7 +228,7 @@ class TestXHTMLMixin(ERP5TypeTestCase): method = list_method if not callable(method): error_list.append((form_path, list_method)) - self.assertEquals(error_list, []) + self.assertEqual(error_list, []) def test_listActionInListbox(self): # check all list_action in listboxes diff --git a/product/ERP5Banking/tests/TestERP5BankingMixin.py b/product/ERP5Banking/tests/TestERP5BankingMixin.py index ac16ee2602..8f5cd4fd66 100644 --- a/product/ERP5Banking/tests/TestERP5BankingMixin.py +++ b/product/ERP5Banking/tests/TestERP5BankingMixin.py @@ -328,7 +328,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase): ) exchange_line.setPriceCurrencyValue(self.getCurrencyModule()[price_currency]) cell_list = exchange_line.objectValues() - self.assertEquals(len(cell_list), 3) + self.assertEqual(len(cell_list), 3) for cell in cell_list: cell.setBasePrice(cell_price) diff --git a/product/ERP5Banking/tests/testERP5BankingCheckPayment.py b/product/ERP5Banking/tests/testERP5BankingCheckPayment.py index 8bddff3fa0..37d7a8a03b 100644 --- a/product/ERP5Banking/tests/testERP5BankingCheckPayment.py +++ b/product/ERP5Banking/tests/testERP5BankingCheckPayment.py @@ -497,27 +497,27 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin): Make sure that the check is in delivered state """ check = self.check_payment.getAggregateValue() - self.assertEquals(check, self.check_1) - self.assertEquals(check.getSimulationState(), 'delivered') + self.assertEqual(check, self.check_1) + self.assertEqual(check.getSimulationState(), 'delivered') def stepCheckUndeliverCheck(self, sequence=None, sequence_list=None, **kwd): """ Make sure that the check is in delivered state """ check = self.check_payment.getAggregateValue() - self.assertEquals(check, self.check_1) + self.assertEqual(check, self.check_1) self.workflow_tool.doActionFor(check, 'undeliver_action', wf_id='check_workflow') - self.assertEquals(check.getSimulationState(), 'confirmed') + self.assertEqual(check.getSimulationState(), 'confirmed') def stepCheckCheckAfterReject(self, sequence=None, sequence_list=None, **kwd): """ Make sure that the check is in delivered state """ check = self.check_payment.getAggregateValue() - self.assertEquals(check, self.check_2) - self.assertEquals(check.getSimulationState(), 'delivered') - self.assertEquals(self.check_1.getSimulationState(), 'confirmed') + self.assertEqual(check, self.check_2) + self.assertEqual(check.getSimulationState(), 'delivered') + self.assertEqual(self.check_1.getSimulationState(), 'confirmed') class TestERP5BankingCheckPayment(TestERP5BankingCheckPaymentMixin): diff --git a/product/ERP5Banking/tests/testERP5BankingCheckbookReception.py b/product/ERP5Banking/tests/testERP5BankingCheckbookReception.py index 147f2d1262..4046eff109 100644 --- a/product/ERP5Banking/tests/testERP5BankingCheckbookReception.py +++ b/product/ERP5Banking/tests/testERP5BankingCheckbookReception.py @@ -280,20 +280,20 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin): for line in self.checkbook_reception.objectValues(): aggregate_value_list = line.getAggregateValueList() - self.assertEquals(len(aggregate_value_list), 1) + self.assertEqual(len(aggregate_value_list), 1) aggregate_value = aggregate_value_list[0] if aggregate_value.getPortalType()=='Checkbook': self.checkbook_1 = aggregate_value elif aggregate_value.getPortalType()=='Check': self.check_1 = aggregate_value # Make sure new check is in draft mode - self.assertEquals(self.check_1.getSimulationState(), 'draft') + self.assertEqual(self.check_1.getSimulationState(), 'draft') self.assertNotEquals(None, self.checkbook_1) self.assertNotEquals(None, self.check_1) # Make sure that all checks inside checkbook are create - self.assertEquals(len(self.checkbook_1.objectValues()), 50) + self.assertEqual(len(self.checkbook_1.objectValues()), 50) # Make sure that all checks inside checkbook are not issued yet - self.assertEquals(self.checkbook_1.objectValues()[0].getSimulationState(), + self.assertEqual(self.checkbook_1.objectValues()[0].getSimulationState(), 'draft') def stepConfirmCheckbookReception(self, sequence=None, sequence_list=None, **kwd): diff --git a/product/ERP5Banking/tests/testERP5BankingCheckbookVaultTransfer.py b/product/ERP5Banking/tests/testERP5BankingCheckbookVaultTransfer.py index 0eee29c80f..83869ea105 100644 --- a/product/ERP5Banking/tests/testERP5BankingCheckbookVaultTransfer.py +++ b/product/ERP5Banking/tests/testERP5BankingCheckbookVaultTransfer.py @@ -116,7 +116,7 @@ class TestERP5BankingCheckbookVaultTransferMixin(TestERP5BankingMixin): for line in self.checkbook_reception.objectValues(): aggregate_value_list = line.getAggregateValueList() - self.assertEquals(len(aggregate_value_list), 1) + self.assertEqual(len(aggregate_value_list), 1) aggregate_value = aggregate_value_list[0] if aggregate_value.getPortalType()=='Checkbook': self.checkbook_1 = aggregate_value diff --git a/product/ERP5Banking/tests/testERP5BankingClassificationSurvey.py b/product/ERP5Banking/tests/testERP5BankingClassificationSurvey.py index b9ded21e91..be73f50028 100644 --- a/product/ERP5Banking/tests/testERP5BankingClassificationSurvey.py +++ b/product/ERP5Banking/tests/testERP5BankingClassificationSurvey.py @@ -320,7 +320,7 @@ class TestERP5BankingClassificationSurvey(TestERP5BankingMixin): variation_text = cell.getBaobabDestinationVariationText() cash_status = [x for x in variation_text.split('\n') if x.startswith('cash_status')][0] - self.assertEquals(cash_status, 'cash_status/retired') + self.assertEqual(cash_status, 'cash_status/retired') if cell.getId() == 'movement_0_0_0': # check the quantity for coin for year 1992 is 5 self.assertEqual(cell.getQuantity(), 2.0) @@ -363,7 +363,7 @@ class TestERP5BankingClassificationSurvey(TestERP5BankingMixin): variation_text = cell.getBaobabDestinationVariationText() cash_status = [x for x in variation_text.split('\n') if x.startswith('cash_status')][0] - self.assertEquals(cash_status, 'cash_status/cancelled') + self.assertEqual(cash_status, 'cash_status/cancelled') if cell.getId() == 'movement_0_0_0': # check the quantity for coin for year 1992 is 5 self.assertEqual(cell.getQuantity(), 5.0) diff --git a/product/ERP5Banking/tests/testERP5BankingCounterDate.py b/product/ERP5Banking/tests/testERP5BankingCounterDate.py index a29461f33c..df655d313b 100644 --- a/product/ERP5Banking/tests/testERP5BankingCounterDate.py +++ b/product/ERP5Banking/tests/testERP5BankingCounterDate.py @@ -176,7 +176,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin): id = 'counter_date_%s_%s' % (date.strftime('%Y%m%d'), site.getId()) self.openCounterDate(site=site, date=date, id=id) counter_date = getattr(self, id) - self.assertEquals(counter_date.getReference(), reference) + self.assertEqual(counter_date.getReference(), reference) counter_date.close() self.tic() diff --git a/product/ERP5Banking/tests/testERP5BankingTravelerCheckPurchase.py b/product/ERP5Banking/tests/testERP5BankingTravelerCheckPurchase.py index 214c36af23..996d795d87 100644 --- a/product/ERP5Banking/tests/testERP5BankingTravelerCheckPurchase.py +++ b/product/ERP5Banking/tests/testERP5BankingTravelerCheckPurchase.py @@ -189,7 +189,7 @@ class TestERP5BankingTravelerCheckPurchase(TestERP5BankingCheckbookUsualCashTran self.assertEqual(len(checkbook_list), 0) # check we have cash checkbook 1 checkbook_object_list = [x.getObject() for x in checkbook_list] - self.assertEquals(len(checkbook_object_list), 0) + self.assertEqual(len(checkbook_object_list), 0) # check the inventory of the bank account self.assertEqual(self.simulation_tool.getCurrentInventory( payment=self.bank_account_1.getRelativeUrl(), diff --git a/product/ERP5Banking/tests/testERP5BankingTravelerCheckSale.py b/product/ERP5Banking/tests/testERP5BankingTravelerCheckSale.py index 852f8c7b72..b99f48a365 100644 --- a/product/ERP5Banking/tests/testERP5BankingTravelerCheckSale.py +++ b/product/ERP5Banking/tests/testERP5BankingTravelerCheckSale.py @@ -263,7 +263,7 @@ class TestERP5BankingTravelerCheckSale(TestERP5BankingCheckbookUsualCashTransfer self.assertEqual(len(checkbook_list), 0) # check we have cash checkbook 1 checkbook_object_list = [x.getObject() for x in checkbook_list] - self.assertEquals(len(checkbook_object_list), 0) + self.assertEqual(len(checkbook_object_list), 0) # check the inventory of the bank account self.assertEqual(self.simulation_tool.getCurrentInventory( payment=self.bank_account_1.getRelativeUrl(), diff --git a/product/ERP5Catalog/tests/testArchive.py b/product/ERP5Catalog/tests/testArchive.py index 422e9ec59b..ff08e0b82b 100644 --- a/product/ERP5Catalog/tests/testArchive.py +++ b/product/ERP5Catalog/tests/testArchive.py @@ -108,7 +108,7 @@ class TestArchive(InventoryAPITestCase): for url in url_list: path = '/' + portal_id + '/' + url #LOG('checkRelativeUrlInSQLPathList found path:',0,path) - self.failUnless(path in path_list) + self.assertTrue(path in path_list) def checkRelativeUrlNotInSQLPathList(self,url_list,connection_id=None): path_list = self.getSQLPathList(connection_id=connection_id) @@ -116,7 +116,7 @@ class TestArchive(InventoryAPITestCase): for url in url_list: path = '/' + portal_id + '/' + url #LOG('checkRelativeUrlInSQLPathList not found path:',0,path) - self.failUnless(path not in path_list) + self.assertTrue(path not in path_list) @reindex def _makeInventory(self, date): @@ -150,7 +150,7 @@ class TestArchive(InventoryAPITestCase): getInventory = self.getSimulationTool().getInventory self.mvt = self._makeMovement(quantity=100, stop_date=DateTime("2006/06/06"), simulation_state='delivered',) - self.assertEquals(100, getInventory(node_uid=self.node.getUid())) + self.assertEqual(100, getInventory(node_uid=self.node.getUid())) self.assertEqual(len(self.folder.searchFolder(portal_type="Dummy Movement")), 1) # Create an inventory object @@ -275,7 +275,7 @@ class TestArchive(InventoryAPITestCase): # Create a new movement and check it goes only in new catalog self.assertEqual(len(self.folder.searchFolder(portal_type="Dummy Movement")), 0) - self.assertEquals(100, getInventory(node_uid=self.node.getUid())) + self.assertEqual(100, getInventory(node_uid=self.node.getUid())) self.new_mvt = self._makeMovement(quantity=50, stop_date=DateTime("2006/08/06"), simulation_state='delivered',) self.tic() @@ -286,7 +286,7 @@ class TestArchive(InventoryAPITestCase): self.checkRelativeUrlNotInSQLPathList(path_list, connection_id=self.original_connection_id) self.checkRelativeUrlInSQLPathList(path_list, connection_id=self.new_connection_id) self.checkRelativeUrlNotInSQLPathList(path_list, connection_id=self.archive_connection_id) - self.assertEquals(150, getInventory(node_uid=self.node.getUid())) + self.assertEqual(150, getInventory(node_uid=self.node.getUid())) # now play with preference to select to view document from archive portal_preferences = self.getPreferenceTool() @@ -299,7 +299,7 @@ class TestArchive(InventoryAPITestCase): self.portal.portal_workflow.doActionFor(self.pref, 'enable_action', wf_id='preference_workflow') - self.assertEquals(self.pref.getPreferenceState(), 'enabled') + self.assertEqual(self.pref.getPreferenceState(), 'enabled') path_list = [self.pref.getRelativeUrl()] self.checkRelativeUrlNotInSQLPathList(path_list, connection_id=self.original_connection_id) @@ -310,7 +310,7 @@ class TestArchive(InventoryAPITestCase): self.assertEqual(len(self.folder.searchFolder(portal_type="Dummy Movement")), 1) # As we only have first movement in archive, inventory must be 100 - self.assertEquals(100, getInventory(node=self.node.getRelativeUrl())) + self.assertEqual(100, getInventory(node=self.node.getRelativeUrl())) # go on current catalog self.pref.edit(preferred_archive=None) @@ -330,7 +330,7 @@ class TestArchive(InventoryAPITestCase): # check inventory in archive now self.pref.edit(preferred_archive=archive.getRelativeUrl()) self.tic() - self.assertEquals(100, getInventory(node=self.node.getRelativeUrl())) + self.assertEqual(100, getInventory(node=self.node.getRelativeUrl())) # check if we unindex an object, it's remove in all catalog: module.manage_delObjects([self.organisation_1.id,]) @@ -340,7 +340,7 @@ class TestArchive(InventoryAPITestCase): self.checkRelativeUrlNotInSQLPathList(path_list, connection_id=self.archive_connection_id) # check the current archive - self.assertEquals(portal_archive.getCurrentArchive(), dest) + self.assertEqual(portal_archive.getCurrentArchive(), dest) def test_suite(): diff --git a/product/ERP5Catalog/tests/testERP5Catalog.py b/product/ERP5Catalog/tests/testERP5Catalog.py index 9857650c81..a35b6378aa 100644 --- a/product/ERP5Catalog/tests/testERP5Catalog.py +++ b/product/ERP5Catalog/tests/testERP5Catalog.py @@ -160,7 +160,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): portal_id = self.getPortalId() for url in url_list: path = '/' + portal_id + '/' + url - self.failUnless(path in path_list) + self.assertTrue(path in path_list) LOG('checkRelativeUrlInSQLPathList found path:',0,path) def checkRelativeUrlNotInSQLPathList(self,url_list,connection_id=None): @@ -168,7 +168,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): portal_id = self.getPortalId() for url in url_list: path = '/' + portal_id + '/' + url - self.failUnless(path not in path_list) + self.assertTrue(path not in path_list) LOG('checkRelativeUrlInSQLPathList not found path:',0,path) def test_01_HasEverything(self): @@ -182,7 +182,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): portal_catalog = self.getCatalogTool() self.tic() organisation_module_list = portal_catalog(portal_type='Organisation Module') - self.assertEquals(len(organisation_module_list),1) + self.assertEqual(len(organisation_module_list),1) def test_03_CreateAndDeleteObject(self): portal_catalog = self.getCatalogTool() @@ -222,50 +222,50 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): person_module = self.getPersonModule() # Now we will try the same thing as previous test and look at searchFolder folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals([],folder_object_list) + self.assertEqual([],folder_object_list) person = person_module.newContent(id='4',portal_type='Person',) person.immediateReindexObject() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals(['4'],folder_object_list) + self.assertEqual(['4'],folder_object_list) person.immediateReindexObject() person_module.manage_delObjects('4') self.tic() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals([],folder_object_list) + self.assertEqual([],folder_object_list) def test_05_SearchFolderWithImmediateReindexObject(self): person_module = self.getPersonModule() # Now we will try the same thing as previous test and look at searchFolder folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals([],folder_object_list) + self.assertEqual([],folder_object_list) person = person_module.newContent(id='4',portal_type='Person') person.immediateReindexObject() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals(['4'],folder_object_list) + self.assertEqual(['4'],folder_object_list) person_module.manage_delObjects('4') self.tic() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals([],folder_object_list) + self.assertEqual([],folder_object_list) def test_06_SearchFolderWithRecursiveImmediateReindexObject(self): person_module = self.getPersonModule() # Now we will try the same thing as previous test and look at searchFolder folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals([],folder_object_list) + self.assertEqual([],folder_object_list) person = person_module.newContent(id='4',portal_type='Person') person_module.recursiveImmediateReindexObject() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals(['4'],folder_object_list) + self.assertEqual(['4'],folder_object_list) person_module.manage_delObjects('4') self.tic() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals([],folder_object_list) + self.assertEqual([],folder_object_list) def test_07_ClearCatalogAndTestNewContent(self): person_module = self.getPersonModule() @@ -277,7 +277,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): person = person_module.newContent(id='4',portal_type='Person') person.immediateReindexObject() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals(['4'],folder_object_list) + self.assertEqual(['4'],folder_object_list) def test_08_ClearCatalogAndTestRecursiveImmediateReindexObject(self): person_module = self.getPersonModule() @@ -289,7 +289,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): person = person_module.newContent(id='4',portal_type='Person') person_module.recursiveImmediateReindexObject() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals(['4'],folder_object_list) + self.assertEqual(['4'],folder_object_list) def test_09_ClearCatalogAndTestImmediateReindexObject(self): person_module = self.getPersonModule() @@ -301,7 +301,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): person = person_module.newContent(id='4',portal_type='Person') person.immediateReindexObject() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals(['4'],folder_object_list) + self.assertEqual(['4'],folder_object_list) def test_10_OrderedSearchFolder(self): person_module = self.getPersonModule() @@ -318,15 +318,15 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): person.immediateReindexObject() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder(sort_on=[('id','ascending')])] - self.assertEquals(['a','b','c'],folder_object_list) + self.assertEqual(['a','b','c'],folder_object_list) folder_object_list = [x.getObject().getId() for x in person_module.searchFolder( sort_on=[('title','ascending'), ('description','ascending')])] - self.assertEquals(['c','b','a'],folder_object_list) + self.assertEqual(['c','b','a'],folder_object_list) folder_object_list = [x.getObject().getId() for x in person_module.searchFolder( sort_on=[('title','ascending'),('description','descending')])] - self.assertEquals(['a','b','c'],folder_object_list) + self.assertEqual(['a','b','c'],folder_object_list) def test_11_CastStringAsInt(self): person_module = self.getPersonModule() @@ -342,14 +342,14 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): person = person_module.newContent(id='c',portal_type='Person',title='12') person.immediateReindexObject() folder_object_list = [x.getObject().getTitle() for x in person_module.searchFolder(sort_on=[('title','ascending')])] - self.assertEquals(['1','12','2'],folder_object_list) + self.assertEqual(['1','12','2'],folder_object_list) folder_object_list = [x.getObject().getTitle() for x in person_module.searchFolder(sort_on=[('title','ascending','int')])] - self.assertEquals(['1','2','12'],folder_object_list) + self.assertEqual(['1','2','12'],folder_object_list) def test_12_TransactionalUidBuffer(self): portal_catalog = self.getCatalogTool() catalog = portal_catalog.getSQLCatalog() - self.failUnless(catalog is not None) + self.assertTrue(catalog is not None) # Clear out the uid buffer. #from Products.ZSQLCatalog.SQLCatalog import uid_buffer_dict, get_ident @@ -368,11 +368,11 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): catalog.newUid() uid_buffer = getUIDBuffer() - self.failUnless(len(uid_buffer) > 0) + self.assertTrue(len(uid_buffer) > 0) self.abort() uid_buffer = getUIDBuffer() - self.failUnless(len(uid_buffer) == 0) + self.assertTrue(len(uid_buffer) == 0) def test_13_ERP5Site_reindexAll(self): # Flush message queue @@ -395,7 +395,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): sql = 'select count(*) from catalog where portal_type!=NULL' result = sql_connection.manage_test(sql) message_count = result[0]['COUNT(*)'] - self.assertEquals(0, message_count) + self.assertEqual(0, message_count) # Commit self.commit() # Reindex all @@ -406,10 +406,10 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): sql = 'select count(*) from message' result = sql_connection.manage_test(sql) message_count = result[0]['COUNT(*)'] - self.assertEquals(0, message_count) + self.assertEqual(0, message_count) # Check if all objects are catalogued as before new_path_list = self.getSQLPathList() - self.assertEquals(set(original_path_list) - set(new_path_list), set()) + self.assertEqual(set(original_path_list) - set(new_path_list), set()) def test_14_ReindexWithBrokenCategory(self): """Reindexing an object with 1 broken category must not affect other valid @@ -426,11 +426,11 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): module = portal.getDefaultModule('Organisation') organisation = module.newContent(portal_type='Organisation',) organisation.setGroup('nexedi') - self.assertEquals(organisation.getGroupValue(), group_nexedi_category) + self.assertEqual(organisation.getGroupValue(), group_nexedi_category) organisation.setRegion('europe') - self.assertEquals(organisation.getRegionValue(), region_europe_category) + self.assertEqual(organisation.getRegionValue(), region_europe_category) organisation.setRole('not_exists') - self.assertEquals(organisation.getRoleValue(), None) + self.assertEqual(organisation.getRoleValue(), None) # Flush message queue self.tic() # Clear catalog @@ -443,7 +443,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): organisation.getUid() result = sql_connection.manage_test(sql) message_count = result[0]['COUNT(*)'] - self.assertEquals(0, message_count) + self.assertEqual(0, message_count) # Commit self.tic() # Check catalog @@ -453,7 +453,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): sql = 'select count(*) from message' result = sql_connection.manage_test(sql) message_count = result[0]['COUNT(*)'] - self.assertEquals(0, message_count) + self.assertEqual(0, message_count) # Check region and group categories are catalogued for base_cat, theorical_count in { 'region':1, @@ -465,7 +465,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): portal_category[base_cat].getUid()) result = sql_connection.manage_test(sql) cataloged_obj_count = result[0]['COUNT(*)'] - self.assertEquals(theorical_count, cataloged_obj_count, + self.assertEqual(theorical_count, cataloged_obj_count, 'category %s is not cataloged correctly' % base_cat) def test_15_getObject(self,): @@ -475,20 +475,20 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): obj = self._makeOrganisation() # otherwise it returns the object - self.assertEquals(obj, portal_catalog.getObject(obj.getUid()).getObject()) + self.assertEqual(obj, portal_catalog.getObject(obj.getUid()).getObject()) # but raises KeyError if object is not in catalog self.assertRaises(KeyError, portal_catalog.getObject, sys.maxint) def test_getRecordForUid(self): portal_catalog = self.getCatalogTool() obj = self._makeOrganisation() - self.assertEquals(obj, + self.assertEqual(obj, portal_catalog.getSQLCatalog().getRecordForUid(obj.getUid()).getObject()) def test_path(self): portal_catalog = self.getCatalogTool() obj = self._makeOrganisation() - self.assertEquals(obj.getPath(), portal_catalog.getpath(obj.getUid())) + self.assertEqual(obj.getPath(), portal_catalog.getpath(obj.getUid())) self.assertRaises(KeyError, portal_catalog.getpath, sys.maxint) def test_16_newUid(self): @@ -498,8 +498,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): uid_dict = {} for i in xrange(UID_BUFFER_SIZE * 3): uid = portal_catalog.newUid() - self.failUnless(isinstance(uid, long)) - self.failIf(uid in uid_dict) + self.assertTrue(isinstance(uid, long)) + self.assertFalse(uid in uid_dict) uid_dict[uid] = None def test_17_CreationDate_ModificationDate(self): @@ -517,25 +517,25 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): sql = """select creation_date, modification_date from catalog where uid = %s""" % organisation.getUid() result = sql_connection.manage_test(sql) - self.assertEquals(creation_date, + self.assertEqual(creation_date, result[0]['creation_date'].ISO()) - self.assertEquals(modification_date, + self.assertEqual(modification_date, result[0]['modification_date'].ISO()) - self.assertEquals(creation_date, + self.assertEqual(creation_date, result[0]['modification_date'].ISO()) import time; time.sleep(3) organisation.edit(title='edited') self.tic() result = sql_connection.manage_test(sql) - self.assertEquals(creation_date, result[0]['creation_date'].ISO()) + self.assertEqual(creation_date, result[0]['creation_date'].ISO()) modification_date = organisation.getModificationDate().toZone('UTC').ISO() self.assertNotEquals(modification_date, organisation.getCreationDate()) # This test was first written with a now variable initialized with # DateTime(). But since we are never sure of the time required in # order to execute some line of code - self.assertEquals(modification_date, + self.assertEqual(modification_date, result[0]['modification_date'].ISO()) self.assertTrue(organisation.getModificationDate()>now) self.assertTrue(result[0]['creation_date']<result[0]['modification_date']) @@ -606,7 +606,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): **kw) ) LOG('kw', 0, kw) LOG('SQL', 0, testMethod(src__=1, **kw)) - self.assertEquals(len(testMethod(**kw)), 2) + self.assertEqual(len(testMethod(**kw)), 2) # check we can make a simple filter on title. kw = default_parametrs.copy() @@ -616,9 +616,9 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): **kw) ) LOG('kw', 1, kw) LOG('SQL', 1, testMethod(src__=1, **kw)) - self.assertEquals( len(testMethod(**kw)), 1, + self.assertEqual( len(testMethod(**kw)), 1, testMethod(src__=1, **kw) ) - self.assertEquals( testMethod(**kw)[0]['uid'], + self.assertEqual( testMethod(**kw)[0]['uid'], source_organisation.getUid(), testMethod(src__=1, **kw) ) @@ -631,9 +631,9 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): LOG('kw', 2, kw) LOG('SQL', 2, testMethod(src__=1, **kw)) brains = testMethod(**kw) - self.assertEquals( len(brains), 2, + self.assertEqual( len(brains), 2, testMethod(src__=1, **kw)) - self.failIf( brains[0]['id'] > brains[1]['id'], + self.assertFalse( brains[0]['id'] > brains[1]['id'], testMethod(src__=1, **kw) ) # check related keys works @@ -645,8 +645,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): LOG('kw', 3, kw) LOG('SQL', 3, testMethod(src__=1, **kw)) brains = testMethod(**kw) - self.assertEquals( len(brains), 1, testMethod(src__=1, **kw) ) - self.assertEquals( brains[0]['uid'], + self.assertEqual( len(brains), 1, testMethod(src__=1, **kw) ) + self.assertEqual( brains[0]['uid'], source_organisation.getUid(), testMethod(src__=1, **kw) ) @@ -657,10 +657,10 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): person = person_module.newContent(id='5',portal_type='Person',title=title) person.immediateReindexObject() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()] - self.assertEquals(['5'],folder_object_list) + self.assertEqual(['5'],folder_object_list) folder_object_list = [x.getObject().getId() for x in person_module.searchFolder(title=title)] - self.assertEquals(['5'],folder_object_list) + self.assertEqual(['5'],folder_object_list) def test_Collation(self): person_module = self.getPersonModule() @@ -670,17 +670,17 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): person.immediateReindexObject() folder_object_list = [x.getObject().getId() for x in person_module.searchFolder(title=title)] - self.assertEquals(['5'],folder_object_list) + self.assertEqual(['5'],folder_object_list) # Searching for Sebastien should also find Sébastien folder_object_list = [x.getObject().getId() for x in person_module.searchFolder(title='Sebastien')] - self.assertEquals(['5'],folder_object_list) + self.assertEqual(['5'],folder_object_list) # Same for sebastien, as catalog searches are case insensitive folder_object_list = [x.getObject().getId() for x in person_module.searchFolder(title='sebastien')] - self.assertEquals(['5'],folder_object_list) + self.assertEqual(['5'],folder_object_list) def test_20_SearchFolderWithDynamicRelatedKey(self): @@ -698,51 +698,51 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): module = portal.getDefaultModule('Organisation') organisation = module.newContent(portal_type='Organisation',) organisation.setGroup('nexedi') - self.assertEquals(organisation.getGroupValue(), group_nexedi_category) + self.assertEqual(organisation.getGroupValue(), group_nexedi_category) organisation2 = module.newContent(portal_type='Organisation',) organisation2.setGroup('storever') organisation2.setTitle('Organisation 2') - self.assertEquals(organisation2.getGroupValue(), group_nexedi_category2) + self.assertEqual(organisation2.getGroupValue(), group_nexedi_category2) # Flush message queue self.tic() # Try to get the organisation with the group title Nexedi organisation_list = [x.getObject() for x in module.searchFolder(group_title='Nexedi')] - self.assertEquals(organisation_list,[organisation]) + self.assertEqual(organisation_list,[organisation]) organisation_list = [x.getObject() for x in module.searchFolder(default_group_title='Nexedi')] - self.assertEquals(organisation_list,[organisation]) + self.assertEqual(organisation_list,[organisation]) # Try to get the organisation with the group id organisation_list = [x.getObject() for x in module.searchFolder(group_id='storever')] - self.assertEquals(organisation_list,[organisation2]) + self.assertEqual(organisation_list,[organisation2]) # Try to get the organisation with the group description 'a' organisation_list = [x.getObject() for x in module.searchFolder(group_description='a')] - self.assertEquals(organisation_list,[organisation]) + self.assertEqual(organisation_list,[organisation]) # Try to get the organisation with the group description 'c' organisation_list = [x.getObject() for x in module.searchFolder(group_description='c')] - self.assertEquals(organisation_list,[]) + self.assertEqual(organisation_list,[]) # Try to get the organisation with the default group description 'c' organisation_list = [x.getObject() for x in module.searchFolder(default_group_description='c')] - self.assertEquals(organisation_list,[]) + self.assertEqual(organisation_list,[]) # Try to get the organisation with group relative_url group_relative_url = group_nexedi_category.getRelativeUrl() organisation_list = [x.getObject() for x in module.searchFolder(group_relative_url=group_relative_url)] - self.assertEquals(organisation_list, [organisation]) + self.assertEqual(organisation_list, [organisation]) # Try to get the organisation with group uid organisation_list = [x.getObject() for x in module.searchFolder(group_uid=group_nexedi_category.getUid())] - self.assertEquals(organisation_list, [organisation]) + self.assertEqual(organisation_list, [organisation]) # Try to get the organisation with the group id AND title of the document organisation_list = [x.getObject() for x in module.searchFolder(group_id='storever', title='Organisation 2')] - self.assertEquals(organisation_list,[organisation2]) + self.assertEqual(organisation_list,[organisation2]) def test_21_SearchFolderWithDynamicStrictRelatedKey(self): @@ -760,26 +760,26 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): module = portal.getDefaultModule('Organisation') organisation = module.newContent(portal_type='Organisation',) organisation.setGroup('nexedi/erp5') - self.assertEquals(organisation.getGroupValue(), sub_group_nexedi) + self.assertEqual(organisation.getGroupValue(), sub_group_nexedi) # Flush message queue self.tic() # Try to get the organisation with the group title Nexedi organisation_list = [x.getObject() for x in module.searchFolder(strict_group_title='Nexedi')] - self.assertEquals(organisation_list,[]) + self.assertEqual(organisation_list,[]) # Try to get the organisation with the group title ERP5 organisation_list = [x.getObject() for x in module.searchFolder(strict_group_title='ERP5')] - self.assertEquals(organisation_list,[organisation]) + self.assertEqual(organisation_list,[organisation]) # Try to get the organisation with the group description a organisation_list = [x.getObject() for x in module.searchFolder(strict_group_description='a')] - self.assertEquals(organisation_list,[]) + self.assertEqual(organisation_list,[]) # Try to get the organisation with the group description b organisation_list = [x.getObject() for x in module.searchFolder(strict_group_description='b')] - self.assertEquals(organisation_list,[organisation]) + self.assertEqual(organisation_list,[organisation]) def test_22_SearchingWithUnicode(self): person_module = self.getPersonModule() @@ -820,7 +820,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): ('catalog.title DESC', '`catalog`.`title` DESC')) def test_26_SortOnUnknownKeys(self): - self.assertEquals('', + self.assertEqual('', self.getCatalogTool().buildSQLQuery(select_list=('uid', 'path'), sort_on=(('ignored', 'ascending'),))['order_by_expression']) @@ -935,7 +935,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): """ organisation_title = 'Nexedi Organisation' organisation = self._makeOrganisation(title=organisation_title) - self.assertEquals([organisation.getPath()], + self.assertEqual([organisation.getPath()], [x.path for x in self.getCatalogTool()( title={'query': organisation_title})]) @@ -943,7 +943,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): """use a dict as a keyword parameter, but using a related key """ organisation = self._makeOrganisation() - self.assertEquals([organisation.getPath()], + self.assertEqual([organisation.getPath()], [x.path for x in self.getCatalogTool()( group_title={'query': 'Nexedi Group'}, # have to filter on portal type, because the group category is @@ -956,7 +956,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): organisation_title = 'Nexedi Organisation' organisation = self._makeOrganisation(title=organisation_title) - self.assertEquals([organisation.getPath()], + self.assertEqual([organisation.getPath()], [x.path for x in self.getCatalogTool()( title={'query': (organisation_title, 'something else'), 'operator': 'or'})]) @@ -967,7 +967,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): organisation_title = 'Nexedi Organisation' organisation = self._makeOrganisation(title=organisation_title) - self.assertEquals([organisation.getPath()], + self.assertEqual([organisation.getPath()], [x.path for x in self.getCatalogTool()( # this is useless, we must find a better use case title={'query': (organisation_title, organisation_title), @@ -980,7 +980,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): org_b = self._makeOrganisation(title='B') org_c = self._makeOrganisation(title='C') - self.assertEquals([org_a.getPath()], + self.assertEqual([org_a.getPath()], [x.path for x in self.getCatalogTool()( portal_type='Organisation', title={'query': 'B', 'range': 'max'})]) @@ -1017,7 +1017,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): org_b = self._makeOrganisation(title='B') org_c = self._makeOrganisation(title='C') - self.assertEquals([org_b.getPath()], + self.assertEqual([org_b.getPath()], [x.path for x in self.getCatalogTool()( portal_type='Organisation', title={'query': ('B', 'C'), 'range': 'minmax'})]) @@ -1047,7 +1047,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): for k, v in query_dict.items(): setattr(query_record, k, v) - self.assertEquals(set([org_b.getPath(), org_c.getPath()]), + self.assertEqual(set([org_b.getPath(), org_c.getPath()]), set([x.path for x in self.getCatalogTool()( portal_type='Organisation', title=query_record)])) @@ -1058,12 +1058,12 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): erp5_sql_deferred_connection = getattr(self.getPortal(), 'erp5_sql_deferred_connection', None) - self.failUnless(erp5_sql_deferred_connection is not None) - self.assertEquals('Z MySQL Deferred Database Connection', + self.assertTrue(erp5_sql_deferred_connection is not None) + self.assertEqual('Z MySQL Deferred Database Connection', erp5_sql_deferred_connection.meta_type) for method in ['z0_uncatalog_fulltext', 'z_catalog_fulltext_list']: - self.assertEquals('erp5_sql_deferred_connection', + self.assertEqual('erp5_sql_deferred_connection', getattr(self.getCatalogTool().getSQLCatalog(), method).connection_id) @@ -1075,7 +1075,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.tic() folder.manage_delObjects([ob.getId()]) self.tic() - self.assertEquals(0, len(folder.searchFolder())) + self.assertEqual(0, len(folder.searchFolder())) def test_41_ProxyRolesInRestrictedPython(self): """test that proxy roles apply to catalog queries within python scripts @@ -1096,36 +1096,36 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): ob.manage_permission(perm, ['Manager'], 0) self.tic() # check access - self.assertEquals(1, getSecurityManager().checkPermission(perm, folder)) - self.assertEquals(1, getSecurityManager().checkPermission(perm, ob)) + self.assertEqual(1, getSecurityManager().checkPermission(perm, folder)) + self.assertEqual(1, getSecurityManager().checkPermission(perm, ob)) self.login('bob') - self.assertEquals(1, getSecurityManager().checkPermission(perm, folder)) - self.assertEquals(None, getSecurityManager().checkPermission(perm, ob)) + self.assertEqual(1, getSecurityManager().checkPermission(perm, folder)) + self.assertEqual(None, getSecurityManager().checkPermission(perm, ob)) # add a script that calls a catalog method self.login('alice') script = createZODBPythonScript(self.getPortal().portal_skins.custom, 'catalog_test_script', '', "return len(context.searchFolder())") # test without proxy role - self.assertEquals(1, folder.catalog_test_script()) + self.assertEqual(1, folder.catalog_test_script()) self.login('bob') - self.assertEquals(0, folder.catalog_test_script()) + self.assertEqual(0, folder.catalog_test_script()) # test with proxy role and correct role self.login('alice') script.manage_proxy(['Manager']) - self.assertEquals(1, folder.catalog_test_script()) + self.assertEqual(1, folder.catalog_test_script()) self.login('bob') - self.assertEquals(1, folder.catalog_test_script()) + self.assertEqual(1, folder.catalog_test_script()) # test with proxy role and wrong role self.login('alice') script.manage_proxy(['Assignor']) # proxy roles must overwrite the user's roles, even if he is the owner # of the script - self.assertEquals(0, folder.catalog_test_script()) + self.assertEqual(0, folder.catalog_test_script()) self.login('bob') - self.assertEquals(0, folder.catalog_test_script()) + self.assertEqual(0, folder.catalog_test_script()) def test_42_SearchableText(self): """Tests SearchableText is working in ERP5Catalog @@ -1133,20 +1133,20 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): folder = self.getOrganisationModule() ob = folder.newContent() ob.setTitle('The title of this object') - self.failUnless('this' in ob.SearchableText(), ob.SearchableText()) + self.assertTrue('this' in ob.SearchableText(), ob.SearchableText()) # add some other objects, we need to create a minimum quantity of data for # full text queries to work correctly for i in range(10): otherob = folder.newContent() otherob.setTitle('Something different') - self.failIf('this' in otherob.SearchableText(), otherob.SearchableText()) + self.assertFalse('this' in otherob.SearchableText(), otherob.SearchableText()) # catalog those objects self.tic() catalog_tool = self.getCatalogTool() - self.assertEquals([ob], + self.assertEqual([ob], [x.getObject() for x in catalog_tool(portal_type='Organisation', SearchableText='title')]) - self.assertEquals(1, + self.assertEqual(1, catalog_tool.countResults(portal_type='Organisation', SearchableText='title')[0][0]) @@ -1156,14 +1156,14 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.portal.erp5_sql_connection.manage_test('SHOW SENNA STATUS') except ProgrammingError: # MySQL - self.assertEquals([], + self.assertEqual([], [x.getObject for x in self.getCatalogTool()( portal_type='Organisation', SearchableText='different')]) - self.assertEquals(0, self.getCatalogTool().countResults( + self.assertEqual(0, self.getCatalogTool().countResults( portal_type='Organisation', SearchableText='different')[0][0]) else: # Tritonn - self.assertEquals(10, self.getCatalogTool().countResults( + self.assertEqual(10, self.getCatalogTool().countResults( portal_type='Organisation', SearchableText='different')[0][0]) def test_43_ManagePasteObject(self): @@ -1184,7 +1184,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): person_module.reindexObject() person = person_module.newContent(id='1',portal_type='Person') self.tic() - self.assertEquals([person], + self.assertEqual([person], [x.getObject() for x in self.getCatalogTool()( parent_title=person_module.getTitle())]) @@ -1330,7 +1330,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.tic() original_path_list = self.getSQLPathList(self.original_connection_id) new_path_list = self.getSQLPathList(self.new_connection_id) - self.assertEquals(set(original_path_list) - set(new_path_list), set()) + self.assertEqual(set(original_path_list) - set(new_path_list), set()) self.organisation2 = module.newContent(portal_type='Organisation', title="GreatTitle2") first_deleted_url = self.organisation2.getRelativeUrl() @@ -1344,9 +1344,9 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): # Make sure some zsql method use the right connection_id zsql_method = portal.portal_skins.erp5_core.Resource_zGetInventoryList - self.assertEquals(getattr(zsql_method,'connection_id'),self.new_connection_id) + self.assertEqual(getattr(zsql_method,'connection_id'),self.new_connection_id) - self.assertEquals(portal_catalog.getHotReindexingState(), + self.assertEqual(portal_catalog.getHotReindexingState(), HOT_REINDEXING_FINISHED_STATE) # Do a hot reindex in the reverse way, but this time a more @@ -1358,7 +1358,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): destination_sql_connection_id_list=source_sql_connection_id_list, update_destination_sql_catalog=True) self.commit() - self.assertEquals(portal_catalog.getHotReindexingState(), + self.assertEqual(portal_catalog.getHotReindexingState(), HOT_REINDEXING_RECORDING_STATE) self.organisation3 = module.newContent(portal_type='Organisation', title="GreatTitle2") @@ -1387,7 +1387,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): 'playBackRecordedObjectList', 'getId', 'setHotReindexingState')) - self.assertEquals(portal_catalog.getHotReindexingState(), + self.assertEqual(portal_catalog.getHotReindexingState(), HOT_REINDEXING_DOUBLE_INDEXING_STATE) # Now we have started an double indexing self.next_deleted_organisation = module.newContent(portal_type='Organisation', @@ -1405,14 +1405,14 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.organisation4 = module.newContent(portal_type='Organisation', title="GreatTitle2") self.tic() - self.assertEquals(portal_catalog.getHotReindexingState(), + self.assertEqual(portal_catalog.getHotReindexingState(), HOT_REINDEXING_FINISHED_STATE) # Check Security UID object exist in roles and users # compare the number object in the catalog count_catalog = len(self.getSQLPathList(self.original_connection_id)) count_restricted_catalog = len(self.getSQLPathListWithRolesAndUsers(\ self.original_connection_id)) - self.assertEquals(count_catalog, count_restricted_catalog) + self.assertEqual(count_catalog, count_restricted_catalog) path_list = [self.organisation3.getRelativeUrl()] self.checkRelativeUrlInSQLPathList(path_list,connection_id=self.new_connection_id) @@ -1561,13 +1561,13 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): # bob cannot see the document self.login('bob') ctool = self.getCatalogTool() - self.assertEquals(0, len(ctool.searchResults(title='Object Title'))) - self.assertEquals(0, ctool.countResults(title='Object Title')[0][0]) + self.assertEqual(0, len(ctool.searchResults(title='Object Title'))) + self.assertEqual(0, ctool.countResults(title='Object Title')[0][0]) # unless using unrestricted searches - self.assertEquals(1, + self.assertEqual(1, len(ctool.unrestrictedSearchResults(title='Object Title'))) - self.assertEquals(1, + self.assertEqual(1, ctool.unrestrictedCountResults(title='Object Title')[0][0]) @todo_erp5 @@ -1590,11 +1590,11 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.assertEqual(len(index_columns), 0) # Check catalog don't tell to use index if nothing defined sql = person_module.searchFolder(src__=1) - self.failUnless('use index' not in sql) + self.assertTrue('use index' not in sql) sql = person_module.searchFolder(src__=1, sort_on=[('id','ascending')]) - self.failUnless('use index' not in sql) + self.assertTrue('use index' not in sql) sql = person_module.searchFolder(src__=1, sort_on=[('title','ascending')]) - self.failUnless('use index' not in sql) + self.assertTrue('use index' not in sql) # Defined that catalog must tell to use index when order by catalog.title index_columns = ('catalog.title',) setattr(catalog, 'sql_catalog_index_on_order_keys', index_columns) @@ -1603,11 +1603,11 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.assertEqual(len(index_columns), 1) # Check catalog tell to use index only when ordering by catalog.title sql = person_module.searchFolder(src__=1) - self.failUnless('use index' not in sql) + self.assertTrue('use index' not in sql) sql = person_module.searchFolder(src__=1, sort_on=[('id','ascending')]) - self.failUnless('use index' not in sql) + self.assertTrue('use index' not in sql) sql = person_module.searchFolder(src__=1, sort_on=[('title','ascending')]) - self.failUnless('use index' in sql) + self.assertTrue('use index' in sql) def test_50_LocalRolesArgument(self): """test local_roles= argument @@ -1627,44 +1627,44 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): # by default bob can see those 2 documents self.login('bob') ctool = self.getCatalogTool() - self.assertEquals(2, len(ctool.searchResults(title='Object Title'))) - self.assertEquals(2, ctool.countResults(title='Object Title')[0][0]) + self.assertEqual(2, len(ctool.searchResults(title='Object Title'))) + self.assertEqual(2, ctool.countResults(title='Object Title')[0][0]) # if we specify local_roles= it will only returns documents on with bob has # a local roles - self.assertEquals(0, + self.assertEqual(0, len(ctool.searchResults(title='Object Title', local_roles='UnexistingRole'))) - self.assertEquals(0, + self.assertEqual(0, len(ctool.searchResults(title='Object Title', local_roles='Assignor'))) - self.assertEquals(1, + self.assertEqual(1, len(ctool.searchResults(title='Object Title', local_roles='Assignee'))) - self.assertEquals(1, + self.assertEqual(1, ctool.countResults(title='Object Title', local_roles='Assignee')[0][0]) # this also work for searchFolder and countFolder - self.assertEquals(1, len(folder.searchFolder(title='Object Title', + self.assertEqual(1, len(folder.searchFolder(title='Object Title', local_roles='Assignee'))) - self.assertEquals(1, folder.countFolder(title='Object Title', + self.assertEqual(1, folder.countFolder(title='Object Title', local_roles='Assignee')[0][0]) # and local_roles can be a list, then this a OR (ie. you must have at least # one role). - self.assertEquals(1, + self.assertEqual(1, len(ctool.searchResults(title='Object Title', local_roles=['Assignee', 'Auditor']))) - self.assertEquals(1, + self.assertEqual(1, ctool.countResults(title='Object Title', local_roles=['Assignee', 'Auditor'])[0][0]) # this list can also be given in ; form, for worklists URL - self.assertEquals(1, + self.assertEqual(1, len(ctool.searchResults(title='Object Title', local_roles='Assignee;Auditor'))) - self.assertEquals(1, + self.assertEqual(1, ctool.countResults(title='Object Title', local_roles='Assignee;Auditor')[0][0]) @@ -1677,16 +1677,16 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.assertFalse(user.has_permission('View', ob1)) self.assertTrue(user.has_role('Assignee', ob1)) result_list = [r.getId() for r in ctool(title='Object Title', local_roles='Assignee')] - self.assertEquals(1, len(result_list)) - self.assertEquals([ob2_id], result_list) - self.assertEquals(1, + self.assertEqual(1, len(result_list)) + self.assertEqual([ob2_id], result_list) + self.assertEqual(1, ctool.countResults(title='Object Title', local_roles='Assignee')[0][0]) # this also work for searchFolder and countFolder - self.assertEquals(1, len(folder.searchFolder(title='Object Title', + self.assertEqual(1, len(folder.searchFolder(title='Object Title', local_roles='Assignee'))) - self.assertEquals(1, folder.countFolder(title='Object Title', + self.assertEqual(1, folder.countFolder(title='Object Title', local_roles='Assignee')[0][0]) def test_51_SearchWithKeyWords(self): @@ -1698,16 +1698,16 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.tic() ctool = self.getCatalogTool() - self.assertEquals([and_], [x.getObject() for x in + self.assertEqual([and_], [x.getObject() for x in ctool(portal_type='Person', title='AND')]) - self.assertEquals([or_], [x.getObject() for x in + self.assertEqual([or_], [x.getObject() for x in ctool(portal_type='Person', title='OR')]) - self.assertEquals([like_], [x.getObject() for x in + self.assertEqual([like_], [x.getObject() for x in ctool(portal_type='Person', title='LIKE')]) - self.assertEquals([select_], [x.getObject() for x in + self.assertEqual([select_], [x.getObject() for x in ctool(portal_type='Person', title='SELECT')]) def test_52_QueryAndTableAlias(self): @@ -1803,11 +1803,11 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): organisation = module.newContent(portal_type='Organisation',) # Ensure that the new uid is long. uid = organisation.uid - self.failUnless(isinstance(uid, long)) + self.assertTrue(isinstance(uid, long)) self.tic() # Ensure that the uid did not change after the indexing. - self.assertEquals(organisation.uid, uid) + self.assertEqual(organisation.uid, uid) # Force to convert the uid to int. self.uid = int(uid) @@ -1815,8 +1815,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): # After the indexing, the uid must be converted to long automatically, # and the value must be equivalent. - self.failUnless(isinstance(uid, long)) - self.assertEquals(organisation.uid, uid) + self.assertTrue(isinstance(uid, long)) + self.assertEqual(organisation.uid, uid) def test_55_FloatFormat(self): catalog_kw = {'uid': {'query': '2 567.54', @@ -1855,10 +1855,10 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): obj2.reindexObject() self.tic() ctool = self.getCatalogTool() - self.assertEquals([obj], [x.getObject() for x in + self.assertEqual([obj], [x.getObject() for x in ctool(title='The Document', owner=self.username)]) - self.assertEquals([], [x.getObject() for x in + self.assertEqual([], [x.getObject() for x in ctool(title='The Document', owner='somebody else')]) @@ -1873,7 +1873,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.tic() self.login('bob') - self.assertEquals([obj2], [x.getObject() for x in + self.assertEqual([obj2], [x.getObject() for x in obj.searchFolder(portal_type='Bank Account')]) # now if we pass the bank account in deleted state, it's no longer returned # by searchFolder. @@ -1881,7 +1881,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): # allow deletion. obj2.delete() self.tic() - self.assertEquals([], [x.getObject() for x in + self.assertEqual([], [x.getObject() for x in obj.searchFolder(portal_type='Bank Account')]) @todo_erp5 @@ -2094,7 +2094,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.assertSameSet([doc, other_doc], [x.getObject() for x in ctool(portal_type='Organisation', title='Foo%')]) # ... but you can force searches with an exact match key - self.assertEquals([doc], [x.getObject() for x in + self.assertEqual([doc], [x.getObject() for x in ctool(portal_type='Organisation', title=dict(query='Foo%', key='ExactMatch'))]) @@ -2108,7 +2108,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): # future, in this case, this test have to be updated) self.assertSameSet([doc], [x.getObject() for x in ctool(portal_type='Organisation', description='Foo')]) - self.assertEquals(set([doc, other_doc]), set([x.getObject() for x in + self.assertEqual(set([doc, other_doc]), set([x.getObject() for x in ctool(portal_type='Organisation', description=dict(query='Foo', key='Keyword'))])) @@ -2123,10 +2123,10 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): return set([x.getObject() for x in ctool.searchResults(**kw)]) # description='' is ignored - self.assertEquals(set([doc_with_empty_description, doc_with_description]), + self.assertEqual(set([doc_with_empty_description, doc_with_description]), searchResults(description='')) # unless we exlicitly say we don't want to ignore empty strings - self.assertEquals(set([doc_with_empty_description]), + self.assertEqual(set([doc_with_empty_description]), searchResults(ignore_empty_string=0, description='')) def test_ignore_empty_string_related_key(self): @@ -2141,9 +2141,9 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): kw['portal_type'] = 'Organisation' return set([x.getObject() for x in ctool.searchResults(**kw)]) - self.assertEquals(set([doc_with_empty_region_description, doc_without_region]), + self.assertEqual(set([doc_with_empty_region_description, doc_without_region]), searchResults(region_description='')) - self.assertEquals(set([doc_with_empty_region_description]), + self.assertEqual(set([doc_with_empty_region_description]), searchResults(ignore_empty_string=0, region_description='')) def test_complex_query(self): @@ -3426,15 +3426,15 @@ VALUES folder.newContent(portal_type=portal_type, title='foo_organisation_1') folder.newContent(portal_type=portal_type, title='foo_organisation_2') self.tic() - self.assertEquals(1, len(folder.portal_catalog(portal_type=portal_type, + self.assertEqual(1, len(folder.portal_catalog(portal_type=portal_type, title='foo_organisation_1'))) - self.assertEquals(1, len(folder.portal_catalog(portal_type=portal_type, + self.assertEqual(1, len(folder.portal_catalog(portal_type=portal_type, title='foo_organisation_2'))) - self.assertEquals(1, len(folder.portal_catalog(portal_type=portal_type, + self.assertEqual(1, len(folder.portal_catalog(portal_type=portal_type, title='%organisation_1'))) - self.assertEquals(2, len(folder.portal_catalog(portal_type=portal_type, + self.assertEqual(2, len(folder.portal_catalog(portal_type=portal_type, title='foo_organisation%'))) - self.assertEquals(1, len(folder.portal_catalog(portal_type=portal_type, + self.assertEqual(1, len(folder.portal_catalog(portal_type=portal_type, title='foo_org%ion_1'))) def test_SearchedStringIsNotStripped(self): @@ -3557,13 +3557,13 @@ VALUES title='Nexedi Orga', description='c') organisation.setGroup('nexedi') - self.assertEquals(organisation.getGroupValue(), group_nexedi_category) + self.assertEqual(organisation.getGroupValue(), group_nexedi_category) organisation2 = module.newContent(portal_type='Organisation', title='Storever Orga', description='d') organisation2.setGroup('storever') organisation2.setTitle('Organisation 2') - self.assertEquals(organisation2.getGroupValue(), group_nexedi_category2) + self.assertEqual(organisation2.getGroupValue(), group_nexedi_category2) # Flush message queue self.tic() @@ -3573,44 +3573,44 @@ VALUES category_list = [x.getObject() for x in base_category.searchFolder( group_related_title='Nexedi Orga')] - self.assertEquals(category_list, [group_nexedi_category]) + self.assertEqual(category_list, [group_nexedi_category]) category_list = [x.getObject() for x in base_category.searchFolder( default_group_related_title='Nexedi Orga')] - self.assertEquals(category_list, [group_nexedi_category]) + self.assertEqual(category_list, [group_nexedi_category]) # Try to get the category with the group related organisation id category_list = [x.getObject() for x in base_category.searchFolder(group_related_id='storever')] - self.assertEquals(category_list,[group_nexedi_category2]) + self.assertEqual(category_list,[group_nexedi_category2]) # Try to get the category with the group related organisation description 'd' category_list = [x.getObject() for x in base_category.searchFolder(group_related_description='d')] - self.assertEquals(category_list,[group_nexedi_category2]) + self.assertEqual(category_list,[group_nexedi_category2]) # Try to get the category with the group related organisation description # 'e' category_list = [x.getObject() for x in base_category.searchFolder(group_related_description='e')] - self.assertEquals(category_list,[]) + self.assertEqual(category_list,[]) # Try to get the category with the default group related organisation description # 'e' category_list = [x.getObject() for x in base_category.searchFolder(default_group_related_description='e')] - self.assertEquals(category_list,[]) + self.assertEqual(category_list,[]) # Try to get the category with the group related organisation relative_url organisation_relative_url = organisation.getRelativeUrl() category_list = [x.getObject() for x in base_category.searchFolder(group_related_relative_url=organisation_relative_url)] - self.assertEquals(category_list, [group_nexedi_category]) + self.assertEqual(category_list, [group_nexedi_category]) # Try to get the category with the group related organisation uid category_list = [x.getObject() for x in base_category.searchFolder(group_related_uid=organisation.getUid())] - self.assertEquals(category_list, [group_nexedi_category]) + self.assertEqual(category_list, [group_nexedi_category]) # Try to get the category with the group related organisation id and title # of the category category_list = [x.getObject() for x in base_category.searchFolder(group_related_id=organisation2.getId(), title='Storever')] - self.assertEquals(category_list,[group_nexedi_category2]) + self.assertEqual(category_list,[group_nexedi_category2]) def test_SearchFolderWithRelatedDynamicStrictRelatedKey(self): # Create some objects @@ -3629,7 +3629,7 @@ VALUES title='ERP5 Orga', description='c') organisation.setGroup('nexedi/erp5') - self.assertEquals(organisation.getGroupValue(), sub_group_nexedi) + self.assertEqual(organisation.getGroupValue(), sub_group_nexedi) organisation2 = module.newContent(portal_type='Organisation', title='Nexedi Orga', description='d') @@ -3644,23 +3644,23 @@ VALUES category_list = [x.getObject() for x in base_category.portal_catalog( strict_group_related_title='Nexedi Orga')] - self.assertEquals(category_list,[group_nexedi_category]) + self.assertEqual(category_list,[group_nexedi_category]) # Try to get the category with the group related organisation title ERP5 # Orga category_list = [x.getObject() for x in base_category.portal_catalog( strict_group_related_title='ERP5 Orga')] - self.assertEquals(category_list,[sub_group_nexedi]) + self.assertEqual(category_list,[sub_group_nexedi]) # Try to get the category with the group related organisation description d category_list = [x.getObject() for x in base_category.portal_catalog( strict_group_related_description='d')] - self.assertEquals(category_list,[group_nexedi_category]) + self.assertEqual(category_list,[group_nexedi_category]) # Try to get the category with the group related organisation description c category_list = [x.getObject() for x in base_category.portal_catalog( strict_group_related_description='c')] - self.assertEquals(category_list,[sub_group_nexedi]) + self.assertEqual(category_list,[sub_group_nexedi]) def test_EscapingLoginInSescurityQuery(self): # Create some objects @@ -3725,8 +3725,8 @@ VALUES group_by_expression='catalog.reference', portal_type='Person', ) - self.assertEquals(1, len(res)) - self.assertEquals(person, res[0].getObject()) + self.assertEqual(1, len(res)) + self.assertEqual(person, res[0].getObject()) def test_CatalogUidDuplicates(self): """ @@ -3742,7 +3742,7 @@ VALUES # Make sure that the new object is catalogued. portal_catalog = self.getPortalObject().portal_catalog - self.assertEquals(person, portal_catalog(uid=person.uid)[0].getObject()) + self.assertEqual(person, portal_catalog(uid=person.uid)[0].getObject()) # Delete the new object to free the uid. available_uid = person.uid @@ -3750,7 +3750,7 @@ VALUES self.tic() # Make sure that the uid is not used any longer. - self.assertEquals(0, len(portal_catalog(uid=person.uid))) + self.assertEqual(0, len(portal_catalog(uid=person.uid))) # Now, we create two new objects without indexing, so the catalog # will not know anything about these objects. @@ -3775,7 +3775,7 @@ VALUES self.assertTrue(person_id in folder_object_list) folder_object_list = [x.getObject().getId() for x in person_module.searchFolder(title=title)] - self.assertEquals([person_id],folder_object_list) + self.assertEqual([person_id],folder_object_list) def test_SearchFolderWithMultipleSpaces(self): person_module = self.getPersonModule() @@ -3792,7 +3792,7 @@ VALUES self.assertTrue(person_id in folder_object_list) folder_object_list = [x.getObject().getId() for x in person_module.searchFolder(title=title)] - self.assertEquals([person_id],folder_object_list) + self.assertEqual([person_id],folder_object_list) def test_SearchFolderWithSingleQuote(self): person_module = self.getPersonModule() @@ -3807,7 +3807,7 @@ VALUES self.assertTrue(person_id in folder_object_list) folder_object_list = [x.getObject().getId() for x in person_module.searchFolder(title=title)] - self.assertEquals([person_id],folder_object_list) + self.assertEqual([person_id],folder_object_list) def test_ParameterSelectDict(self): person_module = self.getPersonModule() @@ -3825,17 +3825,17 @@ VALUES new_description = 'foobarfoo' person.setTitle(new_title) person.setDescription(new_description) - self.assertEquals(new_title, person.getTitle()) + self.assertEqual(new_title, person.getTitle()) expected_sql_title_list = [title] - self.assertEquals([x.title for x in folder_object_list], + self.assertEqual([x.title for x in folder_object_list], expected_sql_title_list) - self.assertEquals([x.getProperty('title') for x in + self.assertEqual([x.getProperty('title') for x in folder_object_list], expected_sql_title_list) expected_sql_description_list = [new_description] - self.assertEquals([x.getProperty('description') for x in + self.assertEqual([x.getProperty('description') for x in folder_object_list], expected_sql_description_list) real_title_list = [new_title] - self.assertEquals([x.getTitle() for x in + self.assertEqual([x.getTitle() for x in folder_object_list], real_title_list) def test_countResultsUsesFromExpression(self): @@ -3904,7 +3904,7 @@ VALUES def test_queriesEndingWithSemicolon(self): connector = self.getPortal().erp5_sql_connection result = connector.manage_test('select 1 as foo;') - self.assertEquals(1, result[0].foo) + self.assertEqual(1, result[0].foo) def _createSomeGroupCategories(self): portal_category = self.getCategoryTool() @@ -3944,7 +3944,7 @@ VALUES org2=['Nexedi'], org3=['TIOLive'], org4=['Nexedi', 'TIOLive']) - self.assertEquals(actual_group_title_map, expected_group_title_map) + self.assertEqual(actual_group_title_map, expected_group_title_map) # Flush message queue self.tic() @@ -3959,7 +3959,7 @@ VALUES organisation_list = [x.getObject() for x in module.searchFolder(strict_group_title='Nexedi', **search_kw)] - self.assertEquals(organisation_list, [org2, org4]) + self.assertEqual(organisation_list, [org2, org4]) # Now lets fetch the titles of groups of the above orgs using select_dict. search_kw.update(select_dict=dict(strict_group_title=None)) records = module.searchFolder(**search_kw) @@ -3969,7 +3969,7 @@ VALUES # relationships each catalog entry has in that related key. results = [(rec.title, rec.strict_group_title) for rec in records] - self.assertEquals(sorted(results), + self.assertEqual(sorted(results), [('org1', None), ('org2', 'Nexedi'), ('org3', 'TIOLive'), @@ -3981,7 +3981,7 @@ VALUES records = module.searchFolder(**search_kw) results = [(rec.title, rec.strict_group_title) for rec in records] - self.assertEquals(sorted(results), + self.assertEqual(sorted(results), [('org1', None), ('org2', 'Nexedi'), ('org3', 'TIOLive'), @@ -3999,7 +3999,7 @@ VALUES search_kw.update(group_by_list=('uid',)) organisation_list = [x.getObject() for x in module.searchFolder(**search_kw)] - self.assertEquals(organisation_list, [org1, org2, org3, org4]) + self.assertEqual(organisation_list, [org1, org2, org3, org4]) def test_BackwardCompatibilityWithOldMethods(self): 'Dealing with RelatedKey methods missing the proper separator' diff --git a/product/ERP5Catalog/tests/testERP5CatalogSecurityUidOptimization.py b/product/ERP5Catalog/tests/testERP5CatalogSecurityUidOptimization.py index c28d136309..15b280b1b6 100644 --- a/product/ERP5Catalog/tests/testERP5CatalogSecurityUidOptimization.py +++ b/product/ERP5Catalog/tests/testERP5CatalogSecurityUidOptimization.py @@ -130,15 +130,15 @@ CREATE TABLE alternate_roles_and_users ( reference='user1') user1.newContent(portal_type='Assignment', group='g1').open() user1.updateLocalRolesOnSecurityGroups() - self.assertEquals(user1.__ac_local_roles__.get('user1'), ['Auditor']) - self.assertEquals(user1.__ac_local_roles__.get('GROUP1'), ['Unknown']) + self.assertEqual(user1.__ac_local_roles__.get('user1'), ['Auditor']) + self.assertEqual(user1.__ac_local_roles__.get('GROUP1'), ['Unknown']) user2 = self.portal.person_module.newContent(portal_type='Person', reference='user2') user2.newContent(portal_type='Assignment', group='g1').open() user2.updateLocalRolesOnSecurityGroups() - self.assertEquals(user2.__ac_local_roles__.get('user2'), ['Auditor']) - self.assertEquals(user2.__ac_local_roles__.get('GROUP1'), ['Unknown']) + self.assertEqual(user2.__ac_local_roles__.get('user2'), ['Auditor']) + self.assertEqual(user2.__ac_local_roles__.get('GROUP1'), ['Unknown']) self.tic() # security_uid_dict in catalog contains entries for user1 and user2: @@ -167,20 +167,20 @@ CREATE TABLE alternate_roles_and_users ( alternate_security_query, = [q for q in security_query.query_list[0].query_list if q.kw.get('alternate_security_uid')] - self.assertEquals([user1_alternate_security_uid], + self.assertEqual([user1_alternate_security_uid], alternate_security_query.kw['alternate_security_uid']) # high level check that that logged in user can see document - self.assertEquals([user1], + self.assertEqual([user1], [o.getObject() for o in self.portal.portal_catalog(portal_type='Person')]) # also with local_roles= argument which is used in worklists - self.assertEquals([user1], + self.assertEqual([user1], [o.getObject() for o in self.portal.portal_catalog(portal_type='Person', local_roles='Auditor')]) # searches still work for other users self.login('user2') - self.assertEquals([user2], + self.assertEqual([user2], [o.getObject() for o in self.portal.portal_catalog(portal_type='Person')]) self.login('ERP5TypeTestCase') diff --git a/product/ERP5Configurator/tests/ConfiguratorTestMixin.py b/product/ERP5Configurator/tests/ConfiguratorTestMixin.py index b627ca62dd..97c7aa6c54 100644 --- a/product/ERP5Configurator/tests/ConfiguratorTestMixin.py +++ b/product/ERP5Configurator/tests/ConfiguratorTestMixin.py @@ -184,24 +184,24 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): business_configuration = sequence.get("business_configuration") # second one: install some standard business templates standard_bt5_config_save = business_configuration['1'] - self.assertEquals( + self.assertEqual( set(self.standard_bt5_list), set([x.bt5_id for x in standard_bt5_config_save.contentValues()])) # third one: we create a business template to store customer configuration custom_bt5_config_save = business_configuration['2'] custom_bt5_config_item = custom_bt5_config_save['1'] - self.assertEquals(custom_bt5_config_item.getPortalType(), + self.assertEqual(custom_bt5_config_item.getPortalType(), 'Customer BT5 Configurator Item') - self.assertEquals(custom_bt5_config_item.bt5_title, + self.assertEqual(custom_bt5_config_item.bt5_title, '_'.join(business_configuration.getTitle().strip().lower().split())) def stepCheckConfigureOrganisationForm(self, sequence=None, sequence_list=None, **kw): """ Check if Confire Organisation step was showed """ response_dict = sequence.get("response_dict") if 'command' in response_dict: - self.assertEquals('show', response_dict['command']) - self.assertEquals('Configure Organisation', response_dict['next']) + self.assertEqual('show', response_dict['command']) + self.assertEqual('Configure Organisation', response_dict['next']) self.assertCurrentStep('Your organisation', response_dict) def stepSetupOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw): @@ -223,9 +223,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): """ Check if Configure Organisation step was showed """ response_dict = sequence.get("response_dict") if 'command' in response_dict: - self.assertEquals('show', response_dict['command']) - self.assertEquals('Configure user accounts number', response_dict['next']) - self.assertEquals('Previous', response_dict['previous']) + self.assertEqual('show', response_dict['command']) + self.assertEqual('Configure user accounts number', response_dict['next']) + self.assertEqual('Previous', response_dict['previous']) self.assertCurrentStep('Number of user accounts', response_dict) def stepSetupUserAccounNumberSix(self, sequence=None, sequence_list=None, **kw): @@ -238,9 +238,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): """ Check the multiple user account form """ response_dict = sequence.get("response_dict") if 'command' in response_dict: - self.assertEquals('show', response_dict['command']) - self.assertEquals('Previous', response_dict['previous']) - self.assertEquals('Configure user accounts', response_dict['next']) + self.assertEqual('show', response_dict['command']) + self.assertEqual('Previous', response_dict['previous']) + self.assertEqual('Configure user accounts', response_dict['next']) self.assertCurrentStep('User accounts configuration', response_dict) def stepSetupMultipleUserAccountSix(self, sequence=None, sequence_list=None, **kw): @@ -257,7 +257,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): Configuration have been created successfully. """ business_configuration = sequence.get("business_configuration") - self.assertEquals(int(self.company_employees_number), + self.assertEqual(int(self.company_employees_number), business_configuration.getGlobalConfigurationAttr( "company_employees_number")) @@ -272,7 +272,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): break - self.assertEquals(int(self.company_employees_number), + self.assertEqual(int(self.company_employees_number), len(person_business_configuration_save.contentValues())) return person_business_configuration_save @@ -280,9 +280,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): """ Check the accounting form configuration. """ response_dict = sequence.get("response_dict") if 'command' in response_dict: - self.assertEquals('show', response_dict['command']) - self.assertEquals('Previous', response_dict['previous']) - self.assertEquals('Configure accounting', response_dict['next']) + self.assertEqual('show', response_dict['command']) + self.assertEqual('Previous', response_dict['previous']) + self.assertEqual('Configure accounting', response_dict['next']) self.assertCurrentStep('Accounting', response_dict) def stepSetupAccountingConfiguration(self, sequence=None, sequence_list=None, **kw): @@ -303,9 +303,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): """ Check the preference form """ response_dict = sequence.get("response_dict") if 'command' in response_dict: - self.assertEquals('show', response_dict['command']) - self.assertEquals('Previous', response_dict['previous']) - self.assertEquals('Configure ERP5 Preferences', response_dict['next']) + self.assertEqual('show', response_dict['command']) + self.assertEqual('Previous', response_dict['previous']) + self.assertEqual('Configure ERP5 Preferences', response_dict['next']) self.assertCurrentStep('Application preferences', response_dict) def _stepCheckAccountingConfigurationItemList(self, business_configuration, @@ -318,35 +318,35 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): contentValues(portal_types='Configuration Save')[-1] bt5_business_configuration_item =\ accounting_business_configuration_save['1'] - self.assertEquals('Standard BT5 Configurator Item', + self.assertEqual('Standard BT5 Configurator Item', bt5_business_configuration_item.getPortalType()) - self.assertEquals(bt5_id, bt5_business_configuration_item.bt5_id) + self.assertEqual(bt5_id, bt5_business_configuration_item.bt5_id) # 2. a preference preference_buisiness_configurator_item_list =\ accounting_business_configuration_save.contentValues( portal_type='Preference Configurator Item') - self.assertEquals(1, len(preference_buisiness_configurator_item_list)) + self.assertEqual(1, len(preference_buisiness_configurator_item_list)) preference_buisiness_configurator_item = \ preference_buisiness_configurator_item_list[0] - self.assertEquals(accounting_transaction_gap, + self.assertEqual(accounting_transaction_gap, preference_buisiness_configurator_item.getProperty( 'preferred_accounting_transaction_gap')) - self.assertEquals(self.preference_group, + self.assertEqual(self.preference_group, preference_buisiness_configurator_item.getProperty( 'preferred_accounting_transaction_section_category')) # 3. some pre-configured accounts account_business_configuration_item =\ accounting_business_configuration_save['2'] - self.assertEquals('Account Configurator Item', + self.assertEqual('Account Configurator Item', account_business_configuration_item.getPortalType()) - self.assertEquals('capital', + self.assertEqual('capital', getattr(account_business_configuration_item, 'account_id', 'not set')) - self.assertEquals('equity', + self.assertEqual('equity', account_business_configuration_item.getAccountType()) - self.assertEquals(gap, account_business_configuration_item.getGap()) - self.assertEquals('equity/share_capital', + self.assertEqual(gap, account_business_configuration_item.getGap()) + self.assertEqual('equity/share_capital', account_business_configuration_item.getFinancialSection()) # title is translated here @@ -359,14 +359,14 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): accounting_period_configuration_item = \ accounting_business_configuration_save['14'] # this ['14'] will break when we'll add more accounts - self.assertEquals('Accounting Period Configurator Item', + self.assertEqual('Accounting Period Configurator Item', accounting_period_configuration_item.getPortalType()) - self.assertEquals(DateTime(2008, 1, 1), + self.assertEqual(DateTime(2008, 1, 1), accounting_period_configuration_item.getStartDate()) - self.assertEquals(DateTime(2008, 12, 31), + self.assertEqual(DateTime(2008, 12, 31), accounting_period_configuration_item.getStopDate()) - self.assertEquals('2008', + self.assertEqual('2008', accounting_period_configuration_item.getShortTitle()) def stepCheckAccountingConfigurationItemListFrance(self, sequence=None, sequence_list=None, **kw): @@ -425,51 +425,51 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): currency_business_configuration_item =\ preferences_business_configuration_save['1'] - self.assertEquals('Currency Configurator Item', + self.assertEqual('Currency Configurator Item', currency_business_configuration_item.getPortalType()) - self.assertEquals(currency_title, + self.assertEqual(currency_title, currency_business_configuration_item.getTitle()) - self.assertEquals(0.01, + self.assertEqual(0.01, currency_business_configuration_item.getBaseUnitQuantity()) - self.assertEquals(currency_reference, + self.assertEqual(currency_reference, currency_business_configuration_item.getReference()) # some services # TODO service_business_configuration_item =\ preferences_business_configuration_save['2'] - self.assertEquals('Service Configurator Item', + self.assertEqual('Service Configurator Item', service_business_configuration_item.getPortalType()) # and a preference preference_business_configuration_item =\ preferences_business_configuration_save['3'] - self.assertEquals('Preference Configurator Item', + self.assertEqual('Preference Configurator Item', preference_business_configuration_item.getPortalType()) # that uses the currency - self.assertEquals('currency_module/%s' % currency_reference, + self.assertEqual('currency_module/%s' % currency_reference, preference_business_configuration_item.getProperty( 'preferred_accounting_transaction_currency')) # system preferences system_pref_configurator_item =\ preferences_business_configuration_save['4'] - self.assertEquals('System Preference Configurator Item', + self.assertEqual('System Preference Configurator Item', system_pref_configurator_item.getPortalType()) # a standard bt5 for localisation bt5_business_configuration_item =\ preferences_business_configuration_save['5'] - self.assertEquals('Standard BT5 Configurator Item', + self.assertEqual('Standard BT5 Configurator Item', bt5_business_configuration_item.getPortalType()) - self.assertEquals(bt5_id, + self.assertEqual(bt5_id, bt5_business_configuration_item.bt5_id) def stepCheckConfigureInstallationForm(self, sequence=None, sequence_list=None, **kw): """ Check the installation form """ response_dict = sequence.get("response_dict") # configuration is finished. We are at the Install state. - self.assertEquals('show', response_dict['command']) - self.assertEquals('Previous', response_dict['previous']) - self.assertEquals('Install', response_dict['next']) + self.assertEqual('show', response_dict['command']) + self.assertEqual('Previous', response_dict['previous']) + self.assertEqual('Install', response_dict['next']) self.assertCurrentStep('Download', response_dict) @@ -480,7 +480,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): def stepCheckInstallConfiguration(self, sequence=None, sequence_list=None, **kw): """ Check the installation of the configuration """ response_dict = sequence.get("response_dict") - self.assertEquals('install', response_dict['command']) + self.assertEqual('install', response_dict['command']) def _stepCheckInstanceIsConfigured(self, business_configuration, bt5_tuple): """ Check if the instance is configured with proper business templates """ @@ -490,13 +490,13 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): # check if bt5 are installed. bt5_title_list = self.portal.portal_templates.getInstalledBusinessTemplateTitleList() expected_list = self.expected_bt5_list + bt5_tuple - self.assertEquals([i for i in expected_list if i not in bt5_title_list], []) + self.assertEqual([i for i in expected_list if i not in bt5_title_list], []) self.assertFalse(bc_id in bt5_title_list) bt = business_configuration.getSpecialiseValue(portal_type="Business Template") - self.assertEquals(bc_id, bt.getTitle()) - self.assertEquals(bt.getInstallationState(), 'not_installed') + self.assertEqual(bc_id, bt.getTitle()) + self.assertEqual(bt.getInstallationState(), 'not_installed') def stepCheckConfiguredInstancePreference(sequence=None, sequence_list=None, **kw): """ Check if the configured instance has appropriate configuration""" @@ -583,7 +583,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): username, 'plan_action', event) event.plan() - self.assertEquals('planned', event.getSimulationState()) + self.assertEqual('planned', event.getSimulationState()) # everybody can confirm or send a planned event for username in self.all_username_list: @@ -593,14 +593,14 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): username, 'start_action', event) event.start() - self.assertEquals('started', event.getSimulationState()) + self.assertEqual('started', event.getSimulationState()) # everybody can deliver a sent event for username in self.all_username_list: self.failUnlessUserCanPassWorkflowTransition( username, 'deliver_action', event) event.deliver() - self.assertEquals('delivered', event.getSimulationState()) + self.assertEqual('delivered', event.getSimulationState()) ## Accounts {{{ def stepViewAccountModule(self, sequence=None, sequence_list=None, **kw): @@ -625,7 +625,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): account = self.portal.account_module.newContent( portal_type='Account') # in draft state, - self.assertEquals('draft', account.getValidationState()) + self.assertEqual('draft', account.getValidationState()) # everybody can see for username in self.all_username_list: self.failUnlessUserCanViewDocument(username, account) @@ -648,7 +648,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): username, 'validate_action', account) account.validate() - self.assertEquals('validated', account.getValidationState()) + self.assertEqual('validated', account.getValidationState()) # in validated state, every body can view, but *nobody* can modify for username in self.all_username_list: self.failUnlessUserCanViewDocument(username, account) @@ -665,7 +665,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): username, 'invalidate_action', account) account.invalidate() - self.assertEquals('invalidated', account.getValidationState()) + self.assertEqual('invalidated', account.getValidationState()) # back in invalidated state, everybody can view for username in self.all_username_list: self.failUnlessUserCanViewDocument(username, account) @@ -687,7 +687,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): account = self.portal.account_module.newContent( portal_type='Account') # in draft state, - self.assertEquals('draft', account.getValidationState()) + self.assertEqual('draft', account.getValidationState()) # everybody can see for username in self.all_username_list: @@ -742,7 +742,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): self.failUnlessUserCanPassWorkflowTransition( username, 'validate_action', entity) entity.validate() - self.assertEquals('validated', entity.getValidationState()) + self.assertEqual('validated', entity.getValidationState()) # in validated state, we can still modify for username in self.all_username_list: @@ -818,7 +818,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): portal_type='Accounting Period', start_date=DateTime(2001, 01, 01), stop_date=DateTime(2002, 12, 31)) - self.assertEquals(accounting_period.getSimulationState(), 'draft') + self.assertEqual(accounting_period.getSimulationState(), 'draft') # accountants can modify the period for username in self.accountant_username_list: @@ -834,7 +834,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): # once the period is started, nobody can modify accounting_period.start() - self.assertEquals('started', accounting_period.getSimulationState()) + self.assertEqual('started', accounting_period.getSimulationState()) for username in self.accountant_username_list: self.failIfUserCanModifyDocument(username, accounting_period) # accountants can still cancel the period @@ -847,7 +847,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): username, 'stop_action', accounting_period) # and reopen it accounting_period.stop() - self.assertEquals('stopped', accounting_period.getSimulationState()) + self.assertEqual('stopped', accounting_period.getSimulationState()) for username in self.accountant_username_list: self.failUnlessUserCanPassWorkflowTransition( username, 'restart_action', accounting_period) @@ -867,13 +867,13 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): portal_type='Organisation') bank_account = entity.newContent(portal_type='Bank Account') # everybody can view in draft ... - self.assertEquals('draft', bank_account.getValidationState()) + self.assertEqual('draft', bank_account.getValidationState()) for username in self.all_username_list: self.failUnlessUserCanViewDocument(username, bank_account) self.failUnlessUserCanAccessDocument(username, bank_account) # ... and validated states bank_account.validate() - self.assertEquals('validated', bank_account.getValidationState()) + self.assertEqual('validated', bank_account.getValidationState()) for username in self.all_username_list: self.failUnlessUserCanViewDocument(username, bank_account) self.failUnlessUserCanAccessDocument(username, bank_account) @@ -884,13 +884,13 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): portal_type='Organisation') ext_payment = entity.newContent(portal_type='Credit Card') # every body can view in draft ... - self.assertEquals('draft', ext_payment.getValidationState()) + self.assertEqual('draft', ext_payment.getValidationState()) for username in self.all_username_list: self.failUnlessUserCanViewDocument(username, ext_payment) self.failUnlessUserCanAccessDocument(username, ext_payment) # ... and validated states ext_payment.validate() - self.assertEquals('validated', ext_payment.getValidationState()) + self.assertEqual('validated', ext_payment.getValidationState()) for username in self.all_username_list: self.failUnlessUserCanViewDocument(username, ext_payment) self.failUnlessUserCanAccessDocument(username, ext_payment) @@ -908,7 +908,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): 'validate_action', bank_account) # validated bank_account.validate() - self.assertEquals('validated', bank_account.getValidationState()) + self.assertEqual('validated', bank_account.getValidationState()) for username in self.all_username_list: self.failUnlessUserCanModifyDocument(username, bank_account) for username in self.all_username_list: @@ -916,7 +916,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): 'invalidate_action', bank_account) # invalidated bank_account.invalidate() - self.assertEquals('invalidated', bank_account.getValidationState()) + self.assertEqual('invalidated', bank_account.getValidationState()) for username in self.all_username_list: self.failUnlessUserCanModifyDocument(username, bank_account) for username in self.all_username_list: @@ -936,7 +936,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): 'validate_action', credit_card) # validated credit_card.validate() - self.assertEquals('validated', credit_card.getValidationState()) + self.assertEqual('validated', credit_card.getValidationState()) for username in self.all_username_list: self.failUnlessUserCanModifyDocument(username, credit_card) for username in self.all_username_list: @@ -944,7 +944,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): 'invalidate_action', credit_card) # invalidated credit_card.invalidate() - self.assertEquals('invalidated', credit_card.getValidationState()) + self.assertEqual('invalidated', credit_card.getValidationState()) for username in self.all_username_list: self.failUnlessUserCanModifyDocument(username, credit_card) for username in self.all_username_list: @@ -956,9 +956,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): for username in self.all_username_list: self._loginAsUser(username) self.failUnlessUserCanAddDocument(username, person) - self.failUnless('Bank Account' in + self.assertTrue('Bank Account' in person.getVisibleAllowedContentTypeList()) - self.failUnless('Credit Card' in + self.assertTrue('Credit Card' in person.getVisibleAllowedContentTypeList()) # when the entity is validated, we can still add some payment nodes person.validate() @@ -966,9 +966,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): for username in self.all_username_list: self._loginAsUser(username) self.failUnlessUserCanAddDocument(username, person) - self.failUnless('Bank Account' in + self.assertTrue('Bank Account' in person.getVisibleAllowedContentTypeList()) - self.failUnless('Credit Card' in + self.assertTrue('Credit Card' in person.getVisibleAllowedContentTypeList()) def stepAddPaymentNodeInOrganisation(self, sequence=None, sequence_list=None, **kw): @@ -977,9 +977,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): for username in self.all_username_list: self._loginAsUser(username) self.failUnlessUserCanAddDocument(username, org) - self.failUnless('Bank Account' in + self.assertTrue('Bank Account' in org.getVisibleAllowedContentTypeList()) - self.failUnless('Credit Card' in + self.assertTrue('Credit Card' in org.getVisibleAllowedContentTypeList()) # when the entity is validated, we can still add some payment nodes org.validate() @@ -987,9 +987,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): for username in self.all_username_list: self._loginAsUser(username) self.failUnlessUserCanAddDocument(username, org) - self.failUnless('Bank Account' in + self.assertTrue('Bank Account' in org.getVisibleAllowedContentTypeList()) - self.failUnless('Credit Card' in + self.assertTrue('Credit Card' in org.getVisibleAllowedContentTypeList()) def stepCopyAndPasteBankAccountInPerson(self, sequence=None, sequence_list=None, **kw): @@ -1048,7 +1048,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): portal_type='Accounting Transaction', start_date=DateTime(2001, 01, 01), stop_date=DateTime(2001, 01, 01)) - self.assertEquals('draft', transaction.getSimulationState()) + self.assertEqual('draft', transaction.getSimulationState()) for username in self.all_username_list: self.assertUserCanViewDocument(username, transaction) self.assertUserCanAccessDocument(username, transaction) @@ -1095,7 +1095,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): # (skip some states) transaction.start() - self.assertEquals('started', transaction.getSimulationState()) + self.assertEqual('started', transaction.getSimulationState()) self.tic() for username in self.all_username_list: @@ -1124,7 +1124,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): transaction) transaction.stop() - self.assertEquals('stopped', transaction.getSimulationState()) + self.assertEqual('stopped', transaction.getSimulationState()) for username in self.all_username_list: # everybody can view self.assertUserCanViewDocument(username, transaction) @@ -1151,7 +1151,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): transaction) # in started state, we can modify again, and go back to stopped state transaction.restart() - self.assertEquals('started', transaction.getSimulationState()) + self.assertEqual('started', transaction.getSimulationState()) self.tic() for username in self.accountant_username_list: @@ -1162,7 +1162,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): # go back to stopped state transaction.stop() - self.assertEquals('stopped', transaction.getSimulationState()) + self.assertEqual('stopped', transaction.getSimulationState()) # only accounting_manager can validate self.failUnlessUserCanPassWorkflowTransition(self.accounting_manager_reference, @@ -1178,7 +1178,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): portal_type='Sale Invoice Transaction', start_date=DateTime(2001, 01, 01), stop_date=DateTime(2001, 01, 01)) - self.assertEquals('draft', transaction.getSimulationState()) + self.assertEqual('draft', transaction.getSimulationState()) for username in self.all_username_list: self.assertUserCanViewDocument(username, transaction) self.assertUserCanAccessDocument(username, transaction) @@ -1235,7 +1235,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): # (skip some states) transaction.start() - self.assertEquals('started', transaction.getSimulationState()) + self.assertEqual('started', transaction.getSimulationState()) self.tic() for username in self.all_username_list: @@ -1264,7 +1264,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): transaction) transaction.stop() - self.assertEquals('stopped', transaction.getSimulationState()) + self.assertEqual('stopped', transaction.getSimulationState()) for username in self.all_username_list: # everybody can view self.assertUserCanViewDocument(username, transaction) @@ -1291,7 +1291,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): transaction) # in started state, we can modify again, and go back to stopped state transaction.restart() - self.assertEquals('started', transaction.getSimulationState()) + self.assertEqual('started', transaction.getSimulationState()) self.tic() for username in self.accountant_username_list: @@ -1302,7 +1302,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): # go back to stopped state transaction.stop() - self.assertEquals('stopped', transaction.getSimulationState()) + self.assertEqual('stopped', transaction.getSimulationState()) # only accounting_manager can validate self.failUnlessUserCanPassWorkflowTransition(self.accounting_manager_reference, @@ -1319,7 +1319,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): portal_type='Purchase Invoice Transaction', start_date=DateTime(2001, 01, 01), stop_date=DateTime(2001, 01, 01)) - self.assertEquals('draft', transaction.getSimulationState()) + self.assertEqual('draft', transaction.getSimulationState()) for username in self.all_username_list: self.assertUserCanViewDocument(username, transaction) self.assertUserCanAccessDocument(username, transaction) @@ -1381,7 +1381,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): # (skip some states) transaction.start() - self.assertEquals('started', transaction.getSimulationState()) + self.assertEqual('started', transaction.getSimulationState()) self.tic() for username in self.all_username_list: @@ -1410,7 +1410,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): transaction) transaction.stop() - self.assertEquals('stopped', transaction.getSimulationState()) + self.assertEqual('stopped', transaction.getSimulationState()) for username in self.all_username_list: # everybody can view self.assertUserCanViewDocument(username, transaction) @@ -1437,7 +1437,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): transaction) # in started state, we can modify again, and go back to stopped state transaction.restart() - self.assertEquals('started', transaction.getSimulationState()) + self.assertEqual('started', transaction.getSimulationState()) self.tic() for username in self.accountant_username_list: @@ -1448,7 +1448,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): # go back to stopped state transaction.stop() - self.assertEquals('stopped', transaction.getSimulationState()) + self.assertEqual('stopped', transaction.getSimulationState()) # only accounting_manager can validate self.failUnlessUserCanPassWorkflowTransition(self.accounting_manager_reference, @@ -1464,7 +1464,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): portal_type='Payment Transaction', start_date=DateTime(2001, 01, 01), stop_date=DateTime(2001, 01, 01)) - self.assertEquals('draft', transaction.getSimulationState()) + self.assertEqual('draft', transaction.getSimulationState()) for username in self.all_username_list: self.assertUserCanViewDocument(username, transaction) self.assertUserCanAccessDocument(username, transaction) @@ -1511,7 +1511,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): # (skip some states) transaction.start() - self.assertEquals('started', transaction.getSimulationState()) + self.assertEqual('started', transaction.getSimulationState()) self.tic() for username in self.all_username_list: @@ -1540,7 +1540,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): transaction) transaction.stop() - self.assertEquals('stopped', transaction.getSimulationState()) + self.assertEqual('stopped', transaction.getSimulationState()) for username in self.all_username_list: # everybody can view self.assertUserCanViewDocument(username, transaction) @@ -1567,7 +1567,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): transaction) # in started state, we can modify again, and go back to stopped state transaction.restart() - self.assertEquals('started', transaction.getSimulationState()) + self.assertEqual('started', transaction.getSimulationState()) self.tic() for username in self.accountant_username_list: @@ -1578,7 +1578,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): # go back to stopped state transaction.stop() - self.assertEquals('stopped', transaction.getSimulationState()) + self.assertEqual('stopped', transaction.getSimulationState()) # only accounting_manager can validate self.failUnlessUserCanPassWorkflowTransition(self.accounting_manager_reference, @@ -1642,7 +1642,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): accounting_transaction_list = accounting_transaction_a.\ AccountingTransaction_getCausalityGroupedAccountingTransactionList() - self.assertEquals(5, len(accounting_transaction_list)) + self.assertEqual(5, len(accounting_transaction_list)) self.assertTrue(accounting_transaction_a in accounting_transaction_list) self.assertTrue(accounting_transaction_b in accounting_transaction_list) @@ -1659,7 +1659,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): accounting_transaction_list = accounting_transaction_a.\ AccountingTransaction_getCausalityGroupedAccountingTransactionList() - self.assertEquals(3, len(accounting_transaction_list)) + self.assertEqual(3, len(accounting_transaction_list)) self.assertFalse(accounting_transaction_x_related_to_a in \ accounting_transaction_list) @@ -1674,7 +1674,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): person = self.portal.person_module.newContent(portal_type='Person') for username in self.all_username_list: self._loginAsUser(username) - self.failUnless('Assignment' in + self.assertTrue('Assignment' in person.getVisibleAllowedContentTypeList()) self.failUnlessUserCanAddDocument(username, person) @@ -1682,7 +1682,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): ti = self.getTypesTool().getTypeInfo('Assignment') self.assertNotEquals(None, ti) # Acquire local roles on Assignment ? no - self.failIf(ti.getProperty('type_acquire_local_role', 1)) + self.assertFalse(ti.getProperty('type_acquire_local_role', 1)) def stepEditAssignments(self, sequence=None, sequence_list=None, **kw): # everybody can open assignments in express @@ -1746,7 +1746,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): username, 'cancel_action', order) order.confirm() - self.assertEquals('confirmed', order.getSimulationState()) + self.assertEqual('confirmed', order.getSimulationState()) self.assertUserCanViewDocument(username, order) self.failIfUserCanModifyDocument(username, order) @@ -1782,7 +1782,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): username, 'cancel_action', order) order.confirm() - self.assertEquals('confirmed', order.getSimulationState()) + self.assertEqual('confirmed', order.getSimulationState()) self.assertUserCanViewDocument(username, order) self.failIfUserCanModifyDocument(username, order) @@ -1807,8 +1807,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): checkPermission = self.portal.portal_membership.checkPermission # switch to Anonymous user self.logout() - self.assertEquals(None, checkPermission('View', web_site_module)) - self.assertEquals(None, checkPermission('Access Contents Information',web_site_module)) + self.assertEqual(None, checkPermission('View', web_site_module)) + self.assertEqual(None, checkPermission('Access Contents Information',web_site_module)) self.assertRaises(Unauthorized, web_site_module) # DMS @@ -1821,5 +1821,5 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): checkPermission = self.portal.portal_membership.checkPermission for username in self.all_username_list: self._loginAsUser(username) - self.assertEquals(True, \ + self.assertEqual(True, \ checkPermission('Modify portal content', portal_contributions)) diff --git a/product/ERP5Configurator/tests/testConfiguratorItem.py b/product/ERP5Configurator/tests/testConfiguratorItem.py index 315050091b..755b2338fb 100644 --- a/product/ERP5Configurator/tests/testConfiguratorItem.py +++ b/product/ERP5Configurator/tests/testConfiguratorItem.py @@ -98,25 +98,25 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): self.assertNotEquals(organisation, None) - self.assertEquals(group_id, organisation.getGroup()) - self.assertEquals(kw['title'], organisation.getTitle()) - self.assertEquals(kw['corporate_name'], organisation.getCorporateName()) - self.assertEquals(kw['default_address_city'], + self.assertEqual(group_id, organisation.getGroup()) + self.assertEqual(kw['title'], organisation.getTitle()) + self.assertEqual(kw['corporate_name'], organisation.getCorporateName()) + self.assertEqual(kw['default_address_city'], organisation.getDefaultAddressCity()) - self.assertEquals(kw['default_email_text'], + self.assertEqual(kw['default_email_text'], organisation.getDefaultEmailText()) - self.assertEquals(kw['default_telephone_text'], + self.assertEqual(kw['default_telephone_text'], organisation.getDefaultTelephoneText()) - self.assertEquals(kw['default_address_zip_code'], + self.assertEqual(kw['default_address_zip_code'], organisation.getDefaultAddressZipCode()) - self.assertEquals(kw['default_address_region'], + self.assertEqual(kw['default_address_region'], organisation.getDefaultAddressRegion()) - self.assertEquals(kw['default_address_street_address'], + self.assertEqual(kw['default_address_street_address'], organisation.getDefaultAddressStreetAddress()) - self.assertEquals('main', organisation.getSite()) - self.assertEquals('validated', organisation.getValidationState()) + self.assertEqual('main', organisation.getSite()) + self.assertEqual('validated', organisation.getValidationState()) def testCategoryConfiguratorItem(self): @@ -144,17 +144,17 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): category_0 = getattr(self.portal.portal_categories.group, category_id_0, None) self.assertNotEquals(category_0, None) - self.assertEquals(category_0.getTitle(), "title_%s" % category_id_0) + self.assertEqual(category_0.getTitle(), "title_%s" % category_id_0) category_1 = getattr(self.portal.portal_categories.group, category_id_1, None) - self.assertEquals(category_1, None) + self.assertEqual(category_1, None) item1._build(bc) self.tic() category_1 = getattr(self.portal.portal_categories.group, category_id_1, None) self.assertNotEquals(category_1, None) - self.assertEquals(category_1.getTitle(), "title_%s" % category_id_1) + self.assertEqual(category_1.getTitle(), "title_%s" % category_id_1) # recreate category_1 with new title @@ -170,7 +170,7 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): category_1 = getattr(self.portal.portal_categories.group, category_id_1, None) self.assertNotEquals(category_1, None) - self.assertEquals(category_1.getTitle(), "new_title_%s" % category_id_1) + self.assertEqual(category_1.getTitle(), "new_title_%s" % category_id_1) def testCurrencyConfiguratorItem(self): """ Test Category Configurator Item """ @@ -200,17 +200,17 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): eur = getattr(self.portal.currency_module, eur_currency_id , None) self.assertNotEquals(eur, None) - self.assertEquals(eur.getTitle(), eur_currency_title) + self.assertEqual(eur.getTitle(), eur_currency_title) brl = getattr(self.portal.currency_module, brl_currency_id , None) - self.assertEquals(brl, None) + self.assertEqual(brl, None) item_brl._build(bc) self.tic() brl = getattr(self.portal.currency_module, brl_currency_id , None) self.assertNotEquals(brl, None) - self.assertEquals(brl.getTitle(), brl_currency_title) + self.assertEqual(brl.getTitle(), brl_currency_title) # Build several times to not break portal. @@ -248,7 +248,7 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): "ERP5Type_getSecurityCategoryMapping", None) self.assertNotEquals(None, security_script) - self.assertEquals(security_script(), expect_script_outcome) + self.assertEqual(security_script(), expect_script_outcome) def testAccountConfiguratorItem(self): """ Test Account Configurator Item """ @@ -272,11 +272,11 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): account = getattr(account_module, account_dict['account_id'], None) self.assertNotEquals(account, None) - self.assertEquals(account.getTitle(), account_dict['title']) - self.assertEquals(account.getGap(), account_dict['gap']) - self.assertEquals(account.getFinancialSection(), + self.assertEqual(account.getTitle(), account_dict['title']) + self.assertEqual(account.getGap(), account_dict['gap']) + self.assertEqual(account.getFinancialSection(), account_dict['financial_section']) - self.assertEquals(account.getAccountType(), + self.assertEqual(account.getAccountType(), account_dict['account_type']) # Update Account dict and try to create again the same account, @@ -293,13 +293,13 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): self.tic() same_account = getattr(account_module, account_dict['account_id'], None) - self.assertEquals(account, same_account) - self.assertEquals(account.getTitle(), account_dict['title']) + self.assertEqual(account, same_account) + self.assertEqual(account.getTitle(), account_dict['title']) self.assertSameSet(account.getGapList(), [previous_gap, account_dict['gap']]) - self.assertEquals(account.getFinancialSection(), + self.assertEqual(account.getFinancialSection(), account_dict['financial_section']) - self.assertEquals(account.getAccountType(), + self.assertEqual(account.getAccountType(), account_dict['account_type']) def testAlarmConfiguratorItem(self): @@ -333,25 +333,25 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): alarm = getattr(self.portal.portal_alarms, "my_test_alarm", None) self.assertNotEquals(None, alarm) - self.assertEquals(alarm.getEnabled(), True) - self.assertEquals(alarm.getTitle(), "My Test Alarm") - self.assertEquals(alarm.getPeriodicityMinuteFrequency(), + self.assertEqual(alarm.getEnabled(), True) + self.assertEqual(alarm.getTitle(), "My Test Alarm") + self.assertEqual(alarm.getPeriodicityMinuteFrequency(), property_map["periodicity_minute_frequency"]) - self.assertEquals(alarm.getPeriodicityMonthList(), + self.assertEqual(alarm.getPeriodicityMonthList(), property_map["periodicity_month_list"]) - self.assertEquals(alarm.getPeriodicityMonthDayList(), + self.assertEqual(alarm.getPeriodicityMonthDayList(), property_map["periodicity_month_day_list"]) - self.assertEquals(alarm.getPeriodicityHourList(), + self.assertEqual(alarm.getPeriodicityHourList(), property_map["periodicity_hour_list"]) - self.assertEquals(alarm.getPeriodicityHourList(), + self.assertEqual(alarm.getPeriodicityHourList(), property_map["periodicity_hour_list"]) - self.assertEquals(alarm.getActiveSenseMethodId(), + self.assertEqual(alarm.getActiveSenseMethodId(), property_map["active_sense_method_id"]) self.assertNotEquals(alarm.getPeriodicityStartDate(), None) - self.failUnless(alarm.getPeriodicityStartDate() < DateTime()) + self.assertTrue(alarm.getPeriodicityStartDate() < DateTime()) alarm.activeSense() self.tic() - self.assertEquals(alarm.getEnabled(), 0) + self.assertEqual(alarm.getEnabled(), 0) def testPortalTypeRolesSpreadsheetConfiguratorItem(self): """ Test Portal Type Roles Configurator Item """ @@ -401,15 +401,15 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): portal_type="Role Information") if i.getTitle() == "TestRole_Person"] - self.assertEquals(len(role_list), 1) + self.assertEqual(len(role_list), 1) - self.assertEquals(role_list[0].getDescription(), + self.assertEqual(role_list[0].getDescription(), "Configured by ERP5 Configurator") - self.assertEquals(role_list[0].getRoleNameList(), + self.assertEqual(role_list[0].getRoleNameList(), ['Auditor', 'Author', 'Assignee']) - self.assertEquals(role_list[0].getRoleCategoryList(), + self.assertEqual(role_list[0].getRoleCategoryList(), ['group/my_group',]) @@ -417,15 +417,15 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): portal_type="Role Information") if i.getTitle() == "TestRole_PersonModule"] - self.assertEquals(len(role_list), 1) + self.assertEqual(len(role_list), 1) - self.assertEquals(role_list[0].getDescription(), + self.assertEqual(role_list[0].getDescription(), "Configured by ERP5 Configurator") - self.assertEquals(role_list[0].getRoleNameList(), + self.assertEqual(role_list[0].getRoleNameList(), ['Auditor', 'Author']) - self.assertEquals(role_list[0].getRoleCategoryList(), + self.assertEqual(role_list[0].getRoleCategoryList(), ['group/my_group',]) @@ -460,25 +460,25 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): base_category = getattr(category_tool, base_category_id) my_test = getattr(base_category, "my_test", None) self.assertNotEquals(my_test, None) - self.assertEquals(my_test.getTitle(), "TEST") - self.assertEquals(my_test.getDescription(), "TEST") - self.assertEquals(my_test.getCodification(), "TEST") - self.assertEquals(my_test.getIntIndex(), 1) + self.assertEqual(my_test.getTitle(), "TEST") + self.assertEqual(my_test.getDescription(), "TEST") + self.assertEqual(my_test.getCodification(), "TEST") + self.assertEqual(my_test.getIntIndex(), 1) # Check Second level my_test = getattr(my_test, "my_test", None) self.assertNotEquals(my_test, None) - self.assertEquals(my_test.getTitle(), "TEST") - self.assertEquals(my_test.getDescription(), "TEST") - self.assertEquals(my_test.getCodification(), "TEST") - self.assertEquals(my_test.getIntIndex(), 2) + self.assertEqual(my_test.getTitle(), "TEST") + self.assertEqual(my_test.getDescription(), "TEST") + self.assertEqual(my_test.getCodification(), "TEST") + self.assertEqual(my_test.getIntIndex(), 2) # Check Thrid level my_test = getattr(my_test, "my_test", None) self.assertNotEquals(my_test, None) - self.assertEquals(my_test.getTitle(), "TEST") - self.assertEquals(my_test.getDescription(), "TEST") - self.assertEquals(my_test.getCodification(), "TEST") - self.assertEquals(my_test.getIntIndex(), 3) + self.assertEqual(my_test.getTitle(), "TEST") + self.assertEqual(my_test.getDescription(), "TEST") + self.assertEqual(my_test.getCodification(), "TEST") + self.assertEqual(my_test.getIntIndex(), 3) def testRuleConfiguratorItem(self): """ Test Rules Configurator Item """ @@ -517,8 +517,8 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): portal_type=self.portal.getPortalRuleTypeList(), validation_state="validated", reference=rule_reference) - self.assertEquals(len(rule_list), 1) - self.assertEquals(['testing/order'], rule_list[0].getTradePhaseList()) + self.assertEqual(len(rule_list), 1) + self.assertEqual(['testing/order'], rule_list[0].getTradePhaseList()) def testBusinessProcessConfiguratorItem(self): configuration_save = self.createConfigurationSave() @@ -552,59 +552,59 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): order_path = getattr(business_process, "order_path", None) self.assertNotEquals(order_path, None) - self.assertEquals(order_path.getEfficiency(), 1.0) - self.assertEquals(order_path.getTradePhase(), 'trade/order') - self.assertEquals(order_path.getTradeDate(), 'trade_phase/trade/order') - self.assertEquals(order_path.getTestMethodId(), None) + self.assertEqual(order_path.getEfficiency(), 1.0) + self.assertEqual(order_path.getTradePhase(), 'trade/order') + self.assertEqual(order_path.getTradeDate(), 'trade_phase/trade/order') + self.assertEqual(order_path.getTestMethodId(), None) delivery_path = getattr(business_process, "delivery_path", None) self.assertNotEquals(delivery_path, None) - self.assertEquals(delivery_path.getEfficiency(), 1.0) - self.assertEquals(delivery_path.getTradePhase(), 'trade/delivery') - self.assertEquals(delivery_path.getTradeDate(), 'trade_phase/trade/order') - self.assertEquals(delivery_path.getTestMethodId(), None) + self.assertEqual(delivery_path.getEfficiency(), 1.0) + self.assertEqual(delivery_path.getTradePhase(), 'trade/delivery') + self.assertEqual(delivery_path.getTradeDate(), 'trade_phase/trade/order') + self.assertEqual(delivery_path.getTestMethodId(), None) invoicing_path = getattr(business_process, "invoicing_path", None) self.assertNotEquals(invoicing_path, None) - self.assertEquals(invoicing_path.getEfficiency(), 1.0) - self.assertEquals(invoicing_path.getTradePhase(), 'trade/invoicing') - self.assertEquals(invoicing_path.getTradeDate(), 'trade_phase/trade/delivery') - self.assertEquals(invoicing_path.getTestMethodId(), None) + self.assertEqual(invoicing_path.getEfficiency(), 1.0) + self.assertEqual(invoicing_path.getTradePhase(), 'trade/invoicing') + self.assertEqual(invoicing_path.getTradeDate(), 'trade_phase/trade/delivery') + self.assertEqual(invoicing_path.getTestMethodId(), None) accounting_credit_path = getattr(business_process, "accounting_credit_path", None) self.assertNotEquals(accounting_credit_path, None) - self.assertEquals(accounting_credit_path.getEfficiency(), -1.0) - self.assertEquals(accounting_credit_path.getTradePhase(), 'trade/accounting') - self.assertEquals(accounting_credit_path.getTradeDate(), 'trade_phase/trade/invoicing') - self.assertEquals(accounting_credit_path.getTestMethodId(), "isAccountingMovementType") + self.assertEqual(accounting_credit_path.getEfficiency(), -1.0) + self.assertEqual(accounting_credit_path.getTradePhase(), 'trade/accounting') + self.assertEqual(accounting_credit_path.getTradeDate(), 'trade_phase/trade/invoicing') + self.assertEqual(accounting_credit_path.getTestMethodId(), "isAccountingMovementType") accounting_debit_path = getattr(business_process, "accounting_debit_path", None) self.assertNotEquals(accounting_debit_path, None) - self.assertEquals(accounting_debit_path.getEfficiency(), 1.0) - self.assertEquals(accounting_debit_path.getTradePhase(), 'trade/accounting') - self.assertEquals(accounting_debit_path.getTradeDate(), 'trade_phase/trade/invoicing') - self.assertEquals(accounting_debit_path.getTestMethodId(), "isAccountingMovementType") + self.assertEqual(accounting_debit_path.getEfficiency(), 1.0) + self.assertEqual(accounting_debit_path.getTradePhase(), 'trade/accounting') + self.assertEqual(accounting_debit_path.getTradeDate(), 'trade_phase/trade/invoicing') + self.assertEqual(accounting_debit_path.getTestMethodId(), "isAccountingMovementType") order_link = getattr(business_process, "order_link", None) self.assertNotEquals(order_link, None) #self.assertTrue(order_link.getDeliverable()) - self.assertEquals(order_link.getSuccessor(), "trade_state/trade/ordered") - self.assertEquals(order_link.getPredecessor(),None) - self.assertEquals(order_link.getCompletedStateList(),["confirmed"]) - self.assertEquals(order_link.getFrozenState(), None) - self.assertEquals(order_link.getDeliveryBuilder(), None) - self.assertEquals(order_link.getTradePhase(),'trade/order') + self.assertEqual(order_link.getSuccessor(), "trade_state/trade/ordered") + self.assertEqual(order_link.getPredecessor(),None) + self.assertEqual(order_link.getCompletedStateList(),["confirmed"]) + self.assertEqual(order_link.getFrozenState(), None) + self.assertEqual(order_link.getDeliveryBuilder(), None) + self.assertEqual(order_link.getTradePhase(),'trade/order') deliver_link = getattr(business_process, "deliver_link", None) self.assertNotEquals(deliver_link, None) #self.assertTrue(deliver_link.getDeliverable()) - self.assertEquals(deliver_link.getSuccessor(),"trade_state/trade/delivered") - self.assertEquals(deliver_link.getPredecessor(),"trade_state/trade/ordered") - self.assertEquals(deliver_link.getCompletedStateList(),['delivered','started','stopped']) - self.assertEquals(deliver_link.getFrozenStateList(),['delivered','stopped']) - self.assertEquals(deliver_link.getTradePhase(),'trade/delivery') + self.assertEqual(deliver_link.getSuccessor(),"trade_state/trade/delivered") + self.assertEqual(deliver_link.getPredecessor(),"trade_state/trade/ordered") + self.assertEqual(deliver_link.getCompletedStateList(),['delivered','started','stopped']) + self.assertEqual(deliver_link.getFrozenStateList(),['delivered','stopped']) + self.assertEqual(deliver_link.getTradePhase(),'trade/delivery') - self.assertEquals(deliver_link.getDeliveryBuilderList(), + self.assertEqual(deliver_link.getDeliveryBuilderList(), ["portal_deliveries/sale_packing_list_builder", "portal_deliveries/internal_packing_list_builder", "portal_deliveries/purchase_packing_list_builder"]) @@ -612,14 +612,14 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): invoice_link = getattr(business_process, "invoice_link", None) self.assertNotEquals(invoice_link, None) #self.assertFalse(invoice_link.getDeliverable()) - self.assertEquals(invoice_link.getSuccessor(),"trade_state/trade/invoiced") - self.assertEquals(invoice_link.getPredecessor(),"trade_state/trade/delivered") - self.assertEquals(invoice_link.getCompletedStateList(), + self.assertEqual(invoice_link.getSuccessor(),"trade_state/trade/invoiced") + self.assertEqual(invoice_link.getPredecessor(),"trade_state/trade/delivered") + self.assertEqual(invoice_link.getCompletedStateList(), ['confirmed','delivered','started','stopped']) - self.assertEquals(invoice_link.getFrozenStateList(),['delivered','stopped']) - self.assertEquals(invoice_link.getTradePhase(),'trade/invoicing') + self.assertEqual(invoice_link.getFrozenStateList(),['delivered','stopped']) + self.assertEqual(invoice_link.getTradePhase(),'trade/invoicing') - self.assertEquals(invoice_link.getDeliveryBuilderList(), + self.assertEqual(invoice_link.getDeliveryBuilderList(), ["portal_deliveries/purchase_invoice_builder", "portal_deliveries/purchase_invoice_transaction_trade_model_builder", "portal_deliveries/sale_invoice_builder", @@ -628,11 +628,11 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): account_link = getattr(business_process, "account_link", None) self.assertNotEquals(account_link, None) #self.assertFalse(account_link.getDeliverable()) - self.assertEquals(account_link.getSuccessor(),"trade_state/trade/accounted") - self.assertEquals(account_link.getPredecessor(),"trade_state/trade/invoiced") - self.assertEquals(account_link.getCompletedStateList(),['delivered','started','stopped']) - self.assertEquals(account_link.getFrozenStateList(),['delivered','stopped']) - self.assertEquals(account_link.getTradePhase(), 'trade/accounting') + self.assertEqual(account_link.getSuccessor(),"trade_state/trade/accounted") + self.assertEqual(account_link.getPredecessor(),"trade_state/trade/invoiced") + self.assertEqual(account_link.getCompletedStateList(),['delivered','started','stopped']) + self.assertEqual(account_link.getFrozenStateList(),['delivered','stopped']) + self.assertEqual(account_link.getTradePhase(), 'trade/accounting') self.assertSameSet(account_link.getDeliveryBuilderList(), ["portal_deliveries/purchase_invoice_transaction_builder", @@ -641,12 +641,12 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin): pay_link = getattr(business_process, "pay_link", None) self.assertNotEquals(pay_link, None) #self.assertFalse(pay_link.getDeliverable()) - self.assertEquals(pay_link.getTradePhase(), 'trade/payment') - self.assertEquals(pay_link.getSuccessor(), None) - self.assertEquals(pay_link.getPredecessor(),"trade_state/trade/accounted") - self.assertEquals(pay_link.getCompletedState(), None) - self.assertEquals(pay_link.getFrozenState(), None) + self.assertEqual(pay_link.getTradePhase(), 'trade/payment') + self.assertEqual(pay_link.getSuccessor(), None) + self.assertEqual(pay_link.getPredecessor(),"trade_state/trade/accounted") + self.assertEqual(pay_link.getCompletedState(), None) + self.assertEqual(pay_link.getFrozenState(), None) - self.assertEquals(pay_link.getDeliveryBuilderList(), + self.assertEqual(pay_link.getDeliveryBuilderList(), ["portal_deliveries/payment_transaction_builder"]) diff --git a/product/ERP5Configurator/tests/testConfiguratorTool.py b/product/ERP5Configurator/tests/testConfiguratorTool.py index 0f8ae0a876..f04b8cd989 100644 --- a/product/ERP5Configurator/tests/testConfiguratorTool.py +++ b/product/ERP5Configurator/tests/testConfiguratorTool.py @@ -51,5 +51,5 @@ class TestConfiguratorTool(TestLiveConfiguratorWorkflowMixin): checkPermission = self.portal.portal_membership.checkPermission configurator_tool = self.portal.portal_configurator self.logout() - self.assertEquals(None, checkPermission('View', configurator_tool)) + self.assertEqual(None, checkPermission('View', configurator_tool)) self.assertRaises(Unauthorized, configurator_tool) diff --git a/product/ERP5Form/tests/testAudioField.py b/product/ERP5Form/tests/testAudioField.py index 91dd906d5c..4f1f44712f 100644 --- a/product/ERP5Form/tests/testAudioField.py +++ b/product/ERP5Form/tests/testAudioField.py @@ -44,7 +44,7 @@ class TestAudioField(ERP5TypeTestCase): def test_render_view(self): self.field.values['default'] = 'Audio content' - self.assertEquals('<audio preload="preload" src="Audio content" ' + + self.assertEqual('<audio preload="preload" src="Audio content" ' + 'controls="controls" >\nYour browser does not ' + 'support audio tag.</audio>', self.field.render_view(value='Audio content')) @@ -54,7 +54,7 @@ class TestAudioField(ERP5TypeTestCase): self.field.values['audio_autoplay'] = True self.field.values['audio_error_message'] = 'Another error message' - self.assertEquals('<audio src="Another Audio content" ' + + self.assertEqual('<audio src="Another Audio content" ' + 'loop="loop" autoplay="autoplay" >\nAnother error ' + 'message</audio>', self.field.render_view(value='Another Audio content')) diff --git a/product/ERP5Form/tests/testFieldValueCache.py b/product/ERP5Form/tests/testFieldValueCache.py index 6833b80977..e61810cf43 100644 --- a/product/ERP5Form/tests/testFieldValueCache.py +++ b/product/ERP5Form/tests/testFieldValueCache.py @@ -78,7 +78,7 @@ class TestFieldValueCache(ERP5TypeTestCase): # Make sure cache has field self.assertTrue(field_value_cache.has_key(cache_id)) # Make sure cache and field are equal - self.assertEquals(field.get_value(id), field_value_cache[cache_id]) + self.assertEqual(field.get_value(id), field_value_cache[cache_id]) # Call manage_renameObject form.manage_renameObject('my_first_name', 'my_first_name2') form.manage_renameObject('my_first_name2', 'my_first_name') @@ -89,4 +89,4 @@ class TestFieldValueCache(ERP5TypeTestCase): # Make sure cache has field self.assertTrue(field_value_cache.has_key(cache_id)) # Make sure cache and field are equal - self.assertEquals(field.get_value(id), field_value_cache[cache_id]) + self.assertEqual(field.get_value(id), field_value_cache[cache_id]) diff --git a/product/ERP5Form/tests/testFields.py b/product/ERP5Form/tests/testFields.py index 4efdf4b81e..1db2dfbff5 100644 --- a/product/ERP5Form/tests/testFields.py +++ b/product/ERP5Form/tests/testFields.py @@ -65,10 +65,10 @@ class TestRenderViewAPI(ERP5TypeTestCase): def test_signature(self): for field in FieldRegistry.get_field_classes().itervalues(): - self.assertEquals(('self', 'value', 'REQUEST', 'render_prefix'), + self.assertEqual(('self', 'value', 'REQUEST', 'render_prefix'), field.render_view.im_func.func_code.co_varnames) if field is not ProxyField.ProxyField: - self.assertEquals(('self', 'field', 'value', 'REQUEST'), + self.assertEqual(('self', 'field', 'value', 'REQUEST'), field.widget.render_view.im_func.func_code.co_varnames[:4], '%s %s' % (field.widget, field.widget.render_view.im_func.func_code.co_varnames[:4])) @@ -86,81 +86,81 @@ class TestFloatField(ERP5TypeTestCase): def test_format_thousand_separator_point(self): self.field.values['input_style'] = '-1 234.5' - self.assertEquals('1 000.0', self.widget.format_value(self.field, 1000)) + self.assertEqual('1 000.0', self.widget.format_value(self.field, 1000)) def test_format_thousand_separator_coma(self): self.field.values['input_style'] = '-1 234,5' - self.assertEquals('1 000,0', self.widget.format_value(self.field, 1000)) + self.assertEqual('1 000,0', self.widget.format_value(self.field, 1000)) def test_format_thousand_separator_point_coma(self): self.field.values['input_style'] = '-1.234,5' - self.assertEquals('1.000,0', self.widget.format_value(self.field, 1000)) + self.assertEqual('1.000,0', self.widget.format_value(self.field, 1000)) def test_format_thousand_separator_coma_point(self): self.field.values['input_style'] = '-1,234.5' - self.assertEquals('1,000.0', self.widget.format_value(self.field, 1000)) + self.assertEqual('1,000.0', self.widget.format_value(self.field, 1000)) def test_format_thousand_separator_first_separator(self): # test for an edge case bug bug, ",100,000.0" was displayed (with leading coma) self.field.values['input_style'] = '-1,234.5' - self.assertEquals('100,000.0', self.widget.format_value(self.field, 100000)) - self.assertEquals('-100,000.0', self.widget.format_value(self.field, -100000)) + self.assertEqual('100,000.0', self.widget.format_value(self.field, 100000)) + self.assertEqual('-100,000.0', self.widget.format_value(self.field, -100000)) def test_format_with_separator_and_precision0(self): self.field.values['input_style'] = '-1,234.5' self.field.values['precision'] = 0 - self.assertEquals('-1,000', self.widget.format_value(self.field, -1000.25)) - self.assertEquals('-1,000', self.widget.format_value(self.field, -1000.49)) - self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.99)) - self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.80)) - self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.70)) - self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.60)) - self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.59)) - self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.51)) + self.assertEqual('-1,000', self.widget.format_value(self.field, -1000.25)) + self.assertEqual('-1,000', self.widget.format_value(self.field, -1000.49)) + self.assertEqual('-1,001', self.widget.format_value(self.field, -1000.99)) + self.assertEqual('-1,001', self.widget.format_value(self.field, -1000.80)) + self.assertEqual('-1,001', self.widget.format_value(self.field, -1000.70)) + self.assertEqual('-1,001', self.widget.format_value(self.field, -1000.60)) + self.assertEqual('-1,001', self.widget.format_value(self.field, -1000.59)) + self.assertEqual('-1,001', self.widget.format_value(self.field, -1000.51)) # this is not -1,001 (is this a specification?) - self.assertEquals('-1,000', self.widget.format_value(self.field, -1000.50)) + self.assertEqual('-1,000', self.widget.format_value(self.field, -1000.50)) def test_format_percent_style(self): self.field.values['input_style'] = '-12.3%' - self.assertEquals('10.0%', self.widget.format_value(self.field, 0.1)) + self.assertEqual('10.0%', self.widget.format_value(self.field, 0.1)) def test_format_precision(self): self.field.values['precision'] = 0 - self.assertEquals('12', self.widget.format_value(self.field, 12.34)) + self.assertEqual('12', self.widget.format_value(self.field, 12.34)) # value is rounded - self.assertEquals('13', self.widget.format_value(self.field, 12.9)) + self.assertEqual('13', self.widget.format_value(self.field, 12.9)) field_value_cache.clear() # call this before changing internal field values. self.field.values['precision'] = 2 - self.assertEquals('0.01', self.widget.format_value(self.field, 0.011)) + self.assertEqual('0.01', self.widget.format_value(self.field, 0.011)) # value is rounded - self.assertEquals('0.01', self.widget.format_value(self.field, 0.009999)) - self.assertEquals('1.00', + self.assertEqual('0.01', self.widget.format_value(self.field, 0.009999)) + self.assertEqual('1.00', self.widget.format_value(self.field, sum([0.1] * 10))) - self.assertEquals('566.30', + self.assertEqual('566.30', self.widget.format_value(self.field, 281.80 + 54.50 + 230.00)) def test_format_no_precision(self): - self.assertEquals('7.2', self.widget.format_value(self.field, 7.2)) - self.assertEquals('0.009999', self.widget.format_value(self.field, 0.009999)) - self.assertEquals('1000.0', self.widget.format_value(self.field, 1000)) + self.assertEqual('7.2', self.widget.format_value(self.field, 7.2)) + self.assertEqual('0.009999', self.widget.format_value(self.field, 0.009999)) + self.assertEqual('1000.0', self.widget.format_value(self.field, 1000)) def test_render_view(self): self.field.values['input_style'] = '-1 234.5' self.field.values['precision'] = 2 self.field.values['editable'] = 0 - self.assertEquals('1 000.00', self.field.render(1000)) + self.assertEqual('1 000.00', self.field.render(1000)) def test_render_dict(self): self.field.values['input_style'] = '-1 234.5' self.field.values['precision'] = 4 - self.assertEquals(dict(query=0.12345, + self.assertEqual(dict(query=0.12345, format='0.0000', type='float'), self.field.render_dict(0.12345)) # this also work when using , as decimal separator self.field.values['input_style'] = '-1.234,5' - self.assertEquals(dict(query=0.12345, + self.assertEqual(dict(query=0.12345, format='0.0000', type='float'), self.field.render_dict(0.12345)) @@ -168,50 +168,50 @@ class TestFloatField(ERP5TypeTestCase): def test_render_string_value(self): self.field.values['precision'] = 2 self.field.values['editable'] = 0 - self.assertEquals('12.34', self.field.render("12.34")) - self.assertEquals('not float', self.field.render("not float")) + self.assertEqual('12.34', self.field.render("12.34")) + self.assertEqual('not float', self.field.render("not float")) def test_percent_style_render_string_value(self): self.field.values['input_style'] = '-12.3%' self.field.values['editable'] = 0 - self.assertEquals('-12.34%', self.field.render("-0.1234")) - self.assertEquals('not float', self.field.render("not float")) + self.assertEqual('-12.34%', self.field.render("-0.1234")) + self.assertEqual('not float', self.field.render("not float")) def test_render_big_numbers(self): self.field.values['precision'] = 2 self.field.values['editable'] = 0 - self.assertEquals('10000000000000.00', + self.assertEqual('10000000000000.00', self.field.render(10000000000000)) - self.assertEquals('1e+20', self.field.render(1e+20)) + self.assertEqual('1e+20', self.field.render(1e+20)) def test_validate_thousand_separator_point(self): self.field.values['input_style'] = '-1 234.5' self.portal.REQUEST.set('field_test_field', '1 000.0') - self.assertEquals(1000, + self.assertEqual(1000, self.validator.validate(self.field, 'field_test_field', self.portal.REQUEST)) def test_validate_thousand_separator_coma(self): self.field.values['input_style'] = '-1 234,5' self.portal.REQUEST.set('field_test_field', '1 000,0') - self.assertEquals(1000, + self.assertEqual(1000, self.validator.validate(self.field, 'field_test_field', self.portal.REQUEST)) def test_validate_thousand_separator_point_coma(self): self.field.values['input_style'] = '-1.234,5' self.portal.REQUEST.set('field_test_field', '1.000,0') - self.assertEquals(1000, + self.assertEqual(1000, self.validator.validate(self.field, 'field_test_field', self.portal.REQUEST)) def test_validate_thousand_separator_coma_point(self): self.field.values['input_style'] = '-1,234.5' self.portal.REQUEST.set('field_test_field', '1,000.0') - self.assertEquals(1000, + self.assertEqual(1000, self.validator.validate(self.field, 'field_test_field', self.portal.REQUEST)) def test_validate_percent_style(self): self.field.values['input_style'] = '-12.3%' self.portal.REQUEST.set('field_test_field', '10.0%') - self.assertEquals(0.1, + self.assertEqual(0.1, self.validator.validate(self.field, 'field_test_field', self.portal.REQUEST)) def test_validate_not_float(self): @@ -234,29 +234,29 @@ class TestFloatField(ERP5TypeTestCase): def test_render_odt(self): self.field.values['input_style'] = '-1 234.5' self.field.values['default'] = 1000 - self.assertEquals('1 000.0', self.field.render_odt(as_string=False).text) + self.assertEqual('1 000.0', self.field.render_odt(as_string=False).text) def test_render_odg(self): self.field.values['input_style'] = '-1 234.5' self.field.values['default'] = 1000 test_value = self.field.render_odg(as_string=False)\ .xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0] - self.assertEquals('1 000.0', test_value) + self.assertEqual('1 000.0', test_value) def test_render_odt_variable(self): self.field.values['default'] = 1000.0 node = self.field.render_odt_variable(as_string=False) - self.assertEquals(node.get('{%s}value-type' % NSMAP['office']), 'float') - self.assertEquals(node.get('{%s}value' % NSMAP['office']), str(1000.0)) + self.assertEqual(node.get('{%s}value-type' % NSMAP['office']), 'float') + self.assertEqual(node.get('{%s}value' % NSMAP['office']), str(1000.0)) def test_fullwidth_number_conversion(self): self.portal.REQUEST.set('field_test_field', '123.45') - self.assertEquals(123.45, + self.assertEqual(123.45, self.validator.validate(self.field, 'field_test_field', self.portal.REQUEST)) def test_fullwidth_minus_number_conversion(self): self.portal.REQUEST.set('field_test_field', '−123.45') - self.assertEquals(-123.45, + self.assertEqual(-123.45, self.validator.validate(self.field, 'field_test_field', self.portal.REQUEST)) @@ -274,34 +274,34 @@ class TestIntegerField(ERP5TypeTestCase): def test_render_odt(self): self.field.values['default'] = 34 - self.assertEquals('34', self.field.render_odt(as_string=False).text) + self.assertEqual('34', self.field.render_odt(as_string=False).text) def test_render_odt_variable(self): value = 34 self.field.values['default'] = value node = self.field.render_odt_variable(as_string=False) - self.assertEquals(node.get('{%s}value-type' % NSMAP['office']), 'float') - self.assertEquals(node.get('{%s}value' % NSMAP['office']), str(value)) - self.assertEquals(node.text, str(value)) + self.assertEqual(node.get('{%s}value-type' % NSMAP['office']), 'float') + self.assertEqual(node.get('{%s}value' % NSMAP['office']), str(value)) + self.assertEqual(node.text, str(value)) self.assertTrue('{%s}formula' % NSMAP['text'] not in node.attrib) def test_render_odg_view(self): self.field.values['default'] = 34 test_value = self.field.render_odg(as_string=False)\ .xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0] - self.assertEquals('34', test_value) + self.assertEqual('34', test_value) test_value = self.field.render_odg(value=0, as_string=False)\ .xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0] - self.assertEquals('0', test_value) + self.assertEqual('0', test_value) def test_fullwidth_number_conversion(self): self.portal.REQUEST.set('field_test_field', '1234') - self.assertEquals(1234, + self.assertEqual(1234, self.validator.validate(self.field, 'field_test_field', self.portal.REQUEST)) def test_fullwidth_minus_number_conversion(self): self.portal.REQUEST.set('field_test_field', 'ー1234') - self.assertEquals(-1234, + self.assertEqual(-1234, self.validator.validate(self.field, 'field_test_field', self.portal.REQUEST)) @@ -318,27 +318,27 @@ class TestStringField(ERP5TypeTestCase): def test_escape_html(self): self.field.values['editable'] = 0 - self.assertEquals('<script>', self.field.render("<script>")) + self.assertEqual('<script>', self.field.render("<script>")) def test_render_odt(self): self.field.values['default'] = 'Hello World! <&> <∓>' - self.assertEquals('Hello World! <&> <∓>', self.field.render_odt(as_string=False).text) - self.assertEquals('Hello World!', self.field.render_odt(value='Hello World!', as_string=False).text) + self.assertEqual('Hello World! <&> <∓>', self.field.render_odt(as_string=False).text) + self.assertEqual('Hello World!', self.field.render_odt(value='Hello World!', as_string=False).text) def test_render_odg(self): self.field.values['default'] = 'Hello World! <&> <∓>' test_value = self.field.render_odg(as_string=False)\ .xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0] - self.assertEquals('Hello World! <&> <∓>', test_value) + self.assertEqual('Hello World! <&> <∓>', test_value) test_value = self.field.render_odg(value='Hello World!', as_string=False)\ .xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0] - self.assertEquals('Hello World!', test_value) + self.assertEqual('Hello World!', test_value) def test_render_odt_variable(self): self.field.values['default'] = 'Hello World! <&> <∓>' node = self.field.render_odt_variable(as_string=False) - self.assertEquals(node.get('{%s}value-type' % NSMAP['office']), 'string') - self.assertEquals(node.text, 'Hello World! <&> <∓>') + self.assertEqual(node.get('{%s}value-type' % NSMAP['office']), 'string') + self.assertEqual(node.text, 'Hello World! <&> <∓>') class TestDateTimeField(ERP5TypeTestCase): """Tests DateTime field @@ -354,13 +354,13 @@ class TestDateTimeField(ERP5TypeTestCase): def test_render_odt(self): self.field.values['default'] = DateTime('2010/01/01 00:00:01 UTC') - self.assertEquals('2010/01/01 00:00', + self.assertEqual('2010/01/01 00:00', self.field.render_odt(as_string=False).text) def test_render_odg(self): self.field.values['default'] = DateTime('2010/01/01 00:00:01 UTC') self.field.render_odg(as_string=False) - self.assertEquals('2010/01/01 00:00', + self.assertEqual('2010/01/01 00:00', self.field.render_odg(as_string=False)\ .xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0]) @@ -368,8 +368,8 @@ class TestDateTimeField(ERP5TypeTestCase): value = DateTime(2010, 12, 06, 10, 23, 32, 'GMT+5') self.field.values['default'] = value node = self.field.render_odt_variable(as_string=False) - self.assertEquals(node.get('{%s}value-type' % NSMAP['office']), 'date') - self.assertEquals(node.get('{%s}date-value' % NSMAP['office']), + self.assertEqual(node.get('{%s}value-type' % NSMAP['office']), 'date') + self.assertEqual(node.get('{%s}date-value' % NSMAP['office']), value.ISO8601()) self.field.values['default'] = None node = self.field.render_odt_variable(as_string=False) @@ -381,7 +381,7 @@ class TestDateTimeField(ERP5TypeTestCase): self.portal.REQUEST.set('subfield_field_test_field_day', '15') self.portal.REQUEST.set('subfield_field_test_field_hour', 'ï¼ï¼’') self.portal.REQUEST.set('subfield_field_test_field_minute', '18') - self.assertEquals(DateTime('2011/12/15 02:18:00'), + self.assertEqual(DateTime('2011/12/15 02:18:00'), self.validator.validate(self.field, 'field_test_field', self.portal.REQUEST)) @@ -398,21 +398,21 @@ class TestTextAreaField(ERP5TypeTestCase): def test_render_view(self): self.field.values['default'] = 'My first Line\n&My Second Line\tfoo' - self.assertEquals('<div >\nMy first Line<br/><br/>&My Second Line\tfoo</div>', + self.assertEqual('<div >\nMy first Line<br/><br/>&My Second Line\tfoo</div>', self.field.render_view(value=['My first Line\n', '&My Second Line\tfoo'])) editable_mode = self.portal.REQUEST.get('editable_mode', 1) self.portal.REQUEST.set('editable_mode', 0) try: - self.assertEquals('<div >\nMy first Line<br/>&My Second Line\tfoo</div>', + self.assertEqual('<div >\nMy first Line<br/>&My Second Line\tfoo</div>', self.field.render(REQUEST=self.portal.REQUEST)) finally: self.portal.REQUEST.set('editable_mode', editable_mode) def test_render_odt(self): self.field.values['default'] = 'My first Line\nMy Second Line\tfoo' - self.assertEquals('text:line-break', + self.assertEqual('text:line-break', self.field.render_odt(as_string=False)[0].xpath('name()')) - self.assertEquals('text:tab', + self.assertEqual('text:tab', self.field.render_odt(as_string=False)[1].xpath('name()')) def test_render_odg(self): @@ -434,22 +434,22 @@ class TestLinesField(ERP5TypeTestCase): self.widget = self.field.widget def test_render_view(self): - self.assertEquals(self.field.render_view(value=['My first Line\n', '&My Second Line\tfoo']), + self.assertEqual(self.field.render_view(value=['My first Line\n', '&My Second Line\tfoo']), '<div >\nMy first Line<br />\n<br />\n&My Second Line\tfoo</div>') def test_render_odt(self): self.field.values['default'] = ['A', 'B'] - self.assertEquals('{%(text)s}p' % NSMAP, + self.assertEqual('{%(text)s}p' % NSMAP, self.field.render_odt(as_string=False).tag) def test_render_odt_view(self): self.field.values['default'] = ['A', 'B'] element = self.field.render_odt(as_string=False, REQUEST=self.portal.REQUEST) - self.assertEquals('{%(text)s}p' % NSMAP, element.tag) + self.assertEqual('{%(text)s}p' % NSMAP, element.tag) # separated by text:line-break - self.assertEquals('{%(text)s}line-break' % NSMAP, element[0].tag) - self.assertEquals(['A', 'B'], [x for x in element.itertext()]) + self.assertEqual('{%(text)s}line-break' % NSMAP, element[0].tag) + self.assertEqual(['A', 'B'], [x for x in element.itertext()]) class TestCheckBoxField(ERP5TypeTestCase): @@ -465,25 +465,25 @@ class TestCheckBoxField(ERP5TypeTestCase): def test_render_odt(self): self.field.values['default'] = 1 - self.assertEquals('{%(form)s}checkbox' % NSMAP, + self.assertEqual('{%(form)s}checkbox' % NSMAP, self.field.render_odt(as_string=False).tag) def test_render_odt_view(self): self.field.values['default'] = 1 self.portal.REQUEST.set('editable_mode', 0) - self.assertEquals('{%(text)s}p' % NSMAP, + self.assertEqual('{%(text)s}p' % NSMAP, self.field.render_odt(as_string=False, REQUEST=self.portal.REQUEST).tag) - self.assertEquals('1', self.field.render_odt(as_string=False, REQUEST=self.portal.REQUEST).text) + self.assertEqual('1', self.field.render_odt(as_string=False, REQUEST=self.portal.REQUEST).text) def test_render_odt_variable(self): for value in (True, False,): self.field.values['default'] = value node = self.field.render_odt_variable(as_string=False) - self.assertEquals(node.get('{%s}value-type' % NSMAP['office']), + self.assertEqual(node.get('{%s}value-type' % NSMAP['office']), 'boolean') - self.assertEquals(node.get('{%s}boolean-value' % NSMAP['office']), + self.assertEqual(node.get('{%s}boolean-value' % NSMAP['office']), str(value).lower()) - self.assertEquals(node.text, str(value).upper()) + self.assertEqual(node.text, str(value).upper()) def test_render_odg_view(self): """Like integer field @@ -493,10 +493,10 @@ class TestCheckBoxField(ERP5TypeTestCase): self.portal.REQUEST.set('editable_mode', 0) test_value = self.field.render_odg(as_string=False)\ .xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0] - self.assertEquals('1', test_value) + self.assertEqual('1', test_value) test_value = self.field.render_odg(value=0, as_string=False)\ .xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0] - self.assertEquals('0', test_value) + self.assertEqual('0', test_value) class TestListField(ERP5TypeTestCase): """Tests List field @@ -539,13 +539,13 @@ class TestListField(ERP5TypeTestCase): self.field.values['items'] = items self.field.values['default'] = '2' element = self.field.render_odt(as_string=False) - self.assertEquals('{%(text)s}p' % NSMAP, element.tag) - self.assertEquals('My Second Line', element.text) + self.assertEqual('{%(text)s}p' % NSMAP, element.tag) + self.assertEqual('My Second Line', element.text) # values not in items are displayed with ??? self.field.values['default'] = '3' element = self.field.render_odt(as_string=False) - self.assertEquals('??? (3)', element.text) + self.assertEqual('??? (3)', element.text) def test_listField_value_order(self): @@ -568,15 +568,15 @@ class TestListField(ERP5TypeTestCase): form_id='Base_viewFieldLibrary', field_id='my_category')) category_item_list = field.get_value('items') - self.assertEquals(category_item_list, + self.assertEqual(category_item_list, [['', ''], ['Male', 'male'], ['Female', 'female']]) # try on a person to select on gender and check if the result is the same person_module = self.portal.getDefaultModule('Person') person = person_module.newContent(portal_type='Person') person.setGender('female') - self.assertEquals(person.getGender(), 'female') - self.assertEquals(person.Person_view.my_gender.get_value('items'), + self.assertEqual(person.getGender(), 'female') + self.assertEqual(person.Person_view.my_gender.get_value('items'), [['', ''], ['Male', 'male'], ['Female', 'female']]) @@ -589,30 +589,30 @@ class TestMultiListField(ERP5TypeTestCase): self.field.values['default'] = ['a', 'b'] def test_render_view(self): - self.assertEquals('A<br />\nB', self.field.render_view(value=['a', 'b'])) + self.assertEqual('A<br />\nB', self.field.render_view(value=['a', 'b'])) def test_render_odt(self): element = self.field.render_odt(as_string=False) - self.assertEquals('{%(text)s}p' % NSMAP, element.tag) + self.assertEqual('{%(text)s}p' % NSMAP, element.tag) # separated by text:line-break - self.assertEquals('{%(text)s}line-break' % NSMAP, element[0].tag) - self.assertEquals(['A', 'B'], [x for x in element.itertext()]) + self.assertEqual('{%(text)s}line-break' % NSMAP, element[0].tag) + self.assertEqual(['A', 'B'], [x for x in element.itertext()]) def test_render_odt_view(self): element = self.field.render_odt_view(as_string=False, value=['a', 'b'], REQUEST=self.portal.REQUEST) - self.assertEquals('{%(text)s}p' % NSMAP, element.tag) + self.assertEqual('{%(text)s}p' % NSMAP, element.tag) # separated by text:line-break - self.assertEquals('{%(text)s}line-break' % NSMAP, element[0].tag) - self.assertEquals(['A', 'B'], [x for x in element.itertext()]) + self.assertEqual('{%(text)s}line-break' % NSMAP, element[0].tag) + self.assertEqual(['A', 'B'], [x for x in element.itertext()]) # values not in items are displayed with ??? element = self.field.render_odt_view(as_string=False, value=['other'], REQUEST=self.portal.REQUEST) - self.assertEquals('{%(text)s}p' % NSMAP, element.tag) - self.assertEquals('??? (other)', element.text) + self.assertEqual('{%(text)s}p' % NSMAP, element.tag) + self.assertEqual('??? (other)', element.text) class TestProxyField(ERP5TypeTestCase): @@ -640,30 +640,30 @@ class TestProxyField(ERP5TypeTestCase): 'my_title', 'Title', 'StringField') proxy_field = self.addField(self.container.Base_view, 'my_title', 'Not Title', 'ProxyField') - self.assertEquals(None, proxy_field.getTemplateField()) - self.assertEquals(None, proxy_field.get_value('enable')) - self.assertEquals(None, proxy_field.get_value('default')) + self.assertEqual(None, proxy_field.getTemplateField()) + self.assertEqual(None, proxy_field.get_value('enable')) + self.assertEqual(None, proxy_field.get_value('default')) proxy_field.manage_edit_xmlrpc(dict(form_id='Base_viewProxyFieldLibrary', field_id='my_title',)) - self.assertEquals(original_field, proxy_field.getTemplateField()) + self.assertEqual(original_field, proxy_field.getTemplateField()) def test_simple_surcharge(self): original_field = self.addField(self.container.Base_viewProxyFieldLibrary, 'my_title', 'Title', 'StringField') - self.assertEquals('Title', original_field.get_value('title')) + self.assertEqual('Title', original_field.get_value('title')) proxy_field = self.addField(self.container.Base_view, 'my_title', 'Not Title', 'ProxyField') proxy_field.manage_edit_xmlrpc(dict(form_id='Base_viewProxyFieldLibrary', field_id='my_title',)) self.assert_(proxy_field.is_delegated('title')) - self.assertEquals('Title', proxy_field.get_value('title')) + self.assertEqual('Title', proxy_field.get_value('title')) def test_simple_not_surcharge(self): original_field = self.addField(self.container.Base_viewProxyFieldLibrary, 'my_title', 'Title', 'StringField') - self.assertEquals('Title', original_field.get_value('title')) + self.assertEqual('Title', original_field.get_value('title')) proxy_field = self.addField(self.container.Base_view, 'my_title', 'Proxy Title', 'ProxyField') @@ -672,8 +672,8 @@ class TestProxyField(ERP5TypeTestCase): # XXX no API for this ? proxy_field._surcharged_edit(dict(title='Proxy Title'), ['title']) - self.failIf(proxy_field.is_delegated('title')) - self.assertEquals('Proxy Title', proxy_field.get_value('title')) + self.assertFalse(proxy_field.is_delegated('title')) + self.assertEqual('Proxy Title', proxy_field.get_value('title')) def test_get_value_default(self): # If the proxy field is named 'my_id', it will get 'id' @@ -684,8 +684,8 @@ class TestProxyField(ERP5TypeTestCase): 'my_id', 'ID', 'ProxyField') proxy_field.manage_edit_xmlrpc(dict(form_id='Base_viewProxyFieldLibrary', field_id='my_title',)) - self.assertEquals('container', self.container.getId()) - self.assertEquals('container', proxy_field.get_value('default')) + self.assertEqual('container', self.container.getId()) + self.assertEqual('container', proxy_field.get_value('default')) def test_field_tales_context(self): # in the TALES context, "field" will be the proxyfield, not the original @@ -693,14 +693,14 @@ class TestProxyField(ERP5TypeTestCase): original_field = self.addField(self.container.Base_viewProxyFieldLibrary, 'my_title', 'Title', 'StringField') original_field.manage_tales_xmlrpc(dict(title='field/getId')) - self.assertEquals('my_title', original_field.get_value('title')) + self.assertEqual('my_title', original_field.get_value('title')) proxy_field = self.addField(self.container.Base_view, 'my_reference', 'Not Title', 'ProxyField') proxy_field.manage_edit_xmlrpc(dict(form_id='Base_viewProxyFieldLibrary', field_id='my_title',)) # 'my_reference' is the ID of the proxy field - self.assertEquals('my_reference', proxy_field.get_value('title')) + self.assertEqual('my_reference', proxy_field.get_value('title')) def test_form_tales_context(self): # in the TALES context, "form" will be the form containing the proxyfield, @@ -708,14 +708,14 @@ class TestProxyField(ERP5TypeTestCase): original_field = self.addField(self.container.Base_viewProxyFieldLibrary, 'my_title', 'Title', 'StringField') original_field.manage_tales_xmlrpc(dict(title='form/getId')) - self.assertEquals('Base_viewProxyFieldLibrary', + self.assertEqual('Base_viewProxyFieldLibrary', original_field.get_value('title')) proxy_field = self.addField(self.container.Base_view, 'my_title', 'Title', 'ProxyField') proxy_field.manage_edit_xmlrpc(dict(form_id='Base_viewProxyFieldLibrary', field_id='my_title',)) - self.assertEquals('Base_view', proxy_field.get_value('title')) + self.assertEqual('Base_view', proxy_field.get_value('title')) def test_get_value_cache_on_TALES_target(self): # If the proxy field defines its target using TALES, then no caching should @@ -730,12 +730,12 @@ class TestProxyField(ERP5TypeTestCase): proxy_field.manage_tales_xmlrpc(dict(field_id='request/field_id')) self.container.REQUEST.set('field_id', 'my_title') - self.assertEquals(original_field, proxy_field.getTemplateField()) - self.assertEquals('Title', proxy_field.get_value('title')) + self.assertEqual(original_field, proxy_field.getTemplateField()) + self.assertEqual('Title', proxy_field.get_value('title')) self.container.REQUEST.set('field_id', 'my_other_field') - self.assertEquals(other_field, proxy_field.getTemplateField()) - self.assertEquals('Other', proxy_field.get_value('title')) + self.assertEqual(other_field, proxy_field.getTemplateField()) + self.assertEqual('Other', proxy_field.get_value('title')) def test_proxy_to_date_time_field(self): # date time fields are specific, because they use a 'sub_form', we must @@ -767,7 +767,7 @@ class TestProxyField(ERP5TypeTestCase): proxy_field.manage_edit_surcharged_xmlrpc(dict(title='Title')) self.assertFalse(proxy_field.is_delegated('title')) - self.assertEquals('Title', proxy_field.get_value('title')) + self.assertEqual('Title', proxy_field.get_value('title')) # beware that all values that are not passed in the mapping will be # delegated again, regardless of the old state. @@ -821,7 +821,7 @@ class TestProxyField(ERP5TypeTestCase): #surcharge from edit field._surcharged_edit(dict(title='TestTitle'), ['title']) self.assertTrue('title' in field.delegated_list) - self.assertEquals(field.values['title'], 'TestTitle') + self.assertEqual(field.values['title'], 'TestTitle') self.assertTrue('title' not in field.tales) def delegate_edit(): @@ -836,7 +836,7 @@ class TestProxyField(ERP5TypeTestCase): field._surcharged_tales(dict(title='string:TestTitle'), ['title']) self.assertTrue('title' in field.delegated_list) self.assertTrue(field.values['title'], 'OrigTitle') - self.assertEquals(field.tales['title'], 'string:TestTitle') + self.assertEqual(field.tales['title'], 'string:TestTitle') def delegate_tales(): # delegate the field from tales view @@ -865,7 +865,7 @@ class TestProxyField(ERP5TypeTestCase): 'my_dict_test', '', 'ProxyField') field.manage_edit_xmlrpc(dict(form_id='Base_viewProxyFieldLibrary', field_id='my_title',)) - self.assertEquals(original_field.get_error_names(), + self.assertEqual(original_field.get_error_names(), field.get_error_names()) test_error = 'too_long' # arbitrary chosen among StringField error names test_message = 'Some Unprobable Error' @@ -873,16 +873,16 @@ class TestProxyField(ERP5TypeTestCase): original_field.message_values[test_error] = test_message field.message_values[test_error] = test_message2 # delegated (by default) - self.assertEquals(original_field.get_error_message(test_error), + self.assertEqual(original_field.get_error_message(test_error), test_message) self.assertTrue(field.is_message_delegated(test_error)) - self.assertEquals(field.get_error_message(test_error), test_message) + self.assertEqual(field.get_error_message(test_error), test_message) # surcharged field.delegated_message_list = [test_error] - self.assertEquals(original_field.get_error_message(test_error), + self.assertEqual(original_field.get_error_message(test_error), test_message) self.assertFalse(field.is_message_delegated(test_error)) - self.assertEquals(field.get_error_message(test_error), test_message2) + self.assertEqual(field.get_error_message(test_error), test_message2) class TestFieldValueCache(ERP5TypeTestCase): """Tests field value caching system diff --git a/product/ERP5Form/tests/testGUIwithSecurity.py b/product/ERP5Form/tests/testGUIwithSecurity.py index bea06679e0..9ac090301d 100644 --- a/product/ERP5Form/tests/testGUIwithSecurity.py +++ b/product/ERP5Form/tests/testGUIwithSecurity.py @@ -75,7 +75,7 @@ class TestGUISecurity(ERP5TypeTestCase): portal = self.getPortal() portal.ListBoxZuite_reset() message = portal.foo_module.FooModule_createObjects() - self.failUnless('Created Successfully' in message) + self.assertTrue('Created Successfully' in message) if not hasattr(portal.person_module, 'user'): user = portal.person_module.newContent(portal_type='Person', id='user', reference='user') asg = user.newContent(portal_type='Assignment') diff --git a/product/ERP5Form/tests/testListBox.py b/product/ERP5Form/tests/testListBox.py index 0a7a9a4591..4442f4d6d0 100644 --- a/product/ERP5Form/tests/testListBox.py +++ b/product/ERP5Form/tests/testListBox.py @@ -85,7 +85,7 @@ class TestListBox(ERP5TypeTestCase): portal.ListBoxZuite_reset() message = portal.foo_module.FooModule_createObjects() - self.failUnless('Created Successfully' in message) + self.assertTrue('Created Successfully' in message) def stepModifyListBoxForStat(self, sequence = None, sequence_list = None, **kw): portal = self.getPortal() @@ -93,7 +93,7 @@ class TestListBox(ERP5TypeTestCase): message = listbox.ListBox_setPropertyList( field_stat_columns = 'id|FooModule_statId\ntitle|FooModule_statTitle', field_stat_method = 'portal_catalog') - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) def stepRenderList(self, sequence = None, sequence_list = None, **kw): portal = self.getPortal() @@ -109,7 +109,7 @@ class TestListBox(ERP5TypeTestCase): self.assertEqual(len(line_list), 12) title_line = line_list[0] - self.failUnless(title_line.isTitleLine()) + self.assertTrue(title_line.isTitleLine()) self.assertEqual(len(title_line.getColumnItemList()), 3) result = (('id', 'ID'), ('title', 'Title'), ('getQuantity', 'Quantity')) for i, (key, value) in enumerate(title_line.getColumnItemList()): @@ -117,7 +117,7 @@ class TestListBox(ERP5TypeTestCase): self.assertEqual(value, result[i][1]) for n, data_line in enumerate(line_list[1:-1]): - self.failUnless(data_line.isDataLine()) + self.assertTrue(data_line.isDataLine()) self.assertEqual(len(data_line.getColumnItemList()), 3) result = (('id', str(n)), ('title', 'Title %d' % n), ('getQuantity', str(10.0 - n))) for i, (key, value) in enumerate(data_line.getColumnItemList()): @@ -125,7 +125,7 @@ class TestListBox(ERP5TypeTestCase): self.assertEqual(str(value).strip(), result[i][1]) stat_line = line_list[-1] - self.failUnless(stat_line.isStatLine()) + self.assertTrue(stat_line.isStatLine()) self.assertEqual(len(stat_line.getColumnItemList()), 3) result = (('id', 'foo_module'), ('title', 'Foos'), ('getQuantity', 'None')) for i, (key, value) in enumerate(stat_line.getColumnItemList()): @@ -323,12 +323,12 @@ class TestListBox(ERP5TypeTestCase): listbox_title_column = form.listbox_title self.assertTrue(listbox_title_column.is_delegated('default')) - self.assertEquals(listbox_title_column.get_recursive_tales('default')._text, + self.assertEqual(listbox_title_column.get_recursive_tales('default')._text, 'python: cell.getTitle()') listboxline_list = form.listbox.get_value('default', render_format = 'list', REQUEST = request) first_item = dict(listboxline_list[1].getColumnItemList()) - self.assertEquals(first_item['title'], 'Title 0') + self.assertEqual(first_item['title'], 'Title 0') # Use "cell" locally listbox_title_column.manage_tales_surcharged_xmlrpc( @@ -337,7 +337,7 @@ class TestListBox(ERP5TypeTestCase): listboxline_list = form.listbox.get_value('default', render_format = 'list', REQUEST = request) first_item = dict(listboxline_list[1].getColumnItemList()) - self.assertEquals(first_item['title'], 'Title 0 local') + self.assertEqual(first_item['title'], 'Title 0 local') def _helperExtraAndCssInListboxLine(self, field_type, editable): """ @@ -488,7 +488,7 @@ class TestListBox(ERP5TypeTestCase): msg = "editable_in_listbox: %s, editable_in_line: %s" \ % (editable_in_listbox, editable_in_line) - self.assertEquals(len(editable_field_list) == 1, expected_editable, msg) + self.assertEqual(len(editable_field_list) == 1, expected_editable, msg) def test_ObjectSupport(self): # make sure listbox supports rendering of simple objects @@ -518,10 +518,10 @@ class TestListBox(ERP5TypeTestCase): line_list = [l for l in listbox.get_value('default', render_format='list', REQUEST=request) if l.isDataLine()] - self.assertEquals(1, len(line_list)) - self.assertEquals('Object Title', line_list[0].getColumnProperty('title')) + self.assertEqual(1, len(line_list)) + self.assertEqual('Object Title', line_list[0].getColumnProperty('title')) html = listbox.render(REQUEST=request) - self.failUnless('Object Title' in html, html) + self.assertTrue('Object Title' in html, html) def test_ProxyFieldRenderFormatLines(self): # tests that listbox default value in render_format=list mode is @@ -551,13 +551,13 @@ class TestListBox(ERP5TypeTestCase): request['here'] = portal.foo_module line_list = proxy_field.get_value('default', render_format='list', REQUEST=request) - self.failUnless(isinstance(line_list, list)) + self.assertTrue(isinstance(line_list, list)) title_line = line_list[0] - self.failUnless(title_line.isTitleLine()) + self.assertTrue(title_line.isTitleLine()) # title of columns is the value overloaded by the proxy field. - self.assertEquals([('proxy_value', 'Proxy')], + self.assertEqual([('proxy_value', 'Proxy')], title_line.getColumnItemList()) def test_ListStyleColumnsSelections(self): diff --git a/product/ERP5Form/tests/testOOoChart.py b/product/ERP5Form/tests/testOOoChart.py index c516ca9db4..20f2f34842 100644 --- a/product/ERP5Form/tests/testOOoChart.py +++ b/product/ERP5Form/tests/testOOoChart.py @@ -130,7 +130,7 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): form = getattr(portal.portal_skins.custom, self.form_id) #listbox = form.listbox listbox = getattr(form, 'listbox') - self.assertEquals(listbox.meta_type, 'ListBox') + self.assertEqual(listbox.meta_type, 'ListBox') request = get_request() request['here'] = portal.portal_skins.custom line_list = [l for l in listbox.get_value('default', @@ -138,23 +138,23 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): REQUEST=request) ] # listbox is empty? - self.assertEquals(2, len(line_list)) + self.assertEqual(2, len(line_list)) # Does the field OOoChart exist ? ooochart = getattr(form, self.ooo_chart_id) - self.assertEquals(ooochart.meta_type, 'OOoChart') + self.assertEqual(ooochart.meta_type, 'OOoChart') response = self.publish( '/%s/%s/%s?render_format=&display=medium' % (self.portal.getId(), self.form_id, self.ooo_chart_id), self.auth ) # test render raw - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') # test content type : application/vnd.oasis.opendocument.graphics self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) # Test ODG (zip) body = response.getBody() # Test Validation Relax NG @@ -177,7 +177,7 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): self.assertNotEquals(0, len(value_list)) # 2 values because there are - 10 document created by a owner # - 0 Reference count - self.assertEquals(2, len(value_list)) + self.assertEqual(2, len(value_list)) # Test the differents render # render image @@ -185,13 +185,13 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/%s/%s?render_format=%s&display=medium' % (self.portal.getId(), self.form_id, self.ooo_chart_id, image_format), self.auth ) - self.assertEquals(HTTP_OK, response.getStatus(), '%s rendering failed: %s' % (image_format, response.getStatus())) + self.assertEqual(HTTP_OK, response.getStatus(), '%s rendering failed: %s' % (image_format, response.getStatus())) # render pdf response = self.publish( '/%s/%s/%s?render_format=pdf&display=medium' % (self.portal.getId(), self.form_id, self.ooo_chart_id), self.auth ) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) # Change some params and restart (circle, bar, ...) @@ -236,18 +236,18 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): form.proxifyField({self.ooo_chart_id:'TestOOochart_viewForm.your_ooochart'}) # Does the field OOoChart exist ? ooochart = getattr(form, self.ooo_chart_id) - self.assertEquals(ooochart.meta_type, 'ProxyField') + self.assertEqual(ooochart.meta_type, 'ProxyField') response = self.publish( '/%s/%s/%s?render_format=&display=medium' % (self.portal.getId(), self.form_id, self.ooo_chart_id), self.auth ) # test render raw - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') # test content type : application/vnd.oasis.opendocument.graphics self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) # Test ODG (zip) body = response.getBody() # Test Validation Relax NG @@ -270,7 +270,7 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): self.assertNotEquals(0, len(value_list)) # 2 values because there are - 10 document created by a owner # - 0 Reference count - self.assertEquals(2, len(value_list)) + self.assertEqual(2, len(value_list)) # Test the differents render # render image @@ -278,13 +278,13 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/%s/%s?render_format=%s&display=medium' % (self.portal.getId(), self.form_id, self.ooo_chart_id, image_format), self.auth ) - self.assertEquals(HTTP_OK, response.getStatus(), '%s rendering failed: %s' % (image_format, response.getStatus())) + self.assertEqual(HTTP_OK, response.getStatus(), '%s rendering failed: %s' % (image_format, response.getStatus())) # render pdf response = self.publish( '/%s/%s/%s?render_format=pdf&display=medium' % (self.portal.getId(), self.form_id, self.ooo_chart_id), self.auth ) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) # Change some params and restart (circle, bar, ...) @@ -325,7 +325,7 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): '/%s/%s' % (self.portal.getId(), self.form_id), self.auth, handle_errors=False ) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) body = response.getBody() self._validate(body) @@ -336,7 +336,7 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): '/%s/%s' % (self.portal.getId(), self.form_id), self.auth, handle_errors=False ) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) body = response.getBody() self._validate(body) diff --git a/product/ERP5Form/tests/testPlanningBox.py b/product/ERP5Form/tests/testPlanningBox.py index 1ab63d53c4..04c6b98028 100644 --- a/product/ERP5Form/tests/testPlanningBox.py +++ b/product/ERP5Form/tests/testPlanningBox.py @@ -71,13 +71,13 @@ class TestPlanningBox(ERP5TypeTestCase): portal = self.getPortal() portal.ListBoxZuite_reset() message = portal.foo_module.FooModule_createObjects() - self.failUnless('Created Successfully' in message) + self.assertTrue('Created Successfully' in message) def stepCreateObjectLines(self, sequence = None, sequence_list = None, **kw): # Make sure that the status is clean. portal = self.getPortal() message = portal.foo_module['0'].Foo_createObjects(num=1) - self.failUnless('Created Successfully' in message) + self.assertTrue('Created Successfully' in message) portal.foo_module['0'].Foo_editObjectLineDates() def stepRenderStructure(self, sequence = None, sequence_list = None, **kw): @@ -96,37 +96,37 @@ class TestPlanningBox(ERP5TypeTestCase): def stepCheckPlanning(self, sequence = None, sequence_list = None, **kw): planning = sequence.get('planning') - self.assertEquals(planning.vertical_view, 0) - self.assertEquals(len(planning.content), 1) + self.assertEqual(planning.vertical_view, 0) + self.assertEqual(len(planning.content), 1) bloc = planning.content[0] - self.assertEquals(bloc.name , 'group_1_activity_1_block_1') - self.assertEquals(bloc.title , 'Title 0') + self.assertEqual(bloc.name , 'group_1_activity_1_block_1') + self.assertEqual(bloc.title , 'Title 0') for info in bloc.info.values(): - self.assertEquals(info.info,'Title 0') - self.assertEquals(info.link , + self.assertEqual(info.info,'Title 0') + self.assertEqual(info.link , '%s/foo_module/0/0' % self.getPortal().absolute_url()) # Check Parent Activities parent = bloc.parent_activity for info in parent.info.values(): - self.assertEquals(info,'Title 0') - self.assertEquals(parent.link , + self.assertEqual(info,'Title 0') + self.assertEqual(parent.link , '/%s/foo_module/0/0' % self.getPortal().getId()) # XXX This test for Quantity is not complete, It should be improved. - self.assertEquals(parent.height , None) - self.assertEquals(parent.title,'Title 0') + self.assertEqual(parent.height , None) + self.assertEqual(parent.title,'Title 0') def stepCheckBasic(self, sequence = None, sequence_list = None, **kw): basic = sequence.get('basic') - self.assertEquals(len(basic.report_group_list), 1) + self.assertEqual(len(basic.report_group_list), 1) lane_tree_list = basic.buildLaneTreeList() sec_axis_info = basic.getLaneAxisInfo(lane_tree_list) date = DateTime() today = DateTime('%s/%s/%s' % (date.year(),date.month(),date.day())) - self.assertEquals(sec_axis_info['bound_start'], today) - self.assertEquals(sec_axis_info['bound_stop'], today+1) + self.assertEqual(sec_axis_info['bound_start'], today) + self.assertEqual(sec_axis_info['bound_stop'], today+1) for tree_list, activity_list,stat in basic.report_group_list: - self.assertEquals(len(activity_list), 1) + self.assertEqual(len(activity_list), 1) def test_01(self, quiet=quiet, run=run_all_test): diff --git a/product/ERP5Form/tests/testPreferences.py b/product/ERP5Form/tests/testPreferences.py index 585425fec3..63150cca59 100644 --- a/product/ERP5Form/tests/testPreferences.py +++ b/product/ERP5Form/tests/testPreferences.py @@ -83,27 +83,27 @@ class TestPreferences(PropertySheetTestCase): self.tic() # check preference levels are Ok - self.assertEquals(person1.getPriority(), Priority.USER) - self.assertEquals(person2.getPriority(), Priority.USER) - self.assertEquals(group.getPriority(), Priority.GROUP) - self.assertEquals(site.getPriority(), Priority.SITE) + self.assertEqual(person1.getPriority(), Priority.USER) + self.assertEqual(person2.getPriority(), Priority.USER) + self.assertEqual(group.getPriority(), Priority.GROUP) + self.assertEqual(site.getPriority(), Priority.SITE) # check initial states - self.assertEquals(person1.getPreferenceState(), 'disabled') - self.assertEquals(person2.getPreferenceState(), 'disabled') - self.assertEquals(group.getPreferenceState(), 'disabled') - self.assertEquals(site.getPreferenceState(), 'disabled') + self.assertEqual(person1.getPreferenceState(), 'disabled') + self.assertEqual(person2.getPreferenceState(), 'disabled') + self.assertEqual(group.getPreferenceState(), 'disabled') + self.assertEqual(site.getPreferenceState(), 'disabled') def test_PreferenceToolTitle(self): """Tests that the title of the preference tool is correct. """ - self.assertEquals('Preferences', self.getPreferenceTool().Title()) + self.assertEqual('Preferences', self.getPreferenceTool().Title()) def test_AllowedContentTypes(self): """Tests Preference can be added in Preference Tool. """ - self.failUnless('Preference' in [x.getId() for x in + self.assertTrue('Preference' in [x.getId() for x in self.getPortal().portal_preferences.allowedContentTypes()]) - self.failUnless('System Preference' in [x.getId() for x in + self.assertTrue('System Preference' in [x.getId() for x in self.getPortal().portal_preferences.allowedContentTypes()]) def test_EnablePreferences(self): @@ -121,7 +121,7 @@ class TestPreferences(PropertySheetTestCase): person1.portal_workflow.doActionFor( person1, 'enable_action', wf_id='preference_workflow') self.commit() - self.assertEquals(person1.getPreferenceState(), 'enabled') + self.assertEqual(person1.getPreferenceState(), 'enabled') self.assertEqual( person1, self.getPreferenceTool().getActivePreference()) self.assertEqual(None, @@ -129,8 +129,8 @@ class TestPreferences(PropertySheetTestCase): portal_workflow.doActionFor( site, 'enable_action', wf_id='preference_workflow') - self.assertEquals(person1.getPreferenceState(), 'enabled') - self.assertEquals(site.getPreferenceState(), 'global') + self.assertEqual(person1.getPreferenceState(), 'enabled') + self.assertEqual(site.getPreferenceState(), 'global') self.assertEqual(person1, self.getPreferenceTool().getActivePreference()) self.assertEqual(None, @@ -138,9 +138,9 @@ class TestPreferences(PropertySheetTestCase): portal_workflow.doActionFor( group, 'enable_action', wf_id='preference_workflow') - self.assertEquals(person1.getPreferenceState(), 'enabled') - self.assertEquals(group.getPreferenceState(), 'enabled') - self.assertEquals(site.getPreferenceState(), 'global') + self.assertEqual(person1.getPreferenceState(), 'enabled') + self.assertEqual(group.getPreferenceState(), 'enabled') + self.assertEqual(site.getPreferenceState(), 'global') self.assertEqual(person1, self.getPreferenceTool().getActivePreference()) self.assertEqual(None, @@ -152,11 +152,11 @@ class TestPreferences(PropertySheetTestCase): self.assertEqual(person2, self.getPreferenceTool().getActivePreference()) self.assertEqual(None, self.getPreferenceTool().getActiveSystemPreference()) - self.assertEquals(person2.getPreferenceState(), 'enabled') + self.assertEqual(person2.getPreferenceState(), 'enabled') # enabling a preference disable all other of the same level - self.assertEquals(person1.getPreferenceState(), 'disabled') - self.assertEquals(group.getPreferenceState(), 'enabled') - self.assertEquals(site.getPreferenceState(), 'global') + self.assertEqual(person1.getPreferenceState(), 'disabled') + self.assertEqual(group.getPreferenceState(), 'enabled') + self.assertEqual(site.getPreferenceState(), 'global') def test_GetPreference(self): """ checks that getPreference returns the good preferred value""" @@ -172,26 +172,26 @@ class TestPreferences(PropertySheetTestCase): group, 'enable_action', wf_id='preference_workflow') portal_workflow.doActionFor( site, 'enable_action', wf_id='preference_workflow') - self.assertEquals(person1.getPreferenceState(), 'enabled') - self.assertEquals(group.getPreferenceState(), 'enabled') - self.assertEquals(site.getPreferenceState(), 'global') + self.assertEqual(person1.getPreferenceState(), 'enabled') + self.assertEqual(group.getPreferenceState(), 'enabled') + self.assertEqual(site.getPreferenceState(), 'global') person1.setPreferredAccountingTransactionSimulationState([]) - self.assertEquals( + self.assertEqual( person1.getPreferredAccountingTransactionSimulationState(), None) group.setPreferredAccountingTransactionSimulationState([]) - self.assertEquals( + self.assertEqual( group.getPreferredAccountingTransactionSimulationState(), None) site.setPreferredAccountingTransactionSimulationState([]) - self.assertEquals( + self.assertEqual( site.getPreferredAccountingTransactionSimulationState(), None) - self.assertEquals(len(pref_tool.getPreference( + self.assertEqual(len(pref_tool.getPreference( 'preferred_accounting_transaction_simulation_state_list')), 0) site.edit( preferred_accounting_transaction_simulation_state_list= ['stopped', 'delivered']) - self.assertEquals(list(pref_tool.getPreference( + self.assertEqual(list(pref_tool.getPreference( 'preferred_accounting_transaction_simulation_state_list')), list(site.getPreferredAccountingTransactionSimulationStateList())) @@ -200,29 +200,29 @@ class TestPreferences(PropertySheetTestCase): for prop in ['preferred_accounting_transaction_simulation_state', 'preferred_accounting_transaction_simulation_state_list']: - self.assertEquals(pref_tool.getPreference(prop), + self.assertEqual(pref_tool.getPreference(prop), site.getProperty(prop)) group.edit( preferred_accounting_transaction_simulation_state_list=['draft']) - self.assertEquals(list(pref_tool.getPreference( + self.assertEqual(list(pref_tool.getPreference( 'preferred_accounting_transaction_simulation_state_list')), list(group.getPreferredAccountingTransactionSimulationStateList())) person1.edit(preferred_accounting_transaction_simulation_state_list= ['cancelled']) - self.assertEquals(list(pref_tool.getPreference( + self.assertEqual(list(pref_tool.getPreference( 'preferred_accounting_transaction_simulation_state_list')), list(person1.getPreferredAccountingTransactionSimulationStateList())) # disable person -> group is selected self.getWorkflowTool().doActionFor(person1, 'disable_action', wf_id='preference_workflow') self.commit() - self.assertEquals(list(pref_tool.getPreference( + self.assertEqual(list(pref_tool.getPreference( 'preferred_accounting_transaction_simulation_state_list')), list(group.getPreferredAccountingTransactionSimulationStateList())) - self.assertEquals('default', pref_tool.getPreference( + self.assertEqual('default', pref_tool.getPreference( 'this_does_not_exists', 'default')) @@ -234,20 +234,20 @@ class TestPreferences(PropertySheetTestCase): person1 = self.getPreferenceTool()['person1'] group = self.getPreferenceTool()['group'] site = self.getPreferenceTool()['site'] - self.assertEquals(person1.getPreferenceState(), 'disabled') + self.assertEqual(person1.getPreferenceState(), 'disabled') portal_workflow.doActionFor( group, 'enable_action', wf_id='preference_workflow') - self.assertEquals(group.getPreferenceState(), 'enabled') + self.assertEqual(group.getPreferenceState(), 'enabled') portal_workflow.doActionFor( site, 'enable_action', wf_id='preference_workflow') - self.assertEquals(site.getPreferenceState(), 'global') + self.assertEqual(site.getPreferenceState(), 'global') group.setPreferredAccountingTransactionSimulationStateList(['cancelled']) self.assertNotEquals( None, pref_tool.getPreferredAccountingTransactionSimulationStateList()) self.assertNotEquals( [], list(pref_tool.getPreferredAccountingTransactionSimulationStateList())) - self.assertEquals( + self.assertEqual( list(pref_tool.getPreferredAccountingTransactionSimulationStateList()), list(pref_tool.getPreference( 'preferred_accounting_transaction_simulation_state_list'))) @@ -270,15 +270,15 @@ class TestPreferences(PropertySheetTestCase): portal_workflow.doActionFor( person1, 'enable_action', wf_id='preference_workflow') - self.assertEquals(person1.getPreferenceState(), 'enabled') + self.assertEqual(person1.getPreferenceState(), 'enabled') person1.setPreferredAccountingTransactionAtDate(DateTime(2005, 01, 01)) pref_tool.setPreference( 'preferred_accounting_transaction_at_date', DateTime(2004, 12, 31)) self.tic() - self.assertEquals( + self.assertEqual( pref_tool.getPreferredAccountingTransactionAtDate(), DateTime(2004, 12, 31)) - self.assertEquals( + self.assertEqual( person1.getPreferredAccountingTransactionAtDate(), DateTime(2004, 12, 31)) @@ -303,8 +303,8 @@ class TestPreferences(PropertySheetTestCase): # enable a pref portal_workflow.doActionFor( user_a_1, 'enable_action', wf_id='preference_workflow') - self.assertEquals(user_a_1.getPreferenceState(), 'enabled') - self.assertEquals(user_a_2.getPreferenceState(), 'disabled') + self.assertEqual(user_a_1.getPreferenceState(), 'enabled') + self.assertEqual(user_a_2.getPreferenceState(), 'disabled') self.login('user_b') @@ -317,11 +317,11 @@ class TestPreferences(PropertySheetTestCase): # enable this preference portal_workflow.doActionFor( user_b_1, 'enable_action', wf_id='preference_workflow') - self.assertEquals(user_b_1.getPreferenceState(), 'enabled') + self.assertEqual(user_b_1.getPreferenceState(), 'enabled') # check user_a's preference is still enabled - self.assertEquals(user_a_1.getPreferenceState(), 'enabled') - self.assertEquals(user_a_2.getPreferenceState(), 'disabled') + self.assertEqual(user_a_1.getPreferenceState(), 'enabled') + self.assertEqual(user_a_2.getPreferenceState(), 'disabled') # Checks that a manager preference doesn't disable any other user # preferences @@ -339,13 +339,13 @@ class TestPreferences(PropertySheetTestCase): # enable this preference portal_workflow.doActionFor( manager_pref, 'enable_action', wf_id='preference_workflow') - self.assertEquals(manager_pref.getPreferenceState(), 'enabled') + self.assertEqual(manager_pref.getPreferenceState(), 'enabled') self.tic() # check users preferences are still enabled - self.assertEquals(user_a_1.getPreferenceState(), 'enabled') - self.assertEquals(user_b_1.getPreferenceState(), 'enabled') - self.assertEquals(user_a_2.getPreferenceState(), 'disabled') + self.assertEqual(user_a_1.getPreferenceState(), 'enabled') + self.assertEqual(user_b_1.getPreferenceState(), 'enabled') + self.assertEqual(user_a_2.getPreferenceState(), 'disabled') # A user with Manager and Owner can view all preferences, because this user # is Manager and Owner, but for Manager, we have an exception, only @@ -354,7 +354,7 @@ class TestPreferences(PropertySheetTestCase): self.login('manager_and_owner') self.assert_('Owner' in getSecurityManager().getUser().getRolesInContext(manager_pref)) - self.assertEquals(None, + self.assertEqual(None, portal_preferences.getPreferredAccountingTransactionAtDate()) def test_proxy_roles(self): @@ -399,7 +399,7 @@ class TestPreferences(PropertySheetTestCase): script.manage_proxy(['Manager']) self.login('user_a') - self.assertEquals(['user_a'], + self.assertEqual(['user_a'], portal_preferences.PreferenceTool_testPreferencesProxyRole()) def test_GlobalPreference(self): @@ -409,10 +409,10 @@ class TestPreferences(PropertySheetTestCase): ['this_is_visible_by_anonymous']) self.getPortal().portal_workflow.doActionFor( ptool.site, 'enable_action', wf_id='preference_workflow') - self.assertEquals('global', ptool.site.getPreferenceState()) + self.assertEqual('global', ptool.site.getPreferenceState()) self.tic() noSecurityManager() - self.assertEquals(['this_is_visible_by_anonymous'], + self.assertEqual(['this_is_visible_by_anonymous'], ptool.getPreferredAccountingTransactionSimulationStateList()) def test_GetDefault(self): @@ -421,33 +421,33 @@ class TestPreferences(PropertySheetTestCase): site = self.getPreferenceTool()['site'] portal_workflow.doActionFor( site, 'enable_action', wf_id='preference_workflow') - self.assertEquals(site.getPreferenceState(), 'global') + self.assertEqual(site.getPreferenceState(), 'global') method = pref_tool.getPreferredAccountingTransactionSimulationState state = method() - self.assertEquals(state, []) + self.assertEqual(state, []) state = method('default') - self.assertEquals(state, 'default') + self.assertEqual(state, 'default') method = lambda *args: pref_tool.getPreference('preferred_accounting_transaction_simulation_state', *args) state = method() - self.assertEquals(state, []) + self.assertEqual(state, []) state = method('default') - self.assertEquals(state, 'default') + self.assertEqual(state, 'default') method = pref_tool.getPreferredAccountingTransactionSimulationStateList state_list = method() - self.assertEquals(state_list, []) + self.assertEqual(state_list, []) state_list = method(('default',)) # Initially, tuples were always casted to lists. This is not the case # anymore when preference_tool.getXxxList returns the default value. - self.assertEquals(state_list, ('default',)) + self.assertEqual(state_list, ('default',)) method = lambda *args: pref_tool.getPreference('preferred_accounting_transaction_simulation_state_list', *args) state_list = method() - self.assertEquals(state_list, []) + self.assertEqual(state_list, []) state_list = method(('default',)) - self.assertEquals(state_list, ('default',)) + self.assertEqual(state_list, ('default',)) def test_Permissions(self): # create a new site preference for later @@ -456,7 +456,7 @@ class TestPreferences(PropertySheetTestCase): portal_type='Preference', priority=Priority.SITE) self.portal.portal_workflow.doActionFor(site_pref, 'enable_action') - self.assertEquals(site_pref.getPreferenceState(), 'global') + self.assertEqual(site_pref.getPreferenceState(), 'global') # Members can add new preferences uf = self.getPortal().acl_users @@ -471,7 +471,7 @@ class TestPreferences(PropertySheetTestCase): # preference. cp_data = preference_tool.manage_copyObjects(ids=[site_pref.getId()]) copy_id = preference_tool.manage_pasteObjects(cp_data)[0]['new_id'] - self.assertEquals(Priority.USER, preference_tool[copy_id].getPriority()) + self.assertEqual(Priority.USER, preference_tool[copy_id].getPriority()) # Globally enabled preferences can be viewed by Members self.assertTrue(member.has_permission('View', site_pref)) @@ -611,7 +611,7 @@ class TestPreferences(PropertySheetTestCase): preference_tool = self.portal.portal_preferences self.assertTrue(guarded_hasattr(preference_tool, 'getPreferredToto')) - self.assertEquals("A TEST", preference_tool.getPreferredToto()) + self.assertEqual("A TEST", preference_tool.getPreferredToto()) preference_tool.manage_permission(write_permission, [], 0) self.assertTrue(guarded_hasattr(preference_tool, 'getPreferredToto')) diff --git a/product/ERP5Form/tests/testProxyField.py b/product/ERP5Form/tests/testProxyField.py index abf84922f7..585b9faeba 100644 --- a/product/ERP5Form/tests/testProxyField.py +++ b/product/ERP5Form/tests/testProxyField.py @@ -126,7 +126,7 @@ class TestProxyField(ERP5TypeTestCase): field.manage_edit_xmlrpc(dict( form_id='Base_viewGeekFieldLibrary', field_id='my_title')) - self.assertEquals(my_title_value, field.get_value('title')) + self.assertEqual(my_title_value, field.get_value('title')) # Reveal a bug, causes infinite loop when ProxyField.getTemplateField # returns the proxyfield itself. @@ -174,7 +174,7 @@ class TestProxyField(ERP5TypeTestCase): field.manage_edit_xmlrpc(dict( form_id='erp5_geek/Base_viewGeekFieldLibrary', field_id='my_title')) - self.assertEquals('Generic Title', field.get_value('title')) + self.assertEqual('Generic Title', field.get_value('title')) @expectedFailure def testSkinSelectionTemplateField(self): @@ -228,11 +228,11 @@ class TestProxyField(ERP5TypeTestCase): form_id='Base_viewGeekFieldLibrary', field_id='my_title')) self.commit() - self.assertEquals(None, field.get_value('title')) + self.assertEqual(None, field.get_value('title')) self.changeSkin('GenericView') - self.assertEquals('Generic Title', field.get_value('title')) + self.assertEqual('Generic Title', field.get_value('title')) self.changeSkin('CustomizedView') - self.assertEquals('Customized Title', field.get_value('title')) + self.assertEqual('Customized Title', field.get_value('title')) def testEmptySurchargedFieldLibrary_acquisition(self): """ @@ -330,7 +330,7 @@ return printed xml_string = formToXML(form) xml_tree = etree.fromstring(xml_string) field_node = xml_tree.find('groups/group/fields/field') - self.assertEquals(field_node.find('type').text, 'ProxyField') + self.assertEqual(field_node.find('type').text, 'ProxyField') self.assertTrue(field_node.find('delegated_list/title') is not None) skin_folder.manage_addProduct['ERP5Form'].addERP5Form('Base_viewSuperGeek', diff --git a/product/ERP5Form/tests/testScribusUtils.py b/product/ERP5Form/tests/testScribusUtils.py index 564b543ff1..515d4e69d3 100644 --- a/product/ERP5Form/tests/testScribusUtils.py +++ b/product/ERP5Form/tests/testScribusUtils.py @@ -78,7 +78,7 @@ class TestScribusUtils(ERP5TypeTestCase): self.assertNotEqual(self.portal._getOb('dummy_module', None), None) self.assertNotEqual( self.portal.portal_skins._getOb("erp5_test", None), None) - self.assertEquals("Dummy Module Title", + self.assertEqual("Dummy Module Title", self.portal.dummy_module.getTitle()) self.assertNotEqual(self.portal.portal_types.getTypeInfo("Dummy Module"), None) @@ -106,7 +106,7 @@ class TestScribusUtils(ERP5TypeTestCase): self.assertNotEqual(self.portal._getOb('dummy_module', None), None) self.assertNotEqual( self.portal.portal_skins._getOb("erp5_test", None), None) - self.assertEquals("Dummy Module Title", + self.assertEqual("Dummy Module Title", self.portal.dummy_module.getTitle()) self.assertNotEqual(self.portal.portal_types.getTypeInfo("Dummy Module"), None) @@ -134,7 +134,7 @@ class TestScribusUtils(ERP5TypeTestCase): form = self.portal.portal_skins.erp5_test._getOb( 'DummyModule_viewDummyList', None) self.assertNotEquals(form, None) - self.assertEquals(form.pt, 'form_list') + self.assertEqual(form.pt, 'form_list') self.assertTrue(hasattr(form, 'listbox')) # listbox is in bottom group self.assertTrue('listbox' in [field.getId() for field in @@ -165,7 +165,7 @@ class TestScribusUtils(ERP5TypeTestCase): self.assertNotEqual(self.portal._getOb('dummy_module', None), None) self.assertNotEqual( self.portal.portal_skins._getOb("erp5_test", None), None) - self.assertEquals("Dummy Module Title", + self.assertEqual("Dummy Module Title", self.portal.dummy_module.getTitle()) self.assertNotEqual(self.portal.portal_types.getTypeInfo("Dummy Module"), None) @@ -189,7 +189,7 @@ class TestScribusUtils(ERP5TypeTestCase): self.assertNotEquals(getattr(self.portal.portal_skins.erp5_test.Dummy_view, 'text_couscous', None), None) # the old field text_1 must have been removed - self.assertEquals(getattr(self.portal.portal_skins.erp5_test.Dummy_view, + self.assertEqual(getattr(self.portal.portal_skins.erp5_test.Dummy_view, 'text_1', None), None) def test_05_requiredFields(self): @@ -211,7 +211,7 @@ class TestScribusUtils(ERP5TypeTestCase): self.assertNotEqual(self.portal._getOb('dummy_module', None), None) self.assertNotEqual( self.portal.portal_skins._getOb("erp5_test", None), None) - self.assertEquals("Dummy Module Title", + self.assertEqual("Dummy Module Title", self.portal.dummy_module.getTitle()) self.assertNotEqual(self.portal.portal_types.getTypeInfo("Dummy Module"), None) @@ -234,7 +234,7 @@ class TestScribusUtils(ERP5TypeTestCase): # check the required fields are required : for field_name in required_field_name_list: field = getattr(form, field_name, None) - self.assertEquals(field.values['required'], 1) + self.assertEqual(field.values['required'], 1) # check fields not required are not : for field_name in not_required_field_name_list: @@ -258,7 +258,7 @@ class TestScribusUtils(ERP5TypeTestCase): self.assertNotEqual(self.portal._getOb('dummy_module', None), None) self.assertNotEqual( self.portal.portal_skins._getOb("erp5_test", None), None) - self.assertEquals("Dummy Module Title", + self.assertEqual("Dummy Module Title", self.portal.dummy_module.getTitle()) self.assertNotEqual(self.portal.portal_types.getTypeInfo("Dummy Module"), None) @@ -281,12 +281,12 @@ class TestScribusUtils(ERP5TypeTestCase): # check the read_only fields are read_only : for field_name in read_only_field_name_list: field = getattr(form, field_name, None) - self.assertEquals(field.values['editable'], 0) + self.assertEqual(field.values['editable'], 0) # check fields not read_only are not : for field_name in not_read_only_field_name_list: field = getattr(form, field_name, None) - self.assertEquals(field.values['editable'], 1) + self.assertEqual(field.values['editable'], 1) def test_07_DateTimeFieldWithModuleCreation(self): '''test DateTime format''' @@ -308,7 +308,7 @@ class TestScribusUtils(ERP5TypeTestCase): self.assertNotEqual(self.portal._getOb('authorisation_module', None), None) self.assertNotEqual( self.portal.portal_skins._getOb("erp5_authorisation", None), None) - self.assertEquals("Authorisation Module Title", + self.assertEqual("Authorisation Module Title", self.portal.authorisation_module.getTitle()) module_portal_type = portal_types.getTypeInfo("Authorisation Module") self.assertNotEqual(module_portal_type, None) @@ -354,9 +354,9 @@ class TestScribusUtils(ERP5TypeTestCase): authorisation)) result_stop_date = expr_stop_date(getExprContext(authorisation, authorisation)) - self.assertEquals(result_other_date, '') - self.assertEquals(result_start_date, start_date.strftime('%d/%m/%Y')) - self.assertEquals(result_stop_date, stop_date.strftime('%Y/%m/%d %H:%M')) + self.assertEqual(result_other_date, '') + self.assertEqual(result_start_date, start_date.strftime('%d/%m/%Y')) + self.assertEqual(result_stop_date, stop_date.strftime('%Y/%m/%d %H:%M')) def test_08_ModuleCreationWithoutField(self): '''check it's possible to create a module using an empty scribus file without errors''' @@ -372,13 +372,13 @@ class TestScribusUtils(ERP5TypeTestCase): self.assertNotEqual(self.portal._getOb('empty_module', None), None) self.assertNotEqual( self.portal.portal_skins._getOb("erp5_empty", None), None) - self.assertEquals("Empty Module Title", + self.assertEqual("Empty Module Title", self.portal.empty_module.getTitle()) self.assertNotEqual(self.portal.portal_types.getTypeInfo("Empty Module"), None) self.assertNotEqual(self.portal.portal_types.getTypeInfo("Empty"), None) form = self.portal.portal_skins.erp5_empty.Empty_view - self.assertEquals(0, len(form.objectValues())) + self.assertEqual(0, len(form.objectValues())) def test_09_creationRadioField(self): '''check it's possible to put a field radioField in ERP5 Form created with @@ -399,17 +399,17 @@ class TestScribusUtils(ERP5TypeTestCase): self.assertNotEqual(self.portal._getOb('radio_module', None), None) self.assertNotEqual( self.portal.portal_skins._getOb("erp5_radio", None), None) - self.assertEquals("Radio Module Title", + self.assertEqual("Radio Module Title", self.portal.radio_module.getTitle()) self.assertNotEqual(self.portal.portal_types.getTypeInfo("Radio Module"), None) self.assertNotEqual(self.portal.portal_types.getTypeInfo("Radio"), None) form = self.portal.portal_skins.erp5_radio.Radio_view field_radio = form.my_radio - self.assertEquals(3, + self.assertEqual(3, len(field_radio.get_value('items'))) items_list = [('young', 'Young'), ('adult', 'Adult'), ('senior', 'Senior')] - self.assertEquals(items_list, field_radio.get_value('items')) + self.assertEqual(items_list, field_radio.get_value('items')) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5Form/tests/testSelectionTool.py b/product/ERP5Form/tests/testSelectionTool.py index db6eee646b..9e6c627cd3 100644 --- a/product/ERP5Form/tests/testSelectionTool.py +++ b/product/ERP5Form/tests/testSelectionTool.py @@ -58,9 +58,9 @@ class TestSelectionTool(ERP5TypeTestCase): self.portal_selections.setSelectionParamsFor('test_selection', {'key':'value'}) def testGetSelectionContainer(self): - self.assertEquals(['test_selection'], + self.assertEqual(['test_selection'], self.portal_selections.getSelectionNameList()) - self.assertEquals(['test_selection'], + self.assertEqual(['test_selection'], self.portal_selections.getSelectionNames()) self.assert_(self.portal_selections._getContainer() is not None) self.assert_(getattr(self.portal_selections, 'selection_data', None) @@ -71,104 +71,104 @@ class TestSelectionTool(ERP5TypeTestCase): def testGetSelectionFor(self): selection = self.portal_selections.getSelectionFor('test_selection') self.assert_(isinstance(selection, Selection)) - self.assertEquals('test_selection', selection.name) + self.assertEqual('test_selection', selection.name) def testGetSelectionParamsFor(self): - self.assertEquals({'key':'value'}, + self.assertEqual({'key':'value'}, self.portal_selections.getSelectionParamsFor('test_selection')) def testGetSelectionParamsDictInterface(self): - self.assertEquals('value', + self.assertEqual('value', self.portal_selections['test_selection']['key']) # the main use case is to have a dict interface in TALES expressions: from Products.PageTemplates.Expressions import getEngine evaluate_tales = getEngine().getContext(dict(context=self.portal)).evaluate - self.assertEquals('value', + self.assertEqual('value', evaluate_tales('context/portal_selections/test_selection/key')) - self.assertEquals('default', evaluate_tales( + self.assertEqual('default', evaluate_tales( 'context/portal_selections/test_selection/not_found | string:default')) @skip('Test to be written') def testCallSelectionFor(self): - self.assertEquals(None, + self.assertEqual(None, self.portal_selections.callSelectionFor('not_found_selection')) raise NotImplementedError('more tests needed') def testCheckedUids(self): - self.assertEquals([], + self.assertEqual([], self.portal_selections.getSelectionCheckedUidsFor('test_selection')) self.portal_selections.setSelectionCheckedUidsFor('test_selection', ['foo']) - self.assertEquals(['foo'], + self.assertEqual(['foo'], self.portal_selections.getSelectionCheckedUidsFor('test_selection')) self.portal_selections.updateSelectionCheckedUidList('test_selection', ['foo'], ['bar']) - self.assertEquals(['bar'], + self.assertEqual(['bar'], self.portal_selections.getSelectionCheckedUidsFor('test_selection')) self.portal_selections.checkAll('test_selection', ['foo', 'baz']) - self.assertEquals(sorted(['foo', 'bar', 'baz']), + self.assertEqual(sorted(['foo', 'bar', 'baz']), sorted(self.portal_selections.getSelectionCheckedUidsFor('test_selection'))) self.portal_selections.uncheckAll('test_selection', ['foo', 'bar']) - self.assertEquals(['baz'], + self.assertEqual(['baz'], self.portal_selections.getSelectionCheckedUidsFor('test_selection')) def testGetSelectionListUrlFor(self): - self.assertEquals('', + self.assertEqual('', self.portal_selections.getSelectionListUrlFor('test_selection')) def testInvertMode(self): self.portal_selections.setSelectionInvertModeFor('test_selection', 1) - self.assertEquals(1, + self.assertEqual(1, self.portal_selections.getSelectionInvertModeFor('test_selection')) - self.assertEquals([], + self.assertEqual([], self.portal_selections.getSelectionInvertModeUidListFor('test_selection')) def testSetSelectionToAll(self): self.portal_selections.checkAll('test_selection', ['foo', 'bar']) self.portal_selections.setSelectionToAll('test_selection') - self.assertEquals(0, + self.assertEqual(0, self.portal_selections.getSelectionInvertModeFor('test_selection')) - self.assertEquals({}, + self.assertEqual({}, self.portal_selections.getSelectionParamsFor('test_selection')) - self.assertEquals([], + self.assertEqual([], self.portal_selections.getSelectionCheckedUidsFor('test_selection')) def testSortOrder(self): self.portal_selections.setSelectionSortOrder('test_selection', [('title', 'ascending')]) - self.assertEquals([('title', 'ascending')], + self.assertEqual([('title', 'ascending')], self.portal_selections.getSelectionSortOrder('test_selection')) self.portal_selections.setSelectionQuickSortOrder('test_selection', 'title') - self.assertEquals([('title', 'descending')], + self.assertEqual([('title', 'descending')], self.portal_selections.getSelectionSortOrder('test_selection')) self.portal_selections.setSelectionQuickSortOrder('test_selection', 'date') - self.assertEquals([('date', 'ascending')], + self.assertEqual([('date', 'ascending')], self.portal_selections.getSelectionSortOrder('test_selection')) def testColumns(self): - self.assertEquals([], + self.assertEqual([], self.portal_selections.getSelectionColumns('test_selection')) - self.assertEquals([('default_key', 'default_val')], + self.assertEqual([('default_key', 'default_val')], self.portal_selections.getSelectionColumns('test_selection', [('default_key', 'default_val')])) self.portal_selections.setSelectionColumns('test_selection', [('key', 'val')]) - self.assertEquals([('key', 'val')], + self.assertEqual([('key', 'val')], self.portal_selections.getSelectionColumns('test_selection')) - self.assertEquals([('key', 'val')], + self.assertEqual([('key', 'val')], self.portal_selections.getSelectionColumns('test_selection', [('default_key', 'default_val')])) def testStats(self): - self.assertEquals([' ', ' ', ' ', ' ', ' ', ' '], + self.assertEqual([' ', ' ', ' ', ' ', ' ', ' '], self.portal_selections.getSelectionStats('test_selection')) self.portal_selections.setSelectionStats('test_selection', []) - self.assertEquals([], + self.assertEqual([], self.portal_selections.getSelectionStats('test_selection')) @skip('Test to be written') @@ -180,38 +180,38 @@ class TestSelectionTool(ERP5TypeTestCase): raise NotImplementedError('test should be added') def testDomainSelection(self): - self.assertEquals('', + self.assertEqual('', self.portal_selections.buildSQLJoinExpressionFromDomainSelection({})) - self.assertEquals('', + self.assertEqual('', self.portal_selections.buildSQLExpressionFromDomainSelection({})) from Products.ERP5Form.Selection import DomainSelection - self.assertEquals('', + self.assertEqual('', self.portal_selections.buildSQLJoinExpressionFromDomainSelection(DomainSelection({}).__of__(self.portal_selections))) category_tool = self.getCategoryTool() base = category_tool.newContent(portal_type = 'Base Category', id='test_base_cat') base_uid = base.getUid() - self.assertEquals('category AS test_base_cat_category', + self.assertEqual('category AS test_base_cat_category', self.portal_selections.buildSQLJoinExpressionFromDomainSelection({'test_base_cat': ('portal_categories', 'test_base_cat')})) - self.assertEquals('( catalog.uid = test_base_cat_category.uid AND (test_base_cat_category.category_uid = %d AND test_base_cat_category.base_category_uid = %d) )' % (base_uid, base_uid), + self.assertEqual('( catalog.uid = test_base_cat_category.uid AND (test_base_cat_category.category_uid = %d AND test_base_cat_category.base_category_uid = %d) )' % (base_uid, base_uid), self.portal_selections.buildSQLExpressionFromDomainSelection({'test_base_cat': ('portal_categories', 'test_base_cat')})) test = base.newContent(portal_type = 'Category', id = 'test_cat') test_uid = test.getUid() - self.assertEquals('category AS test_base_cat_category', + self.assertEqual('category AS test_base_cat_category', self.portal_selections.buildSQLJoinExpressionFromDomainSelection({'test_base_cat': ('portal_categories', 'test_base_cat/test_cat')})) - self.assertEquals('( catalog.uid = test_base_cat_category.uid AND (test_base_cat_category.category_uid = %d AND test_base_cat_category.base_category_uid = %d) )' % (test_uid, base_uid), + self.assertEqual('( catalog.uid = test_base_cat_category.uid AND (test_base_cat_category.category_uid = %d AND test_base_cat_category.base_category_uid = %d) )' % (test_uid, base_uid), self.portal_selections.buildSQLExpressionFromDomainSelection({'test_base_cat': ('portal_categories', 'test_base_cat/test_cat')})) - self.assertEquals('( catalog.uid = test_base_cat_category.uid AND (test_base_cat_category.category_uid = %d AND test_base_cat_category.base_category_uid = %d AND test_base_cat_category.category_strict_membership = 1) )' % (test_uid, base_uid), + self.assertEqual('( catalog.uid = test_base_cat_category.uid AND (test_base_cat_category.category_uid = %d AND test_base_cat_category.base_category_uid = %d AND test_base_cat_category.category_strict_membership = 1) )' % (test_uid, base_uid), self.portal_selections.buildSQLExpressionFromDomainSelection({'test_base_cat': ('portal_categories', 'test_base_cat/test_cat')}, strict_membership = 1)) def testDict(self): - self.assertEquals({}, + self.assertEqual({}, self.portal_selections.getSelectionDomainDictFor('test_selection')) - self.assertEquals({}, + self.assertEqual({}, self.portal_selections.getSelectionReportDictFor('test_selection')) def testIndex(self): - self.assertEquals(None, + self.assertEqual(None, self.portal_selections.getSelectionIndexFor('test_selection')) def testDeleteSelection(self): @@ -310,9 +310,9 @@ class TestSelectionPersistence(unittest.TestCase): # This would raise a ConflictError without conflict resolution code transaction.commit() params = self.portal_selections.getSelectionParamsFor('test_selection1') - self.assertEquals(params.get('a'), 'b') + self.assertEqual(params.get('a'), 'b') params = self.portal_selections.getSelectionParamsFor('test_selection2') - self.assertEquals(params.get('a'), 'b') + self.assertEqual(params.get('a'), 'b') def testDifferentUsernameConflictResolution(self): # different users edits selections @@ -343,7 +343,7 @@ class TestSelectionPersistence(unittest.TestCase): # this check is quite low level. # we know that setUp stored one selection, and each of our 2 threads stored # one selection. - self.assertEquals(3, len(self.portal_selections.selection_data.keys())) + self.assertEqual(3, len(self.portal_selections.selection_data.keys())) def testPersistentSelections(self): # test that selection parameters are persistent @@ -354,7 +354,7 @@ class TestSelectionPersistence(unittest.TestCase): self.cnx = self.db.open() portal_selections = self.cnx.root().portal_selections - self.assertEquals('saved_value', + self.assertEqual('saved_value', portal_selections.getSelectionParamsFor('test_selection').get('key')) class TestSelectionToolMemcachedStorage(TestSelectionTool): @@ -374,9 +374,9 @@ class TestSelectionToolMemcachedStorage(TestSelectionTool): TestSelectionTool.afterSetUp(self) def testGetSelectionContainer(self): - self.assertEquals([], + self.assertEqual([], self.portal_selections.getSelectionNameList()) - self.assertEquals([], + self.assertEqual([], self.portal_selections.getSelectionNames()) self.assert_(self.portal_selections._getContainer() is not None) self.assert_(getattr(self.portal_selections, '_v_selection_container', None) diff --git a/product/ERP5Form/tests/testVideoField.py b/product/ERP5Form/tests/testVideoField.py index b176e3f5fd..7251609205 100644 --- a/product/ERP5Form/tests/testVideoField.py +++ b/product/ERP5Form/tests/testVideoField.py @@ -43,7 +43,7 @@ class TestVideoField(ERP5TypeTestCase): def test_render_view(self): self.field.values['default'] = 'Video content' - self.assertEquals('<video preload="preload" src="Video content" controls="controls" height="85" width="160" >\nYour browser does not support video tag.</video>', \ + self.assertEqual('<video preload="preload" src="Video content" controls="controls" height="85" width="160" >\nYour browser does not support video tag.</video>', \ self.field.render_view(value='Video content')) self.field.values['video_preload'] = False @@ -54,7 +54,7 @@ class TestVideoField(ERP5TypeTestCase): self.field.values['video_height'] = 800 self.field.values['video_width'] = 1280 - self.assertEquals('<video src="Another Video content" ' + + self.assertEqual('<video src="Another Video content" ' + 'height="800" width="1280" loop="loop" autoplay="autoplay" ' + '>\nAnother error message</video>', \ self.field.render_view(value='Another Video content')) diff --git a/product/ERP5OOo/tests/testDeferredStyle.py b/product/ERP5OOo/tests/testDeferredStyle.py index 010b4727c9..f75090e33e 100644 --- a/product/ERP5OOo/tests/testDeferredStyle.py +++ b/product/ERP5OOo/tests/testDeferredStyle.py @@ -89,7 +89,7 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, message_text = last_message - self.assertEquals('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0]) + self.assertEqual('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0]) mail_message = email.message_from_string(message_text) for part in mail_message.walk(): content_type = part.get_content_type() @@ -98,8 +98,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): # "History" is the title of Base_viewHistory form file_name = part.get_filename() expected_file_name = 'History%s' % self.attachment_file_extension - self.assertEquals(expected_file_name, file_name) - self.assertEquals('attachment; filename="%s"' % expected_file_name, + self.assertEqual(expected_file_name, file_name) + self.assertEqual('attachment; filename="%s"' % expected_file_name, part.get('Content-Disposition')) data = part.get_payload(decode=True) error_list = Validator().validate(data) @@ -124,7 +124,7 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): last_message = self.portal.MailHost._last_message self.assertNotEquals((), last_message) mfrom, mto, message_text = last_message - self.assertEquals('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0]) + self.assertEqual('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0]) mail_message = email.message_from_string(message_text) for part in mail_message.walk(): content_type = part.get_content_type() @@ -132,8 +132,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): # "Person" is the title of Person_view form file_name = part.get_filename() expected_file_name = 'Person%s' % self.attachment_file_extension - self.assertEquals(expected_file_name, file_name) - self.assertEquals('attachment; filename="%s"' % expected_file_name, + self.assertEqual(expected_file_name, file_name) + self.assertEqual('attachment; filename="%s"' % expected_file_name, part.get('Content-Disposition')) data = part.get_payload(decode=True) error_list = Validator().validate(data) diff --git a/product/ERP5OOo/tests/testDms.py b/product/ERP5OOo/tests/testDms.py index 02addc5730..53c7723f3e 100644 --- a/product/ERP5OOo/tests/testDms.py +++ b/product/ERP5OOo/tests/testDms.py @@ -335,19 +335,19 @@ class TestDocument(TestDocumentMixin): docs[3] = self.createTestDocument(reference='TEST', version='004', language='en') docs[4] = self.createTestDocument(reference='ANOTHER', version='002', language='en') self.tic() - self.failIf(docs[1].isVersionUnique()) - self.failIf(docs[2].isVersionUnique()) - self.failUnless(docs[3].isVersionUnique()) + self.assertFalse(docs[1].isVersionUnique()) + self.assertFalse(docs[2].isVersionUnique()) + self.assertTrue(docs[3].isVersionUnique()) docs[2].setVersion('003') self.tic() - self.failUnless(docs[1].isVersionUnique()) - self.failUnless(docs[2].isVersionUnique()) - self.failUnless(docs[3].isVersionUnique()) - self.failUnless(docs[1].getLatestVersionValue() == docs[3]) - self.failUnless(docs[2].getLatestVersionValue() == docs[3]) - self.failUnless(docs[3].getLatestVersionValue() == docs[3]) + self.assertTrue(docs[1].isVersionUnique()) + self.assertTrue(docs[2].isVersionUnique()) + self.assertTrue(docs[3].isVersionUnique()) + self.assertTrue(docs[1].getLatestVersionValue() == docs[3]) + self.assertTrue(docs[2].getLatestVersionValue() == docs[3]) + self.assertTrue(docs[3].getLatestVersionValue() == docs[3]) version_list = [br.getRelativeUrl() for br in docs[2].getVersionValueList()] - self.failUnless(version_list == [docs[3].getRelativeUrl(), docs[2].getRelativeUrl(), docs[1].getRelativeUrl()]) + self.assertTrue(version_list == [docs[3].getRelativeUrl(), docs[2].getRelativeUrl(), docs[1].getRelativeUrl()]) def test_04_VersioningWithLanguage(self): """ @@ -388,19 +388,19 @@ class TestDocument(TestDocumentMixin): time.sleep(1) self.tic() doc = docs[2] # can be any - self.failUnless(doc.getOriginalLanguage() == 'en') - self.failUnless(doc.getLanguageList() == ['en', 'fr', 'pl', 'sp']) - self.failUnless(doc.getLatestVersionValue() == docs[4]) # there are two latest - it chooses the one in user language - self.failUnless(doc.getLatestVersionValue('en') == docs[4]) - self.failUnless(doc.getLatestVersionValue('fr') == docs[2]) - self.failUnless(doc.getLatestVersionValue('pl') == docs[3]) - self.failUnless(doc.getLatestVersionValue('ru') == None) + self.assertTrue(doc.getOriginalLanguage() == 'en') + self.assertTrue(doc.getLanguageList() == ['en', 'fr', 'pl', 'sp']) + self.assertTrue(doc.getLatestVersionValue() == docs[4]) # there are two latest - it chooses the one in user language + self.assertTrue(doc.getLatestVersionValue('en') == docs[4]) + self.assertTrue(doc.getLatestVersionValue('fr') == docs[2]) + self.assertTrue(doc.getLatestVersionValue('pl') == docs[3]) + self.assertTrue(doc.getLatestVersionValue('ru') == None) localizer.changeLanguage('sp') # change user language - self.failUnless(doc.getLatestVersionValue() == docs[5]) # there are two latest - it chooses the one in user language + self.assertTrue(doc.getLatestVersionValue() == docs[5]) # there are two latest - it chooses the one in user language docs[6] = document_module.newContent(reference='TEST', version='004', language='pl') docs[7] = document_module.newContent(reference='TEST', version='004', language='en') self.tic() - self.failUnless(doc.getLatestVersionValue() == docs[7]) # there are two latest, neither in user language - it chooses the one in original language + self.assertTrue(doc.getLatestVersionValue() == docs[7]) # there are two latest, neither in user language - it chooses the one in original language def test_06_testExplicitRelations(self): """ @@ -605,7 +605,7 @@ class TestDocument(TestDocumentMixin): # test get_size on OOoDocument doc = self.portal.document_module.newContent(portal_type='Spreadsheet') doc.edit(file=makeFileUpload('import_data_list.ods')) - self.assertEquals(len(makeFileUpload('import_data_list.ods').read()), + self.assertEqual(len(makeFileUpload('import_data_list.ods').read()), doc.get_size()) def testTempOOoDocument_get_size(self): @@ -613,22 +613,22 @@ class TestDocument(TestDocumentMixin): from Products.ERP5Type.Document import newTempOOoDocument doc = newTempOOoDocument(self.portal, 'tmp') doc.edit(data='OOo') - self.assertEquals(len('OOo'), doc.get_size()) + self.assertEqual(len('OOo'), doc.get_size()) def testOOoDocument_hasData(self): # test hasData on OOoDocument doc = self.portal.document_module.newContent(portal_type='Spreadsheet') - self.failIf(doc.hasData()) + self.assertFalse(doc.hasData()) doc.edit(file=makeFileUpload('import_data_list.ods')) - self.failUnless(doc.hasData()) + self.assertTrue(doc.hasData()) def testTempOOoDocument_hasData(self): # test hasData on TempOOoDocument from Products.ERP5Type.Document import newTempOOoDocument doc = newTempOOoDocument(self.portal, 'tmp') - self.failIf(doc.hasData()) + self.assertFalse(doc.hasData()) doc.edit(file=makeFileUpload('import_data_list.ods')) - self.failUnless(doc.hasData()) + self.assertTrue(doc.hasData()) def test_Owner_Base_download(self): # tests that owners can download OOo documents, and all headers (including @@ -645,11 +645,11 @@ class TestDocument(TestDocumentMixin): response = self.publish('%s/Base_download' % doc.getPath(), basic='member_user1:secret') - self.assertEquals(makeFileUpload('import_data_list.ods').read(), + self.assertEqual(makeFileUpload('import_data_list.ods').read(), response.getBody()) - self.assertEquals('application/vnd.oasis.opendocument.spreadsheet', + self.assertEqual('application/vnd.oasis.opendocument.spreadsheet', response.headers['content-type']) - self.assertEquals('attachment; filename="import_data_list.ods"', + self.assertEqual('attachment; filename="import_data_list.ods"', response.headers['content-disposition']) self.tic() @@ -670,8 +670,8 @@ class TestDocument(TestDocumentMixin): response = self.publish('%s?format=pdf' % doc.getPath(), basic='member_user2:secret') - self.assertEquals('application/pdf', response.getHeader('content-type')) - self.assertEquals('attachment; filename="import.file.with.dot.in.filename.pdf"', + self.assertEqual('application/pdf', response.getHeader('content-type')) + self.assertEqual('attachment; filename="import.file.with.dot.in.filename.pdf"', response.getHeader('content-disposition')) response_body = response.getBody() conversion = str(doc.convert('pdf')[1]) @@ -679,13 +679,13 @@ class TestDocument(TestDocumentMixin): conversion.splitlines(), fromfile='first_call.pdf', tofile='second_call.pdf')) - self.assertEquals(response_body, conversion, diff) + self.assertEqual(response_body, conversion, diff) # test Print icon works on OOoDocument response = self.publish('%s/OOoDocument_print' % doc.getPath()) - self.assertEquals('application/pdf', + self.assertEqual('application/pdf', response.headers['content-type']) - self.assertEquals('attachment; filename="import.file.with.dot.in.filename.pdf"', + self.assertEqual('attachment; filename="import.file.with.dot.in.filename.pdf"', response.headers['content-disposition']) def test_05_getCreationDate(self): @@ -710,9 +710,9 @@ class TestDocument(TestDocumentMixin): file = makeFileUpload(filename) document = self.portal.portal_contributions.newContent(file=file) - self.assertEquals('converting', document.getExternalProcessingState()) + self.assertEqual('converting', document.getExternalProcessingState()) self.commit() - self.assertEquals('converting', document.getExternalProcessingState()) + self.assertEqual('converting', document.getExternalProcessingState()) # Clone a uploaded document container = document.getParentValue() @@ -720,14 +720,14 @@ class TestDocument(TestDocumentMixin): paste_result = container.manage_pasteObjects(cb_copy_data=clipboard) new_document = container[paste_result[0]['new_id']] - self.assertEquals('converting', new_document.getExternalProcessingState()) + self.assertEqual('converting', new_document.getExternalProcessingState()) self.commit() - self.assertEquals('converting', new_document.getExternalProcessingState()) + self.assertEqual('converting', new_document.getExternalProcessingState()) # Change workflow state to converted self.tic() - self.assertEquals('converted', document.getExternalProcessingState()) - self.assertEquals('converted', new_document.getExternalProcessingState()) + self.assertEqual('converted', document.getExternalProcessingState()) + self.assertEqual('converted', new_document.getExternalProcessingState()) # Clone a converted document container = document.getParentValue() @@ -735,11 +735,11 @@ class TestDocument(TestDocumentMixin): paste_result = container.manage_pasteObjects(cb_copy_data=clipboard) new_document = container[paste_result[0]['new_id']] - self.assertEquals('converted', new_document.getExternalProcessingState()) + self.assertEqual('converted', new_document.getExternalProcessingState()) self.commit() - self.assertEquals('converted', new_document.getExternalProcessingState()) + self.assertEqual('converted', new_document.getExternalProcessingState()) self.tic() - self.assertEquals('converted', new_document.getExternalProcessingState()) + self.assertEqual('converted', new_document.getExternalProcessingState()) def test_07_EmbeddedDocumentOfAClonedDocument(self): """ @@ -749,9 +749,9 @@ class TestDocument(TestDocumentMixin): document = self.portal.person_module.newContent(portal_type='Person') sub_document = document.newContent(portal_type='Embedded File') - self.assertEquals('embedded', sub_document.getValidationState()) + self.assertEqual('embedded', sub_document.getValidationState()) self.tic() - self.assertEquals('embedded', sub_document.getValidationState()) + self.assertEqual('embedded', sub_document.getValidationState()) # Clone document container = document.getParentValue() @@ -761,11 +761,11 @@ class TestDocument(TestDocumentMixin): new_document = container[paste_result[0]['new_id']] new_sub_document_list = new_document.contentValues(portal_type='Embedded File') - self.assertEquals(1, len(new_sub_document_list)) + self.assertEqual(1, len(new_sub_document_list)) new_sub_document = new_sub_document_list[0] - self.assertEquals('embedded', new_sub_document.getValidationState()) + self.assertEqual('embedded', new_sub_document.getValidationState()) self.tic() - self.assertEquals('embedded', new_sub_document.getValidationState()) + self.assertEqual('embedded', new_sub_document.getValidationState()) def test_08_NoImagesCreatedDuringHTMLConversion(self): """Converting an ODT to html no longer creates Images embedded in the @@ -777,10 +777,10 @@ class TestDocument(TestDocumentMixin): self.tic() - self.assertEquals(0, len(document.contentValues(portal_type='Image'))) + self.assertEqual(0, len(document.contentValues(portal_type='Image'))) document.convert(format='html') image_list = document.contentValues(portal_type='Image') - self.assertEquals(0, len(image_list)) + self.assertEqual(0, len(image_list)) def test_09_SearchableText(self): """ @@ -894,10 +894,10 @@ class TestDocument(TestDocumentMixin): document = portal.document_module.newContent( portal_type = 'Presentation',) # searchable text is empty by default - self.assertEquals('', document.SearchableText()) + self.assertEqual('', document.SearchableText()) # it contains title document.setTitle('foo') - self.assertEquals('foo', document.SearchableText()) + self.assertEqual('foo', document.SearchableText()) # and description document.setDescription('bar') self.assertTrue('bar' in document.SearchableText(), @@ -913,38 +913,38 @@ class TestDocument(TestDocumentMixin): parse = portal.Base_parseSearchString # directly pasing searchable string - self.assertEquals('searchable text', + self.assertEqual('searchable text', assemble(**{'searchabletext': 'searchable text'})) kw = {'searchabletext_any': 'searchabletext_any', 'searchabletext_phrase': 'searchabletext_phrase1 searchabletext_phrase1'} # exact phrase search_string = assemble(**kw) - self.assertEquals('%s "%s"' %(kw['searchabletext_any'], kw['searchabletext_phrase']), \ + self.assertEqual('%s "%s"' %(kw['searchabletext_any'], kw['searchabletext_phrase']), \ search_string) parsed_string = parse(search_string) - self.assertEquals(['searchabletext'], parsed_string.keys()) + self.assertEqual(['searchabletext'], parsed_string.keys()) # search "with all of the words" kw["searchabletext_all"] = "searchabletext_all1 searchabletext_all2" search_string = assemble(**kw) - self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2', \ + self.assertEqual('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2', \ search_string) parsed_string = parse(search_string) - self.assertEquals(['searchabletext'], parsed_string.keys()) + self.assertEqual(['searchabletext'], parsed_string.keys()) # search without these words kw["searchabletext_without"] = "searchabletext_without1 searchabletext_without2" search_string = assemble(**kw) - self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2', \ + self.assertEqual('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2', \ search_string) parsed_string = parse(search_string) - self.assertEquals(['searchabletext'], parsed_string.keys()) + self.assertEqual(['searchabletext'], parsed_string.keys()) # search limited to a certain date range kw['created_within'] = '1w' search_string = assemble(**kw) - self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w', \ + self.assertEqual('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w', \ search_string) parsed_string = parse(search_string) self.assertSameSet(['searchabletext', 'creation_from'], parsed_string.keys()) @@ -953,126 +953,126 @@ class TestDocument(TestDocumentMixin): kw['search_portal_type'] = 'Document' search_string = assemble(**kw) parsed_string = parse(search_string) - self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document)', \ + self.assertEqual('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document)', \ search_string) self.assertSameSet(['searchabletext', 'creation_from', 'portal_type'], \ parsed_string.keys()) - self.assertEquals(kw['search_portal_type'], parsed_string['portal_type']) + self.assertEqual(kw['search_portal_type'], parsed_string['portal_type']) # search by reference kw['reference'] = 'Nxd-test' search_string = assemble(**kw) parsed_string = parse(search_string) - self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test', \ + self.assertEqual('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test', \ search_string) self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference'], \ parsed_string.keys()) - self.assertEquals(kw['search_portal_type'], parsed_string['portal_type']) - self.assertEquals(kw['reference'], parsed_string['reference']) + self.assertEqual(kw['search_portal_type'], parsed_string['portal_type']) + self.assertEqual(kw['reference'], parsed_string['reference']) # search by version kw['version'] = '001' search_string = assemble(**kw) parsed_string = parse(search_string) - self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001', \ + self.assertEqual('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001', \ search_string) self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', 'version'], \ parsed_string.keys()) - self.assertEquals(kw['search_portal_type'], parsed_string['portal_type']) - self.assertEquals(kw['reference'], parsed_string['reference']) - self.assertEquals(kw['version'], parsed_string['version']) + self.assertEqual(kw['search_portal_type'], parsed_string['portal_type']) + self.assertEqual(kw['reference'], parsed_string['reference']) + self.assertEqual(kw['version'], parsed_string['version']) # search by language kw['language'] = 'en' search_string = assemble(**kw) parsed_string = parse(search_string) - self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001 language:en', \ + self.assertEqual('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001 language:en', \ search_string) self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \ 'version', 'language'], \ parsed_string.keys()) - self.assertEquals(kw['search_portal_type'], parsed_string['portal_type']) - self.assertEquals(kw['reference'], parsed_string['reference']) - self.assertEquals(kw['version'], parsed_string['version']) - self.assertEquals(kw['language'], parsed_string['language']) + self.assertEqual(kw['search_portal_type'], parsed_string['portal_type']) + self.assertEqual(kw['reference'], parsed_string['reference']) + self.assertEqual(kw['version'], parsed_string['version']) + self.assertEqual(kw['language'], parsed_string['language']) # contributor title search kw['contributor_title'] = 'John' search_string = assemble(**kw) parsed_string = parse(search_string) - self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001 language:en contributor_title:John', \ + self.assertEqual('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001 language:en contributor_title:John', \ search_string) self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \ 'version', 'language', 'contributor_title'], \ parsed_string.keys()) - self.assertEquals(kw['search_portal_type'], parsed_string['portal_type']) - self.assertEquals(kw['reference'], parsed_string['reference']) - self.assertEquals(kw['version'], parsed_string['version']) - self.assertEquals(kw['language'], parsed_string['language']) + self.assertEqual(kw['search_portal_type'], parsed_string['portal_type']) + self.assertEqual(kw['reference'], parsed_string['reference']) + self.assertEqual(kw['version'], parsed_string['version']) + self.assertEqual(kw['language'], parsed_string['language']) # only my docs kw['mine'] = 'yes' search_string = assemble(**kw) parsed_string = parse(search_string) - self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001 language:en contributor_title:John mine:yes', \ + self.assertEqual('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001 language:en contributor_title:John mine:yes', \ search_string) self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \ 'version', 'language', 'contributor_title', 'mine'], \ parsed_string.keys()) - self.assertEquals(kw['search_portal_type'], parsed_string['portal_type']) - self.assertEquals(kw['reference'], parsed_string['reference']) - self.assertEquals(kw['version'], parsed_string['version']) - self.assertEquals(kw['language'], parsed_string['language']) - self.assertEquals(kw['mine'], parsed_string['mine']) + self.assertEqual(kw['search_portal_type'], parsed_string['portal_type']) + self.assertEqual(kw['reference'], parsed_string['reference']) + self.assertEqual(kw['version'], parsed_string['version']) + self.assertEqual(kw['language'], parsed_string['language']) + self.assertEqual(kw['mine'], parsed_string['mine']) # only newest versions kw['newest'] = 'yes' search_string = assemble(**kw) parsed_string = parse(search_string) - self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001 language:en contributor_title:John mine:yes newest:yes', \ + self.assertEqual('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001 language:en contributor_title:John mine:yes newest:yes', \ search_string) self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \ 'version', 'language', 'contributor_title', 'mine', 'newest'], \ parsed_string.keys()) - self.assertEquals(kw['search_portal_type'], parsed_string['portal_type']) - self.assertEquals(kw['reference'], parsed_string['reference']) - self.assertEquals(kw['version'], parsed_string['version']) - self.assertEquals(kw['language'], parsed_string['language']) - self.assertEquals(kw['mine'], parsed_string['mine']) - self.assertEquals(kw['newest'], parsed_string['newest']) + self.assertEqual(kw['search_portal_type'], parsed_string['portal_type']) + self.assertEqual(kw['reference'], parsed_string['reference']) + self.assertEqual(kw['version'], parsed_string['version']) + self.assertEqual(kw['language'], parsed_string['language']) + self.assertEqual(kw['mine'], parsed_string['mine']) + self.assertEqual(kw['newest'], parsed_string['newest']) # search mode kw['search_mode'] = 'in_boolean_mode' search_string = assemble(**kw) parsed_string = parse(search_string) - self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001 language:en contributor_title:John mine:yes newest:yes mode:boolean', \ + self.assertEqual('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001 language:en contributor_title:John mine:yes newest:yes mode:boolean', \ search_string) self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \ 'version', 'language', 'contributor_title', 'mine', 'newest', 'mode'], \ parsed_string.keys()) - self.assertEquals(kw['search_portal_type'], parsed_string['portal_type']) - self.assertEquals(kw['reference'], parsed_string['reference']) - self.assertEquals(kw['version'], parsed_string['version']) - self.assertEquals(kw['language'], parsed_string['language']) - self.assertEquals(kw['mine'], parsed_string['mine']) - self.assertEquals(kw['newest'], parsed_string['newest']) - self.assertEquals('boolean', parsed_string['mode']) + self.assertEqual(kw['search_portal_type'], parsed_string['portal_type']) + self.assertEqual(kw['reference'], parsed_string['reference']) + self.assertEqual(kw['version'], parsed_string['version']) + self.assertEqual(kw['language'], parsed_string['language']) + self.assertEqual(kw['mine'], parsed_string['mine']) + self.assertEqual(kw['newest'], parsed_string['newest']) + self.assertEqual('boolean', parsed_string['mode']) # search with multiple portal_type kw = {'search_portal_type': ['Document','Presentation','Web Page'], 'searchabletext_any': 'erp5'} search_string = assemble(**kw) parsed_string = parse(search_string) - self.assertEquals('erp5 AND (portal_type:Document OR portal_type:Presentation OR portal_type:"Web Page")', \ + self.assertEqual('erp5 AND (portal_type:Document OR portal_type:Presentation OR portal_type:"Web Page")', \ search_string) self.assertSameSet(['searchabletext', 'portal_type'], \ parsed_string.keys()) - #self.assertEquals(kw['search_portal_type'], parsed_string['portal_type']) + #self.assertEqual(kw['search_portal_type'], parsed_string['portal_type']) # parse with multiple portal_type containing spaces in one portal_type search_string = 'erp5 AND (portal_type:Document OR portal_type:Presentation OR portal_type:"Web Page")' parsed_string = parse(search_string) - self.assertEquals(parsed_string['portal_type'], ['Document','Presentation','"Web Page"']) + self.assertEqual(parsed_string['portal_type'], ['Document','Presentation','"Web Page"']) def test_11_Base_getAdvancedSearchResultList(self): """ @@ -1258,8 +1258,8 @@ class TestDocument(TestDocumentMixin): def test_PDFTextContent(self): upload_file = makeFileUpload('REF-en-001.pdf') document = self.portal.portal_contributions.newContent(file=upload_file) - self.assertEquals('PDF', document.getPortalType()) - self.assertEquals('I use reference to look up TEST\n', + self.assertEqual('PDF', document.getPortalType()) + self.assertEqual('I use reference to look up TEST\n', document._convertToText()) html_data = re.sub(self.re_html_nbsp, ' ', document._convertToHTML()) self.assert_('I use reference to look up TEST' in html_data) @@ -1269,23 +1269,23 @@ class TestDocument(TestDocumentMixin): def test_PDFToImage(self): upload_file = makeFileUpload('REF-en-001.pdf') document = self.portal.portal_contributions.newContent(file=upload_file) - self.assertEquals('PDF', document.getPortalType()) + self.assertEqual('PDF', document.getPortalType()) content_type, image_data = document.convert(format='png', frame=0, display='thumbnail') # it's a valid PNG - self.assertEquals('PNG', image_data[1:4]) + self.assertEqual('PNG', image_data[1:4]) def test_PDF_content_information(self): upload_file = makeFileUpload('REF-en-001.pdf') document = self.portal.portal_contributions.newContent(file=upload_file) - self.assertEquals('PDF', document.getPortalType()) + self.assertEqual('PDF', document.getPortalType()) content_information = document.getContentInformation() - self.assertEquals('1', content_information['Pages']) - self.assertEquals('subject', content_information['Subject']) - self.assertEquals('title', content_information['Title']) - self.assertEquals('application/pdf', document.getContentType()) + self.assertEqual('1', content_information['Pages']) + self.assertEqual('subject', content_information['Subject']) + self.assertEqual('title', content_information['Title']) + self.assertEqual('application/pdf', document.getContentType()) def test_PDF_content_information_extra_metadata(self): # Extra metadata, such as those stored by pdftk update_info are also @@ -1293,11 +1293,11 @@ class TestDocument(TestDocumentMixin): upload_file = makeFileUpload('metadata.pdf', as_name='REF-en-001.pdf') document = self.portal.portal_contributions.newContent(file=upload_file) self.tic() - self.assertEquals('PDF', document.getPortalType()) + self.assertEqual('PDF', document.getPortalType()) content_information = document.getContentInformation() - self.assertEquals('the value', content_information['NonStandardMetadata']) - self.assertEquals('1', content_information['Pages']) - self.assertEquals('REF', document.getReference()) + self.assertEqual('the value', content_information['NonStandardMetadata']) + self.assertEqual('1', content_information['Pages']) + self.assertEqual('REF', document.getReference()) # contribute file which will be merged to current document in synchronous mode # and check content_type recalculated @@ -1319,13 +1319,13 @@ class TestDocument(TestDocumentMixin): document.setFile(upload_file) self.tic() content_information = document.getContentInformation() - self.assertEquals('1', content_information['Pages']) + self.assertEqual('1', content_information['Pages']) def test_empty_PDF_content_information(self): document = self.portal.document_module.newContent(portal_type='PDF') content_information = document.getContentInformation() # empty PDF have no content information - self.assertEquals(dict(), content_information) + self.assertEqual(dict(), content_information) def test_apple_PDF_metadata(self): # PDF created with Apple software have a special 'AAPL:Keywords' info tag @@ -1354,7 +1354,7 @@ class TestDocument(TestDocumentMixin): self.tic() pdf.share() self.tic() - self.assertEquals(pdf.getValidationState(), "shared") + self.assertEqual(pdf.getValidationState(), "shared") result = pdf.getContentInformation() self.assertNotEquals(result, None) @@ -1364,7 +1364,7 @@ class TestDocument(TestDocumentMixin): # Here we use edit instead of setFile, # because only edit method set filename as filename. document.edit(file=upload_file) - self.assertEquals('application/pdf', document.getContentType()) + self.assertEqual('application/pdf', document.getContentType()) def test_PDF_watermark(self): original_document = self.portal.portal_contributions.newContent( @@ -1429,46 +1429,46 @@ class TestDocument(TestDocumentMixin): upload_file = makeFileUpload('metadata.pdf') document = self.portal.document_module.newContent(portal_type='PDF') document.edit(file=upload_file) - self.assertEquals(document.getStandardFilename(), 'metadata.pdf') - self.assertEquals(document.getStandardFilename(format='png'), + self.assertEqual(document.getStandardFilename(), 'metadata.pdf') + self.assertEqual(document.getStandardFilename(format='png'), 'metadata.png') document.setVersion('001') document.setLanguage('en') - self.assertEquals(document.getStandardFilename(), 'metadata-001-en.pdf') - self.assertEquals(document.getStandardFilename(format='png'), + self.assertEqual(document.getStandardFilename(), 'metadata-001-en.pdf') + self.assertEqual(document.getStandardFilename(format='png'), 'metadata-001-en.png') # check when format contains multiple '.' upload_file = makeFileUpload('TEST-en-003.odp') document = self.portal.document_module.newContent(portal_type='Presentation') document.edit(file=upload_file) - self.assertEquals(document.getStandardFilename(), 'TEST-en-003.odp') - self.assertEquals('TEST-en-003.odg', document.getStandardFilename(format='odp.odg')) + self.assertEqual(document.getStandardFilename(), 'TEST-en-003.odp') + self.assertEqual('TEST-en-003.odg', document.getStandardFilename(format='odp.odg')) def test_CMYKImageTextContent(self): upload_file = makeFileUpload('cmyk_sample.jpg') document = self.portal.portal_contributions.newContent(file=upload_file) - self.assertEquals('Image', document.getPortalType()) - self.assertEquals('ERP5 is a free software\n\n', document.asText()) + self.assertEqual('Image', document.getPortalType()) + self.assertEqual('ERP5 is a free software\n\n', document.asText()) def test_MonochromeImageResize(self): upload_file = makeFileUpload('monochrome_sample.tiff') document = self.portal.portal_contributions.newContent(file=upload_file) - self.assertEquals('Image', document.getPortalType()) + self.assertEqual('Image', document.getPortalType()) resized_image = document.convert(format='png', display='small')[1] identify_output = Popen(['identify', '-verbose', '-'], stdin=PIPE, stdout=PIPE).communicate(resized_image)[0] self.assertFalse('1-bit' in identify_output) - self.assertEquals('ERP5 is a free software\n\n', document.asText()) + self.assertEqual('ERP5 is a free software\n\n', document.asText()) def test_Base_showFoundText(self): # Create document with good content document = self.portal.document_module.newContent(portal_type='Drawing') - self.assertEquals('empty', document.getExternalProcessingState()) + self.assertEqual('empty', document.getExternalProcessingState()) upload_file = makeFileUpload('TEST-en-002.odt') document.edit(file=upload_file) self.tic() - self.assertEquals('converted', document.getExternalProcessingState()) + self.assertEqual('converted', document.getExternalProcessingState()) # Delete base_data document.edit(base_data=None) @@ -1476,14 +1476,14 @@ class TestDocument(TestDocumentMixin): # As document is not converted, text conversion is impossible self.assertRaises(NotConvertedError, document.asText) self.assertRaises(NotConvertedError, document.getSearchableText) - self.assertEquals('This document is not converted yet.', + self.assertEqual('This document is not converted yet.', document.Base_showFoundText()) # upload again good content upload_file = makeFileUpload('TEST-en-002.odt') document.edit(file=upload_file) self.tic() - self.assertEquals('converted', document.getExternalProcessingState()) + self.assertEqual('converted', document.getExternalProcessingState()) def test_Base_contribute(self): """ @@ -1500,15 +1500,15 @@ class TestDocument(TestDocumentMixin): description=None, attach_document_to_context=True, file=makeFileUpload('TEST-en-002.odt')) - self.assertEquals('Text', contributed_document.getPortalType()) + self.assertEqual('Text', contributed_document.getPortalType()) self.tic() document_list = person.getFollowUpRelatedValueList() - self.assertEquals(1, len(document_list)) + self.assertEqual(1, len(document_list)) document = document_list[0] - self.assertEquals('converted', document.getExternalProcessingState()) - self.assertEquals('Text', document.getPortalType()) - self.assertEquals('title', document.getTitle()) - self.assertEquals(contributed_document, document) + self.assertEqual('converted', document.getExternalProcessingState()) + self.assertEqual('Text', document.getPortalType()) + self.assertEqual('title', document.getTitle()) + self.assertEqual(contributed_document, document) def test_Base_contribute_empty(self): """ @@ -1533,10 +1533,10 @@ class TestDocument(TestDocumentMixin): file=empty_file_upload) self.tic() document_list = person.getFollowUpRelatedValueList() - self.assertEquals(1, len(document_list)) + self.assertEqual(1, len(document_list)) document = document_list[0] - self.assertEquals('File', document.getPortalType()) - self.assertEquals(contributed_document, document) + self.assertEqual('File', document.getPortalType()) + self.assertEqual(contributed_document, document) def test_Base_contribute_forced_type(self): """Test contributing while forcing the portal type. @@ -1545,7 +1545,7 @@ class TestDocument(TestDocumentMixin): contributed_document = person.Base_contribute( portal_type='PDF', file=makeFileUpload('TEST-en-002.odt')) - self.assertEquals('PDF', contributed_document.getPortalType()) + self.assertEqual('PDF', contributed_document.getPortalType()) def test_Base_contribute_input_parameter_dict(self): """Test contributing while entering input parameters. @@ -1555,7 +1555,7 @@ class TestDocument(TestDocumentMixin): title='user supplied title', file=makeFileUpload('TEST-en-002.pdf')) self.tic() - self.assertEquals('user supplied title', contributed_document.getTitle()) + self.assertEqual('user supplied title', contributed_document.getTitle()) def test_HTML_to_ODT_conversion_keep_enconding(self): """This test perform an PDF conversion of HTML content @@ -1611,7 +1611,7 @@ class TestDocument(TestDocumentMixin): image_count = builder._image_count failure_message = 'Expected image not found in ODF zipped archive' # fetch image from zipped archive content then compare with ERP5 Image - self.assertEquals(builder.extract('Pictures/%s.jpeg' % image_count), + self.assertEqual(builder.extract('Pictures/%s.jpeg' % image_count), image.getData(), failure_message) # Continue the test with image resizing support @@ -1627,7 +1627,7 @@ class TestDocument(TestDocumentMixin): mime, converted_image = image.convert(format='jpeg', display=image_display) # fetch image from zipped archive content # then compare with resized ERP5 Image - self.assertEquals(builder.extract('Pictures/%s.jpeg' % image_count), + self.assertEqual(builder.extract('Pictures/%s.jpeg' % image_count), converted_image, failure_message) # Let's continue with Presentation Document as embbeded image @@ -1649,7 +1649,7 @@ class TestDocument(TestDocumentMixin): quality=75) # fetch image from zipped archive content # then compare with resized ERP5 Image - self.assertEquals(builder.extract('Pictures/%s.png' % image_count), + self.assertEqual(builder.extract('Pictures/%s.png' % image_count), converted_image, failure_message) @@ -1963,7 +1963,7 @@ document.write('<sc'+'ript type="text/javascript" src="http://somosite.bg/utb.ph convert_kw['frame'] = i if not document.hasConversion(**convert_kw): result_list.append(i) - self.assertEquals(result_list, []) + self.assertEqual(result_list, []) def test_conversionCache_reseting(self): """Check that modifying a document with edit method, @@ -2021,7 +2021,7 @@ document.write('<sc'+'ript type="text/javascript" src="http://somosite.bg/utb.ph module = self.portal.getDefaultModule(portal_type) upload_file = makeFileUpload('TEST.Embedded.Image.pdf') document = module.newContent(portal_type=portal_type, file=upload_file) - self.assertEquals(document.asText(), 'ERP5 is a free software.\n\n') + self.assertEqual(document.asText(), 'ERP5 is a free software.\n\n') def createRestrictedSecurityHelperScript(self): script_content_list = ['format=None, **kw', """ @@ -2093,7 +2093,7 @@ return 1 upload_file = makeFileUpload('TEST-en-003.odp') document.edit(file=upload_file) self.tic() - self.assertEquals('converted', document.getExternalProcessingState()) + self.assertEqual('converted', document.getExternalProcessingState()) for object_url in ('img1.html', 'img2.html', 'text1.html', 'text2.html'): for credential in ['ERP5TypeTestCase:', 'zope_user:']: response = self.publish('%s/%s' %(document.getPath(), object_url), @@ -2425,7 +2425,7 @@ return 1 'version': '001'} document1 = portal.document_module.newContent(portal_type="Presentation", **kw) self.tic() - self.assertEquals(0, len(document1.Document_getOtherVersionDocumentList())) + self.assertEqual(0, len(document1.Document_getOtherVersionDocumentList())) kw['version'] == '002' document2 = portal.document_module.newContent(portal_type="Spreadsheet", **kw) @@ -2472,11 +2472,11 @@ return 1 event_list.reverse() # all actions by logged in user for event in event_list: - self.assertEquals(event.actor, logged_in_user) - self.assertEquals(event_list[0].action, 'Edit') - self.assertEquals(event_list[-1].action, 'Share Document') - self.assertEquals(event_list[-2].action, 'Reject Document') - self.assertEquals(event_list[-3].action, 'Publish Document') + self.assertEqual(event.actor, logged_in_user) + self.assertEqual(event_list[0].action, 'Edit') + self.assertEqual(event_list[-1].action, 'Share Document') + self.assertEqual(event_list[-2].action, 'Reject Document') + self.assertEqual(event_list[-3].action, 'Publish Document') def test_ContributeToExistingDocument(self): """ @@ -2494,7 +2494,7 @@ return 1 # Then User takes a decision to choose which document to publish kw['portal_type'] = "Spreadsheet" new_document = self.portal.Base_contribute(**kw) - self.assertEquals(new_document.getValidationState(), 'draft') + self.assertEqual(new_document.getValidationState(), 'draft') # make it read only document.manage_permission(Permissions.ModifyPortalContent, []) @@ -2520,9 +2520,9 @@ return 1 kw = dict(file=upload_file, synchronous_metadata_discovery=True) document = self.portal.Base_contribute(**kw) self.tic() - self.assertEquals('test-en-003-description', document.getDescription()) - self.assertEquals('test-en-003-title', document.getTitle()) - self.assertEquals('test-en-003-keywords', document.getSubject()) + self.assertEqual('test-en-003-description', document.getDescription()) + self.assertEqual('test-en-003-title', document.getTitle()) + self.assertEqual('test-en-003-keywords', document.getSubject()) def test_DocumentIndexation(self): """ @@ -2544,8 +2544,8 @@ return 1 for subject_list in (['subject1',], ['subject2',], ['subject1', 'subject2',],): subject_result = portal.portal_catalog(subject=subject_list) - self.assertEquals(len(subject_result), 1) - self.assertEquals(subject_result[0].getPath(), document.getPath()) + self.assertEqual(len(subject_result), 1) + self.assertEqual(subject_result[0].getPath(), document.getPath()) def test_base_convertable_behaviour_with_successive_updates(self): """Check that update content's document (with setData and setFile) @@ -2563,12 +2563,12 @@ return 1 # Clone document: base_data must not be computed once again cloned_document = document.Base_createCloneDocument(batch_mode=True) - self.assertEquals(previous_md5, cloned_document.getContentMd5()) - self.assertEquals(document.getData(), cloned_document.getData()) - self.assertEquals(document.getBaseData(), cloned_document.getBaseData()) - self.assertEquals(document.getExternalProcessingState(), + self.assertEqual(previous_md5, cloned_document.getContentMd5()) + self.assertEqual(document.getData(), cloned_document.getData()) + self.assertEqual(document.getBaseData(), cloned_document.getBaseData()) + self.assertEqual(document.getExternalProcessingState(), cloned_document.getExternalProcessingState()) - self.assertEquals(document.getExternalProcessingState(), 'converted') + self.assertEqual(document.getExternalProcessingState(), 'converted') # Update document with another content by using setData: # base_data must be recomputed @@ -2578,7 +2578,7 @@ return 1 self.assertNotEquals(previous_base_data, document.getBaseData(), 'base data is not refreshed') self.assertNotEquals(previous_md5, document.getContentMd5()) - self.assertEquals(document.getExternalProcessingState(), 'converted') + self.assertEqual(document.getExternalProcessingState(), 'converted') previous_md5 = document.getContentMd5() previous_base_data = document.getBaseData() @@ -2590,7 +2590,7 @@ return 1 self.assertNotEquals(previous_base_data, document.getBaseData(), 'base data is not refreshed') self.assertNotEquals(previous_md5, document.getContentMd5()) - self.assertEquals(document.getExternalProcessingState(), 'converted') + self.assertEqual(document.getExternalProcessingState(), 'converted') # Currently, 'empty' state in processing_status_workflow is only set # when creating a document and before uploading any file. Once the @@ -2617,7 +2617,7 @@ return 1 self.tic() self.assertFalse(document.hasBaseData()) self.assertFalse(document.hasContentMd5()) - self.assertEquals(document.getExternalProcessingState(), 'empty') + self.assertEqual(document.getExternalProcessingState(), 'empty') def _test_document_publication_workflow(self, portal_type, transition): document = self.getDocumentModule().newContent(portal_type=portal_type) @@ -2815,9 +2815,9 @@ return 1 document.setReference('TEST') request = self.app.REQUEST download_file = document.index_html(REQUEST=request, format=None) - self.assertEquals(download_file, 'foo\n') + self.assertEqual(download_file, 'foo\n') document_format = None - self.assertEquals('TEST-001-en.dummy', document.getStandardFilename( + self.assertEqual('TEST-001-en.dummy', document.getStandardFilename( document_format)) class TestDocumentWithSecurity(TestDocumentMixin): @@ -2867,7 +2867,7 @@ class TestDocumentWithSecurity(TestDocumentMixin): self.tic() # the document should be automatically converted to html - self.assertEquals(text_document.getExternalProcessingState(), 'converted') + self.assertEqual(text_document.getExternalProcessingState(), 'converted') # check there is nothing in the cache for pdf conversion self.assertFalse(text_document.hasConversion(format='pdf')) @@ -2881,7 +2881,7 @@ class TestDocumentWithSecurity(TestDocumentMixin): self.assertTrue(text_document.hasConversion(format='pdf')) # check the size of the pdf conversion - self.assertEquals(text_document.getConversionSize(format='pdf'), pdf_size) + self.assertEqual(text_document.getConversionSize(format='pdf'), pdf_size) def test_ImageSizePreference(self): """ diff --git a/product/ERP5OOo/tests/testFormPrintoutAsODG.py b/product/ERP5OOo/tests/testFormPrintoutAsODG.py index 226d09b224..62089dc48b 100644 --- a/product/ERP5OOo/tests/testFormPrintoutAsODG.py +++ b/product/ERP5OOo/tests/testFormPrintoutAsODG.py @@ -333,7 +333,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): image_data = builder.extract("Pictures/0.png") except KeyError: self.fail('image "Pictures/0.png" not found in odg document') - self.assertEquals(image.getData(), image_data, + self.assertEqual(image.getData(), image_data, '%s != %s' % (len(image.getData()), len(image_data))) content = etree.XML(content_xml) image_frame_xpath = '//draw:frame[@draw:name="image_view"]' diff --git a/product/ERP5OOo/tests/testFormPrintoutAsODT.py b/product/ERP5OOo/tests/testFormPrintoutAsODT.py index 25af48b438..34c53ad051 100644 --- a/product/ERP5OOo/tests/testFormPrintoutAsODT.py +++ b/product/ERP5OOo/tests/testFormPrintoutAsODT.py @@ -251,15 +251,15 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): span_list = content_tree.xpath('//text:reference-mark-start[@text:name="week"]/following-sibling::text:span', namespaces=content_tree.nsmap) if span_list: - self.assertEquals(1, len(span_list)) + self.assertEqual(1, len(span_list)) span = span_list[0] - self.assertEquals('line1', span.text) - self.assertEquals('line2', span[0].tail) + self.assertEqual('line1', span.text) + self.assertEqual('line2', span[0].tail) else: reference_mark_node = content_tree.xpath('//text:reference-mark-start[@text:name="week"][1]', namespaces=content_tree.nsmap)[0] - self.assertEquals('line1', reference_mark_node.tail) - self.assertEquals('line2', reference_mark_node.getnext().tail) + self.assertEqual('line1', reference_mark_node.tail) + self.assertEqual('line2', reference_mark_node.getnext().tail) self._validate(odf_document) def test_01_Paragraph_08_Field_Format(self): @@ -342,7 +342,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): field_stat_method = 'portal_catalog', field_stat_columns = 'quantity | Foo_statQuantity', field_columns = 'id|ID\ntitle|Title\nquantity|Quantity\nstart_date|Date',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) listboxline_list = listbox.get_value('default', render_format = 'list', REQUEST = request) self.assertEqual(len(listboxline_list), 4) @@ -381,7 +381,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): field_stat_method = 'portal_catalog', field_stat_columns = 'quantity | Foo_statQuantity', field_columns = 'id|ID\ntitle|Title\nquantity|Quantity',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) self.assertEqual(listbox.get_value('columns'), [('id', 'ID'), ('title', 'Title'), ('quantity', 'Quantity')]) listboxline_list = listbox.get_value('default', render_format = 'list', @@ -424,7 +424,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): field_stat_columns = 'quantity | Foo_statQuantity', field_columns = 'id|ID\ntitle|Title\nquantity|Quantity\n' 'start_date|Date\nstatus|Status',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) listboxline_list = listbox.get_value('default', render_format = 'list', REQUEST = request) self.assertEqual(len(listboxline_list), 4) @@ -460,7 +460,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): field_stat_method = '', field_stat_columns = 'quantity | Foo_statQuantity', field_columns = 'id|ID\ntitle|Title\nquantity|Quantity\nstart_date|Date',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) listboxline_list = listbox.get_value('default', render_format = 'list', REQUEST = request) for line in listboxline_list: @@ -520,7 +520,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): field_stat_method = 'portal_catalog', field_stat_columns = 'quantity | Foo_statQuantity', field_columns = 'id|ID\ntitle|Title\nquantity|Quantity\nstart_date|Date',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) listboxline_list = listbox2.get_value('default', render_format = 'list', REQUEST = request) self.assertEqual(len(listboxline_list), 4) @@ -535,10 +535,10 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): content_tree = etree.XML(content_xml) #Check that foo_1 is inside table, with the same style xpath_style_name_expression = '//table:table[@table:name="listbox2"]/table:table-row/table:table-cell/text:p[@text:style-name="P4"]/text()' - self.assertEquals(['foo_1', 'foo_2'], content_tree.xpath(xpath_style_name_expression, namespaces=content_tree.nsmap)) + self.assertEqual(['foo_1', 'foo_2'], content_tree.xpath(xpath_style_name_expression, namespaces=content_tree.nsmap)) #Check that each listbox values are inside ODT table cells xpath_result_expression = '//table:table[@table:name="listbox2"]/table:table-row/table:table-cell/text:p/text()' - self.assertEquals(['foo_1', 'foo_title_5', '0.0', 'foo_2', 'foo_2', '0.0', '1234.5'], content_tree.xpath(xpath_result_expression, namespaces=content_tree.nsmap)) + self.assertEqual(['foo_1', 'foo_title_5', '0.0', 'foo_2', 'foo_2', '0.0', '1234.5'], content_tree.xpath(xpath_result_expression, namespaces=content_tree.nsmap)) self.assertFalse(content_xml.find("foo_title_4") > 0) self._validate(odf_document) @@ -575,7 +575,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): field_stat_method = 'portal_catalog', field_stat_columns = 'quantity | Foo_statQuantity', field_columns = 'id|ID\ntitle|Title\nquantity|Quantity\nstart_date|Date',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) listboxline_list = listbox3.get_value('default', render_format = 'list', REQUEST = request) self.assertEqual(len(listboxline_list), 4) @@ -612,7 +612,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): field_stat_method = 'portal_catalog', field_stat_columns = 'quantity | Foo_statQuantity', field_columns = 'id|ID\ntitle|Title\nquantity|Quantity\nstart_date|Date',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) listboxline_list = listbox.get_value('default', render_format = 'list', REQUEST = request) self.assertEqual(len(listboxline_list), 4) @@ -653,7 +653,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): test1.foo_1.setTitle('foo_title_8') message = listbox.ListBox_setPropertyList( field_columns = 'id|ID\ntitle|Title\nquantity|Quantity\nstart_date|Date',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) listboxline_list = listbox.get_value('default', render_format = 'list', REQUEST = request) # title line only @@ -713,7 +713,7 @@ for n in xrange(6, 0, -1): field_portal_types = 'Foo Line | Foo Line', field_row_css_method = 'Foo_getRowCssList', field_columns = 'id|ID\ntitle|Title\nquantity|Quantity',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) listboxline_list = listbox4.get_value('default', render_format = 'list', REQUEST = request) self.assertEqual(len(listboxline_list), 7) @@ -800,7 +800,7 @@ return foo_list field_selection_name = 'listbox_report_selection', field_portal_types = 'Foo Line | Foo Line', field_columns = 'id|ID\ntitle|Title\nquantity|Quantity\nstart_date|Date',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) createZODBPythonScript( self.portal.portal_skins.custom, 'FooReport_getReportSectionList', @@ -904,7 +904,7 @@ return foo_list field_selection_name = 'listbox_report_selection', field_portal_types = 'Foo Line | Foo Line', field_columns = 'id|ID\ntitle|Title\nquantity|Quantity\nstart_date|Date',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) createZODBPythonScript( self.portal.portal_skins.custom, 'FooReport_getReportSectionList', @@ -1006,7 +1006,7 @@ return foo_list field_selection_name = 'listbox_report_selection', field_portal_types = 'Foo Line | Foo Line', field_columns = 'id|ID\ntitle|Title\nquantity|Quantity\nstart_date|Date',) - self.failUnless('Set Successfully' in message) + self.assertTrue('Set Successfully' in message) # report box foo2_view = erp5form.addERP5Form(id='Foo2_view', title='Foo2 View') @@ -1237,25 +1237,25 @@ return [] field_id, klass, value = field_configuration xpath = '//text:variable-set[@text:name = "%s"]' % field_id node_list = content_tree.xpath(xpath, namespaces=nsmap) - self.assertEquals(1, len(node_list)) + self.assertEqual(1, len(node_list)) node = node_list[0] if klass == 'StringField': - self.assertEquals(node.get('{%s}value-type' % nsmap['office']), + self.assertEqual(node.get('{%s}value-type' % nsmap['office']), 'string') - self.assertEquals(node.text, value) + self.assertEqual(node.text, value) elif klass in ('IntegerField', 'FloatField'): - self.assertEquals(node.get('{%s}value-type' % nsmap['office']), + self.assertEqual(node.get('{%s}value-type' % nsmap['office']), 'float') - self.assertEquals(node.get('{%s}value' % nsmap['office']), str(value)) + self.assertEqual(node.get('{%s}value' % nsmap['office']), str(value)) elif klass == 'DateTimeField': - self.assertEquals(node.get('{%s}value-type' % nsmap['office']), 'date') - self.assertEquals(node.text, value.strftime('%d/%m/%Y %H:%M:%S')) + self.assertEqual(node.get('{%s}value-type' % nsmap['office']), 'date') + self.assertEqual(node.text, value.strftime('%d/%m/%Y %H:%M:%S')) elif klass == 'CheckBoxField': - self.assertEquals(node.get('{%s}value-type' % nsmap['office']), + self.assertEqual(node.get('{%s}value-type' % nsmap['office']), 'boolean') - self.assertEquals(node.get('{%s}boolean-value' % nsmap['office']), + self.assertEqual(node.get('{%s}boolean-value' % nsmap['office']), 'false') - self.assertEquals(node.text, 'FALSE') + self.assertEqual(node.text, 'FALSE') else: raise NotImplementedError diff --git a/product/ERP5OOo/tests/testIngestion.py b/product/ERP5OOo/tests/testIngestion.py index 5f882250e6..b6af0c3f8e 100644 --- a/product/ERP5OOo/tests/testIngestion.py +++ b/product/ERP5OOo/tests/testIngestion.py @@ -266,10 +266,10 @@ class TestIngestion(ERP5TypeTestCase): f = makeFileUpload(filename) document.edit(file=f) self.tic() - self.failUnless(document.hasFile()) + self.assertTrue(document.hasFile()) if document.isSupportBaseDataConversion(): # this is how we know if it was ok or not - self.assertEquals(document.getExternalProcessingState(), 'converted') + self.assertEqual(document.getExternalProcessingState(), 'converted') self.assert_('magic' in document.SearchableText()) self.assert_('magic' in str(document.asText())) else: @@ -332,12 +332,12 @@ class TestIngestion(ERP5TypeTestCase): for extension, portal_type in extension_to_type: document = created_documents[count] count+=1 - self.assertEquals(document.getPortalType(), portal_type) - self.assertEquals(document.getReference(), 'TEST') + self.assertEqual(document.getPortalType(), portal_type) + self.assertEqual(document.getReference(), 'TEST') if document.isSupportBaseDataConversion(): # We check if conversion has succeeded by looking # at the external_processing workflow - self.assertEquals(document.getExternalProcessingState(), 'converted') + self.assertEqual(document.getExternalProcessingState(), 'converted') self.assert_('magic' in document.SearchableText()) def newPythonScript(self, script_id, argument_list, code): @@ -381,7 +381,7 @@ class TestIngestion(ERP5TypeTestCase): is the same as expected_metadata """ for k, v in expected_metadata.items(): - self.assertEquals(document.getProperty(k), v) + self.assertEqual(document.getProperty(k), v) def receiveEmail(self, data, portal_type='Document Ingestion Message', @@ -475,7 +475,7 @@ class TestIngestion(ERP5TypeTestCase): (ie. no file upload has been done yet) """ document = self.portal.restrictedTraverse(sequence.get('document_path')) - return self.assertEquals(document.getExternalProcessingState(), 'empty') + return self.assertEqual(document.getExternalProcessingState(), 'empty') def stepCheckUploadedState(self, sequence=None, sequence_list=None, **kw): """ @@ -483,7 +483,7 @@ class TestIngestion(ERP5TypeTestCase): (ie. a file upload has been done) """ document = self.portal.restrictedTraverse(sequence.get('document_path')) - return self.assertEquals(document.getExternalProcessingState(), 'uploaded') + return self.assertEqual(document.getExternalProcessingState(), 'uploaded') def stepCheckConvertingState(self, sequence=None, sequence_list=None, **kw): """ @@ -491,7 +491,7 @@ class TestIngestion(ERP5TypeTestCase): (ie. a file upload has been done and the document is converting) """ document = self.portal.restrictedTraverse(sequence.get('document_path')) - return self.assertEquals(document.getExternalProcessingState(), 'converting') + return self.assertEqual(document.getExternalProcessingState(), 'converting') def stepCheckConvertedState(self, sequence=None, sequence_list=None, **kw): """ @@ -500,7 +500,7 @@ class TestIngestion(ERP5TypeTestCase): been converted) """ document = self.portal.restrictedTraverse(sequence.get('document_path')) - return self.assertEquals(document.getExternalProcessingState(), 'converted') + return self.assertEqual(document.getExternalProcessingState(), 'converted') def stepStraightUpload(self, sequence=None, sequence_list=None, **kw): """ @@ -510,13 +510,13 @@ class TestIngestion(ERP5TypeTestCase): filename = 'TEST-en-002.doc' document = self.portal.restrictedTraverse(sequence.get('document_path')) # First revision is 1 (like web pages) - self.assertEquals(document.getRevision(), '1') + self.assertEqual(document.getRevision(), '1') f = makeFileUpload(filename) document.edit(file=f) self.assert_(document.hasFile()) - self.assertEquals(document.getFilename(), filename) + self.assertEqual(document.getFilename(), filename) # Revision is 1 after upload (revisions are strings) - self.assertEquals(document.getRevision(), '2') + self.assertEqual(document.getRevision(), '2') document.reindexObject() self.commit() @@ -528,7 +528,7 @@ class TestIngestion(ERP5TypeTestCase): f = makeFileUpload('TEST-en-002.doc') revision = document.getRevision() document.edit(file=f) - self.assertEquals(document.getRevision(), str(int(revision) + 1)) + self.assertEqual(document.getRevision(), str(int(revision) + 1)) document.reindexObject() self.commit() @@ -556,9 +556,9 @@ class TestIngestion(ERP5TypeTestCase): self.portal.portal_contributions.newContent(file=f) self.tic() - self.assertEquals(document.getRevision(), str(int(revision) + 1)) + self.assertEqual(document.getRevision(), str(int(revision) + 1)) self.assert_('This document is modified.' in document.asText()) - self.assertEquals(len(self.portal.document_module.objectIds()), + self.assertEqual(len(self.portal.document_module.objectIds()), number_of_document) document.reindexObject() self.commit() @@ -572,9 +572,9 @@ class TestIngestion(ERP5TypeTestCase): sequence.edit(document_path=document.getPath()) self.tic() self.assertTrue('This is a another very interesting document.' in document.asText()) - self.assertEquals(document.getReference(), 'ANOTHE') - self.assertEquals(document.getVersion(), '001') - self.assertEquals(document.getLanguage(), 'en') + self.assertEqual(document.getReference(), 'ANOTHE') + self.assertEqual(document.getVersion(), '001') + self.assertEqual(document.getLanguage(), 'en') def stepDiscoverFromFilename(self, sequence=None, sequence_list=None, **kw): """ @@ -586,22 +586,22 @@ class TestIngestion(ERP5TypeTestCase): filename = 'TEST-en-002.doc' # First make sure the regular expressions work property_dict = document.getPropertyDictFromFilename(filename) - self.assertEquals(property_dict['reference'], 'TEST') - self.assertEquals(property_dict['language'], 'en') - self.assertEquals(property_dict['version'], '002') + self.assertEqual(property_dict['reference'], 'TEST') + self.assertEqual(property_dict['language'], 'en') + self.assertEqual(property_dict['version'], '002') # Then make sure content discover works # XXX - This part must be extended property_dict = document.getPropertyDictFromContent() - self.assertEquals(property_dict['title'], 'title') - self.assertEquals(property_dict['description'], 'comments') - self.assertEquals(property_dict['subject_list'], ['keywords']) + self.assertEqual(property_dict['title'], 'title') + self.assertEqual(property_dict['description'], 'comments') + self.assertEqual(property_dict['subject_list'], ['keywords']) # Then make sure metadata discovery works f = makeFileUpload(filename) document.edit(file=f) - self.assertEquals(document.getReference(), 'TEST') - self.assertEquals(document.getLanguage(), 'en') - self.assertEquals(document.getVersion(), '002') - self.assertEquals(document.getFilename(), filename) + self.assertEqual(document.getReference(), 'TEST') + self.assertEqual(document.getLanguage(), 'en') + self.assertEqual(document.getVersion(), '002') + self.assertEqual(document.getFilename(), filename) def stepCheckConvertedContent(self, sequence=None, sequence_list=None, **kw): """ @@ -635,15 +635,15 @@ class TestIngestion(ERP5TypeTestCase): self.tic() # Then make sure content discover works property_dict = document.getPropertyDictFromUserLogin() - self.assertEquals(property_dict['contributor'], 'person_module/john') + self.assertEqual(property_dict['contributor'], 'person_module/john') # reference from filename (the rest was checked some other place) - self.assertEquals(document.getReference(), 'TEST') + self.assertEqual(document.getReference(), 'TEST') # short_title from content - self.assertEquals(document.getShortTitle(), 'short') + self.assertEqual(document.getShortTitle(), 'short') # title from metadata inside the document - self.assertEquals(document.getTitle(), 'title') + self.assertEqual(document.getTitle(), 'title') # contributors from user - self.assertEquals(document.getContributor(), 'person_module/john') + self.assertEqual(document.getContributor(), 'person_module/john') def stepEditMetadata(self, sequence=None, sequence_list=None, **kw): """ @@ -668,11 +668,11 @@ class TestIngestion(ERP5TypeTestCase): builder = OOoBuilder(newcontent) xml_tree = etree.fromstring(builder.extract('meta.xml')) title = xml_tree.find('*/{%s}title' % xml_tree.nsmap['dc']).text - self.assertEquals(title, 'another title') + self.assertEqual(title, 'another title') subject = xml_tree.find('*/{%s}keyword' % xml_tree.nsmap['meta']).text - self.assertEquals(subject, u'another subject') + self.assertEqual(subject, u'another subject') description = xml_tree.find('*/{%s}description' % xml_tree.nsmap['dc']).text - self.assertEquals(description, u'another description') + self.assertEqual(description, u'another description') def stepIngestTextFormats(self, sequence=None, sequence_list=None, **kw): """ @@ -787,11 +787,11 @@ class TestIngestion(ERP5TypeTestCase): f = makeFileUpload('TEST-en-002.pdf') document.edit(file=f) mime, text = document.convert('text') - self.failUnless('magic' in text) - self.failUnless(mime == 'text/plain') + self.assertTrue('magic' in text) + self.assertTrue(mime == 'text/plain') mime, html = document.convert('html') - self.failUnless('magic' in html) - self.failUnless(mime == 'text/html') + self.assertTrue('magic' in html) + self.assertTrue(mime == 'text/html') def stepExportImage(self, sequence=None, sequence_list=None, **kw): """ @@ -802,7 +802,7 @@ class TestIngestion(ERP5TypeTestCase): image.edit(file=f) self.tic() mime, data = image.convert(None) - self.assertEquals(mime, 'image/jpeg') + self.assertEqual(mime, 'image/jpeg') mime, small_data = image.convert(None, display='small') mime, large_data = image.convert(None, display='xlarge') # Check we are able to resize the image. @@ -945,7 +945,7 @@ class TestIngestion(ERP5TypeTestCase): Verify contributed for initial time multiple document per email. """ attachment_list, ingested_document = self.verifyEmailedMultipleDocuments() - self.assertEquals('1', ingested_document.getRevision()) + self.assertEqual('1', ingested_document.getRevision()) def stepVerifyEmailedMultipleDocumentsMultipleContribution(self, sequence=None, sequence_list=None, **kw): """ @@ -959,7 +959,7 @@ class TestIngestion(ERP5TypeTestCase): Verify contributed for initial time document per email. """ attachment_list, ingested_document = self.verifyEmailedDocument() - self.assertEquals('1', ingested_document.getRevision()) + self.assertEqual('1', ingested_document.getRevision()) def stepVerifyEmailedDocumentMultipleContribution(self, sequence=None, sequence_list=None, **kw): """ @@ -1000,7 +1000,7 @@ class TestIngestion(ERP5TypeTestCase): version='002') self.assertNotEquals(None, ingested_document) if ingested_document.isSupportBaseDataConversion(): - self.assertEquals('converted', ingested_document.getExternalProcessingState()) + self.assertEqual('converted', ingested_document.getExternalProcessingState()) # check aggregate between 'Document Ingestion Message' and ingested document self.assertTrue(ingested_document in attachment_list) return attachment_list, ingested_document @@ -1026,12 +1026,12 @@ class TestIngestion(ERP5TypeTestCase): reference='MAIL', language='en', version='002') - self.assertEquals('MAIL-en-002.doc', ingested_document.getFilename()) - self.assertEquals('converted', ingested_document.getExternalProcessingState()) + self.assertEqual('MAIL-en-002.doc', ingested_document.getFilename()) + self.assertEqual('converted', ingested_document.getExternalProcessingState()) self.assertTrue('magic' in ingested_document.asText()) # check aggregate between 'Document Ingestion Message' and ingested document - self.assertEquals(attachment_list[0], ingested_document) + self.assertEqual(attachment_list[0], ingested_document) return attachment_list, ingested_document ################################## @@ -1044,10 +1044,10 @@ class TestIngestion(ERP5TypeTestCase): """ preference_tool = self.portal.portal_preferences conversion_dict = _getConversionServerDict() - self.assertEquals(preference_tool.getPreferredOoodocServerAddress(), conversion_dict['hostname']) - self.assertEquals(preference_tool.getPreferredOoodocServerPortNumber(), conversion_dict['port']) - self.assertEquals(preference_tool.getPreferredDocumentFilenameRegularExpression(), FILENAME_REGULAR_EXPRESSION) - self.assertEquals(preference_tool.getPreferredDocumentReferenceRegularExpression(), REFERENCE_REGULAR_EXPRESSION) + self.assertEqual(preference_tool.getPreferredOoodocServerAddress(), conversion_dict['hostname']) + self.assertEqual(preference_tool.getPreferredOoodocServerPortNumber(), conversion_dict['port']) + self.assertEqual(preference_tool.getPreferredDocumentFilenameRegularExpression(), FILENAME_REGULAR_EXPRESSION) + self.assertEqual(preference_tool.getPreferredDocumentReferenceRegularExpression(), REFERENCE_REGULAR_EXPRESSION) def test_02_FileExtensionRegistry(self): """ @@ -1077,7 +1077,7 @@ class TestIngestion(ERP5TypeTestCase): } for type, portal_type in correct_type_mapping.items(): filename = 'aaa.' + type - self.assertEquals(reg.findPortalTypeName(filename=filename), + self.assertEqual(reg.findPortalTypeName(filename=filename), portal_type) def test_03_TextDoc(self): @@ -1382,20 +1382,20 @@ class TestIngestion(ERP5TypeTestCase): filename = 'T&é@{T-en-002.doc' # First make sure the regular expressions work property_dict = context.getPropertyDictFromFilename(filename) - self.assertEquals(property_dict['reference'], 'T&é@{T') - self.assertEquals(property_dict['language'], 'en') - self.assertEquals(property_dict['version'], '002') + self.assertEqual(property_dict['reference'], 'T&é@{T') + self.assertEqual(property_dict['language'], 'en') + self.assertEqual(property_dict['version'], '002') # Then make sure content discover works # XXX - This part must be extended property_dict = context.getPropertyDictFromContent() - self.assertEquals(property_dict['title'], 'title') - self.assertEquals(property_dict['description'], 'comments') - self.assertEquals(property_dict['subject_list'], ['keywords']) + self.assertEqual(property_dict['title'], 'title') + self.assertEqual(property_dict['description'], 'comments') + self.assertEqual(property_dict['subject_list'], ['keywords']) # Then make sure metadata discovery works - self.assertEquals(context.getReference(), 'T&é@{T') - self.assertEquals(context.getLanguage(), 'en') - self.assertEquals(context.getVersion(), '002') - self.assertEquals(context.getFilename(), filename) + self.assertEqual(context.getReference(), 'T&é@{T') + self.assertEqual(context.getLanguage(), 'en') + self.assertEqual(context.getVersion(), '002') + self.assertEqual(context.getFilename(), filename) def test_13_UploadTextFromContributionToolWithNonASCIIFilename(self): """ @@ -1419,7 +1419,7 @@ class TestIngestion(ERP5TypeTestCase): portal = self.portal contribution_tool = getToolByName(portal, 'portal_contributions') - self.assertEquals(1, + self.assertEqual(1, len(portal.portal_catalog(path=contribution_tool.getPath()))) # Clear catalog @@ -1428,7 +1428,7 @@ class TestIngestion(ERP5TypeTestCase): # Reindex all portal.ERP5Site_reindexAll() self.tic() - self.assertEquals(1, + self.assertEqual(1, len(portal.portal_catalog(path=contribution_tool.getPath()))) def test_15_TestFilenameDiscovery(self): @@ -1440,12 +1440,12 @@ class TestIngestion(ERP5TypeTestCase): contribution_tool = getToolByName(portal, 'portal_contributions') file_object = makeFileUpload('TEST-en-002.doc') document = contribution_tool.newContent(file=file_object) - self.assertEquals(document.getFilename(), 'TEST-en-002.doc') + self.assertEqual(document.getFilename(), 'TEST-en-002.doc') my_filename = 'Something.doc' document = contribution_tool.newContent(file=file_object, filename=my_filename) self.tic() - self.assertEquals(document.getFilename(), my_filename) + self.assertEqual(document.getFilename(), my_filename) def test_16_TestMetadataDiscoveryFromUserLogin(self): """ @@ -1465,10 +1465,10 @@ class TestIngestion(ERP5TypeTestCase): document = contribution_tool.newContent(file=file_object) document.discoverMetadata(document.getFilename(), 'contributor1') self.tic() - self.assertEquals(document.getFilename(), 'TEST-en-002.doc') - self.assertEquals('musician/wind/saxophone', document.getFunction()) - self.assertEquals('anybody', document.getGroup()) - self.assertEquals('arctic/spitsbergen', document.getSite()) + self.assertEqual(document.getFilename(), 'TEST-en-002.doc') + self.assertEqual('musician/wind/saxophone', document.getFunction()) + self.assertEqual('anybody', document.getGroup()) + self.assertEqual('arctic/spitsbergen', document.getSite()) def test_IngestionConfigurationByTypeBasedMethod_usecase1(self): """How to configure meta data discovery so that each time a file @@ -1516,18 +1516,18 @@ return result url = document_to_ingest.absolute_url() + '/getData' first_doc = self.portal.portal_contributions.newContent(url=url) self.tic() - self.assertEquals(first_doc.getPortalType(), 'Text') - self.assertEquals(first_doc.getContentType(), 'text/plain') - self.assertEquals(first_doc.getReference(), first_doc.asNormalisedURL()) - self.assertEquals(first_doc.getVersion(), '00001') - self.assertEquals(first_doc.asURL(), url) + self.assertEqual(first_doc.getPortalType(), 'Text') + self.assertEqual(first_doc.getContentType(), 'text/plain') + self.assertEqual(first_doc.getReference(), first_doc.asNormalisedURL()) + self.assertEqual(first_doc.getVersion(), '00001') + self.assertEqual(first_doc.asURL(), url) second_doc = self.portal.portal_contributions.newContent(url=url) self.tic() - self.assertEquals(second_doc.getPortalType(), 'Text') - self.assertEquals(second_doc.getContentType(), 'text/plain') - self.assertEquals(second_doc.getReference(), second_doc.asNormalisedURL()) - self.assertEquals(second_doc.getVersion(), '00002') - self.assertEquals(second_doc.asURL(), url) + self.assertEqual(second_doc.getPortalType(), 'Text') + self.assertEqual(second_doc.getContentType(), 'text/plain') + self.assertEqual(second_doc.getReference(), second_doc.asNormalisedURL()) + self.assertEqual(second_doc.getVersion(), '00002') + self.assertEqual(second_doc.asURL(), url) document_to_ingest2 = self.portal.portal_contributions.newContent( portal_type='File', @@ -1538,18 +1538,18 @@ return result url2 = document_to_ingest2.absolute_url() + '/getData' first_doc = self.portal.portal_contributions.newContent(url=url2) self.tic() - self.assertEquals(first_doc.getPortalType(), 'Text') - self.assertEquals(first_doc.getContentType(), 'text/plain') - self.assertEquals(first_doc.getReference(), first_doc.asNormalisedURL()) - self.assertEquals(first_doc.getVersion(), '00001') - self.assertEquals(first_doc.asURL(), url2) + self.assertEqual(first_doc.getPortalType(), 'Text') + self.assertEqual(first_doc.getContentType(), 'text/plain') + self.assertEqual(first_doc.getReference(), first_doc.asNormalisedURL()) + self.assertEqual(first_doc.getVersion(), '00001') + self.assertEqual(first_doc.asURL(), url2) second_doc = self.portal.portal_contributions.newContent(url=url2) self.tic() - self.assertEquals(second_doc.getPortalType(), 'Text') - self.assertEquals(second_doc.getContentType(), 'text/plain') - self.assertEquals(second_doc.getReference(), second_doc.asNormalisedURL()) - self.assertEquals(second_doc.getVersion(), '00002') - self.assertEquals(second_doc.asURL(), url2) + self.assertEqual(second_doc.getPortalType(), 'Text') + self.assertEqual(second_doc.getContentType(), 'text/plain') + self.assertEqual(second_doc.getReference(), second_doc.asNormalisedURL()) + self.assertEqual(second_doc.getVersion(), '00002') + self.assertEqual(second_doc.asURL(), url2) def test_IngestionConfigurationByTypeBasedMethod_usecase2(self): """How to configure meta data discovery so that each time a file @@ -1594,18 +1594,18 @@ return result url = document_to_ingest.absolute_url() + '/getData' first_doc = self.portal.portal_contributions.newContent(url=url) self.tic() - self.assertEquals(first_doc.getPortalType(), 'Text') - self.assertEquals(first_doc.getContentType(), 'text/plain') - self.assertEquals(first_doc.getReference(), first_doc.asNormalisedURL()) - self.assertEquals(first_doc.getVersion(), '001') - self.assertEquals(first_doc.asURL(), url) + self.assertEqual(first_doc.getPortalType(), 'Text') + self.assertEqual(first_doc.getContentType(), 'text/plain') + self.assertEqual(first_doc.getReference(), first_doc.asNormalisedURL()) + self.assertEqual(first_doc.getVersion(), '001') + self.assertEqual(first_doc.asURL(), url) second_doc = self.portal.portal_contributions.newContent(url=url) self.tic() - self.assertEquals(second_doc.getPortalType(), 'Text') - self.assertEquals(second_doc.getContentType(), 'text/plain') - self.assertEquals(second_doc.getReference(), second_doc.asNormalisedURL()) - self.assertEquals(second_doc.getVersion(), '001') - self.assertEquals(second_doc.asURL(), url) + self.assertEqual(second_doc.getPortalType(), 'Text') + self.assertEqual(second_doc.getContentType(), 'text/plain') + self.assertEqual(second_doc.getReference(), second_doc.asNormalisedURL()) + self.assertEqual(second_doc.getVersion(), '001') + self.assertEqual(second_doc.asURL(), url) document_to_ingest2 = self.portal.portal_contributions.newContent( portal_type='File', @@ -1616,18 +1616,18 @@ return result url2 = document_to_ingest2.absolute_url() + '/getData' first_doc = self.portal.portal_contributions.newContent(url=url2) self.tic() - self.assertEquals(first_doc.getPortalType(), 'Text') - self.assertEquals(first_doc.getContentType(), 'text/plain') - self.assertEquals(first_doc.getReference(), first_doc.asNormalisedURL()) - self.assertEquals(first_doc.getVersion(), '001') - self.assertEquals(first_doc.asURL(), url2) + self.assertEqual(first_doc.getPortalType(), 'Text') + self.assertEqual(first_doc.getContentType(), 'text/plain') + self.assertEqual(first_doc.getReference(), first_doc.asNormalisedURL()) + self.assertEqual(first_doc.getVersion(), '001') + self.assertEqual(first_doc.asURL(), url2) second_doc = self.portal.portal_contributions.newContent(url=url2) self.tic() - self.assertEquals(second_doc.getPortalType(), 'Text') - self.assertEquals(second_doc.getContentType(), 'text/plain') - self.assertEquals(second_doc.getReference(), second_doc.asNormalisedURL()) - self.assertEquals(second_doc.getVersion(), '001') - self.assertEquals(second_doc.asURL(), url2) + self.assertEqual(second_doc.getPortalType(), 'Text') + self.assertEqual(second_doc.getContentType(), 'text/plain') + self.assertEqual(second_doc.getReference(), second_doc.asNormalisedURL()) + self.assertEqual(second_doc.getVersion(), '001') + self.assertEqual(second_doc.asURL(), url2) def test_IngestionConfigurationByTypeBasedMethod_usecase3(self): """How to discover metadata so that each new document @@ -1652,18 +1652,18 @@ context.setReference(reference) url = document_to_ingest.absolute_url() + '/getData' first_doc = self.portal.portal_contributions.newContent(url=url) self.tic() - self.assertEquals(first_doc.getPortalType(), 'Text') - self.assertEquals(first_doc.getContentType(), 'text/plain') - self.assertEquals(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 1') - self.assertEquals(first_doc.getVersion(), '001') - self.assertEquals(first_doc.asURL(), url) + self.assertEqual(first_doc.getPortalType(), 'Text') + self.assertEqual(first_doc.getContentType(), 'text/plain') + self.assertEqual(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 1') + self.assertEqual(first_doc.getVersion(), '001') + self.assertEqual(first_doc.asURL(), url) second_doc = self.portal.portal_contributions.newContent(url=url) self.tic() - self.assertEquals(second_doc.getPortalType(), 'Text') - self.assertEquals(second_doc.getContentType(), 'text/plain') - self.assertEquals(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 2') - self.assertEquals(second_doc.getVersion(), '001') - self.assertEquals(second_doc.asURL(), url) + self.assertEqual(second_doc.getPortalType(), 'Text') + self.assertEqual(second_doc.getContentType(), 'text/plain') + self.assertEqual(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 2') + self.assertEqual(second_doc.getVersion(), '001') + self.assertEqual(second_doc.asURL(), url) document_to_ingest2 = self.portal.portal_contributions.newContent( portal_type='File', @@ -1671,24 +1671,24 @@ context.setReference(reference) data='Hello World!') document_to_ingest2.publish() self.tic() - self.assertEquals(document_to_ingest2.getReference(), + self.assertEqual(document_to_ingest2.getReference(), 'I CHOOSED THIS REFERENCE 3') url2 = document_to_ingest2.absolute_url() + '/getData' first_doc = self.portal.portal_contributions.newContent(url=url2) self.tic() - self.assertEquals(first_doc.getPortalType(), 'Text') - self.assertEquals(first_doc.getContentType(), 'text/plain') - self.assertEquals(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 4') - self.assertEquals(first_doc.getVersion(), '001') - self.assertEquals(first_doc.asURL(), url2) + self.assertEqual(first_doc.getPortalType(), 'Text') + self.assertEqual(first_doc.getContentType(), 'text/plain') + self.assertEqual(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 4') + self.assertEqual(first_doc.getVersion(), '001') + self.assertEqual(first_doc.asURL(), url2) second_doc = self.portal.portal_contributions.newContent(url=url2) self.tic() - self.assertEquals(second_doc.getPortalType(), 'Text') - self.assertEquals(second_doc.getContentType(), 'text/plain') - self.assertEquals(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 5') - self.assertEquals(second_doc.getVersion(), '001') - self.assertEquals(second_doc.asURL(), url2) + self.assertEqual(second_doc.getPortalType(), 'Text') + self.assertEqual(second_doc.getContentType(), 'text/plain') + self.assertEqual(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 5') + self.assertEqual(second_doc.getVersion(), '001') + self.assertEqual(second_doc.asURL(), url2) def test_IngestionConfigurationByTypeBasedMethod_usecase4(self): """How to configure meta data discovery so that each time a file @@ -1743,18 +1743,18 @@ return result url = document_to_ingest.absolute_url() + '/getData' first_doc = self.portal.portal_contributions.newContent(url=url) self.tic() - self.assertEquals(first_doc.getPortalType(), 'Text') - self.assertEquals(first_doc.getContentType(), 'text/plain') - self.assertEquals(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 1') - self.assertEquals(first_doc.getVersion(), '00001') - self.assertEquals(first_doc.asURL(), url) + self.assertEqual(first_doc.getPortalType(), 'Text') + self.assertEqual(first_doc.getContentType(), 'text/plain') + self.assertEqual(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 1') + self.assertEqual(first_doc.getVersion(), '00001') + self.assertEqual(first_doc.asURL(), url) second_doc = self.portal.portal_contributions.newContent(url=url) self.tic() - self.assertEquals(second_doc.getPortalType(), 'Text') - self.assertEquals(second_doc.getContentType(), 'text/plain') - self.assertEquals(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 1') - self.assertEquals(second_doc.getVersion(), '00002') - self.assertEquals(second_doc.asURL(), url) + self.assertEqual(second_doc.getPortalType(), 'Text') + self.assertEqual(second_doc.getContentType(), 'text/plain') + self.assertEqual(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 1') + self.assertEqual(second_doc.getVersion(), '00002') + self.assertEqual(second_doc.asURL(), url) document_to_ingest2 = self.portal.portal_contributions.newContent( portal_type='File', @@ -1762,24 +1762,24 @@ return result data='Hello World!') document_to_ingest2.publish() self.tic() - self.assertEquals(document_to_ingest2.getReference(), + self.assertEqual(document_to_ingest2.getReference(), 'I CHOOSED THIS REFERENCE 2') url2 = document_to_ingest2.absolute_url() + '/getData' first_doc = self.portal.portal_contributions.newContent(url=url2) self.tic() - self.assertEquals(first_doc.getPortalType(), 'Text') - self.assertEquals(first_doc.getContentType(), 'text/plain') - self.assertEquals(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 3') - self.assertEquals(first_doc.getVersion(), '00001') - self.assertEquals(first_doc.asURL(), url2) + self.assertEqual(first_doc.getPortalType(), 'Text') + self.assertEqual(first_doc.getContentType(), 'text/plain') + self.assertEqual(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 3') + self.assertEqual(first_doc.getVersion(), '00001') + self.assertEqual(first_doc.asURL(), url2) second_doc = self.portal.portal_contributions.newContent(url=url2) self.tic() - self.assertEquals(second_doc.getPortalType(), 'Text') - self.assertEquals(second_doc.getContentType(), 'text/plain') - self.assertEquals(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 3') - self.assertEquals(second_doc.getVersion(), '00002') - self.assertEquals(second_doc.asURL(), url2) + self.assertEqual(second_doc.getPortalType(), 'Text') + self.assertEqual(second_doc.getContentType(), 'text/plain') + self.assertEqual(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 3') + self.assertEqual(second_doc.getVersion(), '00002') + self.assertEqual(second_doc.asURL(), url2) def test_IngestionConfigurationByTypeBasedMethod_usecase5(self): """How to configure meta data discovery so that each time a file @@ -1833,18 +1833,18 @@ return result url = document_to_ingest.absolute_url() + '/getData' first_doc = self.portal.portal_contributions.newContent(url=url) self.tic() - self.assertEquals(first_doc.getPortalType(), 'Text') - self.assertEquals(first_doc.getContentType(), 'text/plain') - self.assertEquals(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 1') - self.assertEquals(first_doc.getVersion(), '001') - self.assertEquals(first_doc.asURL(), url) + self.assertEqual(first_doc.getPortalType(), 'Text') + self.assertEqual(first_doc.getContentType(), 'text/plain') + self.assertEqual(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 1') + self.assertEqual(first_doc.getVersion(), '001') + self.assertEqual(first_doc.asURL(), url) second_doc = self.portal.portal_contributions.newContent(url=url) self.tic() - self.assertEquals(second_doc.getPortalType(), 'Text') - self.assertEquals(second_doc.getContentType(), 'text/plain') - self.assertEquals(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 1') - self.assertEquals(second_doc.getVersion(), '001') - self.assertEquals(second_doc.asURL(), url) + self.assertEqual(second_doc.getPortalType(), 'Text') + self.assertEqual(second_doc.getContentType(), 'text/plain') + self.assertEqual(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 1') + self.assertEqual(second_doc.getVersion(), '001') + self.assertEqual(second_doc.asURL(), url) document_to_ingest2 = self.portal.portal_contributions.newContent( portal_type='File', @@ -1852,24 +1852,24 @@ return result data='Hello World!') document_to_ingest2.publish() self.tic() - self.assertEquals(document_to_ingest2.getReference(), + self.assertEqual(document_to_ingest2.getReference(), 'I CHOOSED THIS REFERENCE 2') url2 = document_to_ingest2.absolute_url() + '/getData' first_doc = self.portal.portal_contributions.newContent(url=url2) self.tic() - self.assertEquals(first_doc.getPortalType(), 'Text') - self.assertEquals(first_doc.getContentType(), 'text/plain') - self.assertEquals(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 3') - self.assertEquals(first_doc.getVersion(), '001') - self.assertEquals(first_doc.asURL(), url2) + self.assertEqual(first_doc.getPortalType(), 'Text') + self.assertEqual(first_doc.getContentType(), 'text/plain') + self.assertEqual(first_doc.getReference(), 'I CHOOSED THIS REFERENCE 3') + self.assertEqual(first_doc.getVersion(), '001') + self.assertEqual(first_doc.asURL(), url2) second_doc = self.portal.portal_contributions.newContent(url=url2) self.tic() - self.assertEquals(second_doc.getPortalType(), 'Text') - self.assertEquals(second_doc.getContentType(), 'text/plain') - self.assertEquals(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 3') - self.assertEquals(second_doc.getVersion(), '001') - self.assertEquals(second_doc.asURL(), url2) + self.assertEqual(second_doc.getPortalType(), 'Text') + self.assertEqual(second_doc.getContentType(), 'text/plain') + self.assertEqual(second_doc.getReference(), 'I CHOOSED THIS REFERENCE 3') + self.assertEqual(second_doc.getVersion(), '001') + self.assertEqual(second_doc.asURL(), url2) def test_IngestionConfigurationByTypeBasedMethod_usecase6(self): """How to configure meta data discovery so that a Spreadsheet @@ -1885,8 +1885,8 @@ return result self.tic()# Discover metadata will delete first ingested document # then reingest new one with appropriate portal_type result_list = self.portal.portal_catalog(reference='Custom.Reference') - self.assertEquals(len(result_list), 1) - self.assertEquals(result_list[0].getPortalType(), 'Spreadsheet') + self.assertEqual(len(result_list), 1) + self.assertEqual(result_list[0].getPortalType(), 'Spreadsheet') def test_IngestionConfigurationByTypeBasedMethod_usecase7(self): """How to reingest a published document, by a user action ? @@ -1905,26 +1905,26 @@ return result # Now change it to a Text portal_type new_doc = document.migratePortalType('Text') self.tic() - self.assertEquals(new_doc.getPortalType(), 'Text') - self.assertEquals(new_doc.getProperty('property_which_doesnot_exists'), + self.assertEqual(new_doc.getPortalType(), 'Text') + self.assertEqual(new_doc.getProperty('property_which_doesnot_exists'), 'Foo') - self.assertEquals(new_doc.getTitle(), 'One title') - self.assertEquals(new_doc.getReference(), 'EFAA') - self.assertEquals(new_doc.getValidationState(), 'published') - self.assertEquals(new_doc.getData(), 'Hello World!') + self.assertEqual(new_doc.getTitle(), 'One title') + self.assertEqual(new_doc.getReference(), 'EFAA') + self.assertEqual(new_doc.getValidationState(), 'published') + self.assertEqual(new_doc.getData(), 'Hello World!') # Migrate a document with url property url = new_doc.absolute_url() + '/getData' document = self.portal.portal_contributions.newContent(url=url) document.submit() self.tic() - self.assertEquals(document.getPortalType(), 'Text') + self.assertEqual(document.getPortalType(), 'Text') # Change it to File new_doc = document.migratePortalType('File') - self.assertEquals(new_doc.getPortalType(), 'File') - self.assertEquals(new_doc.asURL(), url) - self.assertEquals(new_doc.getData(), 'Hello World!') - self.assertEquals(new_doc.getValidationState(), 'submitted') + self.assertEqual(new_doc.getPortalType(), 'File') + self.assertEqual(new_doc.asURL(), url) + self.assertEqual(new_doc.getData(), 'Hello World!') + self.assertEqual(new_doc.getValidationState(), 'submitted') def test_User_Portal_Type_parameter_is_honoured(self): """Check that given portal_type is always honoured @@ -1941,8 +1941,8 @@ return result self.tic()# Discover metadata will try change the portal_type # but user decision take precedence: PDF must be created result_list = self.portal.portal_catalog(reference='I.want.a.pdf') - self.assertEquals(len(result_list), 1) - self.assertEquals(result_list[0].getPortalType(), 'PDF') + self.assertEqual(len(result_list), 1) + self.assertEqual(result_list[0].getPortalType(), 'PDF') def test_User_ID_parameter_is_honoured(self): """Check that given id is always honoured @@ -1960,7 +1960,7 @@ return result self.tic() result_list = self.portal.portal_catalog(reference='I.want.a.pdf', id='this_id') - self.assertEquals(len(result_list), 1) + self.assertEqual(len(result_list), 1) self.assertRaises(BadRequest, self.portal.portal_contributions.newContent, id='this_id', @@ -1998,12 +1998,12 @@ return result # disable_cookie_login__ is required to force zope to raise Unauthorized (401) # then HTTPDigestAuthHandler can perform HTTP Authentication response = urllib2.urlopen(request) - self.assertEquals(response.getcode(), httplib.OK) + self.assertEqual(response.getcode(), httplib.OK) self.tic() document = self.portal.portal_catalog.getResultValue(portal_type='Spreadsheet', reference=reference) self.assertTrue(document is not None) - self.assertEquals(document.getData(), data) + self.assertEqual(document.getData(), data) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5OOo/tests/testOOoConversionCache.py b/product/ERP5OOo/tests/testOOoConversionCache.py index a8d26ea89d..fb4e2f87a8 100644 --- a/product/ERP5OOo/tests/testOOoConversionCache.py +++ b/product/ERP5OOo/tests/testOOoConversionCache.py @@ -99,12 +99,12 @@ class TestDocumentConversionCache(TestDocumentMixin): quality=40)) if magic is not None: mime_detector = magic.Magic(mime=True) - self.assertEquals(mime_detector.from_buffer(document.getConversion(format=format)[1]), + self.assertEqual(mime_detector.from_buffer(document.getConversion(format=format)[1]), 'image/png') - self.assertEquals(mime_detector.from_buffer(document.getConversion(format=format, + self.assertEqual(mime_detector.from_buffer(document.getConversion(format=format, display='large')[1]), 'image/png') - self.assertEquals(mime_detector.from_buffer(document.getConversion(format=format, + self.assertEqual(mime_detector.from_buffer(document.getConversion(format=format, display='large', quality=40)[1]), 'image/png') @@ -127,7 +127,7 @@ class TestDocumentConversionCache(TestDocumentMixin): document.convert(format=format) self.commit() self.assertTrue(document.hasConversion(format=format), 'Cache Storage failed for %s' % (format)) - self.assertEquals(DateTime().Date(), document.getConversionDate(format=format).Date()) + self.assertEqual(DateTime().Date(), document.getConversionDate(format=format).Date()) self.assertTrue(document.getConversionMd5(format=format)) self.assertTrue(document.getConversionSize(format=format)) document.edit(title='Foo') @@ -160,7 +160,7 @@ class TestDocumentConversionCache(TestDocumentMixin): document.convert(format=format) self.commit() self.assertTrue(document.hasConversion(format=format), 'Cache Storage failed for %s' % (format)) - self.assertEquals(DateTime().Date(), document.getConversionDate(format=format).Date()) + self.assertEqual(DateTime().Date(), document.getConversionDate(format=format).Date()) self.assertTrue(document.getConversionMd5(format=format)) self.assertTrue(document.getConversionSize(format=format)) document.edit(title='Foo') @@ -302,7 +302,7 @@ class TestDocumentConversionCache(TestDocumentMixin): self.tic() document_url = document.getRelativeUrl() document = self.portal.restrictedTraverse(document_url) - self.assertEquals(document.getId(), document_id) + self.assertEqual(document.getId(), document_id) document.convert(format='txt') self.assertTrue(document.getConversion(format='txt')) diff --git a/product/ERP5OOo/tests/testOOoDynamicStyle.py b/product/ERP5OOo/tests/testOOoDynamicStyle.py index 2d7b846d60..b06b7b5542 100644 --- a/product/ERP5OOo/tests/testOOoDynamicStyle.py +++ b/product/ERP5OOo/tests/testOOoDynamicStyle.py @@ -127,7 +127,7 @@ return getattr(context, "%s_%s" % (parameter, current_language)) self.assertEqual('attachment; filename="Dynamic_viewAsOdt.odt"', response.getHeader('content-disposition')) self._validate(response.getBody()) - self.assertEquals(200, response.getStatus()) + self.assertEqual(200, response.getStatus()) ooo_builder = OOoBuilder(response.getBody()) styles_xml_body = ooo_builder.extract('styles.xml') @@ -157,7 +157,7 @@ return getattr(context, "%s_%s" % (parameter, current_language)) response = self.publish('/' + self.getPortal().Dynamic_viewAsOdt.absolute_url(1)) # then, it is not a zip stream self.assertFalse(response.getBody().startswith('PK')) - self.assertEquals(500, response.getStatus()) + self.assertEqual(500, response.getStatus()) def test_02_static(self): @@ -205,7 +205,7 @@ return getattr(context, "%s_%s" % (parameter, current_language)) ooo_stylesheet='NotFound_getODTStyleSheet', script_name='') response = self.publish('/' + self.getPortal().Static_viewAsOdt.absolute_url(1)) self.assertFalse(response.getBody().startswith('PK')) - self.assertEquals(500, response.getStatus()) + self.assertEqual(500, response.getStatus()) def test_include_img(self): """ @@ -236,7 +236,7 @@ return getattr(context, "%s_%s" % (parameter, current_language)) response = self.publish('/' + self.getPortal().Base_viewIncludeImageAsOdt.absolute_url(1)) body = response.getBody() - self.assertEquals(200, response.getStatus(), body) + self.assertEqual(200, response.getStatus(), body) self.assertEqual('application/vnd.oasis.opendocument.text', response.getHeader('content-type').split(';')[0]) self.assertEqual('attachment; filename="Base_viewIncludeImageAsOdt.odt"', diff --git a/product/ERP5OOo/tests/testOOoImport.py b/product/ERP5OOo/tests/testOOoImport.py index 148096f3b6..c4e27be2bb 100644 --- a/product/ERP5OOo/tests/testOOoImport.py +++ b/product/ERP5OOo/tests/testOOoImport.py @@ -646,11 +646,11 @@ class TestOOoImport(TestOOoImportMixin): self.assertTrue('germany' in region.europe.objectIds()) self.assertTrue('france' in region.europe.objectIds()) france = region.europe.france - self.assertEquals('France', france.getTitle()) + self.assertEqual('France', france.getTitle()) self.assertTrue(france.hasProperty('title')) - self.assertEquals('A Country', france.getDescription()) - self.assertEquals('FR', france.getCodification()) - self.assertEquals(1, france.getIntIndex()) + self.assertEqual('A Country', france.getDescription()) + self.assertEqual('FR', france.getCodification()) + self.assertEqual(1, france.getIntIndex()) def test_CategoryTool_importCategoryFileDeletionSupport(self): # tests simple use of CategoryTool_importCategoryFile script @@ -666,11 +666,11 @@ class TestOOoImport(TestOOoImportMixin): self.assertTrue('germany' in region.europe.objectIds()) self.assertTrue('france' in region.europe.objectIds()) france = region.europe.france - self.assertEquals('France', france.getTitle()) + self.assertEqual('France', france.getTitle()) self.assertTrue(france.hasProperty('title')) - self.assertEquals('A Country', france.getDescription()) - self.assertEquals('FR', france.getCodification()) - self.assertEquals(1, france.getIntIndex()) + self.assertEqual('A Country', france.getDescription()) + self.assertEqual('FR', france.getCodification()) + self.assertEqual(1, france.getIntIndex()) def test_CategoryTool_importCategoryFileExpirationSupport(self): # tests simple use of CategoryTool_importCategoryFile script @@ -687,11 +687,11 @@ class TestOOoImport(TestOOoImportMixin): self.assertTrue('germany' in region.europe.objectIds()) self.assertTrue('france' in region.europe.objectIds()) france = region.europe.france - self.assertEquals('France', france.getTitle()) + self.assertEqual('France', france.getTitle()) self.assertTrue(france.hasProperty('title')) - self.assertEquals('A Country', france.getDescription()) - self.assertEquals('FR', france.getCodification()) - self.assertEquals(1, france.getIntIndex()) + self.assertEqual('A Country', france.getDescription()) + self.assertEqual('FR', france.getCodification()) + self.assertEqual(1, france.getIntIndex()) def test_CategoryTool_importCategoryFileXLS(self): # tests that CategoryTool_importCategoryFile supports .xls files @@ -704,10 +704,10 @@ class TestOOoImport(TestOOoImportMixin): self.assertTrue('germany' in region.europe.objectIds()) self.assertTrue('france' in region.europe.objectIds()) france = region.europe.france - self.assertEquals('France', france.getTitle()) - self.assertEquals('A Country', france.getDescription()) - self.assertEquals('FR', france.getCodification()) - self.assertEquals(1, france.getIntIndex()) + self.assertEqual('France', france.getTitle()) + self.assertEqual('A Country', france.getDescription()) + self.assertEqual('FR', france.getCodification()) + self.assertEqual(1, france.getIntIndex()) def test_CategoryTool_importCategoryFile_PathStars(self): # tests CategoryTool_importCategoryFile with * in the paths columns @@ -720,10 +720,10 @@ class TestOOoImport(TestOOoImportMixin): self.assertTrue('germany' in region.europe.objectIds()) self.assertTrue('france' in region.europe.objectIds()) france = region.europe.france - self.assertEquals('France', france.getTitle()) - self.assertEquals('A Country', france.getDescription()) - self.assertEquals('FR', france.getCodification()) - self.assertEquals(1, france.getIntIndex()) + self.assertEqual('France', france.getTitle()) + self.assertEqual('A Country', france.getDescription()) + self.assertEqual('FR', france.getCodification()) + self.assertEqual(1, france.getIntIndex()) def test_CategoryTool_importCategoryFile_PathStars_noID(self): # tests CategoryTool_importCategoryFile with * in the paths columns, and no @@ -738,10 +738,10 @@ class TestOOoImport(TestOOoImportMixin): self.assertTrue('germany' in region.europe.objectIds()) self.assertTrue('france' in region.europe.objectIds()) france = region.europe.france - self.assertEquals('Frà nce', france.getTitle()) - self.assertEquals('A Country', france.getDescription()) - self.assertEquals('FR', france.getCodification()) - self.assertEquals(1, france.getIntIndex()) + self.assertEqual('Frà nce', france.getTitle()) + self.assertEqual('A Country', france.getDescription()) + self.assertEqual('FR', france.getCodification()) + self.assertEqual(1, france.getIntIndex()) def test_CategoryTool_importCategoryFile_DuplicateIds(self): # tests CategoryTool_importCategoryFile when a document contain same @@ -752,11 +752,11 @@ class TestOOoImport(TestOOoImportMixin): self.tic() region = self.portal.portal_categories.region self.assertEqual(1, len(region)) - self.assertEquals(['europe'], list(region.objectIds())) - self.assertEquals(['france'], list(region.europe.objectIds())) - self.assertEquals(['europe'], list(region.europe.france.objectIds())) - self.assertEquals(['france'], list(region.europe.france.europe.objectIds())) - self.assertEquals([], list(region.europe.france.europe.france.objectIds())) + self.assertEqual(['europe'], list(region.objectIds())) + self.assertEqual(['france'], list(region.europe.objectIds())) + self.assertEqual(['europe'], list(region.europe.france.objectIds())) + self.assertEqual(['france'], list(region.europe.france.europe.objectIds())) + self.assertEqual([], list(region.europe.france.europe.france.objectIds())) # Base_getCategoriesSpreadSheetMapping tests def test_Base_getCategoriesSpreadSheetMapping(self): @@ -764,19 +764,19 @@ class TestOOoImport(TestOOoImportMixin): mapping = self.portal.Base_getCategoriesSpreadSheetMapping( import_file=makeFileUpload('import_region_category.sxc')) self.assertTrue(isinstance(mapping, dict)) - self.assertEquals(['region'], list(mapping.keys())) + self.assertEqual(['region'], list(mapping.keys())) region = mapping['region'] self.assertTrue(isinstance(region, list)) - self.assertEquals(6, len(region)) + self.assertEqual(6, len(region)) # base category is contained in the list - self.assertEquals(dict(path='region', + self.assertEqual(dict(path='region', title='region'), region[0]) - self.assertEquals(dict(path='region/europe', + self.assertEqual(dict(path='region/europe', short_title='Europe', title='Europe'), region[1]) - self.assertEquals(dict(codification='FR', + self.assertEqual(dict(codification='FR', description='A Country', int_index='1', path='region/europe/france', @@ -815,7 +815,7 @@ class TestOOoImport(TestOOoImportMixin): self.portal.portal_categories.Base_getCategoriesSpreadSheetMapping(import_file, invalid_spreadsheet_error_handler=on_invalid_spreadsheet) - self.assertEquals(1, len(message_list)) + self.assertEqual(1, len(message_list)) self.assertTrue('france' in str(message_list[0])) def test_Base_getCategoriesSpreadSheetMapping_WrongHierarchy(self): @@ -852,12 +852,12 @@ class TestOOoImport(TestOOoImportMixin): mapping = self.portal.portal_categories.Base_getCategoriesSpreadSheetMapping( import_file=import_file) self.assertTrue(isinstance(mapping, dict)) - self.assertEquals(['region'], list(mapping.keys())) + self.assertEqual(['region'], list(mapping.keys())) region = mapping['region'] self.assertTrue(isinstance(region, list)) - self.assertEquals(7, len(region)) + self.assertEqual(7, len(region)) # Check that category can have a reserved property as title - self.assertEquals(dict(codification='codification', + self.assertEqual(dict(codification='codification', description='codification', path='region/antartica', short_title='codification', @@ -872,7 +872,7 @@ class TestOOoImport(TestOOoImportMixin): mapping = parser.getSpreadsheetsMapping() not_ok = 1 for spread, values in mapping.iteritems(): - self.assertEquals(len(values), 41001) + self.assertEqual(len(values), 41001) not_ok = 0 if not_ok: self.fail('Spreadsheet not read!') @@ -911,11 +911,11 @@ class TestOOoImportWeb(TestOOoImportMixin): self.assertTrue('germany' in region.europe.objectIds()) self.assertTrue('france' in region.europe.objectIds()) france = region.europe.france - self.assertEquals('France', france.getTitle()) + self.assertEqual('France', france.getTitle()) self.assertTrue(france.hasProperty('title')) - self.assertEquals('A Country', france.getDescription()) - self.assertEquals('FR', france.getCodification()) - self.assertEquals(1, france.getIntIndex()) + self.assertEqual('A Country', france.getDescription()) + self.assertEqual('FR', france.getCodification()) + self.assertEqual(1, france.getIntIndex()) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5OOo/tests/testOOoParser.py b/product/ERP5OOo/tests/testOOoParser.py index 80f870ebf7..a63566d3de 100644 --- a/product/ERP5OOo/tests/testOOoParser.py +++ b/product/ERP5OOo/tests/testOOoParser.py @@ -43,13 +43,13 @@ class TestOOoParser(unittest.TestCase): parser = OOoParser() parser.openFile(open(makeFilePath('import_data_list.ods'), 'rb')) mapping = parser.getSpreadsheetsMapping() - self.assertEquals(['Person'], mapping.keys()) + self.assertEqual(['Person'], mapping.keys()) person_mapping = mapping['Person'] self.assertTrue(isinstance(person_mapping, list)) self.assertTrue(102, len(person_mapping)) - self.assertEquals(person_mapping[0], + self.assertEqual(person_mapping[0], ['Title', 'First Name', 'Last Name', 'Default Email Text']) - self.assertEquals(person_mapping[1], + self.assertEqual(person_mapping[1], ['John Doe 0', 'John', 'Doe 0', 'john.doe0@foo.com']) def test_openFromString(self): @@ -57,40 +57,40 @@ class TestOOoParser(unittest.TestCase): parser.openFromString( open(makeFilePath('import_data_list.ods'), 'rb').read()) mapping = parser.getSpreadsheetsMapping() - self.assertEquals(['Person'], mapping.keys()) + self.assertEqual(['Person'], mapping.keys()) def test_getSpreadSheetMappingStyle(self): parser = OOoParser() parser.openFile(open(makeFilePath('import_data_list_with_style.ods'), 'rb')) mapping = parser.getSpreadsheetsMapping() - self.assertEquals(['Feuille1'], mapping.keys()) - self.assertEquals(mapping['Feuille1'][1], + self.assertEqual(['Feuille1'], mapping.keys()) + self.assertEqual(mapping['Feuille1'][1], ['a line with style']) - self.assertEquals(mapping['Feuille1'][2], + self.assertEqual(mapping['Feuille1'][2], ['a line with multiple styles']) - self.assertEquals(mapping['Feuille1'][3], + self.assertEqual(mapping['Feuille1'][3], ['http://www.erp5.org']) - self.assertEquals(mapping['Feuille1'][4], + self.assertEqual(mapping['Feuille1'][4], ['john.doe@example.com']) def test_getSpreadSheetMappingDataTypes(self): parser = OOoParser() parser.openFile(open(makeFilePath('import_data_list_data_type.ods'), 'rb')) mapping = parser.getSpreadsheetsMapping() - self.assertEquals(['Feuille1'], mapping.keys()) - self.assertEquals(mapping['Feuille1'][0], + self.assertEqual(['Feuille1'], mapping.keys()) + self.assertEqual(mapping['Feuille1'][0], ['1234.5678']) - self.assertEquals(mapping['Feuille1'][1], + self.assertEqual(mapping['Feuille1'][1], ['1234.5678']) - self.assertEquals(mapping['Feuille1'][2], + self.assertEqual(mapping['Feuille1'][2], ['0.1']) - self.assertEquals(mapping['Feuille1'][3], + self.assertEqual(mapping['Feuille1'][3], ['2008-11-14']) - self.assertEquals(mapping['Feuille1'][4], + self.assertEqual(mapping['Feuille1'][4], ['2008-11-14T10:20:30']) # supported by DateTime - self.assertEquals(mapping['Feuille1'][5], + self.assertEqual(mapping['Feuille1'][5], ['PT12H34M56S']) # maybe not good, this is raw format - self.assertEquals(mapping['Feuille1'][6], + self.assertEqual(mapping['Feuille1'][6], ['With note']) def test_BigSpreadSheet_can_be_parsed(self,): @@ -101,7 +101,7 @@ class TestOOoParser(unittest.TestCase): mapping = parser.getSpreadsheetsMapping() not_ok = 1 for spread, values in mapping.iteritems(): - self.assertEquals(len(values), 41001) + self.assertEqual(len(values), 41001) not_ok = 0 if not_ok: self.fail('Spreadsheet not read!') @@ -110,18 +110,18 @@ class TestOOoParser(unittest.TestCase): parser = OOoParser() parser.openFile(open(makeFilePath('complex_text.ods'), 'rb')) mapping = parser.getSpreadsheetsMapping() - self.assertEquals(['Feuille1'], mapping.keys()) - self.assertEquals(mapping['Feuille1'][0], [' leading space']) - self.assertEquals(mapping['Feuille1'][1], [' leading space']) - self.assertEquals(mapping['Feuille1'][2], ['tab\t']) - self.assertEquals(mapping['Feuille1'][3], ['New\nLine']) + self.assertEqual(['Feuille1'], mapping.keys()) + self.assertEqual(mapping['Feuille1'][0], [' leading space']) + self.assertEqual(mapping['Feuille1'][1], [' leading space']) + self.assertEqual(mapping['Feuille1'][2], ['tab\t']) + self.assertEqual(mapping['Feuille1'][3], ['New\nLine']) def test_getSpreadSheetMappingEmptyCells(self): parser = OOoParser() parser.openFile(open(makeFilePath('empty_cells.ods'), 'rb')) mapping = parser.getSpreadsheetsMapping() - self.assertEquals(['Feuille1'], mapping.keys()) - self.assertEquals(mapping['Feuille1'], + self.assertEqual(['Feuille1'], mapping.keys()) + self.assertEqual(mapping['Feuille1'], [ ['A1', None, 'C1'], [], diff --git a/product/ERP5OOo/tests/testOOoStyle.py b/product/ERP5OOo/tests/testOOoStyle.py index 99653ee9cb..2afba51a50 100644 --- a/product/ERP5OOo/tests/testOOoStyle.py +++ b/product/ERP5OOo/tests/testOOoStyle.py @@ -122,11 +122,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/person_module/PersonModule_viewPersonList' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_form_list_domain_tree(self): @@ -142,11 +142,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/person_module/PersonModule_viewPersonList' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_form_view(self): @@ -155,11 +155,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/person_module/pers/default_address/GeographicAddress_view' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_form_view_empty_listbox(self): @@ -169,11 +169,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/person_module/pers/Person_view' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_form_view_non_empty_listbox(self): @@ -181,11 +181,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/person_module/pers/Person_view' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_form_view_format(self): @@ -193,33 +193,33 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/person_module/pers/Person_view?format=' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) # format=pdf uses oood for conversion response = self.publish( '/%s/person_module/pers/Person_view?format=pdf' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') - self.assertEquals(content_type, 'application/pdf') + self.assertEqual(content_type, 'application/pdf') content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) def test_report_view_form_view(self): # Test report view rendering forms using form_view - self.assertEquals('form_view', self.portal.Base_viewWorkflowHistory.pt) + self.assertEqual('form_view', self.portal.Base_viewWorkflowHistory.pt) response = self.publish( '/%s/person_module/pers/Base_viewHistory' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_report_view_form_list(self): @@ -234,11 +234,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): finally: self.portal.Base_viewWorkflowHistory.pt = 'form_view' self.commit() - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) @@ -246,44 +246,44 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/person_module/pers/Base_viewHistory?landscape=1' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_report_view_sheet_per_report_section(self): response = self.publish( '/%s/person_module/pers/Base_viewHistory?sheet_per_report_section=1' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_form_view_encoding(self): self.portal.person_module.pers.setFirstName('Jérome') response = self.publish('/%s/person_module/pers/Person_view' % self.portal.getId(), basic=self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_form_view_category(self): self.portal.person_module.pers.setGender('male') response = self.publish('/%s/person_module/pers/Person_view' % self.portal.getId(), basic=self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_form_view_broken_category(self): @@ -291,42 +291,42 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): self.portal.person_module.pers.setCareerRole('not exist') response = self.publish('/%s/person_module/pers/Person_view' % self.portal.getId(), basic=self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_form_view_embedded_image(self): # with image response = self.publish('/%s/person_module/pers/Person_viewDetails' % self.portal.getId(), basic=self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) # without image response = self.publish('/%s/person_module/pers_without_image/Person_viewDetails' % self.portal.getId(), basic=self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_report_view_encoding(self): self.portal.person_module.pers.setFirstName('Jérome') response = self.publish('/%s/person_module/pers/Base_viewHistory' % self.portal.getId(), basic=self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_form_list_encoding(self): @@ -334,11 +334,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/person_module/PersonModule_viewPersonList' % self.portal.getId(), basic=self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_image_field_form_view(self): @@ -346,11 +346,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/person_module/pers/img/Image_view' % self.portal.getId(), basic=self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_image_field_form_view_bottom_group(self): @@ -359,11 +359,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/person_module/pers/img/Image_viewFullSizedImage' % self.portal.getId(), basic=self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) self._validate(response.getBody()) def test_textarea_center_group(self): @@ -374,11 +374,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/person_module/pers/Person_view' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) body = response.getBody() self._validate(body) @@ -406,11 +406,11 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): response = self.publish( '/%s/foo_module/FooModule_viewFooList?portal_skin=' % self.portal.getId(), self.auth) - self.assertEquals(HTTP_OK, response.getStatus()) + self.assertEqual(HTTP_OK, response.getStatus()) content_type = response.getHeader('content-type') self.assertTrue(content_type.startswith(self.content_type), content_type) content_disposition = response.getHeader('content-disposition') - self.assertEquals('attachment', content_disposition.split(';')[0]) + self.assertEqual('attachment', content_disposition.split(';')[0]) body = response.getBody() self._validate(body) diff --git a/product/ERP5Security/tests/testERP5Security.py b/product/ERP5Security/tests/testERP5Security.py index fab5dc0f27..18f8d12570 100644 --- a/product/ERP5Security/tests/testERP5Security.py +++ b/product/ERP5Security/tests/testERP5Security.py @@ -86,7 +86,7 @@ class TestUserManagement(ERP5TypeTestCase): def test_UserFolder(self): """Tests user folder has correct meta type.""" - self.failUnless(isinstance(self.getUserFolder(), + self.assertTrue(isinstance(self.getUserFolder(), PluggableAuthService.PluggableAuthService)) def loginAsUser(self, username): @@ -222,7 +222,7 @@ class TestUserManagement(ERP5TypeTestCase): def test_searchUsers(self): p1 = self._makePerson(reference='person1') p2 = self._makePerson(reference='person2') - self.assertEquals(set(['person1', 'person2']), + self.assertEqual(set(['person1', 'person2']), set([x['userid'] for x in self.portal.acl_users.searchUsers(id='person')])) @@ -230,7 +230,7 @@ class TestUserManagement(ERP5TypeTestCase): p = self._makePerson(reference='person') p1 = self._makePerson(reference='person1') p2 = self._makePerson(reference='person2') - self.assertEquals(['person', ], + self.assertEqual(['person', ], [x['userid'] for x in self.portal.acl_users.searchUsers(id='person', exact_match=True)]) @@ -555,9 +555,9 @@ class TestLocalRoleManagement(ERP5TypeTestCase): """Test users have the Member role. """ self.loginAsUser(self.username) - self.failUnless('Member' in + self.assertTrue('Member' in getSecurityManager().getUser().getRolesInContext(self.portal)) - self.failUnless('Member' in + self.assertTrue('Member' in getSecurityManager().getUser().getRoles()) def testSimpleLocalRole(self): @@ -660,16 +660,16 @@ class TestLocalRoleManagement(ERP5TypeTestCase): module = obj.getParentValue() module.updateLocalRolesOnSecurityGroups() # we said the we do not want acquire local roles. - self.failIf(obj._getAcquireLocalRoles()) + self.assertFalse(obj._getAcquireLocalRoles()) # the local role is set on the module - self.assertEquals(['Assignor'], module.__ac_local_roles__.get('F1_G1_S1')) + self.assertEqual(['Assignor'], module.__ac_local_roles__.get('F1_G1_S1')) # but not on the document - self.assertEquals(None, obj.__ac_local_roles__.get('F1_G1_S1')) + self.assertEqual(None, obj.__ac_local_roles__.get('F1_G1_S1')) # same testing with roles in context. self.loginAsUser(self.username) - self.failUnless('Assignor' in + self.assertTrue('Assignor' in getSecurityManager().getUser().getRolesInContext(module)) - self.failIf('Assignor' in + self.assertFalse('Assignor' in getSecurityManager().getUser().getRolesInContext(obj)) def testGetUserByLogin(self): @@ -681,30 +681,30 @@ class TestLocalRoleManagement(ERP5TypeTestCase): self.portal.portal_caches.clearAllCache() self.commit() person_list = self.portal.acl_users.erp5_users.getUserByLogin(self.username) - self.assertEquals(1, len(person_list)) - self.assertEquals(self.username, person_list[0].getReference()) + self.assertEqual(1, len(person_list)) + self.assertEqual(self.username, person_list[0].getReference()) # getUserByLogin accept login as a list self.portal.portal_caches.clearAllCache() self.commit() person_list = self.portal.acl_users.erp5_users.getUserByLogin([self.username]) - self.assertEquals(1, len(person_list)) - self.assertEquals(self.username, person_list[0].getReference()) + self.assertEqual(1, len(person_list)) + self.assertEqual(self.username, person_list[0].getReference()) # getUserByLogin accept login as a tuple self.portal.portal_caches.clearAllCache() self.commit() person_list = self.portal.acl_users.erp5_users.getUserByLogin((self.username,)) - self.assertEquals(1, len(person_list)) - self.assertEquals(self.username, person_list[0].getReference()) + self.assertEqual(1, len(person_list)) + self.assertEqual(self.username, person_list[0].getReference()) # PreferenceTool pass a user as parameter user = getSecurityManager().getUser() self.portal.portal_caches.clearAllCache() self.commit() person_list = self.portal.acl_users.erp5_users.getUserByLogin(user) - self.assertEquals(1, len(person_list)) - self.assertEquals(self.username, person_list[0].getReference()) + self.assertEqual(1, len(person_list)) + self.assertEqual(self.username, person_list[0].getReference()) def testLocalRoleWithTraverser(self): """Make sure that local role works correctly when traversing @@ -794,7 +794,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase): # encrypt & decrypt works key = erp5_auth_key_plugin.encrypt(reference) self.assertNotEquals(reference, key) - self.assertEquals(reference, erp5_auth_key_plugin.decrypt(key)) + self.assertEqual(reference, erp5_auth_key_plugin.decrypt(key)) base_url = portal.absolute_url(relative=1) # without key we are Anonymous User so we should be redirected with proper HTML @@ -858,7 +858,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase): def test_owner_local_role_on_clone(self): # check that tested stuff is ok parent_type = 'Person' - self.assertEquals(self.portal.portal_types[parent_type].acquire_local_roles, 0) + self.assertEqual(self.portal.portal_types[parent_type].acquire_local_roles, 0) original_owner_id = 'original_user' + self.id() cloning_owner_id = 'cloning_user' + self.id() @@ -890,8 +890,8 @@ class TestLocalRoleManagement(ERP5TypeTestCase): # check that tested stuff is ok parent_type = 'Person' acquiring_type = 'Email' - self.assertEquals(self.portal.portal_types[acquiring_type].acquire_local_roles, 1) - self.assertEquals(self.portal.portal_types[parent_type].acquire_local_roles, 0) + self.assertEqual(self.portal.portal_types[acquiring_type].acquire_local_roles, 1) + self.assertEqual(self.portal.portal_types[parent_type].acquire_local_roles, 0) original_owner_id = 'original_user' + self.id() cloning_owner_id = 'cloning_user' + self.id() diff --git a/product/ERP5SyncML/tests/testERP5DocumentSyncML.py b/product/ERP5SyncML/tests/testERP5DocumentSyncML.py index 113c7fd94c..3e7cc985cb 100644 --- a/product/ERP5SyncML/tests/testERP5DocumentSyncML.py +++ b/product/ERP5SyncML/tests/testERP5DocumentSyncML.py @@ -327,12 +327,12 @@ class TestERP5DocumentSyncMLMixin(TestERP5SyncMLMixin): # Check for each signature that the tempXML is None for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): for m in sub.contentValues(): - self.assertEquals(m.getTemporaryData(), None) - self.assertEquals(m.getPartialData(), None) + self.assertEqual(m.getTemporaryData(), None) + self.assertEqual(m.getPartialData(), None) for pub in portal_sync.contentValues(portal_type='SyncML Publication'): for sub in pub.contentValues(portal_type='SyncML Subscription'): for m in sub.contentValues(): - self.assertEquals(m.getPartialData(), None) + self.assertEqual(m.getPartialData(), None) def checkFirstSynchronization(self, nb_document=0): @@ -347,13 +347,13 @@ class TestERP5DocumentSyncMLMixin(TestERP5SyncMLMixin): self.assertEqual(doc1_s.getVersion(), self.version1) self.assertEqual(doc1_s.getLanguage(), self.language1) self.assertEqual(doc1_s.getFilename(), self.filename_text) - self.assertEquals(self.size_filename_text, doc1_s.get_size()) + self.assertEqual(self.size_filename_text, doc1_s.get_size()) doc2_s = document_server._getOb(self.id2) self.assertEqual(doc2_s.getReference(), self.reference2) self.assertEqual(doc2_s.getVersion(), self.version2) self.assertEqual(doc2_s.getLanguage(), self.language2) self.assertEqual(doc2_s.getFilename(), self.filename_pdf) - self.assertEquals(self.size_filename_pdf, doc2_s.get_size()) + self.assertEqual(self.size_filename_pdf, doc2_s.get_size()) document_client1 = self.getDocumentClient1() document_c = document_client1._getOb(self.id1) self.assertEqual(document_c.getId(), self.id1) @@ -361,7 +361,7 @@ class TestERP5DocumentSyncMLMixin(TestERP5SyncMLMixin): self.assertEqual(document_c.getVersion(), self.version1) self.assertEqual(document_c.getLanguage(), self.language1) self.assertEqual(document_c.getFilename(), self.filename_text) - self.assertEquals(self.size_filename_text, document_c.get_size()) + self.assertEqual(self.size_filename_text, document_c.get_size()) self.assertXMLViewIsEqual(self.sub_id1, doc1_s, document_c) self.assertXMLViewIsEqual(self.sub_id1, doc2_s, document_client1._getOb(self.id2)) @@ -381,7 +381,7 @@ class TestERP5DocumentSyncMLMixin(TestERP5SyncMLMixin): self.assertEqual(document.getDescription(), description) if filename is not None: self.assertEqual(document.getFilename(), filename) - self.assertEquals(size_filename, document.get_size()) + self.assertEqual(size_filename, document.get_size()) else: self.fail("Document is None to check this information") @@ -446,12 +446,12 @@ class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin): nb_document = self.createDocumentServerList() portal_sync = self.getSynchronizationTool() for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') # Synchronize the first client nb_message1 = self.synchronize(self.sub_id1) for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') self.assertEqual(nb_message1, self.nb_message_first_synchronization) self.checkSynchronizationStateIsSynchronized() self.checkFirstSynchronization(nb_document=nb_document) @@ -478,7 +478,7 @@ class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin): self.assertEqual(document_s.getLanguage(), self.language3) self.assertEqual(document_s.getVersion(), self.version3) self.assertEqual(document_c.getFilename(), self.filename_text) - self.assertEquals(self.size_filename_text, document_c.get_size()) + self.assertEqual(self.size_filename_text, document_c.get_size()) self.assertXMLViewIsEqual(self.sub_id1, document_s, document_c) # Then we do only modification on a client (the gid) of client => add a object kw = {'reference':self.reference1,'version':self.version3} @@ -493,7 +493,7 @@ class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin): self.assertEqual(document_s.getLanguage(), self.language3) self.assertEqual(document_s.getVersion(), self.version3) self.assertEqual(document_c.getFilename(), self.filename_odt) - self.assertEquals(self.size_filename_odt, document_c.get_size()) + self.assertEqual(self.size_filename_odt, document_c.get_size()) self.assertXMLViewIsEqual(self.sub_id1, document_s, document_c) # Then we do only modification the field (useless for the gid) # on both the client and the server and of course, on the same object @@ -538,7 +538,7 @@ class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin): self.synchronize(self.sub_id1) # It has transmitted some object for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') self.checkSynchronizationStateIsSynchronized() self.checkFirstSynchronizationWithMultiDocument(nb_document=nb_document) @@ -740,7 +740,7 @@ class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin): self.assertEqual(document_c1.getShortTitle(), self.short_title3) self.assertEqual(document_c1.getFilename(), self.filename_ppt) #XXX Error in convert XML - #self.assertEquals(self.size_filename_text, document_c1.get_size()) + #self.assertEqual(self.size_filename_text, document_c1.get_size()) document_s = document_server._getOb(self.id1) self.assertXMLViewIsEqual(self.sub_id1, document_s, document_c1, ignore_processing_status_workflow=True) @@ -774,7 +774,7 @@ class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin): self.assertEqual(document_s.getReference(), self.reference1) self.assertEqual(document_s.getLanguage(), self.language1) self.assertEqual(document_s.getFilename(), self.filename_text) - self.assertEquals(self.size_filename_text, document_c.get_size()) + self.assertEqual(self.size_filename_text, document_c.get_size()) self.assertXMLViewIsEqual(self.sub_id1, document_s, document_c) finally: SyncMLSubscription.MAX_LEN = previous_max_lines @@ -806,13 +806,13 @@ class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin): nb_document = self.createDocumentServerList(one_way=True) portal_sync = self.getSynchronizationTool() sub_from_server = portal_sync[self.sub_id_from_server] - self.assertEquals(sub_from_server.getSyncmlAlertCode(), 'one_way_from_server') + self.assertEqual(sub_from_server.getSyncmlAlertCode(), 'one_way_from_server') # First do the sync from the server to the client nb_message1 = self.synchronize(self.sub_id_from_server) sub_from_server = portal_sync[self.sub_id_from_server] - self.assertEquals(sub_from_server.getSyncmlAlertCode(), 'one_way_from_server') - self.assertEquals(nb_message1, self.nb_message_first_synchronization) - self.assertEquals(len(sub_from_server.getDocumentList()), nb_document) + self.assertEqual(sub_from_server.getSyncmlAlertCode(), 'one_way_from_server') + self.assertEqual(nb_message1, self.nb_message_first_synchronization) + self.assertEqual(len(sub_from_server.getDocumentList()), nb_document) document_server = self.getDocumentServer() # We also check we don't # modify initial ob document_s = document_server._getOb(self.id1) @@ -832,24 +832,24 @@ class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin): document_s.edit(**kw) self.tic() self.assertEqual(document_s.getFilename(), self.filename_text) - self.assertEquals(self.size_filename_text, document_s.get_size()) + self.assertEqual(self.size_filename_text, document_s.get_size()) nb_message1 = self.synchronize(self.sub_id_from_server) #In One_From_Server Sync not modify the first_name in client because any #datas client sent self.assertEqual(document_c.getFilename(), self.filename_odt) - self.assertEquals(self.size_filename_odt, document_c.get_size()) - self.assertEquals(document_c.getShortTitle(), self.short_title2) + self.assertEqual(self.size_filename_odt, document_c.get_size()) + self.assertEqual(document_c.getShortTitle(), self.short_title2) self.assertEqual(document_s.getFilename(), self.filename_text) - self.assertEquals(self.size_filename_text, document_s.get_size()) - self.assertEquals(document_s.getShortTitle(), self.short_title2) + self.assertEqual(self.size_filename_text, document_s.get_size()) + self.assertEqual(document_s.getShortTitle(), self.short_title2) #reset for refresh sync #after synchronize, the client object retrieve value of server self.resetSignaturePublicationAndSubscription() nb_message1 = self.synchronize(self.sub_id_from_server) self.assertEqual(document_c.getFilename(), self.filename_text) - self.assertEquals(self.size_filename_text, document_c.get_size()) - self.assertEquals(document_c.getShortTitle(), self.short_title2) + self.assertEqual(self.size_filename_text, document_c.get_size()) + self.assertEqual(document_c.getShortTitle(), self.short_title2) self.checkSynchronizationStateIsSynchronized() document_s = document_server._getOb(self.id1) document_c = document_client1._getOb(self.id1) diff --git a/product/ERP5SyncML/tests/testERP5SyncML.py b/product/ERP5SyncML/tests/testERP5SyncML.py index 5bba320ac7..dd0ba2ff19 100644 --- a/product/ERP5SyncML/tests/testERP5SyncML.py +++ b/product/ERP5SyncML/tests/testERP5SyncML.py @@ -172,7 +172,7 @@ class TestERP5SyncMLMixin(TestMixin): last_name=self.last_name2, description=self.description2) nb_person = len(person_server) - self.assertEquals(nb_person, 2) + self.assertEqual(nb_person, 2) return nb_person def populatePersonClient1(self): @@ -188,7 +188,7 @@ class TestERP5SyncMLMixin(TestMixin): description=self.description1) self.tic() nb_person = len(person_client) - self.assertEquals(nb_person, number_of_object) + self.assertEqual(nb_person, number_of_object) return nb_person def clearFiles(self): @@ -332,28 +332,28 @@ class TestERP5SyncMLMixin(TestMixin): for person in person_server.objectValues(): state_list = self.getSynchronizationState(person) for state in state_list: - self.assertEquals(state[1], 'no_conflict') + self.assertEqual(state[1], 'no_conflict') person_client1 = self.getPersonClient1() for person in person_client1.objectValues(): state_list = self.getSynchronizationState(person) for state in state_list: - self.assertEquals(state[1], 'no_conflict') + self.assertEqual(state[1], 'no_conflict') person_client2 = self.getPersonClient2() for person in person_client2.objectValues(): state_list = self.getSynchronizationState(person) for state in state_list: - self.assertEquals(state[1], 'no_conflict') + self.assertEqual(state[1], 'no_conflict') # Check for each signature that the tempXML is None for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): for m in sub.contentValues(): - self.assertEquals(m.getTemporaryData(), None) - self.assertEquals(m.getPartialData(), None) - self.assertEquals(m.getValidationState(), "no_conflict") + self.assertEqual(m.getTemporaryData(), None) + self.assertEqual(m.getPartialData(), None) + self.assertEqual(m.getValidationState(), "no_conflict") for pub in portal_sync.contentValues(portal_type='SyncML Publication'): for sub in pub.contentValues(portal_type='SyncML Subscription'): for m in sub.contentValues(): - self.assertEquals(m.getPartialData(), None) - self.assertEquals(m.getValidationState(), "no_conflict") + self.assertEqual(m.getPartialData(), None) + self.assertEqual(m.getValidationState(), "no_conflict") def verifyFirstNameAndLastNameAreNotSynchronized(self, first_name, last_name, person_server, person_client): @@ -362,32 +362,32 @@ class TestERP5SyncMLMixin(TestMixin): """ self.assertNotEqual(person_server.getFirstName(), first_name) self.assertNotEqual(person_server.getLastName(), last_name) - self.assertEquals(person_client.getFirstName(), first_name) - self.assertEquals(person_client.getLastName(), last_name) + self.assertEqual(person_client.getFirstName(), first_name) + self.assertEqual(person_client.getLastName(), last_name) def checkFirstSynchronization(self, id=None, nb_person=0): portal_sync = self.getSynchronizationTool() subscription1 = portal_sync[self.sub_id1] subscription2 = portal_sync[self.sub_id2] - self.assertEquals(len(subscription1.getDocumentList()), nb_person) + self.assertEqual(len(subscription1.getDocumentList()), nb_person) person_server = self.getPersonServer() # We also check we don't # modify initial ob person1_s = person_server._getOb(self.id1) - self.assertEquals(person1_s.getId(), self.id1) - self.assertEquals(person1_s.getFirstName(), self.first_name1) - self.assertEquals(person1_s.getLastName(), self.last_name1) + self.assertEqual(person1_s.getId(), self.id1) + self.assertEqual(person1_s.getFirstName(), self.first_name1) + self.assertEqual(person1_s.getLastName(), self.last_name1) person_client1 = self.getPersonClient1() person1_c = person_client1._getOb(id) - self.assertEquals(person1_c.getId(), id) - self.assertEquals(person1_c.getFirstName(), self.first_name1) - self.assertEquals(person1_c.getLastName(), self.last_name1) - self.assertEquals(len(subscription2.getDocumentList()), nb_person) + self.assertEqual(person1_c.getId(), id) + self.assertEqual(person1_c.getFirstName(), self.first_name1) + self.assertEqual(person1_c.getLastName(), self.last_name1) + self.assertEqual(len(subscription2.getDocumentList()), nb_person) person_client2 = self.getPersonClient2() person2_c = person_client2._getOb(id) - self.assertEquals(person2_c.getId(), id) - self.assertEquals(person2_c.getFirstName(), self.first_name1) - self.assertEquals(person2_c.getLastName(), self.last_name1) + self.assertEqual(person2_c.getId(), id) + self.assertEqual(person2_c.getFirstName(), self.first_name1) + self.assertEqual(person2_c.getLastName(), self.last_name1) def resetSignaturePublicationAndSubscription(self): portal_sync = self.getSynchronizationTool() @@ -407,7 +407,7 @@ class TestERP5SyncMLMixin(TestMixin): publication = portal_sync[self.pub_id] gid_pub = publication.getGidFromObject(object_pub) gid_sub = publication.getGidFromObject(object_sub) - self.assertEquals(gid_pub, gid_sub) + self.assertEqual(gid_pub, gid_sub) conduit = getConduitByName(publication.getConduitModuleId()) xml_pub = conduit.getXMLFromObjectWithGid(object=object_pub, gid=gid_pub, xml_mapping=publication.getXmlBindingGeneratorMethodId()) @@ -489,19 +489,19 @@ class TestERP5SyncML(TestERP5SyncMLMixin): if person.getId()==self.id1: state_list = self.getSynchronizationState(person) for state in state_list: - self.assertEquals(state[1], 'conflict') + self.assertEqual(state[1], 'conflict') person_client1 = self.getPersonClient1() for person in person_client1.objectValues(): if person.getId()==self.id1: state_list = self.getSynchronizationState(person) for state in state_list: - self.assertEquals(state[1], 'conflict') + self.assertEqual(state[1], 'conflict') person_client2 = self.getPersonClient2() for person in person_client2.objectValues(): if person.getId()==self.id1: state_list = self.getSynchronizationState(person) for state in state_list: - self.assertEquals(state[1], 'conflict') + self.assertEqual(state[1], 'conflict') # make sure sub object are also in a conflict mode person = person_client1._getOb(self.id1) # use a temp_object to create a no persistent object in person @@ -509,7 +509,7 @@ class TestERP5SyncML(TestERP5SyncMLMixin): person.newContent(id=self.id1, portal_type='Person', temp_object=1) state_list = self.getSynchronizationState(sub_person) for state in state_list: - self.assertEquals(state[1], 'conflict') + self.assertEqual(state[1], 'conflict') def populatePersonServerWithSubObject(self): """ @@ -538,9 +538,9 @@ class TestERP5SyncML(TestERP5SyncMLMixin): sub_sub_person2.edit(**kw) # remove ('','portal...','person_server') len_path = len(sub_sub_person1.getPhysicalPath()) - 3 - self.assertEquals(len_path, 3) + self.assertEqual(len_path, 3) len_path = len(sub_sub_person2.getPhysicalPath()) - 3 - self.assertEquals(len_path, 3) + self.assertEqual(len_path, 3) def addAuthenticationToPublication(self, publication_id, login, password, auth_format, auth_type): @@ -573,9 +573,9 @@ class TestERP5SyncML(TestERP5SyncMLMixin): def test_01_HasEverything(self): # Test if portal_synchronizations was created self.assertNotEqual(self.getSynchronizationTool(), None) - #self.failUnless(self.getPersonServer()!=None) - #self.failUnless(self.getPersonClient1()!=None) - #self.failUnless(self.getPersonClient2()!=None) + #self.assertTrue(self.getPersonServer()!=None) + #self.assertTrue(self.getPersonClient1()!=None) + #self.assertTrue(self.getPersonClient2()!=None) def addPublication(self): portal_sync = self.getSynchronizationTool() @@ -647,7 +647,7 @@ class TestERP5SyncML(TestERP5SyncMLMixin): self.setupPublicationAndSubscription() portal_sync = self.getSynchronizationTool() synchronization_list = portal_sync.objectValues() - self.assertEquals(len(synchronization_list), self.nb_synchronization) + self.assertEqual(len(synchronization_list), self.nb_synchronization) def test_06_getDocumentList(self): """ @@ -663,7 +663,7 @@ class TestERP5SyncML(TestERP5SyncMLMixin): portal_type='SyncML Publication') publication = publication_list[0] object_list = publication.getDocumentList() - self.assertEquals(len(object_list), nb_person) + self.assertEqual(len(object_list), nb_person) # now try to set a different method for query method_id = 'PersonServer_getDocumentList' ## add test cached method @@ -677,11 +677,11 @@ return [context[%r]] py_script_obj.ZPythonScript_edit(py_script_params, py_script_body) publication.setListMethodId(method_id) object_list = publication.getDocumentList() - self.assertEquals(len(object_list), 1) + self.assertEqual(len(object_list), 1) # Add the query path publication.setListMethodId('person_server/objectValues') object_list = publication.getDocumentList() - self.assertEquals(len(object_list), nb_person) + self.assertEqual(len(object_list), nb_person) def test_07_ExportImport(self): """ @@ -697,9 +697,9 @@ return [context[%r]] conduit = ERP5Conduit() conduit.addNode(object=person_client1, xml=xml_output) new_object = person_client1._getOb(self.id1) - self.assertEquals(new_object.getLastName(), self.last_name1) - self.assertEquals(new_object.getFirstName(), self.first_name1) - self.assertEquals(person.asXML(), new_object.asXML()) + self.assertEqual(new_object.getLastName(), self.last_name1) + self.assertEqual(new_object.getFirstName(), self.first_name1) + self.assertEqual(person.asXML(), new_object.asXML()) def test_08_FirstSynchronization(self): # We will try to populate the folder person_client1 @@ -709,20 +709,20 @@ return [context[%r]] nb_person = self.populatePersonServer() portal_sync = self.getSynchronizationTool() for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') # Synchronize the first client nb_message1 = self.synchronize(self.sub_id1) for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): if sub.getTitle() == self.sub_id1: - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') else: - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') - self.assertEquals(nb_message1, self.nb_message_first_synchronization) + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(nb_message1, self.nb_message_first_synchronization) # Synchronize the second client nb_message2 = self.synchronize(self.sub_id2) for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') - self.assertEquals(nb_message2, self.nb_message_first_synchronization) + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(nb_message2, self.nb_message_first_synchronization) self.checkFirstSynchronization(id=self.id1, nb_person=nb_person) def test_09_FirstSynchronizationWithLongLines(self): @@ -738,13 +738,13 @@ return [context[%r]] person1_s.edit(**kw) # Synchronize the first client nb_message1 = self.synchronize(self.sub_id1) - self.assertEquals(nb_message1, self.nb_message_first_synchronization) + self.assertEqual(nb_message1, self.nb_message_first_synchronization) portal_sync = self.getSynchronizationTool() subscription1 = portal_sync[self.sub_id1] - self.assertEquals(len(subscription1.getDocumentList()), nb_person) - self.assertEquals(person1_s.getId(), self.id1) - self.assertEquals(person1_s.getFirstName(), long_line) - self.assertEquals(person1_s.getLastName(), self.last_name1) + self.assertEqual(len(subscription1.getDocumentList()), nb_person) + self.assertEqual(person1_s.getId(), self.id1) + self.assertEqual(person1_s.getFirstName(), long_line) + self.assertEqual(person1_s.getLastName(), self.last_name1) person_client1 = self.getPersonClient1() person1_c = person_client1._getOb(self.id1) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) @@ -756,12 +756,12 @@ return [context[%r]] person_server = self.getPersonServer() person1_s = person_server._getOb(self.id1) state_list_s = self.getSynchronizationState(person1_s) - self.assertEquals(len(state_list_s), self.nb_subscription) # one state + self.assertEqual(len(state_list_s), self.nb_subscription) # one state # for each subscriber person_client1 = self.getPersonClient1() person1_c = person_client1._getOb(self.id1) state_list_c = self.getSynchronizationState(person1_c) - self.assertEquals(len(state_list_c), 1) # one state + self.assertEqual(len(state_list_c), 1) # one state # for each subscriber self.checkSynchronizationStateIsSynchronized() @@ -776,8 +776,8 @@ return [context[%r]] self.checkSynchronizationStateIsSynchronized() person_client1 = self.getPersonClient1() person1_c = person_client1._getOb(self.id1) - self.assertEquals(person1_s.getFirstName(), self.first_name3) - self.assertEquals(person1_s.getLastName(), self.last_name3) + self.assertEqual(person1_s.getFirstName(), self.first_name3) + self.assertEqual(person1_s.getLastName(), self.last_name3) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) # Then we do only modification on a client kw = {'first_name':self.first_name1,'last_name':self.last_name1} @@ -788,8 +788,8 @@ return [context[%r]] self.synchronize(self.sub_id1) self.checkSynchronizationStateIsSynchronized() person1_s = person_server._getOb(self.id1) - self.assertEquals(person1_s.getFirstName(), self.first_name1) - self.assertEquals(person1_s.getLastName(), self.last_name1) + self.assertEqual(person1_s.getFirstName(), self.first_name1) + self.assertEqual(person1_s.getLastName(), self.last_name1) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) # Then we do only modification on both the client and the server # and of course, on the same object @@ -800,8 +800,8 @@ return [context[%r]] self.synchronize(self.sub_id1) self.checkSynchronizationStateIsSynchronized() #person1_s = person_server._getOb(self.id1) - self.assertEquals(person1_s.getFirstName(), self.first_name3) - self.assertEquals(person1_s.getDescription(), self.description3) + self.assertEqual(person1_s.getFirstName(), self.first_name3) + self.assertEqual(person1_s.getDescription(), self.description3) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) def test_13_GetConflictList(self): @@ -818,15 +818,15 @@ return [context[%r]] person1_c.setDescription(self.description3) self.synchronize(self.sub_id1) conflict_list = portal_sync.getConflictList() - self.assertEquals(len(conflict_list), 1) + self.assertEqual(len(conflict_list), 1) conflict = conflict_list[0] - self.assertEquals(person1_c.getDescription(), self.description3) - self.assertEquals(person1_s.getDescription(), self.description2) - self.assertEquals(conflict.getPropertyId(), 'description') - self.assertEquals(conflict.getLocalValue(), self.description2) - self.assertEquals(conflict.getRemoteValue(), self.description3) + self.assertEqual(person1_c.getDescription(), self.description3) + self.assertEqual(person1_s.getDescription(), self.description2) + self.assertEqual(conflict.getPropertyId(), 'description') + self.assertEqual(conflict.getLocalValue(), self.description2) + self.assertEqual(conflict.getRemoteValue(), self.description3) subscriber = conflict.getSubscriber() - self.assertEquals(subscriber.getUrlString(), self.subscription_url1) + self.assertEqual(subscriber.getUrlString(), self.subscription_url1) def test_14_GetPublisherAndSubscriberDocument(self): # We will try to generate a conflict and then to get it @@ -837,9 +837,9 @@ return [context[%r]] conflict_list = portal_sync.getConflictList() conflict = conflict_list[0] publisher_document = conflict.getPublisherDocument() - self.assertEquals(publisher_document.getDescription(), self.description2) + self.assertEqual(publisher_document.getDescription(), self.description2) subscriber_document = conflict.getSubscriberDocument() - self.assertEquals(subscriber_document.getDescription(), self.description3) + self.assertEqual(subscriber_document.getDescription(), self.description3) def test_15_ApplyPublisherValue(self): # We will try to generate a conflict and then to get it @@ -855,10 +855,10 @@ return [context[%r]] conflict.applyPublisherValue() self.synchronize(self.sub_id1) self.checkSynchronizationStateIsSynchronized() - self.assertEquals(person1_c.getDescription(), self.description2) + self.assertEqual(person1_c.getDescription(), self.description2) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) conflict_list = portal_sync.getConflictList() - self.assertEquals(len(conflict_list), 0) + self.assertEqual(len(conflict_list), 0) def test_16_ApplySubscriberValue(self): # We will try to generate a conflict and then to get it @@ -874,10 +874,10 @@ return [context[%r]] conflict.applySubscriberValue() self.synchronize(self.sub_id1) self.checkSynchronizationStateIsSynchronized() - self.assertEquals(person1_s.getDescription(), self.description3) + self.assertEqual(person1_s.getDescription(), self.description3) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) conflict_list = portal_sync.getConflictList() - self.assertEquals(len(conflict_list), 0) + self.assertEqual(len(conflict_list), 0) def test_17_AddSubObject(self): """ @@ -897,16 +897,16 @@ return [context[%r]] sub_sub_person2 = sub_person1_c._getOb(self.id2) # remove ('','portal...','person_server') len_path = len(sub_sub_person1.getPhysicalPath()) - 3 - self.assertEquals(len_path, 3) + self.assertEqual(len_path, 3) len_path = len(sub_sub_person2.getPhysicalPath()) - 3 - self.assertEquals(len_path, 3) - self.assertEquals(sub_sub_person1.getDescription(), self.description1) - self.assertEquals(sub_sub_person1.getFirstName(), self.first_name1) - self.assertEquals(sub_sub_person1.getLastName(), self.last_name1) - self.assertEquals(sub_sub_person1.getDefaultTelephoneText(), '+(0)-0689778308') - self.assertEquals(sub_sub_person2.getDescription(), self.description2) - self.assertEquals(sub_sub_person2.getFirstName(), self.first_name2) - self.assertEquals(sub_sub_person2.getLastName(), self.last_name2) + self.assertEqual(len_path, 3) + self.assertEqual(sub_sub_person1.getDescription(), self.description1) + self.assertEqual(sub_sub_person1.getFirstName(), self.first_name1) + self.assertEqual(sub_sub_person1.getLastName(), self.last_name1) + self.assertEqual(sub_sub_person1.getDefaultTelephoneText(), '+(0)-0689778308') + self.assertEqual(sub_sub_person2.getDescription(), self.description2) + self.assertEqual(sub_sub_person2.getFirstName(), self.first_name2) + self.assertEqual(sub_sub_person2.getLastName(), self.last_name2) #check two side (client, server) person_server = self.getPersonServer() sub_sub_person_s = person_server._getOb(self.id1)._getOb(self.id1)._getOb(self.id1) @@ -936,8 +936,8 @@ return [context[%r]] # refresh objects after synchronization sub_sub_person_c = sub_person1_c._getOb(self.id2) sub_sub_person_s = person_server._getOb(self.id1)._getOb(self.id1)._getOb(self.id2) - #self.assertEquals(sub_sub_person_c.getDescription(), self.description3) - #self.assertEquals(sub_sub_person_c.getFirstName(), self.first_name3) + #self.assertEqual(sub_sub_person_c.getDescription(), self.description3) + #self.assertEqual(sub_sub_person_c.getFirstName(), self.first_name3) self.assertXMLViewIsEqual(self.sub_id1, sub_sub_person_s, sub_sub_person_c) def test_19_DeleteObject(self): @@ -958,9 +958,9 @@ return [context[%r]] publication = portal_sync[self.pub_id] subscription1 = portal_sync[self.sub_id1] subscription2 = portal_sync[self.sub_id2] - self.assertEquals(len(publication.getDocumentList()), 0) - self.assertEquals(len(subscription1.getDocumentList()), 0) - self.assertEquals(len(subscription2.getDocumentList()), 0) + self.assertEqual(len(publication.getDocumentList()), 0) + self.assertEqual(len(subscription1.getDocumentList()), 0) + self.assertEqual(len(subscription2.getDocumentList()), 0) def test_20_DeleteSubObject(self): """ @@ -1016,13 +1016,13 @@ return [context[%r]] self.synchronize(self.sub_id1) portal_sync = self.getSynchronizationTool() conflict_list = portal_sync.getConflictList() - self.assertEquals(len(conflict_list), 2) + self.assertEqual(len(conflict_list), 2) conflict_list = portal_sync.getConflictList(sub_object_c1) - self.assertEquals(len(conflict_list), 0) + self.assertEqual(len(conflict_list), 0) conflict_list = portal_sync.getConflictList(object_s) - self.assertEquals(len(conflict_list), 0) + self.assertEqual(len(conflict_list), 0) conflict_list = portal_sync.getConflictList(sub_object_s) - self.assertEquals(len(conflict_list), 2) + self.assertEqual(len(conflict_list), 2) def test_22_ApplyPublisherDocumentOnSubObject(self): """ @@ -1043,8 +1043,8 @@ return [context[%r]] self.synchronize(self.sub_id1) self.synchronize(self.sub_id2) self.checkSynchronizationStateIsSynchronized() - self.assertEquals(sub_object_s.getDescription(), self.description2) - self.assertEquals(sub_object_s.getLanguage(), self.lang2) + self.assertEqual(sub_object_s.getDescription(), self.description2) + self.assertEqual(sub_object_s.getLanguage(), self.lang2) self.assertXMLViewIsEqual(self.sub_id1, sub_object_s, sub_object_c1) self.assertXMLViewIsEqual(self.sub_id2, sub_object_s, sub_object_c2) @@ -1071,8 +1071,8 @@ return [context[%r]] sub_object_s = person_server._getOb(self.id1)._getOb(self.id1) sub_object_c1 = person_client1._getOb(self.id1)._getOb(self.id1) sub_object_c2 = person_client2._getOb(self.id1)._getOb(self.id1) - #self.assertEquals(sub_object_s.getDescription(), self.description3) - #self.assertEquals(sub_object_s.getLanguage(), self.lang3) + #self.assertEqual(sub_object_s.getDescription(), self.description3) + #self.assertEqual(sub_object_s.getLanguage(), self.lang3) self.assertXMLViewIsEqual(self.sub_id1, sub_object_s, sub_object_c1) self.assertXMLViewIsEqual(self.sub_id2, sub_object_s, sub_object_c2) @@ -1090,32 +1090,32 @@ return [context[%r]] self.checkSynchronizationStateIsSynchronized() portal_sync = self.getSynchronizationTool() subscription1 = portal_sync[self.sub_id1] - self.assertEquals(len(subscription1.getDocumentList()), nb_person) + self.assertEqual(len(subscription1.getDocumentList()), nb_person) publication = portal_sync[self.pub_id] - self.assertEquals(len(publication.getDocumentList()), nb_person) + self.assertEqual(len(publication.getDocumentList()), nb_person) gid = self.first_name1 + ' ' + self.last_name1 # ie the title 'Sebastien Robin' gid = b16encode(gid) person_c1 = subscription1.getDocumentFromGid(gid) person_s = publication.getSubscriber(self.subscription_url1).getDocumentFromGid(gid) id_s = person_s.getId() - self.assertEquals(id_s, self.id1) + self.assertEqual(id_s, self.id1) # This will test updating object person_s.setDescription(self.description3) self.synchronize(self.sub_id1) self.checkSynchronizationStateIsSynchronized() - self.assertEquals(person_s.getDescription(), self.description3) - self.assertEquals(person_c1.getDescription(), self.description3) + self.assertEqual(person_s.getDescription(), self.description3) + self.assertEqual(person_c1.getDescription(), self.description3) self.assertXMLViewIsEqual(self.sub_id1, person_s, person_c1) # This will test deleting object person_server = self.getPersonServer() person_server.manage_delObjects(self.id2) self.synchronize(self.sub_id1) self.checkSynchronizationStateIsSynchronized() - self.assertEquals(len(subscription1.getDocumentList()), (nb_person-1)) - self.assertEquals(len(publication.getDocumentList()), (nb_person-1)) + self.assertEqual(len(subscription1.getDocumentList()), (nb_person-1)) + self.assertEqual(len(publication.getDocumentList()), (nb_person-1)) person_s = publication.getSubscriber(self.subscription_url1).getDocumentFromGid(gid) person_c1 = subscription1.getDocumentFromGid(gid) - self.assertEquals(person_s.getDescription(), self.description3) + self.assertEqual(person_s.getDescription(), self.description3) self.assertXMLViewIsEqual(self.sub_id1, person_s, person_c1) def test_25_MultiNodeConflict(self): @@ -1143,7 +1143,7 @@ return [context[%r]] self.synchronize(self.sub_id1) self.synchronize(self.sub_id2) conflict_list = portal_sync.getConflictList() - self.assertEquals(len(conflict_list), 6) + self.assertEqual(len(conflict_list), 6) # check if we have the state conflict on all clients self.checkSynchronizationStateIsConflict() # we will take : @@ -1168,12 +1168,12 @@ return [context[%r]] self.synchronize(self.sub_id1) self.synchronize(self.sub_id2) self.checkSynchronizationStateIsSynchronized() - self.assertEquals(person1_c1.getDescription(), self.description2) - self.assertEquals(person1_c1.getLanguage(), self.lang3) - self.assertEquals(person1_c1.getFormat(), self.format4) - self.assertEquals(person1_s.getDescription(), self.description2) - self.assertEquals(person1_s.getLanguage(), self.lang3) - self.assertEquals(person1_s.getFormat(), self.format4) + self.assertEqual(person1_c1.getDescription(), self.description2) + self.assertEqual(person1_c1.getLanguage(), self.lang3) + self.assertEqual(person1_c1.getFormat(), self.format4) + self.assertEqual(person1_s.getDescription(), self.description2) + self.assertEqual(person1_s.getLanguage(), self.lang3) + self.assertEqual(person1_s.getFormat(), self.format4) self.assertXMLViewIsEqual(self.sub_id2, person1_s, person1_c2) # the workflow has one more "edit_workflow" in person1_c1 self.synchronize(self.sub_id1) @@ -1211,8 +1211,8 @@ return [context[%r]] role_2_s = person2_s.get_local_roles() role_1_c = person1_c.get_local_roles() role_2_c = person2_c.get_local_roles() - self.assertEquals(role_1_s,role_1_c) - self.assertEquals(role_2_s,role_2_c) + self.assertEqual(role_1_s,role_1_c) + self.assertEqual(role_2_s,role_2_c) def test_28_PartialData(self): """ @@ -1237,15 +1237,15 @@ return [context[%r]] sub_sub_person2 = sub_person1_c._getOb(self.id2) # remove ('','portal...','person_server') len_path = len(sub_sub_person1.getPhysicalPath()) - 3 - self.assertEquals(len_path, 3) + self.assertEqual(len_path, 3) len_path = len(sub_sub_person2.getPhysicalPath()) - 3 - self.assertEquals(len_path, 3) - self.assertEquals(sub_sub_person1.getDescription(),self.description1) - self.assertEquals(sub_sub_person1.getFirstName(),self.first_name1) - self.assertEquals(sub_sub_person1.getLastName(),self.last_name1) - self.assertEquals(sub_sub_person2.getDescription(),self.description2) - self.assertEquals(sub_sub_person2.getFirstName(),self.first_name2) - self.assertEquals(sub_sub_person2.getLastName(),self.last_name2) + self.assertEqual(len_path, 3) + self.assertEqual(sub_sub_person1.getDescription(),self.description1) + self.assertEqual(sub_sub_person1.getFirstName(),self.first_name1) + self.assertEqual(sub_sub_person1.getLastName(),self.last_name1) + self.assertEqual(sub_sub_person2.getDescription(),self.description2) + self.assertEqual(sub_sub_person2.getFirstName(),self.first_name2) + self.assertEqual(sub_sub_person2.getLastName(),self.last_name2) finally: SyncMLSubscription.MAX_LEN = previous_max_lines @@ -1272,15 +1272,15 @@ return [context[%r]] self.synchronizeWithBrokenMessage(self.sub_id1) portal_sync = self.getSynchronizationTool() subscription1 = portal_sync[self.sub_id1] - self.assertEquals(len(subscription1.getDocumentList()), nb_person) + self.assertEqual(len(subscription1.getDocumentList()), nb_person) person_server = self.getPersonServer() # We also check we don't # modify initial ob person1_s = person_server._getOb(self.id1) person_client1 = self.getPersonClient1() person1_c = person_client1._getOb(self.id1) - self.assertEquals(person1_s.getId(), self.id1) - self.assertEquals(person1_s.getFirstName(), self.first_name1) - self.assertEquals(person1_s.getLastName(), self.last_name1) + self.assertEqual(person1_s.getId(), self.id1) + self.assertEqual(person1_s.getFirstName(), self.first_name1) + self.assertEqual(person1_s.getLastName(), self.last_name1) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) finally: SyncMLConstant.MAX_LEN = previous_max_lines @@ -1296,7 +1296,7 @@ return [context[%r]] # is TWO WAY portal_sync = self.getSynchronizationTool() for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') person_server = self.getPersonServer() person1_s = person_server._getOb(self.id1) kw = {'first_name':self.first_name3,'last_name':self.last_name3} @@ -1311,7 +1311,7 @@ return [context[%r]] self.synchronize(self.sub_id1) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') # Then we do only modification on both the client and the server # and of course, on the same object kw = {'first_name':self.first_name3} @@ -1321,7 +1321,7 @@ return [context[%r]] self.synchronize(self.sub_id1) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') def test_31_UpdateLocalPermission(self): """ @@ -1352,8 +1352,8 @@ return [context[%r]] role_2_s = person2_s.get_local_permissions() role_1_c = person1_c.get_local_permissions() role_2_c = person2_c.get_local_permissions() - self.assertEquals(role_1_s, role_1_c) - self.assertEquals(role_2_s, role_2_c) + self.assertEqual(role_1_s, role_1_c) + self.assertEqual(role_2_s, role_2_c) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) self.assertXMLViewIsEqual(self.sub_id2, person2_s, person2_c) person1_s.manage_setLocalPermissions('View', ['Owner']) @@ -1372,8 +1372,8 @@ return [context[%r]] role_2_s = person2_s.get_local_permissions() role_1_c = person1_c.get_local_permissions() role_2_c = person2_c.get_local_permissions() - self.assertEquals(role_1_s, role_1_c) - self.assertEquals(role_2_s, role_2_c) + self.assertEqual(role_1_s, role_1_c) + self.assertEqual(role_2_s, role_2_c) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) self.assertXMLViewIsEqual(self.sub_id2, person2_s, person2_c) @@ -1421,23 +1421,23 @@ return [context[%r]] nb_person = self.populatePersonServer() portal_sync = self.getSynchronizationTool() for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'one_way_from_server') + self.assertEqual(sub.getSyncmlAlertCode(), 'one_way_from_server') # First do the sync from the server to the client nb_message1 = self.synchronize(self.sub_id1) for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'one_way_from_server') - self.assertEquals(nb_message1, self.nb_message_first_synchronization) + self.assertEqual(sub.getSyncmlAlertCode(), 'one_way_from_server') + self.assertEqual(nb_message1, self.nb_message_first_synchronization) subscription1 = portal_sync[self.sub_id1] - self.assertEquals(len(subscription1.getDocumentList()), nb_person) + self.assertEqual(len(subscription1.getDocumentList()), nb_person) person_server = self.getPersonServer() # We also check we don't # modify initial ob person1_s = person_server._getOb(self.id1) person_client1 = self.getPersonClient1() person1_c = person_client1._getOb(self.id1) - self.assertEquals(person1_s.getId(), self.id1) - self.assertEquals(person1_s.getFirstName(), self.first_name1) - self.assertEquals(person1_s.getLastName(), self.last_name1) - self.assertEquals(person1_c.getLastName(), self.last_name1) + self.assertEqual(person1_s.getId(), self.id1) + self.assertEqual(person1_s.getFirstName(), self.first_name1) + self.assertEqual(person1_s.getLastName(), self.last_name1) + self.assertEqual(person1_c.getLastName(), self.last_name1) self.checkSynchronizationStateIsSynchronized() self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c, force=1) # Then we change things on both sides and we look if there @@ -1447,10 +1447,10 @@ return [context[%r]] nb_message1 = self.synchronize(self.sub_id1) # In One_From_Server Sync mode, first_name of object on client side # doesn't change because no data is send from Subscription - self.assertEquals(person1_c.getFirstName(), self.first_name2) - self.assertEquals(person1_c.getLastName(), self.last_name2) - self.assertEquals(person1_s.getFirstName(), self.first_name1) - self.assertEquals(person1_s.getLastName(), self.last_name2) + self.assertEqual(person1_c.getFirstName(), self.first_name2) + self.assertEqual(person1_c.getLastName(), self.last_name2) + self.assertEqual(person1_s.getFirstName(), self.first_name1) + self.assertEqual(person1_s.getLastName(), self.last_name2) #reset for refresh sync #after synchronize, the client object retrieve value of server self.resetSignaturePublicationAndSubscription() @@ -1460,8 +1460,8 @@ return [context[%r]] person1_s = person_server._getOb(self.id1) person1_c = person_client1._getOb(self.id1) - self.assertEquals(person1_s.getFirstName(), self.first_name1) - self.assertEquals(person1_s.getLastName(), self.last_name2) + self.assertEqual(person1_s.getFirstName(), self.first_name1) + self.assertEqual(person1_s.getLastName(), self.last_name2) self.checkSynchronizationStateIsSynchronized() self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c, force=1) @@ -1507,22 +1507,22 @@ return [context[%r]] nb_person = self.populatePersonClient1() portal_sync = self.getSynchronizationTool() subscription1 = portal_sync[self.sub_id1] - self.assertEquals(subscription1.getSyncmlAlertCode(), 'one_way_from_client') + self.assertEqual(subscription1.getSyncmlAlertCode(), 'one_way_from_client') # First do the sync from the server to the client self.synchronize(self.sub_id1) - self.assertEquals(subscription1.getSyncmlAlertCode(), + self.assertEqual(subscription1.getSyncmlAlertCode(), 'one_way_from_client') - #self.assertEquals(nb_message1, self.nb_message_first_synchronization) - self.assertEquals(len(subscription1), nb_person) + #self.assertEqual(nb_message1, self.nb_message_first_synchronization) + self.assertEqual(len(subscription1), nb_person) client_person_module = self.getPersonClient1() # We also check we don't # modify initial ob object_id = '1' client_person = client_person_module._getOb(object_id) server_person_module = self.getPersonServer() server_person = server_person_module._getOb(object_id) - self.assertEquals(client_person.getId(), object_id) - self.assertEquals(client_person.getFirstName(), self.first_name1) - self.assertEquals(client_person.getLastName(), self.last_name1) + self.assertEqual(client_person.getId(), object_id) + self.assertEqual(client_person.getFirstName(), self.first_name1) + self.assertEqual(client_person.getLastName(), self.last_name1) self.checkSynchronizationStateIsSynchronized() self.assertXMLViewIsEqual(self.sub_id1, client_person, server_person, force=True) @@ -1539,11 +1539,11 @@ return [context[%r]] # Conflict is generated on title # But first name still is processed # so first name must be up to date - self.assertEquals(server_person.getFirstName(), self.first_name2) - self.assertEquals(server_person.getLastName(), self.last_name2) + self.assertEqual(server_person.getFirstName(), self.first_name2) + self.assertEqual(server_person.getLastName(), self.last_name2) # Client get no change from server as it is in one way from client - self.assertEquals(client_person.getFirstName(), self.first_name2) - self.assertEquals(client_person.getLastName(), self.last_name1) + self.assertEqual(client_person.getFirstName(), self.first_name2) + self.assertEqual(client_person.getLastName(), self.last_name1) # reset for refresh sync # after synchronization, the client retrieves value from server @@ -1554,10 +1554,10 @@ return [context[%r]] server_person = server_person_module._getOb(object_id) client_person = client_person_module._getOb(object_id) - self.assertEquals(server_person.getFirstName(), self.first_name2) - self.assertEquals(server_person.getLastName(), self.last_name1) - self.assertEquals(client_person.getFirstName(), self.first_name2) - self.assertEquals(client_person.getLastName(), self.last_name1) + self.assertEqual(server_person.getFirstName(), self.first_name2) + self.assertEqual(server_person.getLastName(), self.last_name1) + self.assertEqual(client_person.getFirstName(), self.first_name2) + self.assertEqual(client_person.getLastName(), self.last_name1) self.checkSynchronizationStateIsSynchronized() @@ -1602,19 +1602,19 @@ return [context[%r]] self.populatePersonClient1() portal_sync = self.getSynchronizationTool() subscription1 = portal_sync[self.sub_id1] - self.assertEquals(subscription1.getSyncmlAlertCode(), + self.assertEqual(subscription1.getSyncmlAlertCode(), 'refresh_from_client_only') # Execute first synchronization # data from client will be synced on server self.synchronize(self.sub_id1) - self.assertEquals(subscription1.getSyncmlAlertCode(), + self.assertEqual(subscription1.getSyncmlAlertCode(), 'refresh_from_client_only') # Check no signature created - self.assertEquals(len(subscription1), 0) + self.assertEqual(len(subscription1), 0) subscriber_list = publication.contentValues(portal_type="SyncML Subscription") - self.assertEquals(len(subscriber_list), 1) + self.assertEqual(len(subscriber_list), 1) subscriber = subscriber_list[0] - self.assertEquals(len(subscriber), 0) + self.assertEqual(len(subscriber), 0) # Check same person on client & server side client_person_module = self.getPersonClient1() @@ -1622,10 +1622,10 @@ return [context[%r]] for x in xrange(1, 61): client_person = client_person_module._getOb(str(x)) server_person = server_person_module._getOb(str(x)) - self.assertEquals(client_person.getFirstName(), self.first_name1) - self.assertEquals(client_person.getLastName(), self.last_name1) - self.assertEquals(server_person.getFirstName(), self.first_name1) - self.assertEquals(server_person.getLastName(), self.last_name1) + self.assertEqual(client_person.getFirstName(), self.first_name1) + self.assertEqual(client_person.getLastName(), self.last_name1) + self.assertEqual(server_person.getFirstName(), self.first_name1) + self.assertEqual(server_person.getLastName(), self.last_name1) self.assertXMLViewIsEqual(self.sub_id1, client_person, server_person, force=True) @@ -1639,16 +1639,16 @@ return [context[%r]] # Server modification will get ereased self.synchronize(self.sub_id1) # Check no signature created - self.assertEquals(len(subscription1), 0) - self.assertEquals(len(subscriber), 0) + self.assertEqual(len(subscription1), 0) + self.assertEqual(len(subscriber), 0) for x in xrange(1, 61): client_person = client_person_module._getOb(str(x)) server_person = server_person_module._getOb(str(x)) - self.assertEquals(client_person.getFirstName(), self.first_name2) - self.assertEquals(client_person.getDescription(), self.description1) - self.assertEquals(server_person.getFirstName(), self.first_name2) - self.assertEquals(server_person.getDescription(), self.description1) + self.assertEqual(client_person.getFirstName(), self.first_name2) + self.assertEqual(client_person.getDescription(), self.description1) + self.assertEqual(server_person.getFirstName(), self.first_name2) + self.assertEqual(server_person.getDescription(), self.description1) self.assertXMLViewIsEqual(self.sub_id1, client_person, server_person, force=True) # Modify same data of person on both side @@ -1659,19 +1659,19 @@ return [context[%r]] # Client modifications must win over server modifications self.synchronize(self.sub_id1) # Check no signature created - self.assertEquals(len(subscription1), 0) - self.assertEquals(len(subscriber), 0) + self.assertEqual(len(subscription1), 0) + self.assertEqual(len(subscriber), 0) for x in xrange(1, 61): client_person = client_person_module._getOb(str(x)) server_person = server_person_module._getOb(str(x)) - self.assertEquals(client_person.getLastName(), self.last_name2) - self.assertEquals(server_person.getLastName(), self.last_name2) + self.assertEqual(client_person.getLastName(), self.last_name2) + self.assertEqual(server_person.getLastName(), self.last_name2) # These property should not have changed - self.assertEquals(client_person.getFirstName(), self.first_name2) - self.assertEquals(client_person.getDescription(), self.description1) - self.assertEquals(server_person.getFirstName(), self.first_name2) - self.assertEquals(server_person.getDescription(), self.description1) + self.assertEqual(client_person.getFirstName(), self.first_name2) + self.assertEqual(client_person.getDescription(), self.description1) + self.assertEqual(server_person.getFirstName(), self.first_name2) + self.assertEqual(server_person.getDescription(), self.description1) self.assertXMLViewIsEqual(self.sub_id1, client_person, server_person, force=True) @@ -1699,36 +1699,36 @@ sdf\xc3\xa7\xc3\xa7\xc3\xa7_df___&&\xc3\xa9]]]\xc2\xb0\xc2\xb0\xc2\ SElKS0xNTk9QUVJTVFVWV1hZWsOpw6jDp8OgQF5+wrUmwrIwMTIzNDU2Nzg5IUAjMF4mKigpOzo8Pi\ wuIFtde33Dp3NkZl9fc2Rmw6fDp8OnX2RmX19fJibDqV1dXcKwwrDCsMKwwrDCsA==" #test just b64encode - self.assertEquals(b64encode(python), awaited_result_python) - self.assertEquals(b64encode(""), "") - self.assertEquals(b64encode(long_string), awaited_result_long_string) + self.assertEqual(b64encode(python), awaited_result_python) + self.assertEqual(b64encode(""), "") + self.assertEqual(b64encode(long_string), awaited_result_long_string) - self.assertEquals(b64decode(awaited_result_python), python) - self.assertEquals(b64decode(""), "") - self.assertEquals(b64decode(awaited_result_long_string), long_string) + self.assertEqual(b64decode(awaited_result_python), python) + self.assertEqual(b64decode(""), "") + self.assertEqual(b64decode(awaited_result_long_string), long_string) # test with the ERP5 functions string_encoded = encode('b64', python) - self.assertEquals(string_encoded, awaited_result_python) + self.assertEqual(string_encoded, awaited_result_python) string_decoded = decode('b64', awaited_result_python) - self.assertEquals(string_decoded, python) - self.failUnless(isDecodeEncodeTheSame(string_encoded, + self.assertEqual(string_decoded, python) + self.assertTrue(isDecodeEncodeTheSame(string_encoded, python, 'b64')) - self.failUnless(isDecodeEncodeTheSame(string_encoded, + self.assertTrue(isDecodeEncodeTheSame(string_encoded, string_decoded, 'b64')) string_encoded = encode('b64', long_string) - self.assertEquals(string_encoded, awaited_result_long_string) + self.assertEqual(string_encoded, awaited_result_long_string) string_decoded = decode('b64', awaited_result_long_string) - self.assertEquals(string_decoded, long_string) - self.failUnless(isDecodeEncodeTheSame(string_encoded, + self.assertEqual(string_decoded, long_string) + self.assertTrue(isDecodeEncodeTheSame(string_encoded, long_string, 'b64')) - self.failUnless(isDecodeEncodeTheSame(string_encoded, + self.assertTrue(isDecodeEncodeTheSame(string_encoded, string_decoded, 'b64')) - self.assertEquals(encode('b64', ''), '') - self.assertEquals(decode('b64', ''), '') - self.failUnless(isDecodeEncodeTheSame( + self.assertEqual(encode('b64', ''), '') + self.assertEqual(decode('b64', ''), '') + self.assertTrue(isDecodeEncodeTheSame( encode('b64', ''), '', 'b64')) def test_35_authentication(self): @@ -1759,8 +1759,8 @@ wuIFtde33Dp3NkZl9fc2Rmw6fDp8OnX2RmX19fJibDqV1dXcKwwrDCsMKwwrDCsA==" # now it should be synchronize self.checkSynchronizationStateIsSynchronized() self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) - self.assertEquals(person1_s.getFirstName(), self.first_name3) - self.assertEquals(person1_s.getLastName(), self.last_name3) + self.assertEqual(person1_s.getFirstName(), self.first_name3) + self.assertEqual(person1_s.getLastName(), self.last_name3) # adding diferent authentication parameter on pub/sub self.addAuthenticationToPublication(self.pub_id, 'fab', 'myPassword', 'b64', @@ -1785,8 +1785,8 @@ wuIFtde33Dp3NkZl9fc2Rmw6fDp8OnX2RmX19fJibDqV1dXcKwwrDCsMKwwrDCsA==" # data must now have been synchronized self.checkSynchronizationStateIsSynchronized() self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) - self.assertEquals(person1_s.getFirstName(), self.first_name2) - self.assertEquals(person1_s.getLastName(), self.last_name2) + self.assertEqual(person1_s.getFirstName(), self.first_name2) + self.assertEqual(person1_s.getLastName(), self.last_name2) # try to synchronize with a bad login and/or password # test if login is case sensitive (it should be !) @@ -1814,8 +1814,8 @@ wuIFtde33Dp3NkZl9fc2Rmw6fDp8OnX2RmX19fJibDqV1dXcKwwrDCsMKwwrDCsA==" self.synchronize(self.sub_id1) self.checkSynchronizationStateIsSynchronized() self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) - self.assertEquals(person1_s.getFirstName(), self.first_name1) - self.assertEquals(person1_s.getLastName(), self.last_name1) + self.assertEqual(person1_s.getFirstName(), self.first_name1) + self.assertEqual(person1_s.getLastName(), self.last_name1) # verify that the login and password with utf8 caracters are accecpted @@ -1842,8 +1842,8 @@ wuIFtde33Dp3NkZl9fc2Rmw6fDp8OnX2RmX19fJibDqV1dXcKwwrDCsMKwwrDCsA==" 'b64', 'syncml:auth-basic') self.synchronize(self.sub_id1) self.assertXMLViewIsEqual(self.sub_id1, person1_s, person1_c) - self.assertEquals(person1_s.getFirstName(), self.first_name3) - self.assertEquals(person1_s.getLastName(), self.last_name3) + self.assertEqual(person1_s.getFirstName(), self.first_name3) + self.assertEqual(person1_s.getLastName(), self.last_name3) self.checkSynchronizationStateIsSynchronized() @expectedFailure @@ -1858,22 +1858,22 @@ wuIFtde33Dp3NkZl9fc2Rmw6fDp8OnX2RmX19fJibDqV1dXcKwwrDCsMKwwrDCsA==" nb_person = self.populatePersonClient1() portal_sync = self.getSynchronizationTool() for sub in portal_sync.contentValues(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') # Synchronize the first client # data_Sub1 -> Pub (the data are in sub1 to pub is empty) nb_message1 = self.synchronize(self.sub_id1) #Verification number object synchronized - self.assertEquals(nb_message1, self.nb_message_first_sync_max_lines) + self.assertEqual(nb_message1, self.nb_message_first_sync_max_lines) # Synchronize the second client nb_message2 = self.synchronize(self.sub_id2) - self.assertEquals(nb_message2, self.nb_message_first_sync_max_lines) + self.assertEqual(nb_message2, self.nb_message_first_sync_max_lines) person_server = self.getPersonServer() person_client1 = self.getPersonClient1() person_client2 = self.getPersonClient2() # Check we have all data synchronized - self.assertEquals(nb_person, len(person_server.objectValues())) - self.assertEquals(nb_person, len(person_client1.objectValues())) - self.assertEquals(nb_person, len(person_client2.objectValues())) + self.assertEqual(nb_person, len(person_server.objectValues())) + self.assertEqual(nb_person, len(person_client1.objectValues())) + self.assertEqual(nb_person, len(person_client2.objectValues())) for id in range(1, 60): person_s = person_server._getOb(str(id)) diff --git a/product/ERP5SyncML/tests/testERP5SyncMLVCard.py b/product/ERP5SyncML/tests/testERP5SyncMLVCard.py index a0595f31ff..8c12294763 100644 --- a/product/ERP5SyncML/tests/testERP5SyncMLVCard.py +++ b/product/ERP5SyncML/tests/testERP5SyncMLVCard.py @@ -120,17 +120,17 @@ class TestERP5SyncMLVCard(TestERP5SyncMLMixin): nb_person = self.populatePersonServer() portal_sync = self.getSynchronizationTool() for sub in portal_sync.searchFolder(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') # Synchronize the first client nb_message1 = self.synchronize(self.sub_id1) for sub in portal_sync.searchFolder(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') - self.assertEquals(nb_message1, self.nb_message_first_synchronization) + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(nb_message1, self.nb_message_first_synchronization) # Synchronize the second client nb_message2 = self.synchronize(self.sub_id2) for sub in portal_sync.searchFolder(portal_type='SyncML Subscription'): - self.assertEquals(sub.getSyncmlAlertCode(), 'two_way') - self.assertEquals(nb_message2, self.nb_message_first_synchronization) + self.assertEqual(sub.getSyncmlAlertCode(), 'two_way') + self.assertEqual(nb_message2, self.nb_message_first_synchronization) self.checkFirstSynchronization(id='1', nb_person=nb_person) def test_05_basicVCardSynchronization(self): @@ -181,10 +181,10 @@ class TestERP5SyncMLVCard(TestERP5SyncMLMixin): person1_c.edit(**kw) person1_s.edit(**kw) #the same person is added on client AND server #before synchornization, First and Last name souldn't be the same - self.assertEquals(person1_s.getFirstName(), self.first_name3) - self.assertEquals(person1_s.getLastName(), self.last_name3) - self.assertEquals(person1_c.getFirstName(), self.first_name3) - self.assertEquals(person1_c.getLastName(), self.last_name3) + self.assertEqual(person1_s.getFirstName(), self.first_name3) + self.assertEqual(person1_s.getLastName(), self.last_name3) + self.assertEqual(person1_c.getFirstName(), self.first_name3) + self.assertEqual(person1_c.getLastName(), self.last_name3) nb_person_serv_before_sync = len(pub.getDocumentList()) self.synchronize(self.sub_id1) #after synchronization, no new person is created on server because it @@ -194,16 +194,16 @@ class TestERP5SyncMLVCard(TestERP5SyncMLMixin): #after the synchro, the client and server should be synchronized self.checkSynchronizationStateIsSynchronized() - self.assertEquals(person1_s.getFirstName(), self.first_name3) - self.assertEquals(person1_s.getLastName(), self.last_name3) - self.assertEquals(person1_c.getFirstName(), self.first_name3) - self.assertEquals(person1_c.getLastName(), self.last_name3) + self.assertEqual(person1_s.getFirstName(), self.first_name3) + self.assertEqual(person1_s.getLastName(), self.last_name3) + self.assertEqual(person1_c.getFirstName(), self.first_name3) + self.assertEqual(person1_c.getLastName(), self.last_name3) nb_person_serv_after_sync = len(pub.getDocumentList()) #the number of person on server before and after the synchronization should #be the same nb_person_serv_after_sync = len(pub.getDocumentList()) - self.assertEquals(nb_person_serv_after_sync, nb_person_serv_before_sync) + self.assertEqual(nb_person_serv_after_sync, nb_person_serv_before_sync) import unittest diff --git a/product/ERP5TioSafe/tests/testBusinessTemplateInstallation.py b/product/ERP5TioSafe/tests/testBusinessTemplateInstallation.py index 4d15ecfd87..5f9debb5f9 100644 --- a/product/ERP5TioSafe/tests/testBusinessTemplateInstallation.py +++ b/product/ERP5TioSafe/tests/testBusinessTemplateInstallation.py @@ -71,7 +71,7 @@ class TestPackaging(testTioSafeMixin): 'erp5_syncml', 'erp5_integration', ): - self.failUnless(skin_name in self.skin_tool.objectIds(), skin_name) + self.assertTrue(skin_name in self.skin_tool.objectIds(), skin_name) import unittest diff --git a/product/ERP5TioSafe/tests/testSaleOrderERP5Synchronization.py b/product/ERP5TioSafe/tests/testSaleOrderERP5Synchronization.py index 149f5300ff..52c4cc9002 100644 --- a/product/ERP5TioSafe/tests/testSaleOrderERP5Synchronization.py +++ b/product/ERP5TioSafe/tests/testSaleOrderERP5Synchronization.py @@ -131,7 +131,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin): self.assertEqual(round(line.getPrice(), 6), 2.1) self.assertEqual(line.getPriceCurrencyValue(), currency) else: - self.failUnless(line.getTitle() in ['Delivery', 'Stylo']) + self.assertTrue(line.getTitle() in ['Delivery', 'Stylo']) # Check the XML schema and the fixed point self.checkTioSafeXML( tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()), @@ -620,7 +620,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin): self.assertEqual(round(line.getPrice(), 6), 2.1) self.assertEqual(line.getPriceCurrencyValue(), currency) else: - self.failUnless(line.getTitle() in ['Delivery', 'Stylo', 'Discount']) + self.assertTrue(line.getTitle() in ['Delivery', 'Stylo', 'Discount']) # Check the XML schema and the fixed point self.checkTioSafeXML( tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()), @@ -700,7 +700,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin): self.assertEqual(round(line.getPrice(), 6), 2.1) self.assertEqual(line.getPriceCurrencyValue(), currency) else: - self.failUnless(line.getTitle() in ['Delivery', 'Stylo']) + self.assertTrue(line.getTitle() in ['Delivery', 'Stylo']) # Check the XML schema and the fixed point self.checkTioSafeXML( tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(context_document=self.portal.portal_synchronizations.ps_SaleOrder_pub.getPath()), @@ -910,7 +910,7 @@ class TestSaleOrderERP5Synchronization(testPrestashopMixin): self.assertEqual(round(line.getPrice(), 6), 2.1) self.assertEqual(line.getPriceCurrencyValue(), currency) else: - self.failUnless(line.getTitle() in ['Delivery', 'Stylo']) + self.assertTrue(line.getTitle() in ['Delivery', 'Stylo']) raise 'A line has not been checked' # Check the accounting diff --git a/product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py b/product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py index a664572d06..2c80103fa0 100644 --- a/product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py +++ b/product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py @@ -430,7 +430,7 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase): self.logMessage("-" * 79) self.logMessage(detail) self.logMessage("-" * 79) - self.assertEquals([], error_title_list, '\n'.join(error_title_list)) + self.assertEqual([], error_title_list, '\n'.join(error_title_list)) # monkey patch HTTPResponse._unauthorized so that we will not have HTTP # authentication dialog in case of Unauthorized exception to prevent diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py index 58d1e61e16..6bc4487954 100644 --- a/product/ERP5Type/tests/ERP5TypeTestCase.py +++ b/product/ERP5Type/tests/ERP5TypeTestCase.py @@ -569,16 +569,16 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase): def failIfDifferentSet(self, a, b, msg=""): if not msg: msg='%r != %r' % (a, b) - self.assertEquals(set(a), set(b), msg) + self.assertEqual(set(a), set(b), msg) assertSameSet = failIfDifferentSet def assertHasAttribute(self, obj, attribute, msg=None): - self.failIfEqual(None, getattr(obj, attribute, None), + self.assertNotEqual(None, getattr(obj, attribute, None), msg or "'%r': no attribute '%s'" % (obj, attribute)) def failIfHasAttribute(self, obj, attribute, msg=None): - self.assertEquals(None, getattr(obj, attribute, None), + self.assertEqual(None, getattr(obj, attribute, None), msg or "'%r': attribute '%s' present" % (obj, attribute)) diff --git a/product/ERP5Type/tests/_testSQLBench.py b/product/ERP5Type/tests/_testSQLBench.py index 0e8f1f4f91..512af15bdc 100644 --- a/product/ERP5Type/tests/_testSQLBench.py +++ b/product/ERP5Type/tests/_testSQLBench.py @@ -56,6 +56,6 @@ class TestSQLBench(unittest.TestCase): cwd = mariadb_folder + '/sql-bench/', stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, error = process.communicate() - self.assertEquals(0, len(error), error) + self.assertEqual(0, len(error), error) print output self.assertTrue(output.find("Total time: ")>=0) diff --git a/product/ERP5Type/tests/namingConventionTest.py b/product/ERP5Type/tests/namingConventionTest.py index 857826d51e..fd1dc8fb72 100644 --- a/product/ERP5Type/tests/namingConventionTest.py +++ b/product/ERP5Type/tests/namingConventionTest.py @@ -71,7 +71,7 @@ class TestNamingConvention(ERP5TypeTestCase): result += self.getPortal().portal_skins.erp5_core.ERP5Site_checkNamingConventions(html_output=None) problems_re = re.compile('([0-9]+) problems found') problems = int(problems_re.search(result).group(1)) - self.assertEquals(0, problems, result) + self.assertEqual(0, problems, result) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5Type/tests/testBackportUnittest.py b/product/ERP5Type/tests/testBackportUnittest.py index 0c556b5e38..c42bb8e643 100644 --- a/product/ERP5Type/tests/testBackportUnittest.py +++ b/product/ERP5Type/tests/testBackportUnittest.py @@ -17,12 +17,12 @@ class TestBackportUnittest(unittest.TestCase): test_instance = Success() result = self.runner.run(test_instance) - self.assertEquals(result.testsRun, 1) - self.assertEquals(len(result.errors), 0) - self.assertEquals(len(result.failures), 0) - self.assertEquals(len(result.expectedFailures), 0) - self.assertEquals(len(result.unexpectedSuccesses), 0) - self.assertEquals(len(result.skipped), 0) + self.assertEqual(result.testsRun, 1) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 0) + self.assertEqual(len(result.expectedFailures), 0) + self.assertEqual(len(result.unexpectedSuccesses), 0) + self.assertEqual(len(result.skipped), 0) self.assert_(result.wasSuccessful()) @@ -34,12 +34,12 @@ class TestBackportUnittest(unittest.TestCase): test_instance = Failure() result = self.runner.run(test_instance) - self.assertEquals(result.testsRun, 1) - self.assertEquals(len(result.errors), 0) - self.assertEquals(len(result.failures), 1) - self.assertEquals(len(result.expectedFailures), 0) - self.assertEquals(len(result.unexpectedSuccesses), 0) - self.assertEquals(len(result.skipped), 0) + self.assertEqual(result.testsRun, 1) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 1) + self.assertEqual(len(result.expectedFailures), 0) + self.assertEqual(len(result.unexpectedSuccesses), 0) + self.assertEqual(len(result.skipped), 0) self.assert_(not result.wasSuccessful()) @@ -52,12 +52,12 @@ class TestBackportUnittest(unittest.TestCase): test_instance = Skipped() result = self.runner.run(test_instance) - self.assertEquals(result.testsRun, 1) - self.assertEquals(len(result.errors), 0) - self.assertEquals(len(result.failures), 0) - self.assertEquals(len(result.expectedFailures), 0) - self.assertEquals(len(result.unexpectedSuccesses), 0) - self.assertEquals(len(result.skipped), 1) + self.assertEqual(result.testsRun, 1) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 0) + self.assertEqual(len(result.expectedFailures), 0) + self.assertEqual(len(result.unexpectedSuccesses), 0) + self.assertEqual(len(result.skipped), 1) self.assert_(result.wasSuccessful()) @@ -71,12 +71,12 @@ class TestBackportUnittest(unittest.TestCase): test_instance = Skipped() result = self.runner.run(test_instance) - self.assertEquals(result.testsRun, 1) - self.assertEquals(len(result.errors), 0) - self.assertEquals(len(result.failures), 0) - self.assertEquals(len(result.expectedFailures), 0) - self.assertEquals(len(result.unexpectedSuccesses), 0) - self.assertEquals(len(result.skipped), 1) + self.assertEqual(result.testsRun, 1) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 0) + self.assertEqual(len(result.expectedFailures), 0) + self.assertEqual(len(result.unexpectedSuccesses), 0) + self.assertEqual(len(result.skipped), 1) self.assert_(result.wasSuccessful()) @@ -89,12 +89,12 @@ class TestBackportUnittest(unittest.TestCase): test_instance = Skipped() result = self.runner.run(test_instance) - self.assertEquals(result.testsRun, 1) - self.assertEquals(len(result.errors), 0) - self.assertEquals(len(result.failures), 0) - self.assertEquals(len(result.expectedFailures), 0) - self.assertEquals(len(result.unexpectedSuccesses), 0) - self.assertEquals(len(result.skipped), 1) + self.assertEqual(result.testsRun, 1) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 0) + self.assertEqual(len(result.expectedFailures), 0) + self.assertEqual(len(result.unexpectedSuccesses), 0) + self.assertEqual(len(result.skipped), 1) self.assert_(result.wasSuccessful()) @@ -107,12 +107,12 @@ class TestBackportUnittest(unittest.TestCase): test_instance = WillFail() result = self.runner.run(test_instance) - self.assertEquals(result.testsRun, 1) - self.assertEquals(len(result.errors), 0) - self.assertEquals(len(result.failures), 0) - self.assertEquals(len(result.expectedFailures), 1) - self.assertEquals(len(result.unexpectedSuccesses), 0) - self.assertEquals(len(result.skipped), 0) + self.assertEqual(result.testsRun, 1) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 0) + self.assertEqual(len(result.expectedFailures), 1) + self.assertEqual(len(result.unexpectedSuccesses), 0) + self.assertEqual(len(result.skipped), 0) self.assert_(result.wasSuccessful()) @@ -125,12 +125,12 @@ class TestBackportUnittest(unittest.TestCase): test_instance = WillNotFail() result = self.runner.run(test_instance) - self.assertEquals(result.testsRun, 1) - self.assertEquals(len(result.errors), 0) - self.assertEquals(len(result.failures), 0) - self.assertEquals(len(result.expectedFailures), 0) - self.assertEquals(len(result.unexpectedSuccesses), 1) - self.assertEquals(len(result.skipped), 0) + self.assertEqual(result.testsRun, 1) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 0) + self.assertEqual(len(result.expectedFailures), 0) + self.assertEqual(len(result.unexpectedSuccesses), 1) + self.assertEqual(len(result.skipped), 0) # Unexpected success does not FAIL the test self.assert_(not result.wasSuccessful()) diff --git a/product/ERP5Type/tests/testCSSPacker.py b/product/ERP5Type/tests/testCSSPacker.py index 52d625c545..039a79e6d4 100644 --- a/product/ERP5Type/tests/testCSSPacker.py +++ b/product/ERP5Type/tests/testCSSPacker.py @@ -39,16 +39,16 @@ class TestCSSPacker(unittest.TestCase): result = compressCSS(script) output = open(join(PREFIX, 'output/output_erp5.css')).read() - self.assertEquals(result, output) + self.assertEqual(result, output) def test_CSSStyleWithoutSemicolon(self): result = compressCSS('.something {color: #FFFFF}') - self.assertEquals('.something{color:#FFFFF;}', result) + self.assertEqual('.something{color:#FFFFF;}', result) def test_CSSStyleAndClassWithSpaces(self): css = '.something {color: #FFFFFF; border: 0px; }' result = compressCSS(css) - self.assertEquals('.something{color:#FFFFFF;border:0px;}', result) + self.assertEqual('.something{color:#FFFFFF;border:0px;}', result) def test_CSSClassWithSpecialCharacter(self): css = 'div#main_content input.button, input[type="submit"] { \ @@ -59,7 +59,7 @@ class TestCSSPacker(unittest.TestCase): expected_result = 'div#main_content input.button, \ input[type="submit"]{background:#fff url(erp5-website-button.png) bottom \ repeat-x;}' - self.assertEquals(result, expected_result) + self.assertEqual(result, expected_result) if __name__ == '__main__': unittest.main() diff --git a/product/ERP5Type/tests/testCacheTool.py b/product/ERP5Type/tests/testCacheTool.py index 731fbfe3f6..390505edc7 100644 --- a/product/ERP5Type/tests/testCacheTool.py +++ b/product/ERP5Type/tests/testCacheTool.py @@ -231,11 +231,11 @@ return result result=result) end = time.time() calculation_time = end-start - self.assertEquals(cached, result) + self.assertEqual(cached, result) after_cookie_value = self._getCacheCookieValue() # if there is cache miss, then real calculation is done, # then the cookie is increased with a value 1 - self.assertEquals(after_cookie_value-before_cookie_value, + self.assertEqual(after_cookie_value-before_cookie_value, int(real_calculation)) return calculation_time @@ -332,7 +332,7 @@ return result end = time.time() calculation_time = end-start print "\n\tCalculation time (1st call)", calculation_time - self.assertEquals(cached, result) + self.assertEqual(cached, result) self.commit() ## 2nd call - should be cached now @@ -344,7 +344,7 @@ return result calculation_time = end-start print "\n\tCalculation time (2nd call)", calculation_time self.assertTrue(1.0 > calculation_time, "1.0 <= %s" % calculation_time) - self.assertEquals(cached, result) + self.assertEqual(cached, result) self.commit() # Clear only another_ram_cache_factory @@ -358,7 +358,7 @@ return result calculation_time = end-start print "\n\tCalculation time (3rd call)", calculation_time self.assertTrue(1.0 > calculation_time, "1.0 <= %s" % calculation_time) - self.assertEquals(cached, result) + self.assertEqual(cached, result) self.commit() def test_05_CheckLongKeysAndLargeValues(self): @@ -411,7 +411,7 @@ return 'a' * 1024 * 1024 * 25 cache_factory='distributed_ram_cache_factory') cached_method() # Check that Cache plugin create new connection in pool - self.assertEquals(1, len(connection_pool.local_dict)) + self.assertEqual(1, len(connection_pool.local_dict)) # Now test long keys and large values cached_method = CachingMethod(py_script_obj, @@ -425,11 +425,11 @@ return 'a' * 1024 * 1024 * 25 end = time.time() calculation_time = end-start print "\n\tCalculation time (1st call)", calculation_time - self.assertEquals(cached, result) + self.assertEqual(cached, result) self.commit() # Check that Cache plugin create a second connection in pool - self.assertEquals(2, len(connection_pool.local_dict)) + self.assertEqual(2, len(connection_pool.local_dict)) ## 2nd call - should be cached now start = time.time() @@ -439,7 +439,7 @@ return 'a' * 1024 * 1024 * 25 calculation_time = end-start print "\n\tCalculation time (2nd call)", calculation_time self.assertTrue(1.0 > calculation_time, "1.0 <= %s" % calculation_time) - self.assertEquals(cached, result) + self.assertEqual(cached, result) self.commit() def test_06_CheckCacheExpiration(self): diff --git a/product/ERP5Type/tests/testClassTool.py b/product/ERP5Type/tests/testClassTool.py index 35722bc84b..3ece4bed5f 100644 --- a/product/ERP5Type/tests/testClassTool.py +++ b/product/ERP5Type/tests/testClassTool.py @@ -92,7 +92,7 @@ class TestClassTool(ERP5TypeTestCase): doc_helper = folder.asDocumentationHelper() self.assertNotEquals(doc_helper, None) # We simply check that we can access methods of the documentation helper - self.failUnless('Base' in doc_helper.getInheritanceList()) + self.assertTrue('Base' in doc_helper.getInheritanceList()) self.assertNotEquals([], doc_helper.getStaticMethodList()) @@ -117,7 +117,7 @@ class TestClassTool(ERP5TypeTestCase): self.tic() doc_helper = folder.asDocumentationHelper() self.commit() - self.assertEquals(0, len(portal.portal_activities.getMessageList())) + self.assertEqual(0, len(portal.portal_activities.getMessageList())) def test_DocumentationHelperExpressionCategory(self): diff --git a/product/ERP5Type/tests/testConstraint.py b/product/ERP5Type/tests/testConstraint.py index 14c0b2f7aa..4b472ccb46 100644 --- a/product/ERP5Type/tests/testConstraint.py +++ b/product/ERP5Type/tests/testConstraint.py @@ -196,8 +196,8 @@ class TestConstraint(PropertySheetTestCase): object = sequence.get('object') property_name = 'ean13code' # make sure the property is defined on the object - self.failUnless(not object.hasProperty(property_name)) - self.failUnless(object.getPropertyType(property_name) != 'int') + self.assertTrue(not object.hasProperty(property_name)) + self.assertTrue(object.getPropertyType(property_name) != 'int') object.setProperty(property_name, 12) def stepSetObjectIntLocalProperty(self, sequence=None, @@ -279,7 +279,7 @@ class TestConstraint(PropertySheetTestCase): Check that checkConsistency does not return an empty list """ error_list = sequence.get('error_list') - self.failUnless(error_list != [], + self.assertTrue(error_list != [], "error_list : %s" % error_list) # call getTranslatedMessage, to make sure messages have a valid mapping. for error in error_list: @@ -1130,7 +1130,7 @@ class TestConstraint(PropertySheetTestCase): obj.fixConsistency() # should be fixed now self.assertEqual([], obj.checkConsistency()) - self.failUnless(obj.getPropertyType(prop_name)) + self.assertTrue(obj.getPropertyType(prop_name)) def test_TALESConstraint(self): """Tests TALESConstraint diff --git a/product/ERP5Type/tests/testDynamicClassGeneration.py b/product/ERP5Type/tests/testDynamicClassGeneration.py index b631e48176..d7dd538376 100644 --- a/product/ERP5Type/tests/testDynamicClassGeneration.py +++ b/product/ERP5Type/tests/testDynamicClassGeneration.py @@ -142,10 +142,10 @@ class TestPortalTypeClass(ERP5TypeTestCase): person = person_module.newContent(id='John Dough', portal_type='Person') person_type = portal.portal_types.Person - self.assertEquals(person_type.getTypeMixinList() or [], []) + self.assertEqual(person_type.getTypeMixinList() or [], []) try: - self.assertEquals(getattr(person, 'asText', None), None) + self.assertEqual(getattr(person, 'asText', None), None) # just use a mixin/method that Person does not have yet person_type.setTypeMixin('TextConvertableMixin') @@ -167,10 +167,10 @@ class TestPortalTypeClass(ERP5TypeTestCase): person = person_module.newContent(id='Eva Dough', portal_type='Person') person_type = portal.portal_types.Person - self.assertEquals(person_type.getTypeClass(), 'Person') + self.assertEqual(person_type.getTypeClass(), 'Person') try: - self.assertEquals(getattr(person, 'getCorporateName', None), None) + self.assertEqual(getattr(person, 'getCorporateName', None), None) # change the base type class person_type.setTypeClass('Organisation') @@ -234,7 +234,7 @@ class TestPortalTypeClass(ERP5TypeTestCase): # it's necessary to load the class # to have a correct list of interfaces implemented_by = list(implementedBy(InterfaceTestType)) - self.failIf(IForTest in implemented_by) + self.assertFalse(IForTest in implemented_by) InterfaceTestType.loadClass() implemented_by = list(implementedBy(InterfaceTestType)) @@ -243,7 +243,7 @@ class TestPortalTypeClass(ERP5TypeTestCase): InterfaceTestType.restoreGhostState() implemented_by = list(implementedBy(InterfaceTestType)) - self.failIf(IForTest in implemented_by) + self.assertFalse(IForTest in implemented_by) def testClassHierarchyAfterReset(self): """ @@ -625,7 +625,7 @@ class TestZodbPropertySheet(ERP5TypeTestCase): portal = self.getPortal() person_type = portal.portal_types.Person - self.failIf('TestMigration' in person_type.getTypePropertySheetList()) + self.assertFalse('TestMigration' in person_type.getTypePropertySheetList()) new_person = None try: @@ -659,12 +659,12 @@ class TestZodbPropertySheet(ERP5TypeTestCase): # Standard Property self.assertHasAttribute(new_person, 'setTestStandardPropertyAssign') - self.assertEquals(new_person.getTestStandardPropertyAssign(), + self.assertEqual(new_person.getTestStandardPropertyAssign(), "test_default_value") new_person.setTestStandardPropertyAssign('value') - self.assertEquals(new_person.getTestStandardPropertyAssign(), 'value') + self.assertEqual(new_person.getTestStandardPropertyAssign(), 'value') # Acquired Property self.assertHasAttribute( @@ -674,9 +674,9 @@ class TestZodbPropertySheet(ERP5TypeTestCase): self.assertHasAttribute(new_person, 'default_address') self.assertHasAttribute(new_person.default_address, 'getDefaultAddress') - self.failIfEqual(None, new_person.default_address.getDefaultAddress()) + self.assertNotEqual(None, new_person.default_address.getDefaultAddress()) - self.assertEquals( + self.assertEqual( new_person.getDefaultTestAcquiredPropertyAssignStreetAddress(), 'value') @@ -685,7 +685,7 @@ class TestZodbPropertySheet(ERP5TypeTestCase): new_person.setTestCategoryPropertyAssign('sub_category1') - self.assertEquals(new_person.getTestCategoryPropertyAssign(), + self.assertEqual(new_person.getTestCategoryPropertyAssign(), 'sub_category1') # Dynamic Category Property @@ -694,7 +694,7 @@ class TestZodbPropertySheet(ERP5TypeTestCase): new_person.setTestDynamicCategoryPropertyAssign('sub_category1') - self.assertEquals(new_person.getTestDynamicCategoryPropertyAssign(), + self.assertEqual(new_person.getTestDynamicCategoryPropertyAssign(), 'sub_category1') finally: @@ -718,7 +718,7 @@ class TestZodbPropertySheet(ERP5TypeTestCase): # unassigned by creating a new person in Person module self.commit() - self.failIf('TestMigration' in person_type.getTypePropertySheetList()) + self.assertFalse('TestMigration' in person_type.getTypePropertySheetList()) try: new_person = portal.person_module.newContent( @@ -916,16 +916,16 @@ class TestZodbPropertySheet(ERP5TypeTestCase): *args, **kw): constraint = self._getConstraintByReference(constraint_reference) - self.failIfEqual(None, constraint) + self.assertNotEqual(None, constraint) # Use Base.checkConsistency!! # This is the standard interface which real users are always using. # Never call ConstraintMixin.checkConsistency directly in unit test. # You will miss serious bugs. - self.assertEquals(1, len(self.test_module.checkConsistency(filter={'reference':constraint_reference}))) + self.assertEqual(1, len(self.test_module.checkConsistency(filter={'reference':constraint_reference}))) setter_function(*args, **kw) - self.assertEquals([], self.test_module.checkConsistency(filter={'reference':constraint_reference})) + self.assertEqual([], self.test_module.checkConsistency(filter={'reference':constraint_reference})) def testPropertyExistenceConstraint(self): """ @@ -1025,13 +1025,13 @@ class TestZodbPropertySheet(ERP5TypeTestCase): constraint = self._getConstraintByReference( 'test_category_related_membership_arity_constraint') - self.failIfEqual(None, constraint) - self.assertEquals(1, len(constraint.checkConsistency(self.test_module))) + self.assertNotEqual(None, constraint) + self.assertEqual(1, len(constraint.checkConsistency(self.test_module))) self.test_module.setCategoryList(('gender/Test Migration',)) self.tic() - self.assertEquals([], constraint.checkConsistency(self.test_module)) + self.assertEqual([], constraint.checkConsistency(self.test_module)) def testTALESConstraint(self): """ @@ -1453,17 +1453,17 @@ class _TestZodbComponent(SecurityTestCase): component.validate() self.tic() - self.assertEquals(ComponentTool._reset_performed, True) + self.assertEqual(ComponentTool._reset_performed, True) finally: ComponentTool.reset = ComponentTool._original_reset ComponentTool._reset_performed = False - self.assertEquals(component.getValidationState(), 'validated') - self.assertEquals(component.checkConsistency(), []) - self.assertEquals(component.getTextContentErrorMessageList(), []) - self.assertEquals(component.getTextContentWarningMessageList(), []) - self.assertEquals(component.getReference(), valid_reference) - self.assertEquals(component.getReference(validated_only=True), valid_reference) + self.assertEqual(component.getValidationState(), 'validated') + self.assertEqual(component.checkConsistency(), []) + self.assertEqual(component.getTextContentErrorMessageList(), []) + self.assertEqual(component.getTextContentWarningMessageList(), []) + self.assertEqual(component.getReference(), valid_reference) + self.assertEqual(component.getReference(validated_only=True), valid_reference) self.assertModuleImportable(valid_reference) # Check that checkConsistency returns the proper error message for the @@ -1490,14 +1490,14 @@ class _TestZodbComponent(SecurityTestCase): ComponentTool.reset = ComponentTool._original_reset # Should be in modified state as an error has been encountered - self.assertEquals(component.getValidationState(), 'modified') - self.assertEquals([m.getMessage().translate() + self.assertEqual(component.getValidationState(), 'modified') + self.assertEqual([m.getMessage().translate() for m in component.checkConsistency()], [error_message]) - self.assertEquals(component.getTextContentErrorMessageList(), []) - self.assertEquals(component.getTextContentWarningMessageList(), []) - self.assertEquals(component.getReference(), invalid_reference) - self.assertEquals(component.getReference(validated_only=True), valid_reference) + self.assertEqual(component.getTextContentErrorMessageList(), []) + self.assertEqual(component.getTextContentWarningMessageList(), []) + self.assertEqual(component.getReference(), invalid_reference) + self.assertEqual(component.getReference(validated_only=True), valid_reference) self._component_tool.reset(force=True, reset_portal_type_at_transaction_boundary=True) self.assertModuleImportable(valid_reference) @@ -1509,17 +1509,17 @@ class _TestZodbComponent(SecurityTestCase): component.setReference(valid_reference) self.tic() - self.assertEquals(ComponentTool._reset_performed, True) + self.assertEqual(ComponentTool._reset_performed, True) finally: ComponentTool.reset = ComponentTool._original_reset ComponentTool._reset_performed = False - self.assertEquals(component.getValidationState(), 'validated') - self.assertEquals(component.checkConsistency(), []) - self.assertEquals(component.getTextContentErrorMessageList(), []) - self.assertEquals(component.getTextContentWarningMessageList(), []) - self.assertEquals(component.getReference(), valid_reference) - self.assertEquals(component.getReference(validated_only=True), valid_reference) + self.assertEqual(component.getValidationState(), 'validated') + self.assertEqual(component.checkConsistency(), []) + self.assertEqual(component.getTextContentErrorMessageList(), []) + self.assertEqual(component.getTextContentWarningMessageList(), []) + self.assertEqual(component.getReference(), valid_reference) + self.assertEqual(component.getReference(validated_only=True), valid_reference) self.assertModuleImportable(valid_reference) def testVersionWithReservedKeywords(self): @@ -1542,17 +1542,17 @@ class _TestZodbComponent(SecurityTestCase): component.validate() self.tic() - self.assertEquals(ComponentTool._reset_performed, True) + self.assertEqual(ComponentTool._reset_performed, True) finally: ComponentTool.reset = ComponentTool._original_reset ComponentTool._reset_performed = False - self.assertEquals(component.getValidationState(), 'validated') - self.assertEquals(component.checkConsistency(), []) - self.assertEquals(component.getTextContentErrorMessageList(), []) - self.assertEquals(component.getTextContentWarningMessageList(), []) - self.assertEquals(component.getVersion(), valid_version) - self.assertEquals(component.getVersion(validated_only=True), valid_version) + self.assertEqual(component.getValidationState(), 'validated') + self.assertEqual(component.checkConsistency(), []) + self.assertEqual(component.getTextContentErrorMessageList(), []) + self.assertEqual(component.getTextContentWarningMessageList(), []) + self.assertEqual(component.getVersion(), valid_version) + self.assertEqual(component.getVersion(validated_only=True), valid_version) self.assertModuleImportable(reference) # Check that checkConsistency returns the proper error message for the @@ -1573,14 +1573,14 @@ class _TestZodbComponent(SecurityTestCase): ComponentTool.reset = ComponentTool._original_reset # Should be in modified state as an error has been encountered - self.assertEquals(component.getValidationState(), 'modified') - self.assertEquals([m.getMessage().translate() + self.assertEqual(component.getValidationState(), 'modified') + self.assertEqual([m.getMessage().translate() for m in component.checkConsistency()], [error_message]) - self.assertEquals(component.getTextContentErrorMessageList(), []) - self.assertEquals(component.getTextContentWarningMessageList(), []) - self.assertEquals(component.getVersion(), invalid_version) - self.assertEquals(component.getVersion(validated_only=True), valid_version) + self.assertEqual(component.getTextContentErrorMessageList(), []) + self.assertEqual(component.getTextContentWarningMessageList(), []) + self.assertEqual(component.getVersion(), invalid_version) + self.assertEqual(component.getVersion(validated_only=True), valid_version) self._component_tool.reset(force=True, reset_portal_type_at_transaction_boundary=True) self.assertModuleImportable(reference) @@ -1592,17 +1592,17 @@ class _TestZodbComponent(SecurityTestCase): component.setVersion(valid_version) self.tic() - self.assertEquals(ComponentTool._reset_performed, True) + self.assertEqual(ComponentTool._reset_performed, True) finally: ComponentTool.reset = ComponentTool._original_reset ComponentTool._reset_performed = False - self.assertEquals(component.getValidationState(), 'validated') - self.assertEquals(component.checkConsistency(), []) - self.assertEquals(component.getTextContentErrorMessageList(), []) - self.assertEquals(component.getTextContentWarningMessageList(), []) - self.assertEquals(component.getVersion(), valid_version) - self.assertEquals(component.getVersion(validated_only=True), valid_version) + self.assertEqual(component.getValidationState(), 'validated') + self.assertEqual(component.checkConsistency(), []) + self.assertEqual(component.getTextContentErrorMessageList(), []) + self.assertEqual(component.getTextContentWarningMessageList(), []) + self.assertEqual(component.getVersion(), valid_version) + self.assertEqual(component.getVersion(validated_only=True), valid_version) self.assertModuleImportable(reference) def testInvalidSourceCode(self): @@ -1618,25 +1618,25 @@ class _TestZodbComponent(SecurityTestCase): # modified, even in Draft state component = self._newComponent('TestComponentWithSyntaxError', 'print "ok"') self.tic() - self.assertEquals(component.checkConsistency(), []) - self.assertEquals(component.getTextContentErrorMessageList(), []) - self.assertEquals(component.getTextContentWarningMessageList(), []) + self.assertEqual(component.checkConsistency(), []) + self.assertEqual(component.getTextContentErrorMessageList(), []) + self.assertEqual(component.getTextContentWarningMessageList(), []) component.setTextContent('import sys') self.tic() - self.assertEquals(component.checkConsistency(), []) - self.assertEquals(component.getTextContentErrorMessageList(), []) - self.assertEquals(component.getTextContentWarningMessageList(), + self.assertEqual(component.checkConsistency(), []) + self.assertEqual(component.getTextContentErrorMessageList(), []) + self.assertEqual(component.getTextContentWarningMessageList(), ["W: 1, 0: Unused import sys (unused-import)"]) component.setTextContent('import unexistent_module') self.tic() - self.assertEquals( + self.assertEqual( [m.getMessage().translate() for m in component.checkConsistency()], ["Error in Source Code: F: 1, 0: Unable to import 'unexistent_module' (import-error)"]) - self.assertEquals(component.getTextContentErrorMessageList(), + self.assertEqual(component.getTextContentErrorMessageList(), ["F: 1, 0: Unable to import 'unexistent_module' (import-error)"]) - self.assertEquals(component.getTextContentWarningMessageList(), + self.assertEqual(component.getTextContentWarningMessageList(), ["W: 1, 0: Unused import unexistent_module (unused-import)"]) valid_code = 'def foobar():\n return 42' @@ -1646,17 +1646,17 @@ class _TestZodbComponent(SecurityTestCase): component.validate() self.tic() - self.assertEquals(ComponentTool._reset_performed, True) + self.assertEqual(ComponentTool._reset_performed, True) finally: ComponentTool.reset = ComponentTool._original_reset ComponentTool._reset_performed = False - self.assertEquals(component.getValidationState(), 'validated') - self.assertEquals(component.checkConsistency(), []) - self.assertEquals(component.getTextContentErrorMessageList(), []) - self.assertEquals(component.getTextContentWarningMessageList(), []) - self.assertEquals(component.getTextContent(), valid_code) - self.assertEquals(component.getTextContent(validated_only=True), valid_code) + self.assertEqual(component.getValidationState(), 'validated') + self.assertEqual(component.checkConsistency(), []) + self.assertEqual(component.getTextContentErrorMessageList(), []) + self.assertEqual(component.getTextContentWarningMessageList(), []) + self.assertEqual(component.getTextContent(), valid_code) + self.assertEqual(component.getTextContent(validated_only=True), valid_code) self.assertModuleImportable('TestComponentWithSyntaxError') # Check that checkConsistency returns the proper error message for the @@ -1692,15 +1692,15 @@ class _TestZodbComponent(SecurityTestCase): ComponentTool.reset = ComponentTool._original_reset # Should be in modified state as an error has been encountered - self.assertEquals(component.getValidationState(), 'modified') - self.assertEquals([m.getMessage().translate() + self.assertEqual(component.getValidationState(), 'modified') + self.assertEqual([m.getMessage().translate() for m in component.checkConsistency()], check_consistency_list) - self.assertEquals(component.getTextContentErrorMessageList(), error_list) - self.assertEquals(component.getTextContentWarningMessageList(), warning_list) + self.assertEqual(component.getTextContentErrorMessageList(), error_list) + self.assertEqual(component.getTextContentWarningMessageList(), warning_list) - self.assertEquals(component.getTextContent(), invalid_code) - self.assertEquals(component.getTextContent(validated_only=True), valid_code) + self.assertEqual(component.getTextContent(), invalid_code) + self.assertEqual(component.getTextContent(validated_only=True), valid_code) self._component_tool.reset(force=True, reset_portal_type_at_transaction_boundary=True) self.assertModuleImportable('TestComponentWithSyntaxError') @@ -1712,17 +1712,17 @@ class _TestZodbComponent(SecurityTestCase): component.setTextContent(valid_code) self.tic() - self.assertEquals(ComponentTool._reset_performed, True) + self.assertEqual(ComponentTool._reset_performed, True) finally: ComponentTool.reset = ComponentTool._original_reset ComponentTool._reset_performed = False - self.assertEquals(component.getValidationState(), 'validated') - self.assertEquals(component.checkConsistency(), []) - self.assertEquals(component.getTextContentErrorMessageList(), []) - self.assertEquals(component.getTextContentWarningMessageList(), []) - self.assertEquals(component.getTextContent(), valid_code) - self.assertEquals(component.getTextContent(validated_only=True), valid_code) + self.assertEqual(component.getValidationState(), 'validated') + self.assertEqual(component.checkConsistency(), []) + self.assertEqual(component.getTextContentErrorMessageList(), []) + self.assertEqual(component.getTextContentWarningMessageList(), []) + self.assertEqual(component.getTextContent(), valid_code) + self.assertEqual(component.getTextContent(validated_only=True), valid_code) self.assertModuleImportable('TestComponentWithSyntaxError') def testImportVersionedComponentOnly(self): @@ -1772,7 +1772,7 @@ def bar(*args, **kwargs): self.assertHasAttribute( top_module.erp5_version.TestImportedVersionedComponentOnly, 'foo') - self.assertEquals( + self.assertEqual( top_module.erp5_version.TestImportedVersionedComponentOnly.foo(), 'TestImportedVersionedComponentOnly') @@ -1784,7 +1784,7 @@ def bar(*args, **kwargs): self._importModule('TestImportVersionedComponentOnly') self.assertHasAttribute(top_module.TestImportVersionedComponentOnly, 'bar') - self.assertEquals( + self.assertEqual( top_module.TestImportVersionedComponentOnly.bar(), 'BarTestImportedVersionedComponentOnly') @@ -1826,7 +1826,7 @@ def bar(*args, **kwargs): self._importModule('TestVersionPriority') self.assertHasAttribute(top_module.TestVersionPriority, 'function_foo') - self.assertEquals(top_module.TestVersionPriority.function_foo(), + self.assertEqual(top_module.TestVersionPriority.function_foo(), "TestERP5VersionPriority") from Products.ERP5.ERP5Site import getSite @@ -1839,7 +1839,7 @@ def bar(*args, **kwargs): site.setVersionPriorityList(('foo | 99.0',) + priority_tuple) self.tic() - self.assertEquals(ComponentTool._reset_performed, True) + self.assertEqual(ComponentTool._reset_performed, True) self.assertModuleImportable( 'TestVersionPriority', @@ -1848,7 +1848,7 @@ def bar(*args, **kwargs): self._importModule('TestVersionPriority') self.assertHasAttribute(top_module.TestVersionPriority, 'function_foo') - self.assertEquals(top_module.TestVersionPriority.function_foo(), + self.assertEqual(top_module.TestVersionPriority.function_foo(), "TestFooVersionPriority") finally: @@ -1923,7 +1923,7 @@ def bar(*args, **kwargs): self.portal.portal_workflow.doActionFor, component_dup, 'validate_action') - self.assertEquals(component_dup.getValidationState(), 'draft') + self.assertEqual(component_dup.getValidationState(), 'draft') component_dup.setReference(reference + '_copy') component_dup.validate() @@ -1931,9 +1931,9 @@ def bar(*args, **kwargs): component_dup.setReference(reference) self.tic() - self.assertEquals(component_dup.getValidationState(), 'modified') - self.assertEquals(component_dup.getReference(), reference) - self.assertEquals(component_dup.getReference(validated_only=True), + self.assertEqual(component_dup.getValidationState(), 'modified') + self.assertEqual(component_dup.getReference(), reference) + self.assertEqual(component_dup.getReference(validated_only=True), reference + '_copy') component_dup.invalidate() @@ -1943,7 +1943,7 @@ def bar(*args, **kwargs): self.portal.portal_workflow.doActionFor, component_dup, 'validate_action') - self.assertEquals(component_dup.getValidationState(), 'invalidated') + self.assertEqual(component_dup.getValidationState(), 'invalidated') from Products.ERP5Type.Core.ExtensionComponent import ExtensionComponent @@ -2016,7 +2016,7 @@ class TestZodbExtensionComponent(_TestZodbComponent): try: external_method() except RuntimeError, e: - self.assertEquals(e.message, + self.assertEqual(e.message, 'external method could not be called because it is None') else: self.fail("TestExternalMethod should not be callable") @@ -2069,7 +2069,7 @@ class TestPortalType(Person): person_type = self.getPortal().portal_types.Person person_type_class = person_type.getTypeClass() - self.assertEquals(person_type_class, 'Person') + self.assertEqual(person_type_class, 'Person') # Create a new Person person_module = self.getPortal().person_module @@ -2094,7 +2094,7 @@ class TestPortalType(Person): self.commit() self.assertHasAttribute(person, 'test42') - self.assertEquals(person.test42(), 42) + self.assertEqual(person.test42(), 42) # The Portal Type class should not be in ghost state by now as we tried # to access test42() defined in TestPortalType Document Component diff --git a/product/ERP5Type/tests/testERP5Type.py b/product/ERP5Type/tests/testERP5Type.py index 7c180951a5..c333b31a0a 100644 --- a/product/ERP5Type/tests/testERP5Type.py +++ b/product/ERP5Type/tests/testERP5Type.py @@ -183,11 +183,11 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): def testTemplateToolHasGetId(self): # Test if portal_templates has getId method (RAD) - self.assertEquals(self.getTemplateTool().getId(), 'portal_templates') + self.assertEqual(self.getTemplateTool().getId(), 'portal_templates') def testCategoryToolHasGetId(self): # Test if portal_categories has getId method (RAD) - self.assertEquals(self.getCategoryTool().getId(), 'portal_categories') + self.assertEqual(self.getCategoryTool().getId(), 'portal_categories') # erp5_core tests def testERP5CoreHasParentBaseCategory(self): @@ -204,11 +204,11 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): portal_templates = self.getTemplateTool() business_template = self.getTemplateTool().newContent( portal_type="Business Template") - self.assertEquals(business_template.getPortalType(), 'Business Template') + self.assertEqual(business_template.getPortalType(), 'Business Template') # Test simple string accessor test_string = self.getRandomString() business_template.setTitle(test_string) - self.assertEquals(business_template.getTitle(), test_string) + self.assertEqual(business_template.getTitle(), test_string) # Test Dynamic Code Generation def test_02_AqDynamic(self): @@ -231,53 +231,53 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): from Products.ERP5Type.Document import newTempPerson o = newTempPerson(portal, 1.2) o.setTitle('toto') - self.assertEquals(o.getTitle(), 'toto') - self.assertEquals(str(o.getId()), str(1.2)) + self.assertEqual(o.getTitle(), 'toto') + self.assertEqual(str(o.getId()), str(1.2)) from Products.ERP5Type.Document import newTempOrganisation o = newTempOrganisation(portal, -123) o.setTitle('toto') - self.assertEquals(o.getTitle(), 'toto') - self.assertEquals(str(o.getId()), str(-123)) + self.assertEqual(o.getTitle(), 'toto') + self.assertEqual(str(o.getId()), str(-123)) # Try to edit with any property and then get it with getProperty o = newTempOrganisation(portal,'a') o.edit(tutu='toto') - self.assertEquals(o.getProperty('tutu'), 'toto') + self.assertEqual(o.getProperty('tutu'), 'toto') # Same thing with an integer o = newTempOrganisation(portal,'b') o.edit(tata=123) - self.assertEquals(o.getProperty('tata'), 123) + self.assertEqual(o.getProperty('tata'), 123) # Make sure this is a Temp Object - self.assertEquals(o.isTempObject(), 1) + self.assertEqual(o.isTempObject(), 1) # Create a subobject and make sure it is a Temp Object a = o.newContent(portal_type = 'Telephone') - self.assertEquals(a.isTempObject(), 1) + self.assertEqual(a.isTempObject(), 1) # Test newContent with the temp_object parameter o = portal.person_module.newContent(id=987, portal_type="Person", temp_object=1) o.setTitle('bar') - self.assertEquals(o.getTitle(), 'bar') - self.assertEquals(str(o.getId()), str(987)) - self.assertEquals(o.isTempObject(), 1) + self.assertEqual(o.getTitle(), 'bar') + self.assertEqual(str(o.getId()), str(987)) + self.assertEqual(o.isTempObject(), 1) a = o.newContent(id=1, portal_type="Telephone", temp_object=1) - self.assertEquals(str(a.getId()), str(1)) - self.assertEquals(a.isTempObject(), 1) + self.assertEqual(str(a.getId()), str(1)) + self.assertEqual(a.isTempObject(), 1) b = o.newContent(id=2, portal_type="Telephone") - self.assertEquals(b.isTempObject(), 1) - self.assertEquals(b.getId(), str(2)) + self.assertEqual(b.isTempObject(), 1) + self.assertEqual(b.getId(), str(2)) # check we can create temp object without specific roles/permissions self.logout() self.loginWithNoRole() o = newTempOrganisation(portal.organisation_module,'b') - self.assertEquals(o.isTempObject(), 1) + self.assertEqual(o.isTempObject(), 1) a = o.newContent(portal_type = 'Telephone') - self.assertEquals(a.isTempObject(), 1) - self.assertEquals(a, guarded_getattr(o, a.getId())) + self.assertEqual(a.isTempObject(), 1) + self.assertEqual(a, guarded_getattr(o, a.getId())) self.logout() self.login() @@ -297,9 +297,9 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # the module is not changed from ZODB point of view self.assertFalse(portal.person_module._p_changed) # the object is not in ZODB - self.assertEquals(o._p_jar, None) + self.assertEqual(o._p_jar, None) self.commit() - self.assertEquals(o._p_jar, None) + self.assertEqual(o._p_jar, None) # Temp objects always get a dummy ID by default. o = portal.person_module.newContent(portal_type="Person", @@ -308,8 +308,8 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): o = portal.person_module.newContent(portal_type="Person", temp_object=1) second_id = o.getId() - self.assertEquals(first_id, second_id) - self.assertEquals('None', second_id) + self.assertEqual(first_id, second_id) + self.assertEqual('None', second_id) # Make sure a temp object can't be stored in the ZODB portal.person_module._setObject(o.getId(), aq_base(o)) @@ -328,20 +328,20 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): child11 = child1.newContent(portal_type='Person', id='1') child2 = parent.newContent(portal_type='Person', id='2') - self.assertEquals(child1, parent._getOb('1')) - self.assertEquals(child2, parent._getOb('2')) + self.assertEqual(child1, parent._getOb('1')) + self.assertEqual(child2, parent._getOb('2')) - self.assertEquals(child1, parent['1']) - self.assertEquals(child2, parent['2']) + self.assertEqual(child1, parent['1']) + self.assertEqual(child2, parent['2']) - self.assertEquals(child1, getattr(parent, '1')) - self.assertEquals(child2, getattr(parent, '2')) + self.assertEqual(child1, getattr(parent, '1')) + self.assertEqual(child2, getattr(parent, '2')) - self.assertEquals(child1, parent.restrictedTraverse('1')) - self.assertEquals(child11, parent.restrictedTraverse('1/1')) - self.assertEquals(child2, parent.restrictedTraverse('2')) + self.assertEqual(child1, parent.restrictedTraverse('1')) + self.assertEqual(child11, parent.restrictedTraverse('1/1')) + self.assertEqual(child2, parent.restrictedTraverse('2')) - self.assertEquals(('person_module', 'None', '1', '1'), + self.assertEqual(('person_module', 'None', '1', '1'), self.portal.portal_url.getRelativeContentPath(child11)) @@ -389,22 +389,22 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): person_object.reindexObject() category_object.reindexObject() self.tic() - self.assertEquals( person_object.getRegion(), category_id) - self.assertEquals( person_object.getRegion(base=1), category_relative_url) - self.assertEquals( person_object.getRegionValue(), category_object) - self.assertEquals( person_object.getRegionId(), category_id) - self.assertEquals( person_object.getRegionTitle(), category_title) - self.assertEquals( category_object.getRegionRelatedValueList( + self.assertEqual( person_object.getRegion(), category_id) + self.assertEqual( person_object.getRegion(base=1), category_relative_url) + self.assertEqual( person_object.getRegionValue(), category_object) + self.assertEqual( person_object.getRegionId(), category_id) + self.assertEqual( person_object.getRegionTitle(), category_title) + self.assertEqual( category_object.getRegionRelatedValueList( portal_type = "Person"), [person_object] ) - self.assertEquals( category_object.getRegionRelatedTitleList( + self.assertEqual( category_object.getRegionRelatedTitleList( portal_type = "Person"), [person_title] ) - self.assertEquals( category_object.getRegionRelatedTitleSet( + self.assertEqual( category_object.getRegionRelatedTitleSet( portal_type = "Person"), [person_title] ) - self.assertEquals( category_object.getRegionRelatedList( + self.assertEqual( category_object.getRegionRelatedList( portal_type = "Person"), [person_relative_url] ) - self.assertEquals( category_object.getRegionRelatedIdList( + self.assertEqual( category_object.getRegionRelatedIdList( portal_type = "Person"), [person_id] ) - self.assertEquals( category_object.getRegionRelatedIdSet( + self.assertEqual( category_object.getRegionRelatedIdSet( portal_type = "Person"), [person_id] ) def checkRelationUnset(self): @@ -412,17 +412,17 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): person_object.reindexObject() category_object.reindexObject() self.tic() - self.assertEquals( person_object.getRegion(), None) - self.assertEquals( person_object.getRegionValue(), None) - self.assertEquals( person_object.getRegionId(), None) - self.assertEquals( person_object.getRegionTitle(), None) - self.assertEquals( category_object.getRegionRelatedValueList( + self.assertEqual( person_object.getRegion(), None) + self.assertEqual( person_object.getRegionValue(), None) + self.assertEqual( person_object.getRegionId(), None) + self.assertEqual( person_object.getRegionTitle(), None) + self.assertEqual( category_object.getRegionRelatedValueList( portal_type = "Person"), [] ) - self.assertEquals( category_object.getRegionRelatedTitleList( + self.assertEqual( category_object.getRegionRelatedTitleList( portal_type = "Person"), [] ) - self.assertEquals( category_object.getRegionRelatedList( + self.assertEqual( category_object.getRegionRelatedList( portal_type = "Person"), [] ) - self.assertEquals( category_object.getRegionRelatedIdList( + self.assertEqual( category_object.getRegionRelatedIdList( portal_type = "Person"), [] ) # Test setRegion in default mode (base = 0) @@ -487,16 +487,16 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): module = self.getOrganisationModule() organisation = module.newContent(id='1', portal_type='Organisation') organisation.setDefaultTelephoneText('+55(0)66-5555') - self.assertEquals(organisation.default_telephone.getTelephoneCountry(),'55') - self.assertEquals(organisation.default_telephone.getTelephoneArea(),'66') - self.assertEquals(organisation.default_telephone.getTelephoneNumber(),'5555') + self.assertEqual(organisation.default_telephone.getTelephoneCountry(),'55') + self.assertEqual(organisation.default_telephone.getTelephoneArea(),'66') + self.assertEqual(organisation.default_telephone.getTelephoneNumber(),'5555') organisation.setCorporateName('Nexedi') - #self.assertEquals(organisation.default_telephone.getProperty('corporate_name'),'Nexedi') # Who is right ? XXX + #self.assertEqual(organisation.default_telephone.getProperty('corporate_name'),'Nexedi') # Who is right ? XXX organisation.default_telephone.setProperty('corporate_name','Toto') - self.assertEquals(organisation.corporate_name,'Nexedi') - self.assertEquals(organisation.default_telephone.getCorporateName(),'Nexedi') - self.assertEquals(organisation.default_telephone.corporate_name,'Toto') - self.assertEquals(organisation.default_telephone.getProperty('corporate_name'),'Toto') + self.assertEqual(organisation.corporate_name,'Nexedi') + self.assertEqual(organisation.default_telephone.getCorporateName(),'Nexedi') + self.assertEqual(organisation.default_telephone.corporate_name,'Toto') + self.assertEqual(organisation.default_telephone.getProperty('corporate_name'),'Toto') def test_06_CachingMethod(self): """Tests Caching methods.""" @@ -508,15 +508,15 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): from Products.ERP5Type.Cache import CachingMethod cache = CachingMethod(_cache, id='testing_cache') - self.assertEquals(cache(), cached_var) + self.assertEqual(cache(), cached_var) # change the variable cached_var = 'cached_var (modified)' # cache hit -> still the old variable - self.assertEquals(cache(), cached_var_orig) + self.assertEqual(cache(), cached_var_orig) self.portal.portal_caches.clearCache() - self.assertEquals(cache(), cached_var) + self.assertEqual(cache(), cached_var) def test_07_afterCloneScript(self): """manage_afterClone can call a type based script.""" @@ -539,7 +539,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): copy_data = folder.manage_copyObjects([pers.getId()]) new_id = folder.manage_pasteObjects(copy_data)[0]['new_id'] new_pers = folder[new_id] - self.assertEquals(new_pers.getTitle(), 'reseted') + self.assertEqual(new_pers.getTitle(), 'reseted') # we can even change subobjects in the script if not hasattr(pers, 'default_address'): @@ -551,7 +551,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): copy_data = folder.manage_copyObjects([pers.getId()]) new_id = folder.manage_pasteObjects(copy_data)[0]['new_id'] new_pers = folder[new_id] - self.assertEquals(new_pers.default_address.getTitle(), + self.assertEqual(new_pers.default_address.getTitle(), 'address_title_reseted') # of course, other portal types are not affected @@ -561,7 +561,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): copy_data = folder.manage_copyObjects([orga.getId()]) new_id = folder.manage_pasteObjects(copy_data)[0]['new_id'] new_orga = folder[new_id] - self.assertEquals(new_orga.getTitle(), 'something') + self.assertEqual(new_orga.getTitle(), 'something') def test_08_AccessorGeneration(self): """Tests accessor generation doesn't generate error messages. @@ -593,14 +593,14 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): for obj in folder.objectValues(): new_id = '%s_new' % obj.getId() folder.manage_renameObjects([obj.getId()], [new_id]) - self.assertEquals(obj.getId(), new_id) + self.assertEqual(obj.getId(), new_id) for obj_id in folder.objectIds(): self.assertTrue(obj_id.endswith('_new'), 'bad object id: %s' % obj_id) for id_ in id_list: new_id = '%s_new' % id_ - self.assertEquals(folder._getOb(new_id).getId(), new_id) + self.assertEqual(folder._getOb(new_id).getId(), new_id) def test_11_valueAccessor(self): """ @@ -636,7 +636,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): id = "nofunction", title = "No Function", ) - self.assertEquals(alpha.getRelativeUrl(), 'region/alpha') + self.assertEqual(alpha.getRelativeUrl(), 'region/alpha') alpha.reindexObject() beta.reindexObject() @@ -651,77 +651,77 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # Value setters (list, set, default) person.setFunction('nofunction') # Fill at least one other category person.setDefaultRegionValue(alpha) - self.assertEquals(person.getDefaultRegion(), 'alpha') - self.assertEquals(person.getRegion(), 'alpha') + self.assertEqual(person.getDefaultRegion(), 'alpha') + self.assertEqual(person.getRegion(), 'alpha') person.setRegionValue(alpha) - self.assertEquals(person.getRegion(), 'alpha') + self.assertEqual(person.getRegion(), 'alpha') person.setRegionValueList([alpha, alpha]) - self.assertEquals(person.getRegionList(), ['alpha', 'alpha']) + self.assertEqual(person.getRegionList(), ['alpha', 'alpha']) person.setRegionValueSet([alpha, alpha]) - self.assertEquals(person.getRegionList(), ['alpha']) - self.assertEquals(person.getRegionSet(), ['alpha']) + self.assertEqual(person.getRegionList(), ['alpha']) + self.assertEqual(person.getRegionSet(), ['alpha']) person.setRegionValueList([alpha, beta, alpha]) - self.assertEquals(person.getRegionList(), ['alpha', 'beta', 'alpha']) + self.assertEqual(person.getRegionList(), ['alpha', 'beta', 'alpha']) person.setRegionValueSet([alpha, beta, alpha]) result = person.getRegionSet() result.sort() - self.assertEquals(result, ['alpha', 'beta']) + self.assertEqual(result, ['alpha', 'beta']) person.setDefaultRegionValue(beta) - self.assertEquals(person.getDefaultRegion(), 'beta') + self.assertEqual(person.getDefaultRegion(), 'beta') result = person.getRegionSet() result.sort() - self.assertEquals(result, ['alpha', 'beta']) - self.assertEquals(person.getRegionList(), ['beta', 'alpha']) + self.assertEqual(result, ['alpha', 'beta']) + self.assertEqual(person.getRegionList(), ['beta', 'alpha']) person.setDefaultRegionValue(alpha) - self.assertEquals(person.getDefaultRegion(), 'alpha') + self.assertEqual(person.getDefaultRegion(), 'alpha') result = person.getRegionSet() result.sort() - self.assertEquals(result, ['alpha', 'beta']) - self.assertEquals(person.getRegionList(), ['alpha', 'beta']) + self.assertEqual(result, ['alpha', 'beta']) + self.assertEqual(person.getRegionList(), ['alpha', 'beta']) # Test accessor on documents rather than on categories person.setDefaultRegionValue(person) - self.assertEquals(person.getDefaultRegion(), person.getRelativeUrl()) - self.assertEquals(person.getRegionList(), [person.getRelativeUrl(), 'alpha', 'beta']) + self.assertEqual(person.getDefaultRegion(), person.getRelativeUrl()) + self.assertEqual(person.getRegionList(), [person.getRelativeUrl(), 'alpha', 'beta']) person.setRegionValue([person, alpha, beta]) - self.assertEquals(person.getRegionList(), [person.getRelativeUrl(), 'alpha', 'beta']) + self.assertEqual(person.getRegionList(), [person.getRelativeUrl(), 'alpha', 'beta']) # Category setters (list, set, default) person = module.newContent(portal_type='Person') person.setFunction('nofunction') # Fill at least one other category person.setDefaultRegion('alpha') - self.assertEquals(person.getRegion(), 'alpha') - self.assertEquals(person.getDefaultRegion(), 'alpha') + self.assertEqual(person.getRegion(), 'alpha') + self.assertEqual(person.getDefaultRegion(), 'alpha') person.setRegion('alpha') - self.assertEquals(person.getRegion(), 'alpha') + self.assertEqual(person.getRegion(), 'alpha') person.setRegionList(['alpha', 'alpha']) - self.assertEquals(person.getRegionList(), ['alpha', 'alpha']) - self.assertEquals(person.getRegionSet(), ['alpha']) + self.assertEqual(person.getRegionList(), ['alpha', 'alpha']) + self.assertEqual(person.getRegionSet(), ['alpha']) person.setRegionSet(['beta', 'alpha', 'alpha']) - self.assertEquals(person.getRegionList(), ['alpha', 'beta']) + self.assertEqual(person.getRegionList(), ['alpha', 'beta']) person.setRegionList(['beta', 'alpha', 'alpha']) - self.assertEquals(person.getRegionList(), ['beta', 'alpha', 'alpha']) + self.assertEqual(person.getRegionList(), ['beta', 'alpha', 'alpha']) # at this point the person have a default region set to the first item in # the list. - self.assertEquals(person.getDefaultRegion(), 'beta') + self.assertEqual(person.getDefaultRegion(), 'beta') person.setRegionSet(['alpha', 'beta', 'alpha']) - self.assertEquals(person.getRegionList(), ['beta', 'alpha']) + self.assertEqual(person.getRegionList(), ['beta', 'alpha']) # calling a set setter did not change the default region - self.assertEquals(person.getDefaultRegion(), 'beta') + self.assertEqual(person.getDefaultRegion(), 'beta') person.setDefaultRegion('alpha') - self.assertEquals(person.getDefaultRegion(), 'alpha') - self.assertEquals(sorted(person.getRegionSet()), ['alpha', 'beta']) - self.assertEquals(person.getRegionList(), ['alpha', 'beta']) + self.assertEqual(person.getDefaultRegion(), 'alpha') + self.assertEqual(sorted(person.getRegionSet()), ['alpha', 'beta']) + self.assertEqual(person.getRegionList(), ['alpha', 'beta']) person.setDefaultRegion('beta') - self.assertEquals(person.getDefaultRegion(), 'beta') - self.assertEquals(sorted(person.getRegionSet()), ['alpha', 'beta']) - self.assertEquals(person.getRegionList(), ['beta', 'alpha']) + self.assertEqual(person.getDefaultRegion(), 'beta') + self.assertEqual(sorted(person.getRegionSet()), ['alpha', 'beta']) + self.assertEqual(person.getRegionList(), ['beta', 'alpha']) # Test accessor on documents rather than on categories person.setDefaultRegion(person.getRelativeUrl()) - self.assertEquals(person.getDefaultRegion(), person.getRelativeUrl()) - self.assertEquals(person.getRegionList(), [person.getRelativeUrl(), 'beta', 'alpha']) + self.assertEqual(person.getDefaultRegion(), person.getRelativeUrl()) + self.assertEqual(person.getRegionList(), [person.getRelativeUrl(), 'beta', 'alpha']) person.setRegion([person.getRelativeUrl(), 'alpha', 'beta']) - self.assertEquals(person.getRegionList(), [person.getRelativeUrl(), 'alpha', 'beta']) + self.assertEqual(person.getRegionList(), [person.getRelativeUrl(), 'alpha', 'beta']) # Uid setters (list, set, default) person = module.newContent(portal_type='Person') @@ -729,32 +729,32 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.tic()# Make sure person is reindexed person.setFunction('nofunction') # Fill at least one other category person.setDefaultRegionUid(alpha.getUid()) - self.assertEquals(person.getRegion(), 'alpha') - self.assertEquals(person.getDefaultRegion(), 'alpha') + self.assertEqual(person.getRegion(), 'alpha') + self.assertEqual(person.getDefaultRegion(), 'alpha') person.setRegionUid(alpha.getUid()) - self.assertEquals(person.getRegion(), 'alpha') + self.assertEqual(person.getRegion(), 'alpha') person.setRegionUidList([beta.getUid(), beta.getUid()]) - self.assertEquals(person.getRegionList(), ['beta', 'beta']) + self.assertEqual(person.getRegionList(), ['beta', 'beta']) person.setRegionUidSet([alpha.getUid(), alpha.getUid()]) - self.assertEquals(person.getRegionList(), ['alpha']) + self.assertEqual(person.getRegionList(), ['alpha']) person.setRegionUidList([alpha.getUid(), beta.getUid(), alpha.getUid()]) - self.assertEquals(person.getRegionList(), ['alpha', 'beta', 'alpha']) + self.assertEqual(person.getRegionList(), ['alpha', 'beta', 'alpha']) person.setRegionUidSet([alpha.getUid(), beta.getUid(), alpha.getUid()]) - self.assertEquals(sorted(person.getRegionSet()), ['alpha', 'beta']) + self.assertEqual(sorted(person.getRegionSet()), ['alpha', 'beta']) person.setDefaultRegionUid(beta.getUid()) - self.assertEquals(person.getDefaultRegion(), 'beta') - self.assertEquals(sorted(person.getRegionSet()), ['alpha', 'beta']) - self.assertEquals(person.getRegionList(), ['beta', 'alpha']) + self.assertEqual(person.getDefaultRegion(), 'beta') + self.assertEqual(sorted(person.getRegionSet()), ['alpha', 'beta']) + self.assertEqual(person.getRegionList(), ['beta', 'alpha']) person.setDefaultRegionUid(alpha.getUid()) - self.assertEquals(person.getDefaultRegion(), 'alpha') - self.assertEquals(sorted(person.getRegionSet()), ['alpha', 'beta']) - self.assertEquals(person.getRegionList(), ['alpha', 'beta']) + self.assertEqual(person.getDefaultRegion(), 'alpha') + self.assertEqual(sorted(person.getRegionSet()), ['alpha', 'beta']) + self.assertEqual(person.getRegionList(), ['alpha', 'beta']) # Test accessor on documents rather than on categories person.setDefaultRegionUid(person.getUid()) - self.assertEquals(person.getDefaultRegion(), person.getRelativeUrl()) - self.assertEquals(person.getRegionList(), [person.getRelativeUrl(), 'alpha', 'beta']) + self.assertEqual(person.getDefaultRegion(), person.getRelativeUrl()) + self.assertEqual(person.getRegionList(), [person.getRelativeUrl(), 'alpha', 'beta']) person.setRegionUid([person.getUid(), alpha.getUid(), beta.getUid()]) - self.assertEquals(person.getRegionList(), [person.getRelativeUrl(), 'alpha', 'beta']) + self.assertEqual(person.getRegionList(), [person.getRelativeUrl(), 'alpha', 'beta']) def test_12_listAccessor(self): """ @@ -769,32 +769,32 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # Do the same tests as in test_11_valueAccessor person.setSubject('beta') - self.assertEquals(person.getSubject(), 'beta') + self.assertEqual(person.getSubject(), 'beta') person.setSubjectList(['alpha', 'alpha']) - self.assertEquals(person.getSubjectList(), ['alpha', 'alpha']) - self.assertEquals(person.getSubjectSet(), ['alpha']) + self.assertEqual(person.getSubjectList(), ['alpha', 'alpha']) + self.assertEqual(person.getSubjectSet(), ['alpha']) person.setSubjectSet(['beta', 'beta']) - self.assertEquals(person.getSubjectList(), ['beta']) - self.assertEquals(person.getSubjectSet(), ['beta']) + self.assertEqual(person.getSubjectList(), ['beta']) + self.assertEqual(person.getSubjectSet(), ['beta']) person.setSubjectList(['beta', 'alpha', 'beta']) - self.assertEquals(person.getSubjectList(), ['beta', 'alpha', 'beta']) + self.assertEqual(person.getSubjectList(), ['beta', 'alpha', 'beta']) person.setSubjectSet(['alpha', 'beta', 'alpha']) - self.assertEquals(person.getSubjectList(), ['beta', 'alpha']) + self.assertEqual(person.getSubjectList(), ['beta', 'alpha']) result = person.getSubjectSet() result.sort() - self.assertEquals(result, ['alpha', 'beta']) + self.assertEqual(result, ['alpha', 'beta']) person.setDefaultSubject('beta') - self.assertEquals(person.getDefaultSubject(), 'beta') + self.assertEqual(person.getDefaultSubject(), 'beta') result = person.getSubjectSet() result.sort() - self.assertEquals(result, ['alpha', 'beta']) - self.assertEquals(person.getSubjectList(), ['beta', 'alpha']) + self.assertEqual(result, ['alpha', 'beta']) + self.assertEqual(person.getSubjectList(), ['beta', 'alpha']) person.setDefaultSubject('alpha') - self.assertEquals(person.getDefaultSubject(), 'alpha') + self.assertEqual(person.getDefaultSubject(), 'alpha') result = person.getSubjectSet() result.sort() - self.assertEquals(result, ['alpha', 'beta']) - self.assertEquals(person.getSubjectList(), ['alpha', 'beta']) + self.assertEqual(result, ['alpha', 'beta']) + self.assertEqual(person.getSubjectList(), ['alpha', 'beta']) def test_storage_id_accessor(self): self._addProperty('Person', @@ -805,11 +805,11 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): portal_type='Standard Property') obj = self.getPersonModule().newContent(portal_type='Person') obj.setFooBar('foo') - self.assertEquals('foo', obj.getFooBar()) - self.assertEquals('foo', getattr(obj, 'foo_bar_storage', 'unset')) + self.assertEqual('foo', obj.getFooBar()) + self.assertEqual('foo', getattr(obj, 'foo_bar_storage', 'unset')) obj.edit(foo_bar='bar') - self.assertEquals('bar', obj.getFooBar()) - self.assertEquals('bar', getattr(obj, 'foo_bar_storage', 'unset')) + self.assertEqual('bar', obj.getFooBar()) + self.assertEqual('bar', getattr(obj, 'foo_bar_storage', 'unset')) def test_13_acquiredAccessor(self): """ @@ -843,26 +843,26 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): person.getFirstName = getFirstName # test static method - self.assertEquals(person.getFirstName(), None) - self.assertEquals(person.getFirstName('foo'), 'foo') - self.assertEquals(person.getFirstName(default='foo'), 'foo') + self.assertEqual(person.getFirstName(), None) + self.assertEqual(person.getFirstName('foo'), 'foo') + self.assertEqual(person.getFirstName(default='foo'), 'foo') # test dynamic method - self.assertEquals(person.getLastName(), None) - self.assertEquals(person.getLastName('foo'), 'foo') - #self.assertEquals(person.getLastName(default='foo'), 'foo') + self.assertEqual(person.getLastName(), None) + self.assertEqual(person.getLastName('foo'), 'foo') + #self.assertEqual(person.getLastName(default='foo'), 'foo') # test static method through getProperty - self.assertEquals(person.getProperty('first_name'), None) - self.assertEquals(person.getProperty('first_name', 'foo'), 'foo') - self.assertEquals(person.getProperty('first_name', d='foo'), 'foo') + self.assertEqual(person.getProperty('first_name'), None) + self.assertEqual(person.getProperty('first_name', 'foo'), 'foo') + self.assertEqual(person.getProperty('first_name', d='foo'), 'foo') # test dynamic method through getProperty - self.assertEquals(person.getProperty('last_name'), None) - self.assertEquals(person.getProperty('last_name', 'foo'), 'foo') - self.assertEquals(person.getProperty('last_name', d='foo'), 'foo') + self.assertEqual(person.getProperty('last_name'), None) + self.assertEqual(person.getProperty('last_name', 'foo'), 'foo') + self.assertEqual(person.getProperty('last_name', d='foo'), 'foo') # test simple property through getProperty property_name = 'XXXthis_property_does_not_exist123123' - self.assertEquals(person.getProperty(property_name), None) - self.assertEquals(person.getProperty(property_name, 'foo'), 'foo') - self.assertEquals(person.getProperty(property_name, d='foo'), 'foo') + self.assertEqual(person.getProperty(property_name), None) + self.assertEqual(person.getProperty(property_name, 'foo'), 'foo') + self.assertEqual(person.getProperty(property_name, d='foo'), 'foo') def test_15b_DefaultValueDefinedOnPropertySheet(self): """Tests that the default value is returned correctly when a default @@ -878,24 +878,24 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): module = self.getPersonModule() person = module.newContent(id='1', portal_type='Person') # The default ps value will be returned, when using generated accessor - self.assertEquals('ps_default', person.getDummyPsProp()) + self.assertEqual('ps_default', person.getDummyPsProp()) # (unless you explicitly pass a default value. - self.assertEquals('default', person.getDummyPsProp('default')) + self.assertEqual('default', person.getDummyPsProp('default')) # using getProperty - self.assertEquals('ps_default', person.getProperty('dummy_ps_prop')) - self.assertEquals('default', person.getProperty('dummy_ps_prop', 'default')) + self.assertEqual('ps_default', person.getProperty('dummy_ps_prop')) + self.assertEqual('default', person.getProperty('dummy_ps_prop', 'default')) # None can be a default value too - self.assertEquals(None, person.getProperty('dummy_ps_prop', None)) - self.assertEquals(None, person.getDummyPsProp(None)) + self.assertEqual(None, person.getProperty('dummy_ps_prop', None)) + self.assertEqual(None, person.getDummyPsProp(None)) # once the value has been set, there's no default value = 'a value' person.setDummyPsProp(value) - self.assertEquals(value, person.getDummyPsProp()) - self.assertEquals(value, person.getDummyPsProp('default')) - self.assertEquals(value, person.getProperty('dummy_ps_prop')) - self.assertEquals(value, person.getProperty('dummy_ps_prop', d='default')) + self.assertEqual(value, person.getDummyPsProp()) + self.assertEqual(value, person.getDummyPsProp('default')) + self.assertEqual(value, person.getProperty('dummy_ps_prop')) + self.assertEqual(value, person.getProperty('dummy_ps_prop', d='default')) def test_15b_ListAccessorsDefaultValueDefinedOnPropertySheet(self): @@ -916,21 +916,21 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertTrue(hasattr(person, 'getDummyPsPropList')) # The default ps value will be returned, when using generated accessor - self.assertEquals([1, 2, 3], person.getDummyPsPropList()) + self.assertEqual([1, 2, 3], person.getDummyPsPropList()) # (unless you explicitly pass a default value. - self.assertEquals(['default'], person.getDummyPsPropList(['default'])) + self.assertEqual(['default'], person.getDummyPsPropList(['default'])) # using getProperty - self.assertEquals([1, 2, 3], person.getProperty('dummy_ps_prop_list')) - self.assertEquals(['default'], + self.assertEqual([1, 2, 3], person.getProperty('dummy_ps_prop_list')) + self.assertEqual(['default'], person.getProperty('dummy_ps_prop_list', ['default'])) # once the value has been set, there's no default value_list = ['some', 'values'] person.setDummyPsPropList(value_list) - self.assertEquals(value_list, person.getDummyPsPropList()) - self.assertEquals(value_list, person.getDummyPsPropList(['default'])) - self.assertEquals(value_list, person.getProperty('dummy_ps_prop_list')) - self.assertEquals(value_list, + self.assertEqual(value_list, person.getDummyPsPropList()) + self.assertEqual(value_list, person.getDummyPsPropList(['default'])) + self.assertEqual(value_list, person.getProperty('dummy_ps_prop_list')) + self.assertEqual(value_list, person.getProperty('dummy_ps_prop_list', d=['default'])) @@ -942,8 +942,8 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # test default value of getDescription accessor # as defined in the DublinCore PropertySheet - self.assertEquals('', person.getDescription()) - self.assertEquals('foo', + self.assertEqual('', person.getDescription()) + self.assertEqual('foo', person.getDescription('foo')) def test_16_SimpleStringAccessor(self): @@ -955,26 +955,26 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): elementary_type='string', portal_type='Standard Property') person = self.getPersonModule().newContent(id='1', portal_type='Person') - self.assertEquals('string', person.getPropertyType('dummy_ps_prop')) + self.assertEqual('string', person.getPropertyType('dummy_ps_prop')) self.assertTrue(hasattr(person, 'getDummyPsProp')) self.assertTrue(hasattr(person, 'setDummyPsProp')) person.setDummyPsProp('a value') self.assertTrue(person.hasProperty('dummy_ps_prop')) - self.assertEquals('a value', person.getDummyPsProp()) + self.assertEqual('a value', person.getDummyPsProp()) # string accessors converts the data type, if provided an unicode, it # will store an utf-8 encoded string person.setDummyPsProp(u'type convérsion') - self.assertEquals('type convérsion', person.getDummyPsProp()) + self.assertEqual('type convérsion', person.getDummyPsProp()) # if provided anything else, it will store it's string representation person.setDummyPsProp(1) - self.assertEquals('1', person.getDummyPsProp()) + self.assertEqual('1', person.getDummyPsProp()) class Dummy: def __str__(self): return 'string representation' person.setDummyPsProp(Dummy()) - self.assertEquals('string representation', person.getDummyPsProp()) + self.assertEqual('string representation', person.getDummyPsProp()) def test_17_WorkflowStateAccessor(self): @@ -989,7 +989,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # those are assumptions for this test. self.assertTrue(wf.getId() in self.getWorkflowTool().getChainFor('Person')) - self.assertEquals('validation_state', wf.variables.getStateVar()) + self.assertEqual('validation_state', wf.variables.getStateVar()) initial_state = wf.states[wf.initial_state] other_state = wf.states['validated'] @@ -997,46 +997,46 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertTrue(hasattr(person, 'getValidationStateTitle')) self.assertTrue(hasattr(person, 'getTranslatedValidationStateTitle')) - self.assertEquals(initial_state.getId(), person.getValidationState()) - self.assertEquals(initial_state.title, + self.assertEqual(initial_state.getId(), person.getValidationState()) + self.assertEqual(initial_state.title, person.getValidationStateTitle()) - self.assertEquals(initial_state.title, + self.assertEqual(initial_state.title, person.getTranslatedValidationStateTitle()) self.assertTrue([initial_state.title], message_catalog._translated) - self.assertEquals(initial_state.getId(), + self.assertEqual(initial_state.getId(), person.getProperty('validation_state')) - self.assertEquals(initial_state.title, + self.assertEqual(initial_state.title, person.getProperty('validation_state_title')) message_catalog._translated = [] - self.assertEquals(initial_state.title, + self.assertEqual(initial_state.title, person.getProperty('translated_validation_state_title')) self.assertTrue([initial_state.title], message_catalog._translated) # default parameter is accepted by getProperty for compatibility - self.assertEquals(initial_state.getId(), + self.assertEqual(initial_state.getId(), person.getProperty('validation_state', 'default')) - self.assertEquals(initial_state.title, + self.assertEqual(initial_state.title, person.getProperty('validation_state_title', 'default')) message_catalog._translated = [] - self.assertEquals(initial_state.title, + self.assertEqual(initial_state.title, person.getProperty('translated_validation_state_title', 'default')) self.assertTrue([initial_state.title], message_catalog._translated) # pass a transition and check accessors again. person.validate() - self.assertEquals(other_state.getId(), person.getValidationState()) - self.assertEquals(other_state.title, + self.assertEqual(other_state.getId(), person.getValidationState()) + self.assertEqual(other_state.title, person.getValidationStateTitle()) - self.assertEquals(other_state.title, + self.assertEqual(other_state.title, person.getTranslatedValidationStateTitle()) - self.assertEquals(other_state.getId(), + self.assertEqual(other_state.getId(), person.getProperty('validation_state')) - self.assertEquals(other_state.title, + self.assertEqual(other_state.title, person.getProperty('validation_state_title')) message_catalog._translated = [] - self.assertEquals(other_state.title, + self.assertEqual(other_state.title, person.getProperty('translated_validation_state_title')) self.assertTrue([other_state.title], message_catalog._translated) @@ -1074,9 +1074,9 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # an organisation is created inside the person. default_organisation = person._getOb('default_organisation', None) self.assertNotEquals(None, default_organisation) - self.assertEquals('Organisation', + self.assertEqual('Organisation', default_organisation.getPortalTypeName()) - self.assertEquals('The organisation title', + self.assertEqual('The organisation title', default_organisation.getTitle()) self.assertTrue(person.hasDefaultOrganisation()) self.assertTrue(person.hasOrganisation()) @@ -1084,7 +1084,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertTrue(person.hasOrganisationTitle()) # make sure this new organisation is indexed self.commit() - self.assertEquals(1, len([m for m in + self.assertEqual(1, len([m for m in self.portal.portal_activities.getMessageList() if m.method_id == 'immediateReindexObject' and m.object_path == default_organisation.getPhysicalPath()])) @@ -1092,13 +1092,13 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # edit once again, this time no new organisation is created, the same is # edited, and reindexed - self.assertEquals(1, len(person.objectIds())) + self.assertEqual(1, len(person.objectIds())) self.assertFalse(person._p_changed) person.setDefaultOrganisationTitle('New title') - self.assertEquals('New title', + self.assertEqual('New title', default_organisation.getTitle()) self.commit() - self.assertEquals(1, len([m for m in + self.assertEqual(1, len([m for m in self.portal.portal_activities.getMessageList() if m.method_id == 'immediateReindexObject' and m.object_path == default_organisation.getPhysicalPath()])) @@ -1106,15 +1106,15 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # edit once again (this time, with edit method), this time no new # organisation is created, the same is edited, and reindexed - self.assertEquals(1, len(person.objectIds())) + self.assertEqual(1, len(person.objectIds())) self.assertFalse(person._p_changed) person.edit(default_organisation_title='New title 2') - self.assertEquals('New title 2', + self.assertEqual('New title 2', default_organisation.getTitle()) - self.assertEquals(0, len([m for m in + self.assertEqual(0, len([m for m in self.portal.portal_activities.getMessageList()])) self.commit() - self.assertEquals(1, len([m for m in + self.assertEqual(1, len([m for m in self.portal.portal_activities.getMessageList() if m.method_id == 'immediateReindexObject' and m.object_path == default_organisation.getPhysicalPath()])) @@ -1138,14 +1138,14 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): default_organisation = person._getOb('default_organisation', None) self.assertNotEquals(None, default_organisation) - self.assertEquals('Organisation', + self.assertEqual('Organisation', default_organisation.getPortalTypeName()) - self.assertEquals('The organisation ref', + self.assertEqual('The organisation ref', default_organisation.getReference()) # make sure this new organisation is indexed self.commit() - self.assertEquals(1, len([m for m in + self.assertEqual(1, len([m for m in self.portal.portal_activities.getMessageList() if m.method_id == 'immediateReindexObject' and m.object_path == default_organisation.getPhysicalPath()])) @@ -1153,13 +1153,13 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # edit once again, this time no new organisation is created, the same is # edited, and reindexed - self.assertEquals(1, len(person.objectIds())) + self.assertEqual(1, len(person.objectIds())) self.assertFalse(person._p_changed) person.setDefaultOrganisationReference('New reference') - self.assertEquals('New reference', + self.assertEqual('New reference', default_organisation.getReference()) self.commit() - self.assertEquals(1, len([m for m in + self.assertEqual(1, len([m for m in self.portal.portal_activities.getMessageList() if m.method_id == 'immediateReindexObject' and m.object_path == default_organisation.getPhysicalPath()])) @@ -1167,15 +1167,15 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # edit once again (this time, with edit method), this time no new # organisation is created, the same is edited, and reindexed - self.assertEquals(1, len(person.objectIds())) + self.assertEqual(1, len(person.objectIds())) self.assertFalse(person._p_changed) person.edit(default_organisation_reference='New reference 2') - self.assertEquals('New reference 2', + self.assertEqual('New reference 2', default_organisation.getReference()) - self.assertEquals(0, len([m for m in + self.assertEqual(0, len([m for m in self.portal.portal_activities.getMessageList()])) self.commit() - self.assertEquals(1, len([m for m in + self.assertEqual(1, len([m for m in self.portal.portal_activities.getMessageList() if m.method_id == 'immediateReindexObject' and m.object_path == default_organisation.getPhysicalPath()])) @@ -1205,7 +1205,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # an organisation is created inside the person. default_organisation = person._getOb('default_organisation', None) self.assertNotEquals(None, default_organisation) - self.assertEquals('The organisation title', + self.assertEqual('The organisation title', person.getDefaultOrganisationTitle()) DEFAULT_ORGANISATION_TITLE_ACQUIRED_PROP = { @@ -1248,15 +1248,15 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): person.setDestinationValue(other_pers) # title is acquired from the other person - self.assertEquals(other_pers_title, + self.assertEqual(other_pers_title, person.getDefaultOrganisationTitle()) # now if we save, it should create a default_organisation inside this # person, but do not modify the other_pers. person.setDefaultOrganisationTitle('Our organisation title') - self.assertEquals('Our organisation title', + self.assertEqual('Our organisation title', person.getDefaultOrganisationTitle()) - self.assertEquals(other_pers_title, + self.assertEqual(other_pers_title, other_pers.getDefaultOrganisationTitle()) def test_19b_AcquiredContentAccessorWithIdClash(self): @@ -1289,7 +1289,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # an organisation is created inside the person. default_organisation = person._getOb('default_organisation', None) self.assertNotEquals(None, default_organisation) - self.assertEquals('The organisation title', + self.assertEqual('The organisation title', person.getDefaultOrganisationTitle()) DEFAULT_LANGUAGE_PROP = { @@ -1323,15 +1323,15 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): person = self.getPersonModule().newContent(id='1', portal_type='Person') email = person.newContent(portal_type='Email') - self.assertEquals(0, len(email.getAvailableLanguageList())) + self.assertEqual(0, len(email.getAvailableLanguageList())) email.setAvailableLanguageSet(['fr', 'en', 'ja']) - self.assertEquals(email.getAvailableLanguageList(), ('fr', 'en', 'ja')) - self.assertEquals(email.getAvailableLanguage(), 'fr') - self.assertEquals(email.getDefaultAvailableLanguage(), 'fr') + self.assertEqual(email.getAvailableLanguageList(), ('fr', 'en', 'ja')) + self.assertEqual(email.getAvailableLanguage(), 'fr') + self.assertEqual(email.getDefaultAvailableLanguage(), 'fr') email.setDefaultAvailableLanguage('ja') - self.assertEquals(email.getAvailableLanguage(), 'ja') - self.assertEquals(email.getDefaultAvailableLanguage(), 'ja') - self.assertEquals(email.getAvailableLanguageList(), ('ja', 'fr', 'en')) + self.assertEqual(email.getAvailableLanguage(), 'ja') + self.assertEqual(email.getDefaultAvailableLanguage(), 'ja') + self.assertEqual(email.getAvailableLanguageList(), ('ja', 'fr', 'en')) SUBORDINATION_ORGANISATION_REFERENCE = { 'portal_type': 'Acquired Property', @@ -1362,22 +1362,22 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): person.setSubordinationOrganisationReference(person_reference) # Relation is not setted up, accessor must return # local value - self.assertEquals(person.getSubordinationOrganisationReference(), + self.assertEqual(person.getSubordinationOrganisationReference(), person_reference) person.setSubordinationValue(organisation) self.tic() # mask_value is True, so local value take precedence - self.assertEquals(person.getSubordinationOrganisationReference(), + self.assertEqual(person.getSubordinationOrganisationReference(), person_reference) organisation_reference = 'organisation_terry' organisation.setReference(organisation_reference) - self.assertEquals(person.getSubordinationOrganisationReference(), + self.assertEqual(person.getSubordinationOrganisationReference(), person_reference) person.setSubordinationOrganisationReference(None) - self.assertEquals(person.getSubordinationOrganisationReference(), + self.assertEqual(person.getSubordinationOrganisationReference(), organisation_reference) SUBORDINATION_ORGANISATION_SOURCE_REFERENCE = { @@ -1409,7 +1409,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): person.setSubordinationOrganisationSourceReference(person_reference) # Relation is not setted up, accessor must return # local value - self.assertEquals(person.getSubordinationOrganisationSourceReference(), + self.assertEqual(person.getSubordinationOrganisationSourceReference(), person_reference) person.setSubordinationValue(organisation) @@ -1419,15 +1419,15 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # Because relation exists but distant document has no # value, accessors fallback on local_value to display # something to the user. - self.assertEquals(person.getSubordinationOrganisationSourceReference(), + self.assertEqual(person.getSubordinationOrganisationSourceReference(), person_reference) organisation_reference = 'organisation_terry' organisation.setSourceReference(organisation_reference) - self.assertEquals(person.getSubordinationOrganisationSourceReference(), + self.assertEqual(person.getSubordinationOrganisationSourceReference(), organisation_reference) person.setSubordinationOrganisationSourceReference(None) - self.assertEquals(person.getSubordinationOrganisationSourceReference(), + self.assertEqual(person.getSubordinationOrganisationSourceReference(), organisation_reference) @@ -1502,13 +1502,13 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): obj.setTitle('obj title') copy = obj.asContext() self.assertTrue(copy.isTempObject(), '%r is not a temp object' % (copy,)) - self.assertEquals(obj, copy.getOriginalDocument()) - self.assertEquals(obj.absolute_url(), + self.assertEqual(obj, copy.getOriginalDocument()) + self.assertEqual(obj.absolute_url(), copy.getOriginalDocument().absolute_url()) copy.setTitle('copy title') - self.assertEquals('obj title', obj.getTitle()) - self.assertEquals('copy title', copy.getTitle()) - self.assertEquals(obj.getId(), copy.getId()) + self.assertEqual('obj title', obj.getTitle()) + self.assertEqual('copy title', copy.getTitle()) + self.assertEqual(obj.getId(), copy.getId()) # asContext method accepts parameters, and edit the copy with those # parameters @@ -1516,13 +1516,13 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): obj.setTitle('obj title') copy = obj.asContext(title='copy title') self.assertTrue(copy.isTempObject(), '%r is not a temp object' % (copy,)) - self.assertEquals('obj title', obj.getTitle()) - self.assertEquals('copy title', copy.getTitle()) - self.assertEquals(obj.getId(), copy.getId()) + self.assertEqual('obj title', obj.getTitle()) + self.assertEqual('copy title', copy.getTitle()) + self.assertEqual(obj.getId(), copy.getId()) # acquisition context is the same - self.assertEquals(self.getPersonModule(), obj.getParentValue()) - self.assertEquals(self.getPersonModule(), copy.getParentValue()) + self.assertEqual(self.getPersonModule(), obj.getParentValue()) + self.assertEqual(self.getPersonModule(), copy.getParentValue()) # Test category accessor gender = self.getCategoryTool().gender._getOb('male', None) @@ -1531,15 +1531,15 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): portal_type='Category', id='male') # Category can not be used as asContext parameter # new_copy = obj.asContext(gender=gender.getCategoryRelativeUrl()) -# self.assertEquals(gender.getCategoryRelativeUrl(), new_copy.getGender()) +# self.assertEqual(gender.getCategoryRelativeUrl(), new_copy.getGender()) new_copy = obj.asContext() self.assertTrue(new_copy.isTempObject(), '%r is not a temp object' % (new_copy,)) - self.assertEquals(obj.getId(), new_copy.getId()) + self.assertEqual(obj.getId(), new_copy.getId()) new_copy.edit(gender=gender.getCategoryRelativeUrl()) self.tic() - self.assertEquals(gender.getCategoryRelativeUrl(), new_copy.getGender()) - self.assertEquals(None, obj.getGender()) + self.assertEqual(gender.getCategoryRelativeUrl(), new_copy.getGender()) + self.assertEqual(None, obj.getGender()) # Make sure that we can do the same for a tool. category_tool = self.getCategoryTool() @@ -1548,9 +1548,9 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): copy_of_category_tool = category_tool.asContext(title=copy_title) self.assertTrue(copy_of_category_tool.isTempObject(), '%r is not a temp object' % (copy_of_category_tool,)) - self.assertEquals(category_tool.getTitle(), original_title) - self.assertEquals(copy_of_category_tool.getTitle(), copy_title) - self.assertEquals(category_tool.getId(), copy_of_category_tool.getId()) + self.assertEqual(category_tool.getTitle(), original_title) + self.assertEqual(copy_of_category_tool.getTitle(), copy_title) + self.assertEqual(category_tool.getId(), copy_of_category_tool.getId()) def test_21_ActionCondition(self): """Tests action conditions @@ -1598,10 +1598,10 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): default_view_list = [view for view in portal_type_object.listActions() if view.getReference() == 'view'] # we got only one default view on this portal type - self.assertEquals(1, len(default_view_list)) + self.assertEqual(1, len(default_view_list)) default_view = default_view_list[0] - self.assertEquals("Organisation_view", + self.assertEqual("Organisation_view", portal_type_object.getDefaultViewFor(obj).getId()) # Add new action with low priority to replace default view @@ -1616,7 +1616,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): float_index=0.5) # check new default view is resturn - self.assertEquals("Organisation_viewDetails", + self.assertEqual("Organisation_viewDetails", portal_type_object.getDefaultViewFor(obj).getId()) # Add new action with low priority @@ -1632,7 +1632,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): float_index=0.3) # Default view must not change - self.assertEquals("Organisation_viewDetails", + self.assertEqual("Organisation_viewDetails", portal_type_object.getDefaultViewFor(obj).getId()) # If no action belong to view category, getDefaultViewFor @@ -1655,7 +1655,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): float_index=0.2) # check new custom action '_list' is return - self.assertEquals("Organisation_viewFinancialInformationList", + self.assertEqual("Organisation_viewFinancialInformationList", portal_type_object.getDefaultViewFor(obj).getId()) # Avoid deletion of actions fo rother tests @@ -1689,7 +1689,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertTrue('Auditor' not in user.getRolesInContext(person)) self.logout() newSecurityManager(None, user) - self.assertEquals(len(person_module.searchFolder(id=person.getId())), 0) + self.assertEqual(len(person_module.searchFolder(id=person.getId())), 0) self.logout() self.login() @@ -1704,7 +1704,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertTrue('Auditor' in user.getRolesInContext(person)) self.logout() newSecurityManager(None, user) - self.assertEquals(len(person_module.searchFolder(id=person.getId())), 0) + self.assertEqual(len(person_module.searchFolder(id=person.getId())), 0) self.logout() self.login() @@ -1715,7 +1715,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertTrue('Auditor' in user.getRolesInContext(person)) self.logout() newSecurityManager(None, user) - self.assertEquals(len(person_module.searchFolder(id=person.getId())), 1) + self.assertEqual(len(person_module.searchFolder(id=person.getId())), 1) self.logout() self.login() @@ -1746,7 +1746,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): title = "Alpha System", ) alpha_path = alpha.getRelativeUrl() - self.assertEquals(alpha.getRelativeUrl(), 'region/alpha') + self.assertEqual(alpha.getRelativeUrl(), 'region/alpha') # Create a new person module = self.getPersonModule() @@ -1836,12 +1836,12 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): from Products.ERP5Type.Document import newTempPerson o = newTempPerson(portal, 'temp_person_1') self.assertTrue(o.isTempObject()) - self.assertEquals(o.getOriginalDocument(), None) + self.assertEqual(o.getOriginalDocument(), None) # This should generate a workflow method. - self.assertEquals(o.getValidationState(), 'draft') + self.assertEqual(o.getValidationState(), 'draft') o.validate() - self.assertEquals(o.getValidationState(), 'validated') + self.assertEqual(o.getValidationState(), 'validated') # Create a new persistent person object. person_module = portal.person_module @@ -1849,12 +1849,12 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): if person_id in person_module.objectIds(): person_module.manage_delObjects([person_id]) o = person_module.newContent(id=person_id, portal_type='Person') - self.failIf(o.isTempObject()) + self.assertFalse(o.isTempObject()) # This should call methods generated above for the temporary object. - self.assertEquals(o.getValidationState(), 'draft') + self.assertEqual(o.getValidationState(), 'draft') o.validate() - self.assertEquals(o.getValidationState(), 'validated') + self.assertEqual(o.getValidationState(), 'validated') # Paranoia: test the reverse snenario as well, although this # should succeed anyway. @@ -1864,24 +1864,24 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): if person_id in person_module.objectIds(): person_module.manage_delObjects([person_id]) o = person_module.newContent(id=person_id, portal_type='Person') - self.failIf(o.isTempObject()) + self.assertFalse(o.isTempObject()) # Clear out all generated methods. self.portal.portal_types.resetDynamicDocuments() # This should generate workflow methods. - self.assertEquals(o.getValidationState(), 'draft') + self.assertEqual(o.getValidationState(), 'draft') o.validate() - self.assertEquals(o.getValidationState(), 'validated') + self.assertEqual(o.getValidationState(), 'validated') # Create a new temporary person object. o = newTempPerson(portal, 'temp_person_2') self.assertTrue(o.isTempObject()) # This should call methods generated for the persistent object. - self.assertEquals(o.getValidationState(), 'draft') + self.assertEqual(o.getValidationState(), 'draft') o.validate() - self.assertEquals(o.getValidationState(), 'validated') + self.assertEqual(o.getValidationState(), 'validated') def test_26_hasAccessors(self): """Test 'has' Accessor. @@ -1894,7 +1894,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): portal_type='Standard Property') obj = self.getPersonModule().newContent(portal_type='Person') self.assertTrue(hasattr(obj, 'hasFooBar')) - self.failIf(obj.hasFooBar()) + self.assertFalse(obj.hasFooBar()) obj.setFooBar('something') self.assertTrue(obj.hasFooBar()) @@ -1937,7 +1937,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # Make sure categories are reindexed self.tic() - self.assertEquals(beta.getRelativeUrl(), 'region/beta') + self.assertEqual(beta.getRelativeUrl(), 'region/beta') # Create a new person module = self.getPersonModule() @@ -1945,38 +1945,38 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # Check getDefaultCategory accessor foo.setDefaultRegionValue(beta) - self.assertEquals(beta_path, foo.getDefaultRegion()) - self.assertEquals( + self.assertEqual(beta_path, foo.getDefaultRegion()) + self.assertEqual( None, foo.getDefaultRegion(checked_permission=checked_permission)) # Check getCategory accessor foo.setDefaultRegionValue(beta) - self.assertEquals(beta_path, foo.getRegion()) - self.assertEquals( + self.assertEqual(beta_path, foo.getRegion()) + self.assertEqual( None, foo.getRegion(checked_permission=checked_permission)) # Check getCategoryId accessor foo.setDefaultRegionValue(beta) - self.assertEquals(beta_id, foo.getRegionId()) - self.assertEquals( + self.assertEqual(beta_id, foo.getRegionId()) + self.assertEqual( None, foo.getRegionId(checked_permission=checked_permission)) # Check getCategoryTitle accessor foo.setDefaultRegionValue(beta) - self.assertEquals(beta_title, foo.getRegionTitle()) - self.assertEquals( + self.assertEqual(beta_title, foo.getRegionTitle()) + self.assertEqual( None, foo.getRegionTitle(checked_permission=checked_permission)) # Check getCategoryLogicalPath accesor foo.setDefaultRegionValue(beta) - self.assertEquals(beta_title, foo.getRegionLogicalPath()) + self.assertEqual(beta_title, foo.getRegionLogicalPath()) foo.setDefaultRegionValue(alpha) - self.assertEquals('Gamma System/Alpha', foo.getRegionLogicalPath()) + self.assertEqual('Gamma System/Alpha', foo.getRegionLogicalPath()) # Check getCategoryValue accessor # XXX did you know ? @@ -1984,8 +1984,8 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # the region list would be [beta, alpha]. # bug or feature ? I don't know ... foo.setRegionValue(beta) - self.assertEquals(beta, foo.getRegionValue()) - self.assertEquals( + self.assertEqual(beta, foo.getRegionValue()) + self.assertEqual( None, foo.getRegionValue(checked_permission=checked_permission)) @@ -2050,10 +2050,10 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): checked_permission=checked_permission)) foo.setRegionValue(None) - self.assertEquals(None, foo.getRegion()) + self.assertEqual(None, foo.getRegion()) # Check setCategoryValue accessor foo.setRegionValue(beta) - self.assertEquals(beta_path, foo.getRegion()) + self.assertEqual(beta_path, foo.getRegion()) foo.setRegionValue(None) foo.setRegionValue(gamma, checked_permission=checked_permission) @@ -2064,105 +2064,105 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertSameSet([beta_path, gamma_path], foo.getRegionList()) foo.setRegionValue(None) - self.assertEquals(None, foo.getRegion()) + self.assertEqual(None, foo.getRegion()) # Check setDefaultCategoryValue accessor foo.setDefaultRegionValue(beta) - self.assertEquals(beta_path, foo.getRegion()) + self.assertEqual(beta_path, foo.getRegion()) # XXX setDefaultValue seems buggy when passing None # foo.setDefaultRegionValue(None) foo.setRegionValue(None) foo.setDefaultRegionValue(gamma, checked_permission=checked_permission) - self.assertEquals(gamma_path, foo.getRegion()) + self.assertEqual(gamma_path, foo.getRegion()) foo.setDefaultRegionValue(beta_path) foo.setDefaultRegionValue(gamma_path, checked_permission=checked_permission) - self.assertEquals(gamma_path, foo.getDefaultRegion()) + self.assertEqual(gamma_path, foo.getDefaultRegion()) self.assertSameSet([beta_path, gamma_path], foo.getRegionList()) foo.setRegionValue(None) - self.assertEquals(None, foo.getRegion()) + self.assertEqual(None, foo.getRegion()) # Check setCategory accessor foo.setRegion(beta_path) - self.assertEquals(beta_path, foo.getRegion()) + self.assertEqual(beta_path, foo.getRegion()) foo.setRegion(None) foo.setRegion(gamma_path, checked_permission=checked_permission) - self.assertEquals(gamma_path, foo.getRegion()) + self.assertEqual(gamma_path, foo.getRegion()) foo.setRegion(beta_path) foo.setRegion(gamma_path, checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList()) - self.assertEquals(gamma_path, + self.assertEqual(gamma_path, foo.getRegion(checked_permission=checked_permission)) foo.setRegionValue(None) - self.assertEquals(None, foo.getRegion()) + self.assertEqual(None, foo.getRegion()) # Check setDefaultCategory accessor foo.setDefaultRegion(beta_path) - self.assertEquals(beta_path, foo.getRegion()) + self.assertEqual(beta_path, foo.getRegion()) foo.setRegion(None) foo.setDefaultRegion(gamma_path, checked_permission=checked_permission) - self.assertEquals(gamma_path, foo.getRegion()) + self.assertEqual(gamma_path, foo.getRegion()) foo.setDefaultRegion(beta_path) foo.setDefaultRegion(gamma_path, checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList()) - self.assertEquals(gamma_path, + self.assertEqual(gamma_path, foo.getDefaultRegion()) foo.setRegionValue(None) - self.assertEquals(None, foo.getRegion()) + self.assertEqual(None, foo.getRegion()) # Check setCategoryList accessor foo.setRegionList([beta_path]) - self.assertEquals(beta_path, foo.getRegion()) + self.assertEqual(beta_path, foo.getRegion()) foo.setRegionList([]) foo.setRegionList([gamma_path], checked_permission=checked_permission) - self.assertEquals(gamma_path, foo.getRegion()) + self.assertEqual(gamma_path, foo.getRegion()) foo.setRegionList([beta_path]) foo.setRegionList([gamma_path], checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList()) foo.setRegionValue(None) - self.assertEquals(None, foo.getRegion()) + self.assertEqual(None, foo.getRegion()) # Check setCategoryValueList accessor foo.setRegionValueList([beta]) - self.assertEquals(beta_path, foo.getRegion()) + self.assertEqual(beta_path, foo.getRegion()) foo.setRegionList([]) foo.setRegionValueList([gamma], checked_permission=checked_permission) - self.assertEquals(gamma_path, foo.getRegion()) + self.assertEqual(gamma_path, foo.getRegion()) foo.setRegionValueList([beta]) foo.setRegionValueList([gamma], checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList()) foo.setRegionValue(None) - self.assertEquals(None, foo.getRegion()) + self.assertEqual(None, foo.getRegion()) # Check setCategorySet accessor foo.setRegionSet([beta_path]) - self.assertEquals(beta_path, foo.getRegion()) + self.assertEqual(beta_path, foo.getRegion()) foo.setRegionSet([]) foo.setRegionSet([gamma_path], checked_permission=checked_permission) - self.assertEquals(gamma_path, foo.getRegion()) + self.assertEqual(gamma_path, foo.getRegion()) foo.setRegionSet([beta_path]) foo.setRegionSet([gamma_path], checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList()) foo.setRegionValue(None) - self.assertEquals(None, foo.getRegion()) + self.assertEqual(None, foo.getRegion()) # Check setCategoryValueSet accessor foo.setRegionValueSet([beta]) - self.assertEquals(beta_path, foo.getRegion()) + self.assertEqual(beta_path, foo.getRegion()) foo.setRegionSet([]) foo.setRegionValueSet([gamma], checked_permission=checked_permission) - self.assertEquals(gamma_path, foo.getRegion()) + self.assertEqual(gamma_path, foo.getRegion()) foo.setRegionValueSet([beta]) foo.setRegionValueSet([gamma], checked_permission=checked_permission) @@ -2170,7 +2170,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # check hasCategory accessors foo.setRegionValue(None) - self.assertEquals(None, foo.getRegion()) + self.assertEqual(None, foo.getRegion()) self.assertFalse(foo.hasRegion()) foo.setRegionValue(beta) self.assertTrue(foo.hasRegion()) @@ -2212,22 +2212,22 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): foo.setRegionValueList((beta, gamma)) # getRegionList returns relative URLs, no security checks are applied - self.assertEquals([beta_path, gamma_path], + self.assertEqual([beta_path, gamma_path], foo.getRegionList()) - self.assertEquals([gamma_path], + self.assertEqual([gamma_path], foo.getRegionList(checked_permission='View')) # getRegionValueList raises Unauthorized if document is related to # private documents (as always, unless you pass checked_permission) self.assertRaises(Unauthorized, foo.getRegionValueList) self.assertRaises(Unauthorized, foo.getRegionValueSet) - self.assertEquals([gamma], + self.assertEqual([gamma], foo.getRegionValueList(checked_permission='View')) # same for property accessors self.assertRaises(Unauthorized, foo.getRegionTitleList) self.assertRaises(Unauthorized, foo.getRegionTitleSet) - self.assertEquals(["Gamma System"], + self.assertEqual(["Gamma System"], foo.getRegionTitleList(checked_permission='View')) # same for default accessors @@ -2284,15 +2284,15 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): foo.setRegionValueList((beta, gamma)) # getRegionList returns relative URLs, no security checks are applied - self.assertEquals([beta_path, gamma_path], + self.assertEqual([beta_path, gamma_path], foo.getRegionList()) - self.assertEquals([gamma_path], + self.assertEqual([gamma_path], foo.getRegionList(checked_permission='View')) # getWrappedRegionTitleList raise Unauthorized if a related document is # private self.assertRaises(Unauthorized, foo.getWrappedRegionTitleList) - self.assertEquals(["Gamma System"], + self.assertEqual(["Gamma System"], foo.getWrappedRegionTitleList(checked_permission='View')) # Remove permission from parent object, the behaviour of acessor should @@ -2301,19 +2301,19 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): gamma.getParentValue().manage_permission("View", [], acquire=0) # getProperty is used by forms - self.assertEquals(None,foo.getProperty("wrapped_region_title_list", + self.assertEqual(None,foo.getProperty("wrapped_region_title_list", checked_permission='View')) - self.assertEquals(None, + self.assertEqual(None, foo.getWrappedRegionTitleList(checked_permission='View')) - self.assertEquals(["Gamma System"], + self.assertEqual(["Gamma System"], foo.getWrappedRegionTitleList(checked_permission='Access contents information')) gamma.getParentValue().manage_permission("Access contents information", [], acquire=0) - self.assertEquals(None, + self.assertEqual(None, foo.getWrappedRegionTitleList(checked_permission='View')) - self.assertEquals(None, + self.assertEqual(None, foo.getWrappedRegionTitleList(checked_permission='Access contents information')) @@ -2339,19 +2339,19 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): foo = module.newContent(portal_type='Person', title='Foo') foo.setRegionList(('beta', 'gamma')) - self.assertEquals([beta_path, 'gamma'], + self.assertEqual([beta_path, 'gamma'], foo.getRegionList()) # using relations to non existant objects will issue a warning in # event.log self._catch_log_errors(ignored_level=sys.maxint) - self.assertEquals([beta], + self.assertEqual([beta], foo.getRegionValueList()) - self.assertEquals([beta_title], + self.assertEqual([beta_title], foo.getRegionTitleList()) self._ignore_log_errors() logged_errors = [ logrecord for logrecord in self.logged if logrecord.name == 'CMFCategory' ] - self.assertEquals('Could not access object region/gamma', + self.assertEqual('Could not access object region/gamma', logged_errors[0].getMessage()) def test_list_accessors(self): @@ -2368,19 +2368,19 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertTrue(hasattr(person, 'getDummy')) self.assertTrue(hasattr(person, 'getDummyList')) - self.assertEquals(person.getDummy(), None) - self.assertEquals(person.getDummyList(), None) - self.assertEquals(person.getDummySet(), None) + self.assertEqual(person.getDummy(), None) + self.assertEqual(person.getDummyList(), None) + self.assertEqual(person.getDummySet(), None) person.setDummyList(['a', 'b']) - self.assertEquals(person.getDummy(), 'a') - self.assertEquals(person.getDummyList(), ['a', 'b']) - self.assertEquals(person.getDummySet(), ['a', 'b']) + self.assertEqual(person.getDummy(), 'a') + self.assertEqual(person.getDummyList(), ['a', 'b']) + self.assertEqual(person.getDummySet(), ['a', 'b']) person.setDummy('value') - self.assertEquals(person.getDummy(), 'value') - self.assertEquals(person.getDummyList(), ['value']) - self.assertEquals(person.getDummySet(), ['value']) + self.assertEqual(person.getDummy(), 'value') + self.assertEqual(person.getDummyList(), ['value']) + self.assertEqual(person.getDummySet(), ['value']) def test_translated_accessors(self): self._addProperty('Person', @@ -2397,27 +2397,27 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertTrue(hasattr(doc, 'getTranslatedDummy')) self.assertTrue(hasattr(doc, 'getDummyTranslationDomain')) - self.assertEquals('erp5_ui', doc.getDummyTranslationDomain()) + self.assertEqual('erp5_ui', doc.getDummyTranslationDomain()) doc.setDummy('foo') - self.assertEquals('foo', doc.getTranslatedDummy()) + self.assertEqual('foo', doc.getTranslatedDummy()) # the value of the property is translated with erp5_ui - self.assertEquals(['foo'], self.portal.Localizer.erp5_ui._translated) + self.assertEqual(['foo'], self.portal.Localizer.erp5_ui._translated) # we can change the translation domain on the portal type self.portal.portal_types.Person.setTranslationDomain('dummy', 'erp5_content') self.commit() - self.assertEquals('erp5_content', doc.getDummyTranslationDomain()) - self.assertEquals('foo', doc.getTranslatedDummy()) - self.assertEquals(['foo'], + self.assertEqual('erp5_content', doc.getDummyTranslationDomain()) + self.assertEqual('foo', doc.getTranslatedDummy()) + self.assertEqual(['foo'], self.portal.Localizer.erp5_content._translated) # set on instance. It has priority over portal type doc.setDummyTranslationDomain('default') - self.assertEquals('default', doc.getDummyTranslationDomain()) - self.assertEquals('foo', doc.getTranslatedDummy()) - self.assertEquals(['foo'], self.portal.Localizer.default._translated) + self.assertEqual('default', doc.getDummyTranslationDomain()) + self.assertEqual('foo', doc.getTranslatedDummy()) + self.assertEqual(['foo'], self.portal.Localizer.default._translated) # if domain is empty, no translation is performed doc = self.portal.person_module.newContent(portal_type='Person') @@ -2427,8 +2427,8 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): doc.setDummy('foo') self.assertFalse(doc.getDummyTranslationDomain()) - self.assertEquals('foo', doc.getTranslatedDummy()) - self.assertEquals([], self.portal.Localizer.erp5_ui._translated) + self.assertEqual('foo', doc.getTranslatedDummy()) + self.assertEqual([], self.portal.Localizer.erp5_ui._translated) def test_translated_category_accessors(self): region_category = self.portal.portal_categories.region @@ -2442,17 +2442,17 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): doc = self.portal.person_module.newContent(portal_type='Person', region='gamma/alpha') - self.assertEquals('Alpha', doc.getRegionTranslatedTitle()) + self.assertEqual('Alpha', doc.getRegionTranslatedTitle()) # the value of the category title is translated with erp5_content - self.assertEquals(['Alpha'], self.portal.Localizer.erp5_content._translated) + self.assertEqual(['Alpha'], self.portal.Localizer.erp5_content._translated) self.portal.Localizer.erp5_content._translated = [] - self.assertEquals(['Alpha'], doc.getRegionTranslatedTitleList()) - self.assertEquals(['Alpha'], self.portal.Localizer.erp5_content._translated) + self.assertEqual(['Alpha'], doc.getRegionTranslatedTitleList()) + self.assertEqual(['Alpha'], self.portal.Localizer.erp5_content._translated) self.portal.Localizer.erp5_content._translated = [] - self.assertEquals('Gamma System/Alpha', doc.getRegionTranslatedLogicalPath()) - self.assertEquals(['Gamma System', 'Alpha'], + self.assertEqual('Gamma System/Alpha', doc.getRegionTranslatedLogicalPath()) + self.assertEqual(['Gamma System', 'Alpha'], self.portal.Localizer.erp5_content._translated) @@ -2545,8 +2545,8 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): return 'returned_attr' ok = Ok().__of__(doc) - self.assertEquals('returned_attr', getattr(ok, 'attr')) - self.assertEquals(ok.aq_dynamic_calls, ['attr']) + self.assertEqual('returned_attr', getattr(ok, 'attr')) + self.assertEqual(ok.aq_dynamic_calls, ['attr']) def test_aq_dynamic_exception(self): # if an exception is raised in _aq_dynamic, it should not be hidden @@ -2605,8 +2605,8 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): createZODBPythonScript(script_container, script_id, '', 'context.setTitle("couscous")') try: security_manager = getSecurityManager() - self.assertEquals(1, security_manager.checkPermission('Access contents information', object)) - self.assertEquals(1, security_manager.checkPermission('Modify portal content', object)) + self.assertEqual(1, security_manager.checkPermission('Access contents information', object)) + self.assertEqual(1, security_manager.checkPermission('Modify portal content', object)) object.manage_permission('Modify portal content') clipboard = folder.manage_copyObjects(ids=[object.id]) # Test fails if this method raises. @@ -2809,19 +2809,19 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): portal_type='Standard Property') person = self.getPersonModule().newContent(portal_type='Person') email = person.newContent(portal_type='Email') - self.assertEquals(None, getattr(person, 'getFooBarList', None)) - self.assertEquals(person.getFooBar(), None) + self.assertEqual(None, getattr(person, 'getFooBarList', None)) + self.assertEqual(person.getFooBar(), None) self.assertFalse(person.hasProperty('foo_bar')) - self.assertEquals(person.getProperty('foo_bar'), None) - self.assertEquals(person.getPropertyList('foo_bar'), [None]) + self.assertEqual(person.getProperty('foo_bar'), None) + self.assertEqual(person.getPropertyList('foo_bar'), [None]) person.setFooBar('foo') - self.assertEquals(person.getProperty('foo_bar'), 'foo') - self.assertEquals(person.getPropertyList('foo_bar'), ['foo']) + self.assertEqual(person.getProperty('foo_bar'), 'foo') + self.assertEqual(person.getPropertyList('foo_bar'), ['foo']) person.setFooBar(None) - self.assertEquals(person.getProperty('foo_bar'), None) + self.assertEqual(person.getProperty('foo_bar'), None) person.setPropertyList('foo_bar', ['bar']) - self.assertEquals(person.getProperty('foo_bar'), 'bar') - self.assertEquals(person.getPropertyList('foo_bar'), ['bar']) + self.assertEqual(person.getProperty('foo_bar'), 'bar') + self.assertEqual(person.getPropertyList('foo_bar'), ['bar']) self.assertRaises(TypeError, person.setPropertyList, 'foo_bar', ['a', 'b']) @@ -2849,15 +2849,15 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): acquisition_accessor_id='getFooBar') person = self.getPersonModule().newContent(portal_type='Person') email = person.newContent(portal_type='Email') - self.assertEquals(email.getPropertyList('foo_bar'), [None]) + self.assertEqual(email.getPropertyList('foo_bar'), [None]) person.setPropertyList('foo_bar', ['foo']) - self.assertEquals(email.getPropertyList('foo_bar'), ['foo']) + self.assertEqual(email.getPropertyList('foo_bar'), ['foo']) email.setPropertyList('foo_bar', ['bar']) - self.assertEquals(email.getPropertyList('foo_bar'), ['bar']) + self.assertEqual(email.getPropertyList('foo_bar'), ['bar']) email.setPropertyList('foo_bar', [None]) - self.assertEquals(email.getPropertyList('foo_bar'), ['foo']) + self.assertEqual(email.getPropertyList('foo_bar'), ['foo']) person.setPropertyList('foo_bar', [None]) - self.assertEquals(email.getPropertyList('foo_bar'), [None]) + self.assertEqual(email.getPropertyList('foo_bar'), [None]) def testPropertyListWithMultiValuedProperty(self): """ @@ -2871,12 +2871,12 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): portal_type='Standard Property') person = self.getPersonModule().newContent(portal_type='Person') # We have None, like test_list_accessors - self.assertEquals(person.getFooBarList(), None) - self.assertEquals(person.getPropertyList('foo_bar'), None) + self.assertEqual(person.getFooBarList(), None) + self.assertEqual(person.getPropertyList('foo_bar'), None) person.setPropertyList('foo_bar', ['foo', 'bar']) - self.assertEquals(person.getPropertyList('foo_bar'), ['foo', 'bar']) + self.assertEqual(person.getPropertyList('foo_bar'), ['foo', 'bar']) person.setPropertyList('foo_bar', []) - self.assertEquals(person.getFooBarList(), []) + self.assertEqual(person.getFooBarList(), []) def testPropertyNoAcquisition(self): """ @@ -2892,11 +2892,11 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): person_module = self.getPersonModule() person_module.setPropertyList('multivalued_no_acquisition', ['foo']) - self.assertEquals( + self.assertEqual( person_module.getPropertyList('multivalued_no_acquisition'), ['foo']) person = self.getPersonModule().newContent(portal_type='Person') - self.assertEquals( + self.assertEqual( person.getPropertyList('multivalued_no_acquisition', ['bar']), ['bar']) def testUndefinedProperties(self): @@ -2905,12 +2905,12 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): in a propertysheet is working properly. """ person = self.getPersonModule().newContent(portal_type='Person') - self.assertEquals(person.getProperty('foo_bar'), None) + self.assertEqual(person.getProperty('foo_bar'), None) person.setProperty('foo_bar', 'foo') - self.assertEquals(person.getProperty('foo_bar'), 'foo') - self.assertEquals(person.getPropertyList('foo_bar_list'), None) + self.assertEqual(person.getProperty('foo_bar'), 'foo') + self.assertEqual(person.getPropertyList('foo_bar_list'), None) person.setProperty('foo_bar_list', ['foo', 'bar']) - self.assertEquals(list(person.getProperty('foo_bar_list')), ['foo', 'bar']) + self.assertEqual(list(person.getProperty('foo_bar_list')), ['foo', 'bar']) def test_objectValues_contentValues(self): """ @@ -2966,10 +2966,10 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): person = self.getPersonModule().newContent(portal_type='Person') method = getattr(person, 'isDeliveryType', None) self.assertNotEquals(None, method) - self.assertEquals(0, method()) + self.assertEqual(0, method()) method = getattr(person, 'isNodeType', None) self.assertNotEquals(None, method) - self.assertEquals(1, method()) + self.assertEqual(1, method()) def test_providesAccessors(self): """ @@ -2979,7 +2979,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): person = self.getPersonModule().newContent(portal_type='Person') method = getattr(person, 'providesIMovement', None) self.assertNotEquals(None, method) - self.assertEquals(False, method()) + self.assertEqual(False, method()) method = getattr(person, 'providesICategoryAccessProvider', None) self.assertNotEquals(None, method) self.assertTrue(method()) @@ -3006,7 +3006,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): types_tool.listTypeInfo()]) # not existing types are not an error - self.assertEquals(None, types_tool.getTypeInfo(self.id())) + self.assertEqual(None, types_tool.getTypeInfo(self.id())) # we can create instances from our type provider container = self.portal.newContent(portal_type='Folder', id='test_folder') @@ -3018,7 +3018,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.tic() dummy_instance.setReference('test') - self.assertEquals('test', dummy_instance.getReference()) + self.assertEqual('test', dummy_instance.getReference()) def test_getIcon(self): """ @@ -3054,9 +3054,9 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): addCustomAction('test_after', max_priority + 1) final_action_list = portal_actions.listFilteredActionsFor(person)\ .get('object_view',[]) - self.assertEquals(len(final_action_list), len(initial_action_list) + 2) - self.assertEquals(final_action_list[0]['id'], 'test_before') - self.assertEquals(final_action_list[-1]['id'], 'test_after') + self.assertEqual(len(final_action_list), len(initial_action_list) + 2) + self.assertEqual(final_action_list[0]['id'], 'test_before') + self.assertEqual(final_action_list[-1]['id'], 'test_after') # check that we have another portal types action in the middle self.assertTrue('view' in [x['id'] for x in final_action_list[1:-1]]) finally: @@ -3083,10 +3083,10 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): portal = self.getPortalObject() person = portal.person_module.newContent(portal_type='Person') person.edit(foo_property='bar') - self.assertEquals('bar', person.getProperty('foo_property')) + self.assertEqual('bar', person.getProperty('foo_property')) del person.__dict__['foo_property'] - self.assertEquals(None, person.getProperty('foo_property')) - self.assertEquals(None, person.getProperty('foobar_property')) + self.assertEqual(None, person.getProperty('foo_property')) + self.assertEqual(None, person.getProperty('foobar_property')) def test_getInstancePropertyAndBaseCategoryList(self): """ diff --git a/product/ERP5Type/tests/testFolder.py b/product/ERP5Type/tests/testFolder.py index 9564514c2b..5f57b00632 100644 --- a/product/ERP5Type/tests/testFolder.py +++ b/product/ERP5Type/tests/testFolder.py @@ -89,12 +89,12 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): Ids are incremented at content creation and start at 1. """ # No id generator defined - self.assertEquals(self.folder.getIdGenerator(), '') - self.assertEquals(len(self.folder), 0) + self.assertEqual(self.folder.getIdGenerator(), '') + self.assertEqual(len(self.folder), 0) obj = self.newContent() - self.assertEquals(obj.getId(), '1') + self.assertEqual(obj.getId(), '1') obj = self.newContent() - self.assertEquals(obj.getId(), '2') + self.assertEqual(obj.getId(), '2') def test_03_customGenerateNewId(self): """ @@ -106,11 +106,11 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): id_generator_script_name, '', 'return %s[len(context)]' % (repr(id_generator_id_list), )) self.folder.setIdGenerator(id_generator_script_name) - self.assertEquals(self.folder.getIdGenerator(), id_generator_script_name) + self.assertEqual(self.folder.getIdGenerator(), id_generator_script_name) for expected_length in xrange(len(id_generator_id_list)): - self.assertEquals(len(self.folder), expected_length) + self.assertEqual(len(self.folder), expected_length) obj = self.newContent() - self.assertEquals(obj.getId(), id_generator_id_list[expected_length]) + self.assertEqual(obj.getId(), id_generator_id_list[expected_length]) def test_03_unkownGenerateNewId(self): self.folder.setIdGenerator('no such method') @@ -186,9 +186,9 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): result = self.folder.upgradeObjectClass(test_script, from_class, to_class, test_script) self.commit() - self.assertEquals(self.folder[obj.getId()].__class__, to_class) + self.assertEqual(self.folder[obj.getId()].__class__, to_class) self.assertNotEquals(self.folder[obj.getId()].__class__, from_class) - self.assertEquals([1], result) + self.assertEqual([1], result) def test_upgradeObjectClassOnlyTest(self): """ Test if it DOES NOT change Object Class, only test it. """ @@ -202,8 +202,8 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): to_class, test_script, test_only=1) self.commit() self.assertNotEquals(self.folder[obj.getId()].__class__, to_class) - self.assertEquals(self.folder[obj.getId()].__class__, from_class) - self.assertEquals([1], result) + self.assertEqual(self.folder[obj.getId()].__class__, from_class) + self.assertEqual([1], result) def test_upgradeObjectClassHierarchicaly(self): """ Test if migrate sub objects Hierarchicaly """ @@ -217,9 +217,9 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): result = self.folder.upgradeObjectClass(test_script, from_class, to_class, test_script) self.commit() - self.assertEquals(subfolder[obj.getId()].__class__, to_class) + self.assertEqual(subfolder[obj.getId()].__class__, to_class) self.assertNotEquals(subfolder[obj.getId()].__class__, from_class) - self.assertEquals([1], result) + self.assertEqual([1], result) def test_upgradeObjectClassWithSubObject(self): """ Test If upgrade preseve subobjects """ @@ -233,11 +233,11 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): result = self.folder.upgradeObjectClass(test_script, from_class, to_class, test_script) self.commit() - self.assertEquals(self.folder[subobject.getId()].__class__, to_class) + self.assertEqual(self.folder[subobject.getId()].__class__, to_class) self.assertNotEquals(self.folder[subobject.getId()].__class__, from_class) - self.assertEquals(self.folder[subobject.getId()][obj.getId()].__class__, to_class) + self.assertEqual(self.folder[subobject.getId()][obj.getId()].__class__, to_class) self.assertNotEquals(self.folder[subobject.getId()][obj.getId()].__class__, from_class) - self.assertEquals([1, 1], result) + self.assertEqual([1, 1], result) def test_upgradeObjectClassWithStrings(self): """ Test if it changes Object Class """ @@ -252,9 +252,9 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): result = self.folder.upgradeObjectClass(test_script, from_class_as_string, to_class_as_string, test_script) self.commit() - self.assertEquals(self.folder[obj.getId()].__class__, to_class) + self.assertEqual(self.folder[obj.getId()].__class__, to_class) self.assertNotEquals(self.folder[obj.getId()].__class__, from_class) - self.assertEquals([1], result) + self.assertEqual([1], result) def test_FolderMixinSecurity(self): """ Test if FolderMix methods cannot be called by URL """ @@ -265,7 +265,7 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): response = self.publish('%s/deleteContent?id=%s' % ( self.folder.absolute_url(relative=True), obj.getId())) self.assertTrue(obj.getId() in self.folder.objectIds()) - self.assertEquals(302, response.getStatus()) + self.assertEqual(302, response.getStatus()) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5Type/tests/testFolderMigration.py b/product/ERP5Type/tests/testFolderMigration.py index 51892dcfea..2cb0220bdc 100644 --- a/product/ERP5Type/tests/testFolderMigration.py +++ b/product/ERP5Type/tests/testFolderMigration.py @@ -83,14 +83,14 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): migrate folder from btree to hbtree """ # Create some objects - self.assertEquals(self.folder.getIdGenerator(), '') - self.assertEquals(len(self.folder), 0) + self.assertEqual(self.folder.getIdGenerator(), '') + self.assertEqual(len(self.folder), 0) obj1 = self.newContent() - self.assertEquals(obj1.getId(), '1') + self.assertEqual(obj1.getId(), '1') obj2 = self.newContent() - self.assertEquals(obj2.getId(), '2') + self.assertEqual(obj2.getId(), '2') obj3 = self.newContent() - self.assertEquals(obj3.getId(), '3') + self.assertEqual(obj3.getId(), '3') self.tic() # call migration script self.folder.migrateToHBTree(migration_generate_id_method="Base_generateIdFromStopDate", @@ -109,12 +109,12 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): from DateTime import DateTime date = DateTime().Date() date = date.replace("/", "") - self.assertEquals(obj1.getId(), '%s-1' %date) - self.assertEquals(obj2.getId(), '%s-2' %date) - self.assertEquals(obj3.getId(), '%s-3' %date) + self.assertEqual(obj1.getId(), '%s-1' %date) + self.assertEqual(obj2.getId(), '%s-2' %date) + self.assertEqual(obj3.getId(), '%s-3' %date) # add object and check its id obj4 = self.newContent() - self.assertEquals(obj4.getId().split('-')[0], date) + self.assertEqual(obj4.getId().split('-')[0], date) def test_03_emptyFolderIsBtree(self): """ @@ -138,8 +138,8 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): migrate empty folder from btree to hbtree """ # Create some objects - self.assertEquals(self.folder.getIdGenerator(), '') - self.assertEquals(len(self.folder), 0) + self.assertEqual(self.folder.getIdGenerator(), '') + self.assertEqual(len(self.folder), 0) self.assertEqual(len(self.folder.objectIds()), 0) # call migration script self.folder.migrateToHBTree(migration_generate_id_method=None, @@ -154,7 +154,7 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): from DateTime import DateTime date = DateTime().Date() date = date.replace("/", "") - self.failUnless(date in obj1.getId()) + self.assertTrue(date in obj1.getId()) # check we still have a hbtree self.assertEqual(self.folder.isBTree(), False) self.assertEqual(self.folder.isHBTree(), True) @@ -165,14 +165,14 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): migrate folder from btree to hbtree, do not touch ids """ # Create some objects - self.assertEquals(self.folder.getIdGenerator(), '') - self.assertEquals(len(self.folder), 0) + self.assertEqual(self.folder.getIdGenerator(), '') + self.assertEqual(len(self.folder), 0) obj1 = self.newContent() - self.assertEquals(obj1.getId(), '1') + self.assertEqual(obj1.getId(), '1') obj2 = self.newContent() - self.assertEquals(obj2.getId(), '2') + self.assertEqual(obj2.getId(), '2') obj3 = self.newContent() - self.assertEquals(obj3.getId(), '3') + self.assertEqual(obj3.getId(), '3') self.tic() # call migration script with explicit new_generate_id_method (so migration code # doesn't assign a good default @@ -188,26 +188,26 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(len(self.folder.objectValues()), 3) self.assertEqual(len(self.folder.objectValues(base_id=None)), 3) # check object ids - self.assertEquals(obj1.getId(), '1') - self.assertEquals(obj2.getId(), '2') - self.assertEquals(obj3.getId(), '3') + self.assertEqual(obj1.getId(), '1') + self.assertEqual(obj2.getId(), '2') + self.assertEqual(obj3.getId(), '3') # add object and check its id obj4 = self.newContent() - self.assertEquals(obj4.getId(), '4') + self.assertEqual(obj4.getId(), '4') def test_06_migrateFolderChangeIdGenerationMethodLater(self): """ migrate folder from btree to hbtree, do not touch ids """ # Create some objects - self.assertEquals(self.folder.getIdGenerator(), '') - self.assertEquals(len(self.folder), 0) + self.assertEqual(self.folder.getIdGenerator(), '') + self.assertEqual(len(self.folder), 0) obj1 = self.newContent() - self.assertEquals(obj1.getId(), '1') + self.assertEqual(obj1.getId(), '1') obj2 = self.newContent() - self.assertEquals(obj2.getId(), '2') + self.assertEqual(obj2.getId(), '2') obj3 = self.newContent() - self.assertEquals(obj3.getId(), '3') + self.assertEqual(obj3.getId(), '3') self.tic() # call migration script with explicit new_generate_id_method (so migration code # doesn't assign a good default @@ -223,43 +223,43 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(len(self.folder.objectValues()), 3) self.assertEqual(len(self.folder.objectValues(base_id=None)), 3) # check object ids - self.assertEquals(obj1.getId(), '1') - self.assertEquals(obj2.getId(), '2') - self.assertEquals(obj3.getId(), '3') + self.assertEqual(obj1.getId(), '1') + self.assertEqual(obj2.getId(), '2') + self.assertEqual(obj3.getId(), '3') # add object and check its id obj4 = self.newContent() - self.assertEquals(obj4.getId(), '4') + self.assertEqual(obj4.getId(), '4') # set id generator id_generator_method = '_generatePerDayId' self.folder.setIdGenerator(id_generator_method) self.commit() - self.assertEquals(self.folder.getIdGenerator(), id_generator_method) + self.assertEqual(self.folder.getIdGenerator(), id_generator_method) # check object ids - self.assertEquals(obj1.getId(), '1') - self.assertEquals(obj2.getId(), '2') - self.assertEquals(obj3.getId(), '3') - self.assertEquals(obj4.getId(), '4') + self.assertEqual(obj1.getId(), '1') + self.assertEqual(obj2.getId(), '2') + self.assertEqual(obj3.getId(), '3') + self.assertEqual(obj4.getId(), '4') # add object and check its id from DateTime import DateTime date = DateTime().Date() date = date.replace("/", "") obj5 = self.newContent() - self.assertEquals(obj5.getId().split('-')[0], date) + self.assertEqual(obj5.getId().split('-')[0], date) def test_07_migrateFolderTwice(self): """ migrate folder twice from btree to hbtree """ # Create some objects - self.assertEquals(self.folder.getIdGenerator(), '') - self.assertEquals(len(self.folder), 0) + self.assertEqual(self.folder.getIdGenerator(), '') + self.assertEqual(len(self.folder), 0) obj1 = self.newContent() - self.assertEquals(obj1.getId(), '1') + self.assertEqual(obj1.getId(), '1') obj2 = self.newContent() - self.assertEquals(obj2.getId(), '2') + self.assertEqual(obj2.getId(), '2') obj3 = self.newContent() - self.assertEquals(obj3.getId(), '3') + self.assertEqual(obj3.getId(), '3') self.tic() # call migration script self.folder.migrateToHBTree(migration_generate_id_method="Base_generateIdFromStopDate", @@ -278,36 +278,36 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): from DateTime import DateTime date = DateTime().Date() date = date.replace("/", "") - self.assertEquals(obj1.getId(), '%s-1' %date) - self.assertEquals(obj2.getId(), '%s-2' %date) - self.assertEquals(obj3.getId(), '%s-3' %date) + self.assertEqual(obj1.getId(), '%s-1' %date) + self.assertEqual(obj2.getId(), '%s-2' %date) + self.assertEqual(obj3.getId(), '%s-3' %date) # add object and check its id obj4 = self.newContent() - self.assertEquals(obj4.getId().split('-')[0], date) + self.assertEqual(obj4.getId().split('-')[0], date) # call migration script again self.folder.migrateToHBTree(migration_generate_id_method="Base_generateIdFromStopDate", new_generate_id_method="_generatePerDayId") self.tic() # check object ids - self.assertEquals(obj1.getId(), '%s-1' %date) - self.assertEquals(obj2.getId(), '%s-2' %date) - self.assertEquals(obj3.getId(), '%s-3' %date) - self.assertEquals(obj4.getId().split('-')[0], date) + self.assertEqual(obj1.getId(), '%s-1' %date) + self.assertEqual(obj2.getId(), '%s-2' %date) + self.assertEqual(obj3.getId(), '%s-3' %date) + self.assertEqual(obj4.getId().split('-')[0], date) def test_08_migrateFolderTwiceSimultaneously(self): """ migrate folder twice from btree to hbtree, simultaneously """ # Create some objects - self.assertEquals(self.folder.getIdGenerator(), '') - self.assertEquals(len(self.folder), 0) + self.assertEqual(self.folder.getIdGenerator(), '') + self.assertEqual(len(self.folder), 0) obj1 = self.newContent() - self.assertEquals(obj1.getId(), '1') + self.assertEqual(obj1.getId(), '1') obj2 = self.newContent() - self.assertEquals(obj2.getId(), '2') + self.assertEqual(obj2.getId(), '2') obj3 = self.newContent() - self.assertEquals(obj3.getId(), '3') + self.assertEqual(obj3.getId(), '3') self.tic() # call migration script twice self.folder.migrateToHBTree(migration_generate_id_method="Base_generateIdFromStopDate", @@ -329,12 +329,12 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): from DateTime import DateTime date = DateTime().Date() date = date.replace("/", "") - self.assertEquals(obj1.getId(), '%s-1' %date) - self.assertEquals(obj2.getId(), '%s-2' %date) - self.assertEquals(obj3.getId(), '%s-3' %date) + self.assertEqual(obj1.getId(), '%s-1' %date) + self.assertEqual(obj2.getId(), '%s-2' %date) + self.assertEqual(obj3.getId(), '%s-3' %date) # add object and check its id obj4 = self.newContent() - self.assertEquals(obj4.getId().split('-')[0], date) + self.assertEqual(obj4.getId().split('-')[0], date) def test_09_migrateFolderCreateNewObjectAtOnce(self): """ @@ -342,20 +342,20 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): previous checks """ # Create some objects - self.assertEquals(self.folder.getIdGenerator(), '') - self.assertEquals(len(self.folder), 0) + self.assertEqual(self.folder.getIdGenerator(), '') + self.assertEqual(len(self.folder), 0) obj1 = self.newContent() - self.assertEquals(obj1.getId(), '1') + self.assertEqual(obj1.getId(), '1') obj2 = self.newContent() - self.assertEquals(obj2.getId(), '2') + self.assertEqual(obj2.getId(), '2') obj3 = self.newContent() - self.assertEquals(obj3.getId(), '3') + self.assertEqual(obj3.getId(), '3') self.tic() # call migration script self.folder.migrateToHBTree() self.tic() obj4 = self.newContent(id='BASE-123') - self.assertEquals(obj4.getId(), 'BASE-123') + self.assertEqual(obj4.getId(), 'BASE-123') self.assertEqual(len(self.folder.objectIds(base_id=None)), 3) self.assertEqual(len(self.folder.objectValues()), 4) self.assertEqual(len(self.folder.objectValues(base_id=None)), 3) @@ -368,22 +368,22 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): without any previous checks """ # Create some objects - self.assertEquals(self.folder.getIdGenerator(), '') - self.assertEquals(len(self.folder), 0) + self.assertEqual(self.folder.getIdGenerator(), '') + self.assertEqual(len(self.folder), 0) obj1 = self.newContent() - self.assertEquals(obj1.getId(), '1') + self.assertEqual(obj1.getId(), '1') obj2 = self.newContent() - self.assertEquals(obj2.getId(), '2') + self.assertEqual(obj2.getId(), '2') obj3 = self.newContent() - self.assertEquals(obj3.getId(), '3') + self.assertEqual(obj3.getId(), '3') self.tic() # call migration script self.folder.migrateToHBTree() self.tic() obj4 = self.newContent(id='BASE-123') obj5 = self.newContent(id='BASE-BELONG-123') - self.assertEquals(obj4.getId(), 'BASE-123') - self.assertEquals(obj5.getId(), 'BASE-BELONG-123') + self.assertEqual(obj4.getId(), 'BASE-123') + self.assertEqual(obj5.getId(), 'BASE-BELONG-123') self.assertEqual(len(self.folder.objectIds(base_id=None)), 3) self.assertEqual(len(self.folder.objectValues()), 5) self.assertEqual(len(self.folder.objectValues(base_id=None)), 3) @@ -414,8 +414,8 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): obj2_id = '%s-2'%(id_prefix,) obj3_id = '%s-3'%(id_prefix,) # Create some objects - self.assertEquals(self.folder.getIdGenerator(), '') - self.assertEquals(len(self.folder), 0) + self.assertEqual(self.folder.getIdGenerator(), '') + self.assertEqual(len(self.folder), 0) obj1 = self.newContent(id=obj1_id) obj2 = self.newContent(id=obj2_id) obj3 = self.newContent(id=obj3_id) @@ -434,7 +434,7 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(len(self.folder.objectValues(base_id=id_prefix)), 3) # add object without base obj4 = self.newContent(id='1') - self.assertEquals(obj4.getId(), '1') + self.assertEqual(obj4.getId(), '1') self.assertEqual(len(self.folder.objectIds(base_id=None)), 1) self.assertEqual(len(self.folder.objectValues()), 4) self.assertEqual(len(self.folder.objectValues(base_id=id_prefix)), 3) @@ -449,7 +449,7 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(self.folder.isBTree(), False) self.assertEqual(self.folder.isHBTree(), False) - self.assertEquals(self.folder._fixFolderHandler(), True) + self.assertEqual(self.folder._fixFolderHandler(), True) self.commit() self.assertEqual(self.folder.isBTree(), True) diff --git a/product/ERP5Type/tests/testJSPacker.py b/product/ERP5Type/tests/testJSPacker.py index 4af1b942d1..15cfda7db3 100644 --- a/product/ERP5Type/tests/testJSPacker.py +++ b/product/ERP5Type/tests/testJSPacker.py @@ -39,7 +39,7 @@ class TestJSPacker(unittest.TestCase): result = compressJavaScript(script) output = open(join(PREFIX, 'output/output_erp5.js')).read() - self.assertEquals(result, output) + self.assertEqual(result, output) def test_JavaScriptHandleMultLineComment(self): script = '/*** ' \ @@ -61,7 +61,7 @@ class TestJSPacker(unittest.TestCase): '(2)!="6"){ 2.5("0.3");}\\n\',14,14,\'MochiKit||dojo|'\ 'Base||provide|undefined|typeof|if|Reserved|rights|'\ 'All|VERSION|PACKED\'.split(\'|\'),0,{}))\n' - self.assertEquals(result, expected_result) + self.assertEqual(result, expected_result) if __name__ == '__main__': unittest.main() diff --git a/product/ERP5Type/tests/testLocalizer.py b/product/ERP5Type/tests/testLocalizer.py index 08a5e20a8b..0c217f5022 100644 --- a/product/ERP5Type/tests/testLocalizer.py +++ b/product/ERP5Type/tests/testLocalizer.py @@ -125,23 +125,23 @@ class TestLocalizer(ERP5TypeTestCase): self.commit() while self.portal.portal_activities.getMessageList(): self.portal.portal_activities.process_timer(None, None) - self.assertEquals(tmp_obj.getComment(), "C'est 1€.") + self.assertEqual(tmp_obj.getComment(), "C'est 1€.") def test_get_selected_language(self): # default selected language is en - self.assertEquals('en', self.portal.Localizer.get_selected_language()) + self.assertEqual('en', self.portal.Localizer.get_selected_language()) def test_translationContext(self): self.message_catalog._messages['This is 1€.'] = PersistentMapping( {'fr':"C'est 1€.", 'note':'',}) localizer = self.portal.Localizer with localizer.translationContext('fr'): - self.assertEquals('fr', localizer.get_selected_language()) - self.assertEquals("C'est 1€.", + self.assertEqual('fr', localizer.get_selected_language()) + self.assertEqual("C'est 1€.", self.portal.Base_translateString("This is 1€.")) # outside of this context manager we are back to english - self.assertEquals('en', localizer.get_selected_language()) - self.assertEquals("This is 1€.", + self.assertEqual('en', localizer.get_selected_language()) + self.assertEqual("This is 1€.", self.portal.Base_translateString("This is 1€.")) def test_translationContextActivity(self): @@ -168,22 +168,22 @@ assertEquals("This is 1€.", context.Base_translateString("This is 1€.")) portal.portal_activities.activate().test_script() self.tic() # after activity execution we are still in english - self.assertEquals('en', localizer.get_selected_language()) - self.assertEquals("This is 1€.", + self.assertEqual('en', localizer.get_selected_language()) + self.assertEqual("This is 1€.", self.portal.Base_translateString("This is 1€.")) # execute activity with group_method portal.portal_activities.activate(group_method_id=None).test_script() self.tic() # after activity execution we are still in english - self.assertEquals('en', localizer.get_selected_language()) - self.assertEquals("This is 1€.", + self.assertEqual('en', localizer.get_selected_language()) + self.assertEqual("This is 1€.", self.portal.Base_translateString("This is 1€.")) def test_get_request(self): # check that Localizer's get_request hack works as expected from Products.Localizer.utils import get_request - self.assertEquals(get_request(), self.portal.REQUEST) + self.assertEqual(get_request(), self.portal.REQUEST) def test_default_not_changed(self): """ @@ -196,13 +196,13 @@ assertEquals("This is 1€.", context.Base_translateString("This is 1€.")) # Base_translateString == Localizer.translate() currently, which calls # zope.i18n.translate and sets 'default' to 'message' before passing it to # MessageCatalog (Localizer.erp5_ui.translate) - self.assertEquals(message, self.portal.Base_translateString(message)) - self.assertEquals(message, + self.assertEqual(message, self.portal.Base_translateString(message)) + self.assertEqual(message, self.portal.Localizer.translate('ui', message).encode('utf-8')) # default=None, thus 'message' was previously stripped before being set as # 'default' value (MessageCatalog.gettext) - self.assertEquals(message, self.portal.Localizer.erp5_ui.translate(message)) + self.assertEqual(message, self.portal.Localizer.erp5_ui.translate(message)) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5Type/tests/testMemcachedTool.py b/product/ERP5Type/tests/testMemcachedTool.py index 2759506798..5e0e928ca5 100644 --- a/product/ERP5Type/tests/testMemcachedTool.py +++ b/product/ERP5Type/tests/testMemcachedTool.py @@ -200,7 +200,7 @@ class TestMemcachedTool(ERP5TypeTestCase): value = 'a'*100 tested_dict[key] = value self.commit() - self.assertEquals(tested_dict.get(key), value) + self.assertEqual(tested_dict.get(key), value) self.commit() # Sleep epliration_time + 1 second to be sure that it is well expired time.sleep(self.expiration_time + 1) diff --git a/product/ERP5Type/tests/testPerformance.py b/product/ERP5Type/tests/testPerformance.py index 7e27dfc3bd..4e207fcd24 100644 --- a/product/ERP5Type/tests/testPerformance.py +++ b/product/ERP5Type/tests/testPerformance.py @@ -197,7 +197,7 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): if PROFILE: self.profile(bar.Bar_viewPerformance) if DO_TEST: - self.failUnless(min < req_time < max, + self.assertTrue(min < req_time < max, '%.4f < %.4f < %.4f' % (min, req_time, max)) def profile(self, func, suffix=''): @@ -306,14 +306,14 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): add_value = add_result[key] min_view = MIN_MODULE_VIEW + LISTBOX_COEF * i max_view = MAX_MODULE_VIEW + LISTBOX_COEF * i - self.failUnless(min_view < module_value < max_view, + self.assertTrue(min_view < module_value < max_view, 'View: %.4f < %.4f < %.4f' % ( min_view, module_value, max_view)) - self.failUnless( + self.assertTrue( MIN_OBJECT_CREATION < add_value < MAX_OBJECT_CREATION, 'Create: %.4f < %.4f < %.4f' % ( MIN_OBJECT_CREATION, add_value, MAX_OBJECT_CREATION)) - self.failUnless(MIN_TIC < tic_value < MAX_TIC, + self.assertTrue(MIN_TIC < tic_value < MAX_TIC, 'Tic: %.4f < %.4f < %.4f' % ( MIN_TIC, tic_value, MAX_TIC)) i += 1 @@ -347,7 +347,7 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): if PROFILE: self.profile(foo.Foo_viewProxyField) if DO_TEST: - self.failUnless( MIN_OBJECT_PROXYFIELD_VIEW < req_time + self.assertTrue( MIN_OBJECT_PROXYFIELD_VIEW < req_time < MAX_OBJECT_PROXYFIELD_VIEW, '%.4f < %.4f < %.4f' % ( MIN_OBJECT_PROXYFIELD_VIEW, @@ -379,7 +379,7 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): if PROFILE: self.profile(foo.Foo_viewPerformance) if DO_TEST: - self.failUnless( MIN_OBJECT_MANY_LINES_VIEW < req_time + self.assertTrue( MIN_OBJECT_MANY_LINES_VIEW < req_time < MAX_OBJECT_MANY_LINES_VIEW, '%.4f < %.4f < %.4f' % ( MIN_OBJECT_MANY_LINES_VIEW, diff --git a/product/ERP5Type/tests/testSessionTool.py b/product/ERP5Type/tests/testSessionTool.py index fa2aafe8cb..1a6777b6a1 100644 --- a/product/ERP5Type/tests/testSessionTool.py +++ b/product/ERP5Type/tests/testSessionTool.py @@ -94,7 +94,7 @@ class TestSessionTool(ERP5TypeTestCase): session.clear() session.update(primitives_kw) session = self.portal.portal_sessions[self.session_id] - self.assertEquals(primitives_kw, session) + self.assertEqual(primitives_kw, session) # API check self.assert_(self.portal.portal_sessions[self.session_id] == \ @@ -102,7 +102,7 @@ class TestSessionTool(ERP5TypeTestCase): session.clear() session.edit(**primitives_kw) session = self.portal.portal_sessions[self.session_id] - self.assertEquals(primitives_kw, session) + self.assertEqual(primitives_kw, session) def stepTestAcquisitionRamSessionStorage(self, sequence=None, \ sequence_list=None, **kw): @@ -185,10 +185,10 @@ class TestSessionTool(ERP5TypeTestCase): session.clear() session['foo'] = 'Bar' self.assertTrue('foo' in session) - self.assertEquals('Bar', session['foo']) - self.assertEquals('Bar', session.get('foo')) + self.assertEqual('Bar', session['foo']) + self.assertEqual('Bar', session.get('foo')) self.assertFalse('bar' in session) - self.assertEquals('Default', session.get('bar', 'Default')) + self.assertEqual('Default', session.get('bar', 'Default')) self.assertRaises(KeyError, session.__getitem__, 'bar') def stepTestSessionGetattr(self, sequence=None, \ @@ -196,8 +196,8 @@ class TestSessionTool(ERP5TypeTestCase): session = self.portal.portal_sessions[self.session_id] session.clear() session['foo'] = 'Bar' - #self.assertEquals('Bar', session.foo) - self.assertEquals('Default', getattr(session, 'bar', 'Default')) + #self.assertEqual('Bar', session.foo) + self.assertEqual('Default', getattr(session, 'bar', 'Default')) self.assertRaises(AttributeError, getattr, session, 'bar') def stepTestSessionBulkStorage(self, sequence=None, \ @@ -214,7 +214,7 @@ class TestSessionTool(ERP5TypeTestCase): session[i] = v kw[i] = v session = self.portal.portal_sessions[self.session_id] - self.assertEquals(kw, session) + self.assertEqual(kw, session) # test big session session.clear() @@ -222,7 +222,7 @@ class TestSessionTool(ERP5TypeTestCase): kw[key] = ''.join([choice(LETTERS) for x in range(1000)]) session.update(kw) session = self.portal.portal_sessions[self.session_id] - self.assertEquals(kw, session) + self.assertEqual(kw, session) def stepTestSessionExpire(self, sequence=None, \ sequence_list=None, **kw): @@ -257,7 +257,7 @@ class TestSessionTool(ERP5TypeTestCase): reference='test') session = self.portal.portal_sessions[self.session_id] - self.assertEquals(session.get('key'), 'value') + self.assertEqual(session.get('key'), 'value') self.abort() def test_01_CheckSessionTool(self): diff --git a/product/ERP5Type/tests/testTransactionalVariable.py b/product/ERP5Type/tests/testTransactionalVariable.py index e48b87d41a..ce610781e1 100644 --- a/product/ERP5Type/tests/testTransactionalVariable.py +++ b/product/ERP5Type/tests/testTransactionalVariable.py @@ -51,75 +51,75 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor): """Check if a transaction variable behaves in the same way as a dict. """ tv = getTransactionalVariable() - self.failIfEqual(tv, None) + self.assertNotEqual(tv, None) # Test frequently used dict methods. This does not cover everything, # but should be enough. tv.clear() - self.failUnlessEqual(len(tv), 0) - self.failUnlessRaises(KeyError, tv.__getitem__, 'toto') + self.assertEqual(len(tv), 0) + self.assertRaises(KeyError, tv.__getitem__, 'toto') tv['toto'] = 'titi' - self.failUnlessEqual(len(tv), 1) - self.failUnlessEqual(tv['toto'], 'titi') + self.assertEqual(len(tv), 1) + self.assertEqual(tv['toto'], 'titi') - self.failUnlessEqual(tv.get('foo'), None) + self.assertEqual(tv.get('foo'), None) tv.setdefault('foo', 'bar') - self.failUnlessEqual(len(tv), 2) - self.failUnlessEqual(tv['foo'], 'bar') + self.assertEqual(len(tv), 2) + self.assertEqual(tv['foo'], 'bar') - self.failUnless('foo' in tv) + self.assertTrue('foo' in tv) del tv['foo'] - self.failIf('foo' in tv) - self.failUnlessEqual(len(tv), 1) + self.assertFalse('foo' in tv) + self.assertEqual(len(tv), 1) def test_02_Expiration(self): """Check if a transaction variable does not persist over multiple transactions. """ tv = getTransactionalVariable() - self.failIfEqual(tv, None) + self.assertNotEqual(tv, None) tv.clear() - self.failUnlessEqual(len(tv), 0) + self.assertEqual(len(tv), 0) # Commit and check. tv['toto'] = 'titi' - self.failUnlessEqual(tv['toto'], 'titi') + self.assertEqual(tv['toto'], 'titi') self.commit() - self.failIf('toto' in tv) + self.assertFalse('toto' in tv) # Abort and check. tv['toto'] = 'titi' - self.failUnlessEqual(tv['toto'], 'titi') + self.assertEqual(tv['toto'], 'titi') self.abort() - self.failIf('toto' in tv) + self.assertFalse('toto' in tv) def test_03_Durability(self): """Check if a transaction variable does not disappear within the same transaction. """ tv = getTransactionalVariable() - self.failIfEqual(tv, None) + self.assertNotEqual(tv, None) tv.clear() - self.failUnlessEqual(len(tv), 0) + self.assertEqual(len(tv), 0) # Set both a transaction variable and a volatile attribute, # in order to detect the difference between their behaviors. tv['toto'] = 'titi' - self.failUnlessEqual(tv['toto'], 'titi') + self.assertEqual(tv['toto'], 'titi') portal = self.getPortal() vattr = '_v_erp5type_test_durability' setattr(portal, vattr, 'dummy') - self.failUnlessEqual(getattr(portal, vattr), 'dummy') + self.assertEqual(getattr(portal, vattr), 'dummy') # Force to minimize the connection cache so that volatile attributes # and unghostified objects are discarded. portal._p_jar.cacheMinimize() - self.failUnless('toto' in tv) - self.failUnlessEqual(tv['toto'], 'titi') - self.failUnlessEqual(getattr(portal, vattr, None), None) + self.assertTrue('toto' in tv) + self.assertEqual(tv['toto'], 'titi') + self.assertEqual(getattr(portal, vattr, None), None) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5Type/tests/testXMLMatrix.py b/product/ERP5Type/tests/testXMLMatrix.py index 05fe72a711..5aa0b04856 100644 --- a/product/ERP5Type/tests/testXMLMatrix.py +++ b/product/ERP5Type/tests/testXMLMatrix.py @@ -215,7 +215,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor): self.assertEqual(map(set, matrix.getCellRange(**kwd)), map(set, cell_range)) next_cell_id_list = list(matrix.objectIds()) # the cells on coordinates 2b, 3b, 3b and 3c are kept - self.assertEquals(4, len(next_cell_id_list)) + self.assertEqual(4, len(next_cell_id_list)) for coord in [['2', 'b'], ['2', 'c'], ['3', 'b'], @@ -314,7 +314,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor): cell_range = [['1', ], ['a', ]] matrix.setCellRange(*cell_range, **kwd) - self.assertEquals(0, len(matrix.getCellValueList(**kwd))) + self.assertEqual(0, len(matrix.getCellValueList(**kwd))) new_cell = matrix.newCell(*['1', 'a'], **kwd) self.tic() @@ -331,7 +331,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor): cell_range = [['1', ]] matrix.setCellRange(*cell_range, **kwd) - self.assertEquals(0, len(matrix.getCellValueList(**kwd))) + self.assertEqual(0, len(matrix.getCellValueList(**kwd))) self.tic() def test_increase_dimension(self): @@ -348,12 +348,12 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor): cell_range = [['1', '2', ], ['a']] matrix.setCellRange(*cell_range, **kwd) - self.assertEquals(1, len(matrix.getCellValueList(**kwd))) + self.assertEqual(1, len(matrix.getCellValueList(**kwd))) # previous cell is kept - self.assertEquals(cell, matrix.getCell(*['1', 'a'], **kwd)) + self.assertEqual(cell, matrix.getCell(*['1', 'a'], **kwd)) self.tic() # the cell is still in catalog - self.assertEquals(cell, + self.assertEqual(cell, self.portal.portal_catalog.getObject(cell.getUid())) def test_decrease_dimension(self): @@ -370,12 +370,12 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor): cell_range = [['1', ], ['a']] matrix.setCellRange(*cell_range, **kwd) - self.assertEquals(1, len(matrix.getCellValueList(**kwd))) + self.assertEqual(1, len(matrix.getCellValueList(**kwd))) # previous cell is kept - self.assertEquals(cell, matrix.getCell(*['1', 'a'], **kwd)) + self.assertEqual(cell, matrix.getCell(*['1', 'a'], **kwd)) self.tic() # the cell is still in catalog - self.assertEquals(cell, + self.assertEqual(cell, self.portal.portal_catalog.getObject(cell.getUid())) @@ -393,12 +393,12 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor): cell_range = [['1', ], ['a', 'b']] matrix.setCellRange(*cell_range, **kwd) - self.assertEquals(1, len(matrix.getCellValueList(**kwd))) + self.assertEqual(1, len(matrix.getCellValueList(**kwd))) # previous cell is kept - self.assertEquals(cell, matrix.getCell(*['1', 'a'], **kwd)) + self.assertEqual(cell, matrix.getCell(*['1', 'a'], **kwd)) self.tic() # the cell is still in catalog - self.assertEquals(cell, + self.assertEqual(cell, self.portal.portal_catalog.getObject(cell.getUid())) def test_change_dimension_cell_change_id(self): @@ -414,7 +414,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor): matrix.newCell(*place, **kwd) cell = matrix.getCell('2', 'b', **kwd) - self.assertEquals('quantity_1_1', cell.getId()) + self.assertEqual('quantity_1_1', cell.getId()) cell.setTitle('This one') self.tic() @@ -424,13 +424,13 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor): self.assertFalse('quantity_0_1' in matrix.objectIds()) cell = matrix.getCell('2', 'b', **kwd) - self.assertEquals('quantity_1_1', cell.getId()) - self.assertEquals('This one', cell.getTitle()) + self.assertEqual('quantity_1_1', cell.getId()) + self.assertEqual('This one', cell.getTitle()) self.tic() # the cell is still in catalog - self.assertEquals(cell, + self.assertEqual(cell, self.portal.portal_catalog.getObject(cell.getUid())) diff --git a/product/ERP5Wizard/tests/testGeneratorCall.py b/product/ERP5Wizard/tests/testGeneratorCall.py index 9c260a0cc2..58b45709e0 100644 --- a/product/ERP5Wizard/tests/testGeneratorCall.py +++ b/product/ERP5Wizard/tests/testGeneratorCall.py @@ -39,28 +39,28 @@ class TestGeneratorCall(unittest.TestCase): def test_dump(self): call = GeneratorCall() dumped = call.dump() - self.failUnless(isinstance(dumped, str)) + self.assertTrue(isinstance(dumped, str)) load = xmlrpclib.loads(dumped) - self.failUnless(isinstance(load, tuple)) - self.assertEquals(len(load), 2) - self.assertEquals(load[1], 'GeneratorAnswer') + self.assertTrue(isinstance(load, tuple)) + self.assertEqual(len(load), 2) + self.assertEqual(load[1], 'GeneratorAnswer') - self.failUnless(isinstance(load[0], tuple)) - self.assertEquals(len(load[0]), 1) + self.assertTrue(isinstance(load[0], tuple)) + self.assertEqual(len(load[0]), 1) server_response_dict = load[0][0] - self.failUnless(isinstance(server_response_dict, dict)) + self.assertTrue(isinstance(server_response_dict, dict)) def test_dump_load(self): call = GeneratorCall(data='Foo') - self.assertEquals(call['data'], 'Foo') + self.assertEqual(call['data'], 'Foo') dumped = call.dump() - self.failUnless(isinstance(dumped, str)) + self.assertTrue(isinstance(dumped, str)) # reread it in a new call read = GeneratorCall() read.load(dumped) - self.assertEquals(read['data'], 'Foo') + self.assertEqual(read['data'], 'Foo') def test_suite(): diff --git a/product/ERP5Workflow/tests/testERP5Workflow.py b/product/ERP5Workflow/tests/testERP5Workflow.py index e37e1cbeb1..142216982d 100644 --- a/product/ERP5Workflow/tests/testERP5Workflow.py +++ b/product/ERP5Workflow/tests/testERP5Workflow.py @@ -72,12 +72,12 @@ class TestERP5Workflow(ERP5TypeTestCase): # create a document and associate it to this workflow doc = self.portal.newContent(portal_type='Folder', id='test_doc') workflow.initializeDocument(doc) - self.assertEquals(s1.getRelativeUrl(), + self.assertEqual(s1.getRelativeUrl(), doc._getDefaultAcquiredCategoryMembership('current_state')) # pass a transition t1.execute(doc) - self.assertEquals(s2.getRelativeUrl(), + self.assertEqual(s2.getRelativeUrl(), doc._getDefaultAcquiredCategoryMembership('current_state')) @@ -97,7 +97,7 @@ class TestERP5Workflow(ERP5TypeTestCase): doc = self.portal.newContent(portal_type='Folder', id='test_doc') workflow.initializeDocument(doc) - self.assertEquals([t1], s1.getAvailableTransitionList(doc)) + self.assertEqual([t1], s1.getAvailableTransitionList(doc)) def test_WorkflowVariables(self): @@ -121,14 +121,14 @@ class TestERP5Workflow(ERP5TypeTestCase): t1.execute(doc) current_state = workflow.getCurrentStatusDict(doc) - self.failUnless(isinstance(current_state, dict)) - self.assertEquals(s1.getRelativeUrl(), current_state.get('current_state')) - self.assertEquals('ERP5TypeTestCase', current_state.get('actor')) - self.assertEquals(0, current_state.get('undo')) + self.assertTrue(isinstance(current_state, dict)) + self.assertEqual(s1.getRelativeUrl(), current_state.get('current_state')) + self.assertEqual('ERP5TypeTestCase', current_state.get('actor')) + self.assertEqual(0, current_state.get('undo')) # XXX workflow history is a method on State ? history = s1.getWorkflowHistory(doc) - self.assertEquals(len(history), 2) + self.assertEqual(len(history), 2) def test_afterScript(self): @@ -156,7 +156,7 @@ class TestERP5Workflow(ERP5TypeTestCase): workflow.initializeDocument(doc) t1.execute(doc) - self.assertEquals(['called {}'], called) + self.assertEqual(['called {}'], called) # FIXME: not passing parameter to an after script is probably too # restrictive @@ -185,7 +185,7 @@ class TestERP5Workflow(ERP5TypeTestCase): workflow.initializeDocument(doc) t1.execute(doc) - self.assertEquals(['called {}'], called) + self.assertEqual(['called {}'], called) # FIXME: not passing parameter to an before script is probably too # restrictive diff --git a/product/Formulator/tests/testForm.py b/product/Formulator/tests/testForm.py index acec3b1fe1..52599f22b7 100644 --- a/product/Formulator/tests/testForm.py +++ b/product/Formulator/tests/testForm.py @@ -43,7 +43,7 @@ class FormTestCase(unittest.TestCase): """ test if has_field works, if one asks for a non-field attribute. this has raised AttributeError "aq_explicit" in previous versions """ - self.failIf(self.form.has_field('title')) + self.assertFalse(self.form.has_field('title')) def _test_list_values(self): """ test if a list of values returned by TALES (override) expressions @@ -85,14 +85,14 @@ class FormTestCase(unittest.TestCase): list_field.tales['items'] = TALESMethod("python:['ok', 'no']") items2 = list_field.render() - self.assertEquals(items1, items2) + self.assertEqual(items1, items2) # test override del list_field.tales['items'] list_field.overrides['items'] = Method('override_test') items2 = list_field.render() - self.assertEquals(items1, items2) + self.assertEqual(items1, items2) # test if TALES returns a list of e.g. int #list_field.values['items'] = [ ('42', '42'), ('88', '88') ] @@ -102,7 +102,7 @@ class FormTestCase(unittest.TestCase): #list_field.tales['items'] = TALESMethod("python:[42, 88]") #items2 = list_field.render() # - #self.assertEquals(items1, items2) + #self.assertEqual(items1, items2) def test_labels(self): self.form.manage_addField( @@ -115,7 +115,7 @@ class FormTestCase(unittest.TestCase): result = self.form.validate_all( {'field_int_field': '3'}) - self.assertEquals({'int_field': 3}, result) + self.assertEqual({'int_field': 3}, result) def test_datetime_css_class_rendering(self): @@ -128,17 +128,17 @@ class FormTestCase(unittest.TestCase): css_matcher = re.compile('class="([^"]*)"') # initially no css class is set - self.assertEquals(0, len(css_matcher.findall(field.render()))) + self.assertEqual(0, len(css_matcher.findall(field.render()))) # edit the field, bypassing validation ... field._edit({'css_class':'some_class'}) # now we should have five matches for the five subfields ... css_matches = css_matcher.findall(field.render()) - self.assertEquals(5, len(css_matches)) + self.assertEqual(5, len(css_matches)) # ... and all have the given value: for m in css_matches: - self.assertEquals('some_class',m) + self.assertEqual('some_class',m) # change the input style: the css needs to be # propagated to the newly created subfields @@ -148,21 +148,21 @@ class FormTestCase(unittest.TestCase): # still the css classes should remain the same css_matches = css_matcher.findall(field.render()) - self.assertEquals(5, len(css_matches)) + self.assertEqual(5, len(css_matches)) for m in css_matches: - self.assertEquals('some_class',m) + self.assertEqual('some_class',m) # now just change to another value: field._edit({'css_class':'other_class'}) css_matches = css_matcher.findall(field.render()) - self.assertEquals(5, len(css_matches)) + self.assertEqual(5, len(css_matches)) for m in css_matches: - self.assertEquals('other_class',m) + self.assertEqual('other_class',m) # and clear the css_class field: field._edit({'css_class':''}) css_matches = css_matcher.findall(field.render()) - self.assertEquals(0, len(css_matches)) + self.assertEqual(0, len(css_matches)) def test_suite(): diff --git a/product/Formulator/tests/testFormValidator.py b/product/Formulator/tests/testFormValidator.py index 50099e1db4..7ddd929896 100644 --- a/product/Formulator/tests/testFormValidator.py +++ b/product/Formulator/tests/testFormValidator.py @@ -132,11 +132,11 @@ class EmailValidatorTestCase(ValidatorTestCase): result = self.v.validate( TestField('f', max_length=0, truncate=0, required=1, unicode=0), 'f', {'f': 'foo@bar.com'}) - self.assertEquals('foo@bar.com', result) + self.assertEqual('foo@bar.com', result) result = self.v.validate( TestField('f', max_length=0, truncate=0, required=1, unicode=0), 'f', {'f': 'm.faassen@vet.uu.nl'}) - self.assertEquals('m.faassen@vet.uu.nl', result) + self.assertEqual('m.faassen@vet.uu.nl', result) def test_error_not_email(self): # a few wrong email addresses should raise error @@ -172,15 +172,15 @@ class BooleanValidatorTestCase(ValidatorTestCase): result = self.v.validate( TestField('f'), 'f', {'f': ''}) - self.assertEquals(0, result) + self.assertEqual(0, result) result = self.v.validate( TestField('f'), 'f', {'f': 1}) - self.assertEquals(1, result) + self.assertEqual(1, result) result = self.v.validate( TestField('f'), 'f', {'f': 0}) - self.assertEquals(0, result) + self.assertEqual(0, result) class IntegerValidatorTestCase(ValidatorTestCase): def setUp(self): @@ -191,19 +191,19 @@ class IntegerValidatorTestCase(ValidatorTestCase): TestField('f', max_length=0, truncate=0, required=0, start="", end=""), 'f', {'f': '15'}) - self.assertEquals(15, result) + self.assertEqual(15, result) result = self.v.validate( TestField('f', max_length=0, truncate=0, required=0, start="", end=""), 'f', {'f': '0'}) - self.assertEquals(0, result) + self.assertEqual(0, result) result = self.v.validate( TestField('f', max_length=0, truncate=0, required=0, start="", end=""), 'f', {'f': '-1'}) - self.assertEquals(-1, result) + self.assertEqual(-1, result) def test_no_entry(self): # result should be empty string if nothing entered @@ -211,7 +211,7 @@ class IntegerValidatorTestCase(ValidatorTestCase): TestField('f', max_length=0, truncate=0, required=0, start="", end=""), 'f', {'f': ''}) - self.assertEquals("", result) + self.assertEqual("", result) def test_ranges(self): # first check whether everything that should be in range is @@ -221,7 +221,7 @@ class IntegerValidatorTestCase(ValidatorTestCase): TestField('f', max_length=0, truncate=0, required=1, start=0, end=100), 'f', {'f': str(i)}) - self.assertEquals(i, result) + self.assertEqual(i, result) # now check out of range errors self.assertValidatorRaises( Validator.ValidationError, 'integer_out_of_range', @@ -349,11 +349,11 @@ class DateTimeValidatorTestCase(ValidatorTestCase): 'subfield_f_day': '1', 'subfield_f_hour': '10', 'subfield_f_minute': '30'}) - self.assertEquals(2002, result.year()) - self.assertEquals(12, result.month()) - self.assertEquals(1, result.day()) - self.assertEquals(10, result.hour()) - self.assertEquals(30, result.minute()) + self.assertEqual(2002, result.year()) + self.assertEqual(12, result.month()) + self.assertEqual(1, result.day()) + self.assertEqual(10, result.hour()) + self.assertEqual(30, result.minute()) def test_ampm(self): result = self.v.validate( @@ -364,11 +364,11 @@ class DateTimeValidatorTestCase(ValidatorTestCase): 'subfield_f_hour': '10', 'subfield_f_minute': '30', 'subfield_f_ampm': 'am'}) - self.assertEquals(2002, result.year()) - self.assertEquals(12, result.month()) - self.assertEquals(1, result.day()) - self.assertEquals(10, result.hour()) - self.assertEquals(30, result.minute()) + self.assertEqual(2002, result.year()) + self.assertEqual(12, result.month()) + self.assertEqual(1, result.day()) + self.assertEqual(10, result.hour()) + self.assertEqual(30, result.minute()) result = self.v.validate( DateTimeField('f', ampm_time_style=1), @@ -378,11 +378,11 @@ class DateTimeValidatorTestCase(ValidatorTestCase): 'subfield_f_hour': '10', 'subfield_f_minute': '30', 'subfield_f_ampm': 'pm'}) - self.assertEquals(2002, result.year()) - self.assertEquals(12, result.month()) - self.assertEquals(1, result.day()) - self.assertEquals(22, result.hour()) - self.assertEquals(30, result.minute()) + self.assertEqual(2002, result.year()) + self.assertEqual(12, result.month()) + self.assertEqual(1, result.day()) + self.assertEqual(22, result.hour()) + self.assertEqual(30, result.minute()) self.assertValidatorRaises( KeyError, 'not_datetime', @@ -400,11 +400,11 @@ class DateTimeValidatorTestCase(ValidatorTestCase): 'f', {'subfield_f_year': '2002', 'subfield_f_month': '12', 'subfield_f_day': '1'}) - self.assertEquals(2002, result.year()) - self.assertEquals(12, result.month()) - self.assertEquals(1, result.day()) - self.assertEquals(0, result.hour()) - self.assertEquals(0, result.minute()) + self.assertEqual(2002, result.year()) + self.assertEqual(12, result.month()) + self.assertEqual(1, result.day()) + self.assertEqual(0, result.hour()) + self.assertEqual(0, result.minute()) result = self.v.validate( DateTimeField('f', date_only=1), @@ -413,11 +413,11 @@ class DateTimeValidatorTestCase(ValidatorTestCase): 'subfield_f_day': '1', 'subfield_f_hour': '10', 'subfield_f_minute': '30'}) - self.assertEquals(2002, result.year()) - self.assertEquals(12, result.month()) - self.assertEquals(1, result.day()) - self.assertEquals(0, result.hour()) - self.assertEquals(0, result.minute()) + self.assertEqual(2002, result.year()) + self.assertEqual(12, result.month()) + self.assertEqual(1, result.day()) + self.assertEqual(0, result.hour()) + self.assertEqual(0, result.minute()) def test_allow_empty_time(self): result = self.v.validate( @@ -425,11 +425,11 @@ class DateTimeValidatorTestCase(ValidatorTestCase): 'f', {'subfield_f_year': '2002', 'subfield_f_month': '12', 'subfield_f_day': '1'}) - self.assertEquals(2002, result.year()) - self.assertEquals(12, result.month()) - self.assertEquals(1, result.day()) - self.assertEquals(0, result.hour()) - self.assertEquals(0, result.minute()) + self.assertEqual(2002, result.year()) + self.assertEqual(12, result.month()) + self.assertEqual(1, result.day()) + self.assertEqual(0, result.hour()) + self.assertEqual(0, result.minute()) result = self.v.validate( DateTimeField('f', allow_empty_time=1), @@ -438,11 +438,11 @@ class DateTimeValidatorTestCase(ValidatorTestCase): 'subfield_f_day': '1', 'subfield_f_hour': '10', 'subfield_f_minute': '30'}) - self.assertEquals(2002, result.year()) - self.assertEquals(12, result.month()) - self.assertEquals(1, result.day()) - self.assertEquals(10, result.hour()) - self.assertEquals(30, result.minute()) + self.assertEqual(2002, result.year()) + self.assertEqual(12, result.month()) + self.assertEqual(1, result.day()) + self.assertEqual(10, result.hour()) + self.assertEqual(30, result.minute()) class LinesValidatorTestCase(ValidatorTestCase): def setUp(self): diff --git a/product/Formulator/tests/testSerializeForm.py b/product/Formulator/tests/testSerializeForm.py index 5d3a5bb272..f69b26e819 100644 --- a/product/Formulator/tests/testSerializeForm.py +++ b/product/Formulator/tests/testSerializeForm.py @@ -173,18 +173,18 @@ class SerializeTestCase(unittest.TestCase): self.assert_(form2.has_field(field.getId())) field2 = getattr(form2, field.getId()) # XXX test if values are the same - self.assertEquals(field.values, field2.values) + self.assertEqual(field.values, field2.values) # test if default renderings are the same - self.assertEquals(field.render(), field2.render()) + self.assertEqual(field.render(), field2.render()) - self.assertEquals(form.title, form2.title) - self.assertEquals(form.name, form2.name) - self.assertEquals(form.action, form2.action) - self.assertEquals(form.enctype, form2.enctype) - self.assertEquals(form.method, form2.method) + self.assertEqual(form.title, form2.title) + self.assertEqual(form.name, form2.name) + self.assertEqual(form.action, form2.action) + self.assertEqual(form.enctype, form2.enctype) + self.assertEqual(form.method, form2.method) # if we have forgotten something, this will usually remind us ;-) - self.assertEquals(form.render(), form2.render()) + self.assertEqual(form.render(), form2.render()) def test_messages(self): @@ -211,17 +211,17 @@ class SerializeTestCase(unittest.TestCase): form.validate_all(request) self.fail('form should fail in validation') except FormValidationError, e: - self.assertEquals(1, len(e.errors)) + self.assertEqual(1, len(e.errors)) text1 = e.errors[0].error_text try: form2.validate_all(request) self.fail('form2 should fail in validation') except FormValidationError, e: - self.assertEquals(1, len(e.errors)) + self.assertEqual(1, len(e.errors)) text2 = e.errors[0].error_text - self.assertEquals(text1, text2) + self.assertEqual(text1, text2) def test_fieldValueTypes(self): @@ -361,7 +361,7 @@ class SerializeTestCase(unittest.TestCase): # naively. message = 'the values of %r and %r are different: %r != %r' \ % (field, field2, field.values, field2.values) - self.assertEquals(sorted(field.values.iterkeys()), + self.assertEqual(sorted(field.values.iterkeys()), sorted(field2.values.keys()), message) @@ -377,11 +377,11 @@ class SerializeTestCase(unittest.TestCase): message) # test if default renderings are the same - self.assertEquals(field.render(REQUEST=request), + self.assertEqual(field.render(REQUEST=request), field2.render(REQUEST=request)) # brute force compare ... - self.assertEquals(form.render(REQUEST=request), + self.assertEqual(form.render(REQUEST=request), form2.render(REQUEST=request)) request.clear() request['field_int_field'] = '42' @@ -409,12 +409,12 @@ class SerializeTestCase(unittest.TestCase): # XXX only render first error ... self.fail('error when editing form1, field %s; error message: %s' % (e.errors[0].field_id, e.errors[0].error_text) ) - self.assertEquals(result1, result2) - self.assertEquals(42, result2['int_field']) - self.assertEquals(2.71828, result2['float_field']) + self.assertEqual(result1, result2) + self.assertEqual(42, result2['int_field']) + self.assertEqual(2.71828, result2['float_field']) # check link field timeout value - self.assertEquals(link_field.get_value('check_timeout'), + self.assertEqual(link_field.get_value('check_timeout'), form2.link_field.get_value('check_timeout')) # XXX not tested: equal form validation failure on invalid input @@ -434,9 +434,9 @@ class SerializeTestCase(unittest.TestCase): # XXX actually the empty group is not rendered anyway, but # if we get here, we are behind the bug anyway ... - self.assertEquals(form.render(), form2.render()) + self.assertEqual(form.render(), form2.render()) - self.assertEquals(form.get_groups(), form2.get_groups()) + self.assertEqual(form.get_groups(), form2.get_groups()) def test_suite(): diff --git a/product/MailTemplates/tests/test_FSMailTemplate.py b/product/MailTemplates/tests/test_FSMailTemplate.py index 4232e7fd52..29214ce842 100644 --- a/product/MailTemplates/tests/test_FSMailTemplate.py +++ b/product/MailTemplates/tests/test_FSMailTemplate.py @@ -106,7 +106,7 @@ else: self.MailHost.checkSent() # check we're not setting a content type - self.failIf(self.r.RESPONSE.headers.get('content-type'), + self.assertFalse(self.r.RESPONSE.headers.get('content-type'), self.r.RESPONSE.headers) def test_properties(self): @@ -117,7 +117,7 @@ else: def test_zodbclone(self): from Products.MailTemplates.MailTemplate import MailTemplate clone = self.ob.fake_skin.test._createZODBClone() - self.failUnless(isinstance(clone,MailTemplate),'Clone not a MailTemplate!') + self.assertTrue(isinstance(clone,MailTemplate),'Clone not a MailTemplate!') self.assertEqual(self.ob.fake_skin.test.read(),clone.read()) self.assertEqual(clone.getProperty('mailhost'),None) self.assertEqual(clone.mailhost,'MailHost') @@ -136,7 +136,7 @@ else: self.ob.fake_skin.test.manage_main() # ugh, okay, so we can't really test for security, but lets # test for the missing docstring that was causing problems! - self.failUnless(self.ob.fake_skin.test.__doc__) + self.assertTrue(self.ob.fake_skin.test.__doc__) def test_example2(self): # login diff --git a/product/MailTemplates/tests/test_MailTemplate.py b/product/MailTemplates/tests/test_MailTemplate.py index 3b45271dac..c23a1554b2 100644 --- a/product/MailTemplates/tests/test_MailTemplate.py +++ b/product/MailTemplates/tests/test_MailTemplate.py @@ -151,7 +151,7 @@ class TestMailTemplate(TestCase): def test_addAddFormNoMailHosts(self): self.app.manage_delObjects(ids=['MailHost']) res = self.app.manage_addProduct['MailTemplates'].addMailTemplateForm() - self.failUnless( + self.assertTrue( res.find( '<option value="MailHost">MHTID</option>' )==-1 @@ -160,7 +160,7 @@ class TestMailTemplate(TestCase): def test_addAddFormMailHost(self): self.app._objects = ({'meta_type': 'Mail Host', 'id': 'MailHost'},) res = self.app.manage_addProduct['MailTemplates'].addMailTemplateForm() - self.failIf( + self.assertFalse( res.find( '<option value="MailHost">MHTID</option>' )==-1 @@ -172,7 +172,7 @@ class TestMailTemplate(TestCase): self.MailHost = self.app.MailHost = DummyMailDropHost() self.app._objects = ({'meta_type': 'Maildrop Host', 'id': 'MailHost'},) res = self.app.manage_addProduct['MailTemplates'].addMailTemplateForm() - self.failIf( + self.assertFalse( res.find( '<option value="MailHost">MHTID</option>' )==-1 @@ -282,7 +282,7 @@ class TestMailTemplate(TestCase): def test_PropertiesStartsEmpty(self): self.test_add() - self.failIf(self.mt.propertyMap()) + self.assertFalse(self.mt.propertyMap()) # Test Test tab, well, actually, make sure it's not there ;-) @@ -291,7 +291,7 @@ class TestMailTemplate(TestCase): for option in MailTemplate.manage_options: if option['label']=='Test': self.fail('Test label found') - self.failIf(MailTemplate.ZScriptHTML_tryForm, 'try form not None') + self.assertFalse(MailTemplate.ZScriptHTML_tryForm, 'try form not None') # Test Editing @@ -303,7 +303,7 @@ class TestMailTemplate(TestCase): self.test_add() self.app.manage_delObjects('MailHost') r = self.mt.pt_editForm() - self.failIf( + self.assertFalse( r.find( """<option selected="selected" value="MailHost">'MailHost' is no longer valid!</option>""" )==-1,'No warning for MailHost being invalid found in:\n'+r @@ -332,7 +332,7 @@ class TestMailTemplate(TestCase): self.assertEqual(r.args,('http://foo/test_mt/pt_editForm',)) # ugh, okay, so we can't really test for security, but lets # test for the missing docstring that was causing problems! - self.failUnless(self.mt.__doc__) + self.assertTrue(self.mt.__doc__) def test_view_manage_main(self): self.test_add() @@ -359,7 +359,7 @@ class TestMailTemplate(TestCase): self.MailHost.checkSent() # check we're not setting a content type - self.failIf(self.r.RESPONSE.headers.get('content-type'), + self.assertFalse(self.r.RESPONSE.headers.get('content-type'), self.r.RESPONSE.headers) def testMailHostNotAMailHost(self): @@ -547,7 +547,7 @@ class TestMailTemplate(TestCase): boundary='111', subtype='alternative') - self.failUnless(isinstance(msg,MIMEMultipart)) + self.assertTrue(isinstance(msg,MIMEMultipart)) attachment = MIMEText('A Test Attachment',_subtype='plain') attachment.add_header('Content-Disposition', 'attachment', filename='test.txt') msg.attach(attachment) @@ -580,7 +580,7 @@ class TestMailTemplate(TestCase): boundary='111', subtype='alternative') - self.failUnless(isinstance(msg,MIMEMultipart)) + self.assertTrue(isinstance(msg,MIMEMultipart)) return msg def testZopeFileObject(self): diff --git a/product/PortalTransforms/tests/testImageMagickPortalTransforms.py b/product/PortalTransforms/tests/testImageMagickPortalTransforms.py index 1d5e3fb29c..c074e6d366 100644 --- a/product/PortalTransforms/tests/testImageMagickPortalTransforms.py +++ b/product/PortalTransforms/tests/testImageMagickPortalTransforms.py @@ -24,57 +24,57 @@ class ImageMagickTransformsTest(ERP5TypeTestCase, ZopeTestCase.Functional): self.pt.registerTransform(image_to_bmp()) imgFile = open(input_file_path('logo.jpg'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.portal.mimetypes_registry.classify(data),'image/jpeg') + self.assertEqual(self.portal.mimetypes_registry.classify(data),'image/jpeg') data = self.pt.convertTo(target_mimetype='image/x-ms-bmp',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/x-ms-bmp') + self.assertEqual(data.getMetadata()['mimetype'], 'image/x-ms-bmp') def test_image_to_gif(self): self.pt.registerTransform(image_to_gif()) imgFile = open(input_file_path('logo.png'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.portal.mimetypes_registry.classify(data),'image/png') + self.assertEqual(self.portal.mimetypes_registry.classify(data),'image/png') data = self.pt.convertTo(target_mimetype='image/gif',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/gif') + self.assertEqual(data.getMetadata()['mimetype'], 'image/gif') def test_image_to_jpeg(self): self.pt.registerTransform(image_to_jpeg()) imgFile = open(input_file_path('logo.gif'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.portal.mimetypes_registry.classify(data),'image/gif') + self.assertEqual(self.portal.mimetypes_registry.classify(data),'image/gif') data = self.pt.convertTo(target_mimetype='image/jpeg',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/jpeg') + self.assertEqual(data.getMetadata()['mimetype'], 'image/jpeg') def test_image_to_png(self): self.pt.registerTransform(image_to_png()) imgFile = open(input_file_path('logo.jpg'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.portal.mimetypes_registry.classify(data),'image/jpeg') + self.assertEqual(self.portal.mimetypes_registry.classify(data),'image/jpeg') data = self.pt.convertTo(target_mimetype='image/png',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/png') + self.assertEqual(data.getMetadata()['mimetype'], 'image/png') def test_image_to_pcx(self): self.pt.registerTransform(image_to_pcx()) imgFile = open(input_file_path('logo.gif'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.portal.mimetypes_registry.classify(data),'image/gif') + self.assertEqual(self.portal.mimetypes_registry.classify(data),'image/gif') data = self.pt.convertTo(target_mimetype='image/pcx',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/pcx') + self.assertEqual(data.getMetadata()['mimetype'], 'image/pcx') def test_image_to_ppm(self): self.pt.registerTransform(image_to_ppm()) imgFile = open(input_file_path('logo.png'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.portal.mimetypes_registry.classify(data),'image/png') + self.assertEqual(self.portal.mimetypes_registry.classify(data),'image/png') data = self.pt.convertTo(target_mimetype='image/x-portable-pixmap',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/x-portable-pixmap') + self.assertEqual(data.getMetadata()['mimetype'], 'image/x-portable-pixmap') def test_image_to_tiff(self): self.pt.registerTransform(image_to_tiff()) imgFile = open(input_file_path('logo.jpg'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.portal.mimetypes_registry.classify(data),'image/jpeg') + self.assertEqual(self.portal.mimetypes_registry.classify(data),'image/jpeg') data = self.pt.convertTo(target_mimetype='image/tiff',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/tiff') + self.assertEqual(data.getMetadata()['mimetype'], 'image/tiff') # FIXME missing tests for image_to_html, st diff --git a/product/PortalTransforms/tests/test_engine.py b/product/PortalTransforms/tests/test_engine.py index 0f3a0b2030..98c9e4a6e5 100644 --- a/product/PortalTransforms/tests/test_engine.py +++ b/product/PortalTransforms/tests/test_engine.py @@ -131,45 +131,45 @@ class TestEngine(ATSiteTestCase): def testCall(self): self.register() data = self.engine('HtmlToText', self.data) - self.failUnlessEqual(data, "foo") + self.assertEqual(data, "foo") data = self.engine('FooToBar', self.data) - self.failUnlessEqual(data, "<b>bar</b>") + self.assertEqual(data, "<b>bar</b>") def testConvert(self): self.register() data = self.engine.convert('HtmlToText', self.data) - self.failUnlessEqual(data.getData(), "foo") - self.failUnlessEqual(data.getMetadata()['mimetype'], 'text/plain') - self.failUnlessEqual(data.getMetadata().get('encoding'), None) - self.failUnlessEqual(data.name(), "HtmlToText") + self.assertEqual(data.getData(), "foo") + self.assertEqual(data.getMetadata()['mimetype'], 'text/plain') + self.assertEqual(data.getMetadata().get('encoding'), None) + self.assertEqual(data.name(), "HtmlToText") self.engine.registerTransform(HtmlToTextWithEncoding()) data = self.engine.convert('HtmlToTextWithEncoding', self.data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'text/plain') - self.failUnlessEqual(data.getMetadata()['encoding'], 'ascii') - self.failUnlessEqual(data.name(), "HtmlToTextWithEncoding") + self.assertEqual(data.getMetadata()['mimetype'], 'text/plain') + self.assertEqual(data.getMetadata()['encoding'], 'ascii') + self.assertEqual(data.name(), "HtmlToTextWithEncoding") def testConvertTo(self): self.register() data = self.engine.convertTo('text/plain', self.data, mimetype="text/html") - self.failUnlessEqual(data.getData(), "foo") - self.failUnlessEqual(data.getMetadata()['mimetype'], 'text/plain') - self.failUnlessEqual(data.getMetadata().get('encoding'), None) - self.failUnlessEqual(data.name(), "text/plain") + self.assertEqual(data.getData(), "foo") + self.assertEqual(data.getMetadata()['mimetype'], 'text/plain') + self.assertEqual(data.getMetadata().get('encoding'), None) + self.assertEqual(data.name(), "text/plain") self.engine.unregisterTransform('HtmlToText') self.engine.unregisterTransform('FooToBar') self.engine.registerTransform(HtmlToTextWithEncoding()) data = self.engine.convertTo('text/plain', self.data, mimetype="text/html") - self.failUnlessEqual(data.getMetadata()['mimetype'], 'text/plain') + self.assertEqual(data.getMetadata()['mimetype'], 'text/plain') # HtmlToTextWithEncoding. Now None is the right - #self.failUnlessEqual(data.getMetadata()['encoding'], 'ascii') + #self.assertEqual(data.getMetadata()['encoding'], 'ascii') # XXX the new algorithm is choosing html_to_text instead of - self.failUnlessEqual(data.getMetadata()['encoding'], None) - self.failUnlessEqual(data.name(), "text/plain") + self.assertEqual(data.getMetadata()['encoding'], None) + self.assertEqual(data.name(), "text/plain") def testChain(self): self.register() @@ -179,15 +179,15 @@ class TestEngine(ATSiteTestCase): self.engine.registerTransform(hb) cache = self.engine.convert('hbar', self.data) - self.failUnlessEqual(cache.getData(), "bar") - self.failUnlessEqual(cache.name(), "hbar") + self.assertEqual(cache.getData(), "bar") + self.assertEqual(cache.name(), "hbar") def testPolicy(self): mt = 'text/x-html-safe' data = '<script>this_is_unsafe();</script><p>this is safe</p>' cache = self.engine.convertTo(mt, data, mimetype='text/html') - self.failUnlessEqual(cache.getData(), '<p>this is safe</p>') + self.assertEqual(cache.getData(), '<p>this is safe</p>') self.engine.registerTransform(DummyHtmlFilter1()) self.engine.registerTransform(DummyHtmlFilter2()) @@ -196,16 +196,16 @@ class TestEngine(ATSiteTestCase): self.engine.manage_addPolicy(mt, required) expected_policy = [('text/x-html-safe', ('dummy_html_filter1', 'dummy_html_filter2'))] - self.failUnlessEqual(self.engine.listPolicies(), expected_policy) + self.assertEqual(self.engine.listPolicies(), expected_policy) cache = self.engine.convertTo(mt, data, mimetype='text/html') - self.failUnlessEqual(cache.getData(), '<div class="dummy"><span class="dummy"><p>this is safe</p></span></div>') + self.assertEqual(cache.getData(), '<div class="dummy"><span class="dummy"><p>this is safe</p></span></div>') - self.failUnlessEqual(cache.getMetadata()['mimetype'], mt) - self.failUnlessEqual(cache.name(), mt) + self.assertEqual(cache.getMetadata()['mimetype'], mt) + self.assertEqual(cache.name(), mt) path = self.engine._findPath('text/html', mt, required) - self.failUnlessEqual(str(path), + self.assertEqual(str(path), "[<Transform at dummy_html_filter1>, " "<Transform at dummy_html_filter2>, " "<Transform at safe_html>]") @@ -214,8 +214,8 @@ class TestEngine(ATSiteTestCase): data = "This is a test" mt = "text/plain" out = self.engine.convertTo('text/plain', data, mimetype=mt) - self.failUnlessEqual(out.getData(), data) - self.failUnlessEqual(out.getMetadata()['mimetype'], 'text/plain') + self.assertEqual(out.getData(), data) + self.assertEqual(out.getMetadata()['mimetype'], 'text/plain') def testCache(self): data = "This is a test" @@ -223,14 +223,14 @@ class TestEngine(ATSiteTestCase): mt = "text/plain" self.engine.max_sec_in_cache = 20 out = self.engine.convertTo(mt, data, mimetype=mt, object=self) - self.failUnlessEqual(out.getData(), data, out.getData()) + self.assertEqual(out.getData(), data, out.getData()) out = self.engine.convertTo(mt, other_data, mimetype=mt, object=self) - self.failUnlessEqual(out.getData(), data, out.getData()) + self.assertEqual(out.getData(), data, out.getData()) self.engine.max_sec_in_cache = -1 out = self.engine.convertTo(mt, data, mimetype=mt, object=self) - self.failUnlessEqual(out.getData(), data, out.getData()) + self.assertEqual(out.getData(), data, out.getData()) out = self.engine.convertTo(mt, other_data, mimetype=mt, object=self) - self.failUnlessEqual(out.getData(), other_data, out.getData()) + self.assertEqual(out.getData(), other_data, out.getData()) def testCacheWithVHost(self): """Ensure that the transform cache key includes virtual @@ -248,7 +248,7 @@ class TestEngine(ATSiteTestCase): out = self.engine.convertTo( mt, data, mimetype='text/html', object=self.folder, context=self.folder) - self.failUnlessEqual( + self.assertEqual( out.getData(), '<a href="http://nohost">vhost link</a>', out.getData()) @@ -256,7 +256,7 @@ class TestEngine(ATSiteTestCase): out = self.engine.convertTo( mt, data, mimetype='text/html', object=self, context=self.folder) - self.failUnlessEqual( + self.assertEqual( out.getData(), '<a href="http://nohost">vhost link</a>', out.getData()) @@ -266,7 +266,7 @@ class TestEngine(ATSiteTestCase): out = self.engine.convertTo( mt, data, mimetype='text/html', object=self.folder, context=self.folder) - self.failUnlessEqual( + self.assertEqual( out.getData(), '<a href="http://otherhost">vhost link</a>', out.getData()) @@ -274,7 +274,7 @@ class TestEngine(ATSiteTestCase): out = self.engine.convertTo( mt, data, mimetype='text/html', object=self, context=self.folder) - self.failUnlessEqual( + self.assertEqual( out.getData(), '<a href="http://otherhost">vhost link</a>', out.getData()) diff --git a/product/PortalTransforms/tests/test_graph.py b/product/PortalTransforms/tests/test_graph.py index eda3120ede..f2b4340020 100644 --- a/product/PortalTransforms/tests/test_graph.py +++ b/product/PortalTransforms/tests/test_graph.py @@ -14,7 +14,7 @@ class TestGraph(ATSiteTestCase): requirements = self.engine._policies.get('text/plain', []) if requirements: out = self.engine.convertTo('text/plain', data, filename=FILE_PATH) - self.failUnless(out.getData()) + self.assertTrue(out.getData()) def testFindPath(self): originalMap = self.engine._mtmap @@ -86,7 +86,7 @@ class TestGraph(ATSiteTestCase): if gotPath is not None: gotPath = [transform.name() for transform in gotPath] # this must be the same as in our expectation - self.assertEquals(expectedPath, gotPath) + self.assertEqual(expectedPath, gotPath) self.engine._mtmap = originalMap def testFindPathWithEmptyTransform(self): @@ -101,7 +101,7 @@ class TestGraph(ATSiteTestCase): orig = 'Some text' converted = self.engine.convertTo( 'text/plain', 'Some text', mimetype='text/plain') - self.assertEquals(orig, str(converted)) + self.assertEqual(orig, str(converted)) def test_suite(): diff --git a/product/PortalTransforms/tests/test_transforms.py b/product/PortalTransforms/tests/test_transforms.py index ec1953012d..61fd33320a 100644 --- a/product/PortalTransforms/tests/test_transforms.py +++ b/product/PortalTransforms/tests/test_transforms.py @@ -57,10 +57,10 @@ class TransformTest(ATSiteTestCase): got_start = got.strip()[:30] expected_start = expected.strip()[:30] - self.assertEquals(got_start, expected_start, + self.assertEqual(got_start, expected_start, '[%s]\n\n!=\n\n[%s]\n\nIN %s(%s)' % ( got_start, expected_start, self.transform.name(), self.input)) - self.assertEquals(self.subobjects, len(res_data.getSubObjects()), + self.assertEqual(self.subobjects, len(res_data.getSubObjects()), '%s\n\n!=\n\n%s\n\nIN %s(%s)' % ( self.subobjects, len(res_data.getSubObjects()), self.transform.name(), self.input)) @@ -90,57 +90,57 @@ class PILTransformsTest(ATSiteTestCase): self.pt.registerTransform(image_to_bmp()) imgFile = open(input_file_path('logo.jpg'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.mimetypes_registry.classify(data),'image/jpeg') + self.assertEqual(self.mimetypes_registry.classify(data),'image/jpeg') data = self.pt.convertTo(target_mimetype='image/x-ms-bmp',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/x-ms-bmp') + self.assertEqual(data.getMetadata()['mimetype'], 'image/x-ms-bmp') def test_image_to_gif(self): self.pt.registerTransform(image_to_gif()) imgFile = open(input_file_path('logo.png'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.mimetypes_registry.classify(data),'image/png') + self.assertEqual(self.mimetypes_registry.classify(data),'image/png') data = self.pt.convertTo(target_mimetype='image/gif',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/gif') + self.assertEqual(data.getMetadata()['mimetype'], 'image/gif') def test_image_to_jpeg(self): self.pt.registerTransform(image_to_jpeg()) imgFile = open(input_file_path('logo.gif'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.mimetypes_registry.classify(data),'image/gif') + self.assertEqual(self.mimetypes_registry.classify(data),'image/gif') data = self.pt.convertTo(target_mimetype='image/jpeg',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/jpeg') + self.assertEqual(data.getMetadata()['mimetype'], 'image/jpeg') def test_image_to_png(self): self.pt.registerTransform(image_to_png()) imgFile = open(input_file_path('logo.jpg'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.mimetypes_registry.classify(data),'image/jpeg') + self.assertEqual(self.mimetypes_registry.classify(data),'image/jpeg') data = self.pt.convertTo(target_mimetype='image/png',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/png') + self.assertEqual(data.getMetadata()['mimetype'], 'image/png') def test_image_to_pcx(self): self.pt.registerTransform(image_to_pcx()) imgFile = open(input_file_path('logo.gif'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.mimetypes_registry.classify(data),'image/gif') + self.assertEqual(self.mimetypes_registry.classify(data),'image/gif') data = self.pt.convertTo(target_mimetype='image/pcx',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/pcx') + self.assertEqual(data.getMetadata()['mimetype'], 'image/pcx') def test_image_to_ppm(self): self.pt.registerTransform(image_to_ppm()) imgFile = open(input_file_path('logo.png'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.mimetypes_registry.classify(data),'image/png') + self.assertEqual(self.mimetypes_registry.classify(data),'image/png') data = self.pt.convertTo(target_mimetype='image/x-portable-pixmap',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/x-portable-pixmap') + self.assertEqual(data.getMetadata()['mimetype'], 'image/x-portable-pixmap') def test_image_to_tiff(self): self.pt.registerTransform(image_to_tiff()) imgFile = open(input_file_path('logo.jpg'), 'rb') data = imgFile.read() - self.failUnlessEqual(self.mimetypes_registry.classify(data),'image/jpeg') + self.assertEqual(self.mimetypes_registry.classify(data),'image/jpeg') data = self.pt.convertTo(target_mimetype='image/tiff',orig=data) - self.failUnlessEqual(data.getMetadata()['mimetype'], 'image/tiff') + self.assertEqual(data.getMetadata()['mimetype'], 'image/tiff') TRANSFORMS_TESTINFO = ( diff --git a/product/ZSQLCatalog/tests/testZSQLCatalog.py b/product/ZSQLCatalog/tests/testZSQLCatalog.py index 9e03d7f4ac..35107679d3 100644 --- a/product/ZSQLCatalog/tests/testZSQLCatalog.py +++ b/product/ZSQLCatalog/tests/testZSQLCatalog.py @@ -52,7 +52,7 @@ class TestSQLCatalog(unittest.TestCase): self._catalog.sql_catalog_object_list = ('z_dummy_method', ) def test_getFilterableMethodList(self): - self.failUnless(self._catalog.z_dummy_method in + self.assertTrue(self._catalog.z_dummy_method in self._catalog.getFilterableMethodList()) def test_manage_editFilter(self): @@ -69,31 +69,31 @@ class TestSQLCatalog(unittest.TestCase): def test_getFilterExpression(self): request = dict(z_dummy_method_box=1, z_dummy_method_expression='python: 1') self._catalog.manage_editFilter(REQUEST=request) - self.assertEquals('python: 1', self._catalog.getExpression('z_dummy_method')) - self.assertEquals('', self._catalog.getExpression('not_exists')) + self.assertEqual('python: 1', self._catalog.getExpression('z_dummy_method')) + self.assertEqual('', self._catalog.getExpression('not_exists')) def test_setFilterExpression(self): request = dict(z_dummy_method_box=1, z_dummy_method_expression='python: 1') self._catalog.manage_editFilter(REQUEST=request) expression = self._catalog.getExpressionInstance('z_dummy_method') self._catalog.setFilterExpression('z_dummy_method', 'python: 2') - self.assertEquals('python: 2', self._catalog.getExpression('z_dummy_method')) + self.assertEqual('python: 2', self._catalog.getExpression('z_dummy_method')) self.assertNotEquals(expression, self._catalog.getExpressionInstance('z_dummy_method')) self._catalog.setFilterExpression('z_dummy_method', 'python: 1') - self.assertEquals('python: 1', self._catalog.getExpression('z_dummy_method')) + self.assertEqual('python: 1', self._catalog.getExpression('z_dummy_method')) self.assertRaises(KeyError, self._catalog.setFilterExpression, 'not_exists', "python:1") - self.assertEquals('', self._catalog.getExpression('not_exists')) + self.assertEqual('', self._catalog.getExpression('not_exists')) def test_getFilterDict(self): request = dict(z_dummy_method_box=1, z_dummy_method_expression='python: 1') self._catalog.manage_editFilter(REQUEST=request) filter_dict = self._catalog.getFilterDict() - self.assertEquals(self._catalog.filter_dict.keys(), filter_dict.keys()) + self.assertEqual(self._catalog.filter_dict.keys(), filter_dict.keys()) self.assertTrue(isinstance(filter_dict, type({}))) self.assertTrue(isinstance(filter_dict['z_dummy_method'], type({}))) - self.assertEquals(self._catalog.getExpression('z_dummy_method'), + self.assertEqual(self._catalog.getExpression('z_dummy_method'), filter_dict['z_dummy_method']['expression']) def test_getFilterExpressionInstance(self): @@ -101,7 +101,7 @@ class TestSQLCatalog(unittest.TestCase): self._catalog.manage_editFilter(REQUEST=request) self.assertTrue(isinstance( self._catalog.getExpressionInstance('z_dummy_method'), Expression)) - self.assertEquals(None, self._catalog.getExpressionInstance('not_exists')) + self.assertEqual(None, self._catalog.getExpressionInstance('not_exists')) def test_isPortalTypeSelected(self): request = dict(z_dummy_method_box=1, z_dummy_method_type=['Selected']) diff --git a/product/Zelenium/tests/test_zuite.py b/product/Zelenium/tests/test_zuite.py index 9fefd79957..9b5b883f7a 100644 --- a/product/Zelenium/tests/test_zuite.py +++ b/product/Zelenium/tests/test_zuite.py @@ -179,8 +179,8 @@ class ZuiteTests( unittest.TestCase ): zuite = self._makeOne() self.assertEqual( len( zuite.test_case_metatypes ), 2 ) - self.failUnless( 'File' in zuite.test_case_metatypes ) - self.failUnless( 'Page Template' in zuite.test_case_metatypes ) + self.assertTrue( 'File' in zuite.test_case_metatypes ) + self.assertTrue( 'Page Template' in zuite.test_case_metatypes ) self.assertEqual( len( zuite.listTestCases() ), 0 ) def test___getitem___normal( self ): @@ -199,7 +199,7 @@ class ZuiteTests( unittest.TestCase ): zuite._setObject( _KEY, self._makeFile( _KEY ) ) object = zuite[ _KEY ] - self.failUnless( aq_base( object ) + self.assertTrue( aq_base( object ) is aq_base( getattr( zuite, _KEY ) ) ) def test___getitem___support_files( self ): @@ -293,7 +293,7 @@ class ZuiteTests( unittest.TestCase ): cases = zuite.listTestCases() self.assertEqual( len( cases ), len( _TEST_IDS ) ) for case in cases: - self.failUnless( case[ 'id' ] in _TEST_IDS ) + self.assertTrue( case[ 'id' ] in _TEST_IDS ) zuite.test_case_metatypes = () self.assertEqual( len( zuite.listTestCases() ), 0 ) @@ -302,7 +302,7 @@ class ZuiteTests( unittest.TestCase ): cases = zuite.listTestCases() self.assertEqual( len( cases ), len( _TEST_IDS ) ) for case in cases: - self.failUnless( case[ 'id' ] in _TEST_IDS ) + self.assertTrue( case[ 'id' ] in _TEST_IDS ) def test_listTestCases_recursive( self ): @@ -331,14 +331,14 @@ class ZuiteTests( unittest.TestCase ): expected = _TEST_IDS + _SUB_IDS self.assertEqual( len( cases ), len( expected ) ) for case in cases: - self.failUnless( case[ 'id' ] in expected ) + self.assertTrue( case[ 'id' ] in expected ) # verfiy that disabling the parent's metatypes leaves the child's OK. zuite.test_case_metatypes = () cases = zuite.listTestCases() self.assertEqual( len( cases ), len( _SUB_IDS ) ) for case in cases: - self.failUnless( case[ 'id' ] in _SUB_IDS ) + self.assertTrue( case[ 'id' ] in _SUB_IDS ) # verfiy that disabling the child's metatypes leaves the parent's OK. zuite.test_case_metatypes = ( 'File', ) @@ -346,7 +346,7 @@ class ZuiteTests( unittest.TestCase ): cases = zuite.listTestCases() self.assertEqual( len( cases ), len( _TEST_IDS ) ) for case in cases: - self.failUnless( case[ 'id' ] in _TEST_IDS ) + self.assertTrue( case[ 'id' ] in _TEST_IDS ) def test_listTestCases_filesystem( self ): @@ -379,8 +379,8 @@ class ZuiteTests( unittest.TestCase ): cases = zuite.listTestCases() self.assertEqual( len( cases ), 2 ) case_ids = [ x[ 'id' ] for x in cases ] - self.failUnless( 'test_one.html' in case_ids ) - self.failUnless( 'test_another.html' in case_ids ) + self.assertTrue( 'test_one.html' in case_ids ) + self.assertTrue( 'test_another.html' in case_ids ) def test_listTestCases_filesystem_ordered_default( self ): @@ -590,7 +590,7 @@ class ZuiteTests( unittest.TestCase ): zuite.manage_createSnapshot( archive_name=_ARCHIVE_NAME ) object_ids = zuite.objectIds() self.assertEqual( len( object_ids ), 1 ) - self.failUnless( _ARCHIVE_NAME in object_ids ) + self.assertTrue( _ARCHIVE_NAME in object_ids ) archive = zuite._getOb( _ARCHIVE_NAME ) expected = self._listDefaultArchiveNames() @@ -608,7 +608,7 @@ class ZuiteTests( unittest.TestCase ): ) object_ids = zuite.objectIds() self.assertEqual( len( object_ids ), 1 ) - self.failUnless( _ARCHIVE_NAME in object_ids ) + self.assertTrue( _ARCHIVE_NAME in object_ids ) archive = zuite._getOb( _ARCHIVE_NAME ) expected = self._listDefaultArchiveNames( include_selenium=False ) @@ -631,7 +631,7 @@ class ZuiteTests( unittest.TestCase ): object_ids = zuite.objectIds() self.assertEqual( len( object_ids ), 2 ) expected_id = '%s-%s.zip' % ( zuite.getId(), _NOW ) - self.failUnless( expected_id in object_ids ) + self.assertTrue( expected_id in object_ids ) expected = self._listDefaultArchiveNames() expected.append( '.objects' ) @@ -666,7 +666,7 @@ class ZuiteTests( unittest.TestCase ): zuite.manage_createSnapshot( archive_name=_ARCHIVE_NAME ) object_ids = zuite.objectIds() self.assertEqual( len( object_ids ), len( _TEST_IDS ) + 2 ) - self.failUnless( _ARCHIVE_NAME in object_ids ) + self.assertTrue( _ARCHIVE_NAME in object_ids ) archive = zuite._getOb( _ARCHIVE_NAME ) expected = self._listDefaultArchiveNames() @@ -719,7 +719,7 @@ class ZuiteTests( unittest.TestCase ): , 'text/html' ) ) - self.failUnless( u'azértï' in zresults.index_html() ) + self.assertTrue( u'azértï' in zresults.index_html() ) def test_suite(): -- 2.30.9