def test_02_ReturnedSalePackingListWorkflow(self, quiet=quiet, run=run_all_test): """ Test that returned sale packing list workflow """ if not run: return sequence_list = SequenceList() sequence_string = self.default_sequence + '\ stepTic \ stepCreateReturnedPackingList \ stepConfirmReturnedPackingList \ stepTic \ stepCheckConfirmedReturnedPackingList \ stepShipReturnedPackingList \ stepTic \ stepCheckShippedReturnedPackingList \ stepReceiveReturnedPackingList \ stepTic \ stepCheckReceivedReturnedPackingList \ stepDeliverReturnedPackingList \ stepTic \ stepCheckDeliveredReturnedPackingList \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_11_ManuallyAddedMovementsManyTransactions(self, quiet=quiet, run=RUN_ALL_TESTS): """ Checks that adding invoice lines and accounting lines generates correct simulation In this case checks what is happening, where movements are added in one transaction and edited in another """ if not run: return if not quiet: self.logMessage('Invoice with Manually Added Movements in separate transactions') sequence_list = SequenceList() sequence_list.addSequenceString( self.PACKING_LIST_DEFAULT_SEQUENCE + """ stepSetReadyPackingList stepTic stepStartPackingList stepCheckInvoicingRule stepTic stepInvoiceBuilderAlarm stepTic stepCheckInvoiceBuilding stepRebuildAndCheckNothingIsCreated stepCheckInvoicesConsistency stepTic stepCheckInvoiceIsSolved stepStartInvoice stepTic stepAddInvoiceLinesManyTransactions stepTic stepCheckSimulationTrees """) sequence_list.play(self, quiet=quiet)
def test_01_ERP5BankingMoneyDepositRendering(self, quiet=QUIET, run=RUN_ALL_TEST): """ Define the sequence of step that will be play """ if not run: return sequence_list = SequenceList() # define the sequence sequence_string = 'Tic CheckObjects Tic CheckInitialInventory CheckSource CheckDestination ' \ + 'CreateMoneyDepositRendering ' \ + 'Tic CheckBaobabDestination ' \ + 'CreateValidLine1 CheckSubTotal ' \ + 'CreateValidLine2 CheckTotal ' \ + 'CheckSource CheckDestination ' \ + 'CreateInvalidLine ' \ + 'TryOrderMoneyDepositRenderingWithBadInventory ' \ + 'DelInvalidLine Tic CheckTotal ' \ + 'OrderMoneyDepositRendering ' \ + 'Tic CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \ + 'ResetInventory Tic ' \ + 'DeliverFails Tic ' \ + 'DeleteResetInventory Tic ' \ + 'DeliverMoneyDepositRendering ' \ + 'CheckSourceDebit CheckDestinationCredit ' sequence_list.addSequenceString(sequence_string) # play the sequence sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_twoPurchasePackingList(self): """ Check that calling Computer.getSoftwareReleaseList uses the Purchase Packing List in proper state, regardless its date """ sequence_list = SequenceList() sequence_string = self.prepare_two_purchase_packing_list + '\ SlapLoginCurrentComputer \ CheckSuccessComputerGetSoftwareReleaseListCall \ SlapLogout \ LoginDefaultUser \ StepPurchasePackingListBStartDateAfterPurchasePackingListA \ Tic \ Logout \ SlapLoginCurrentComputer \ CheckSuccessComputerGetSoftwareReleaseListCall \ SlapLogout \ LoginDefaultUser \ StepPurchasePackingListBStartDateBeforePurchasePackingListA \ Tic \ Logout \ SlapLoginCurrentComputer \ CheckSuccessComputerGetSoftwareReleaseListCall \ Tic \ SlapLogout \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_AdoptQuantityDivergenceOnInvoiceLineWithStoppedPackingList(self, quiet=quiet, run=RUN_ALL_TESTS): """Adopt quantity with stopped packing list""" if not run: return sequence_list = SequenceList() sequence = sequence_list.addSequenceString( self.PACKING_LIST_DEFAULT_SEQUENCE + \ """ stepStartPackingList stepStopPackingList stepTic stepInvoiceBuilderAlarm stepTic stepChangeQuantityDoubledOnInvoice stepTic stepCheckDivergedQuantityOnInvoice stepAdoptPrevisionOnInvoice stepTic """) 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.assertEquals(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, invoice_line.getDeliveryRelatedValue(portal_type='Simulation Movement' ).getQuantity()) self.assertEquals([], packing_list.getDivergenceList()) self.assertEquals('solved', packing_list.getCausalityState())
def test_01_ERP5BankingCashInventory(self, quiet=QUIET, run=RUN_ALL_TEST): """ Define the sequence of step that will be play """ if not run: return sequence_list = SequenceList() # define the sequence sequence_string = ( "Tic CheckObjects Tic CheckInitialInventory " + "CreateCashInventoryGroup CreateCashInventory " + "CreateInventoryLine1 CheckSubTotal1 " + "CreateInventoryLine2 CheckSubTotal2 " + "CreateInventoryLine3 CheckTotal " + "CheckInventoryDelivered Tic CheckInventory " + "CreateCashInventoryGroup2 CreateCashInventory " + "CreateInventoryLine1 CheckSubTotal1 " + "CreateInventoryLine2 CheckSubTotal2 " + "CreateInventoryLine3 CheckTotal " + "CheckInventoryDelivered Tic CheckInventory" ) sequence_list.addSequenceString(sequence_string) # play the sequence sequence_list.play(self)
def test_01_ERP5BankingClassificationSurvey(self, quiet=QUIET, run=RUN_ALL_TEST): """ Define the sequence of step that will be play """ if not run: return sequence_list = SequenceList() # define the sequence sequence_string = 'Tic CheckObjects Tic CheckInitialInventory CheckSource CheckDestination ' \ + 'CreateClassificationSurvey ' \ + 'CreateTwoValidIncomingLine CheckSubTotal ' \ + 'CreateValidOutgoingLineForInternalBanknote ' \ + 'CreateValidOutgoingLineForExternalBanknote ' \ + 'Tic CheckTotal ' \ + 'CheckSource CheckDestination ' \ + 'ConfirmClassificationSurvey Tic ' \ + 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \ + 'ResetSourceInventory Tic ' \ + 'DeliverClassificationSurveyFails Tic ' \ + 'DeleteResetInventory Tic ' \ + 'DeliverClassificationSurvey Tic ' \ + 'CheckSourceDebit CheckDestinationCredit ' sequence_list.addSequenceString(sequence_string) # play the sequence sequence_list.play(self)
def test_01_ItemSimpleTest(self, quiet=quiet): sequence_list = SequenceList() # Test with a simply order without cell sequence_string = 'stepCreateOrganisation1 \ stepCreateOrganisation2 \ stepCreateOrganisation3 \ stepCreateItemList \ stepCreateOrder \ stepSetOrderProfile \ stepCreateNotVariatedResource \ stepTic \ stepCreateOrderLine \ stepSetOrderLineResource \ stepSetOrderLineDefaultValues \ stepOrderLineSetAggregationList \ stepConfirmOrder \ stepTic \ stepPackingListBuilderAlarm \ stepTic \ stepCheckOrderLineAggregate \ stepCheckOrderSimulation \ stepCheckSimulationAggregate \ stepCheckDeliveryBuilding \ stepCheckPackingListLineAggregate \ stepCheckPackingListIsNotDivergent ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_14_ManuallyAddPackingListWithItem(self, quiet=quiet, run=run_all_test): """ Checks that adding invoice lines and accounting lines to one invoice generates correct simulation """ if not quiet: self.logMessage('Invoice with Manually Added Movements') sequence_list = SequenceList() sequence_string = self.DEFAULT_ITEM_WITH_PACKING_LIST_SEQUENCE + '\ stepSetReadyPackingList \ stepTic \ stepStartPackingList \ stepCheckInvoicingRule \ stepTic \ stepInvoiceBuilderAlarm \ stepTic \ stepCheckInvoiceBuilding \ stepRebuildAndCheckNothingIsCreated \ stepCheckInvoicesConsistency \ stepAddInvoiceLines \ stepTic \ stepStartInvoice \ stepTic \ stepCheckSimulationTrees \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_04_checkNotMergedTaskReportLine(self, quiet=0, run=run_all_test): """ Check that a task report can not be the created from a merged of multiple task lines. """ if not run: return sequence_list = SequenceList() sequence_string = 'stepLogin \ stepCreateOrganisation \ stepCreateOrganisation \ stepCreateResource \ stepCreateResource \ stepCreateSimpleTask \ stepSetTaskValues \ stepCreateTaskLine \ stepFillTaskLineWithData \ stepCreateTaskLine \ stepFillTaskLineWithData \ stepConfirmTask \ stepTic \ stepSetTaskReport \ stepVerifyMergedTaskLine \ stepStartTaskReport \ stepFinishTaskReport \ stepCloseTaskReport \ stepTic' sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_05_testStrictSimulationSecurity(self, quiet=0, run=run_all_test): """Test creation of task and (automatic) task_report with strict security in the simulation. """ if not run: return sequence_list = SequenceList() sequence_string = self.default_task_sequence + '\ stepVerifyGeneratedByBuilderTaskReport \ stepStartTaskReport \ stepFinishTaskReport \ stepCloseTaskReport \ stepTic' sequence_list.addSequenceString(sequence_string) simulation_tool = self.getPortal().portal_simulation uf = self.getPortal().acl_users if not uf.getUser('manager'): uf._doAddUser('manager', '', ['Manager'], []) self.login('manager') try: simulation_tool.Base_setDefaultSecurity() self.logout() sequence_list.play(self) finally: self.login('manager') for permission in simulation_tool.possible_permissions(): simulation_tool.manage_permission(permission, roles=(), acquire=1) self.logout()
def test_03_setCheckBugNotification(self, quiet=QUIET, run=RUN_ALL_TEST): """ Test that a closed bug has its stop date property updated. """ if not run: return sequence_list = SequenceList() step_list = [ 'stepLoginUsualUser' , 'stepCreateBug' , 'stepCreateProject' , 'stepCreatePerson1' , 'stepCreatePerson2' , 'stepSetSourceProject' , 'stepSetRequester' , 'stepTic' , 'stepOpenBug' , 'stepTic' , 'stepCheckBugNotification' , 'stepCreateBugMessage' , 'stepCheckBugMessage' , 'stepTic' , 'stepPostBugMessage' , 'stepTic' , 'stepCheckBugMessageIsDelivered' , 'stepCheckBugMessageNotification' ] sequence_string = ' '.join(step_list) sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_01_StopDateUpdatedOnClose(self, quiet=QUIET, run=RUN_ALL_TEST): """ Test that a closed bug has its stop date property updated. """ if not run: return sequence_list = SequenceList() step_list = [ 'stepCreateBug' , 'stepCheckBugInit' , 'stepOpenBug' , 'stepTic' , 'stepSetOldClosedDate' , 'stepAssignBug' , 'stepTic' , 'stepResolveBug' , 'stepTic' , 'stepReAssignBug' , 'stepTic' , 'stepResolveBug' , 'stepTic' , 'stepCloseBug' , 'stepTic' , 'stepCheckClosedDate' ] sequence_string = ' '.join(step_list) sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_03_ReturnedSalePackingListWorkflowFail(self, quiet=quiet, run=run_all_test): """ Test that can not change workflow when delivered """ if not run: return sequence_list = SequenceList() sequence_string = self.default_sequence + '\ stepTic \ stepCreateReturnedPackingList \ stepConfirmReturnedPackingList \ stepTic \ stepCheckConfirmedReturnedPackingList \ stepShipReturnedPackingList \ stepTic \ stepCheckShippedReturnedPackingList \ stepReceiveReturnedPackingList \ stepTic \ stepCheckReceivedReturnedPackingList \ stepDeliverReturnedPackingList \ stepTic \ stepCheckDeliveredReturnedPackingList \ stepTic \ stepConfirmReturnedPackingList \ stepTic \ ' sequence_list.addSequenceString(sequence_string) try: sequence_list.play(self, quiet=quiet) except UnsupportedWorkflowMethod, e: self.assertTrue(True)
def test_03_ImportNoMapping(self): sequence_list = SequenceList() step_list = [ 'stepImportFileNoMapping' ] sequence_string = ' '.join(step_list) sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_15_ThreeOrderLines(self, quiet=quiet, run=run_all_test): """ Check that item with three order lines. """ sequence_list = SequenceList() sequence_string = self.DEFAULT_ITEM_WITH_ORDER_SEQUENCE + '\ stepCreateItemList \ stepCreateOrderLine \ stepSetOrderLineResource \ stepSetOrderLineDefaultValues \ stepCreateItemList \ stepCreateOrderLine \ stepSetOrderLineResource \ stepSetOrderLineDefaultValues \ stepOrderSetAggregationList \ stepTic \ stepOrderOrder \ stepTic \ stepConfirmOrder \ stepTic \ stepPackingListBuilderAlarm \ stepTic \ stepCheckOrderSimulation \ stepCheckDeliveryBuilding \ stepCheckPackingListIsNotDivergent \ stepCheckPackingListLineAggregateList \ stepCheckOrderPackingList ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_02_TestReportListChangeDestination(self, quiet=quiet, run=run_all_test): """ Test generation of delivery list """ if not run: return sequence_list = SequenceList() # Test with a simply order without cell sequence_string = '\ stepSetStrictSecurity \ stepLogin \ stepCreateOrganisation ' + \ self.default_task_sequence + '\ stepCheckTaskReportIsSolved \ stepChangeTaskReportDestination \ stepCheckTaskReportIsCalculating \ stepTic \ stepCheckTaskReportIsDiverged \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_03_TaskReportChangeStartDate(self, quiet=quiet, run=run_all_test): """ Test generation of delivery list """ if not run: return sequence_list = SequenceList() # Test with a simply order without cell sequence_string = '\ stepSetStrictSecurity \ ' + self.default_task_sequence + '\ stepCheckTaskReportIsSolved \ stepChangeCommentOnTaskReport \ stepChangeTaskReportStartDate \ stepCheckTaskReportIsCalculating \ stepTic \ stepCheckTaskReportIsDiverged \ stepAcceptDateDecision \ stepTic \ stepCheckTaskReportIsSolved \ stepCheckCommentStillOnTaskReport \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_01_IfNested(self, quiet=quiet): sequence_list = SequenceList() sequence = sequence_list.addSequenceString(self.DEFAULT_SEQUENCE) sequence_list.play(self, quiet=quiet) # order = sequence.get('order') # packing_list = sequence.get('packing_list') document = sequence.get('invoice') self.assertEquals('Sale Invoice Transaction', document.getPortalType()) line_list = document.objectValues( portal_type=self.portal.getPortalInvoiceMovementTypeList()) self.assertEquals(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)) line_line = line.objectValues()[0] self.assertEquals('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())
def test_04_TaskReportChangeStartDate(self, quiet=quiet, run=run_all_test): """ Check that it is possible to solve date's divergence on the task report line level. """ if not run: return sequence_list = SequenceList() # Test with a simply order without cell sequence_string = '\ stepSetStrictSecurity \ ' + self.default_task_sequence + '\ stepCheckTaskReportIsSolved \ \ stepCloneTaskReportLine \ stepChangeFirstTaskReportLineDate \ stepChangeSecondTaskReportLineDate \ stepCheckTaskReportIsCalculating \ stepTic \ stepCheckTaskReportIsDiverged \ stepAcceptLineDateDecision \ stepTic \ stepCheckTaskReportIsSolved \ stepCheckTaskReportDates \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_13_acceptQuantityDivergenceOnInvoiceWithStartedPackingList( self, quiet=quiet, run=RUN_ALL_TESTS): if not run: return if not quiet: self.logMessage('Accept Quantity Divergence on Invoice') sequence_list = SequenceList() sequence = sequence_list.addSequenceString( self.PACKING_LIST_DEFAULT_SEQUENCE + """ stepSetReadyPackingList stepTic stepStartPackingList stepTic stepInvoiceBuilderAlarm stepTic stepChangeQuantityDoubledOnInvoice stepTic stepCheckDivergedQuantityOnInvoice stepAcceptDecisionOnInvoice stepTic stepCheckDivergenceOnInvoice stepCheckDivergedOnPackingList stepCheckDivergedQuantityOnPackingList stepAdoptPrevisionOnPackingList stepTic """) 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())
def test_01_relationFieldToInaccessibleObject(self): """ This test checks if a form can be viewed when it contains a RelationStringField which links to an object the user is not authorized to view. This problem can happen for example in the following situation: - a user is a member of a project P team, so he can view P - the user creates a project-related document and leaves it in "draft" state - the user quits the project P team Then the user can not view the project, but still can view his document as he is the owner. An attempt to view the document form would raise Unauthorized. """ # this really depends on the generated markup self.category_field_markup = '<input name="field_my_foo_category_title" value="a" type="text"' sequence_list = SequenceList() sequence_string = '\ CreateObjects \ CreateTestFoo \ Tic \ AccessFooDoesNotRaise \ AccessFooDisplaysCategoryName \ ChangeCategorySecurity \ Tic \ AccessFooDoesNotRaise \ AccessFooDoesNotDisplayCategoryName \ ResetCategorySecurity \ Tic \ AccessFooDoesNotRaise \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_02_InvoiceDeletePackingListLine(self, quiet=quiet, run=RUN_ALL_TESTS): """ Checks that deleting a Packing List Line still creates a correct Invoice """ if not run: return if not quiet: self.logMessage('Packing List Line Delete') sequence_list = SequenceList() for base_sequence in (self.PACKING_LIST_TWO_LINES_DEFAULT_SEQUENCE, ) : sequence_list.addSequenceString( base_sequence + """ stepDeletePackingListLine stepSetReadyPackingList stepTic stepStartPackingList stepCheckInvoicingRule stepTic stepInvoiceBuilderAlarm stepTic stepCheckInvoiceBuilding stepRebuildAndCheckNothingIsCreated stepCheckInvoicesConsistency """) sequence_list.play(self, quiet=quiet)
def test_01_ERP5BankingCheckPayment(self, quiet=QUIET, run=RUN_ALL_TEST): """ Define the sequence of step that will be play """ if not run: return sequence_list = SequenceList() # define the sequence sequence_string = 'Tic CheckObjects Tic CheckInitialInventory ' \ 'CreateCheckPayment Tic ' \ 'CheckConsistency Tic ' \ 'stepValidateAnotherCheckPaymentWorks Tic ' \ 'SendToCounter ' \ 'stepValidateAnotherCheckPaymentFails Tic ' \ 'CheckConfirmedInventory ' \ 'stepValidateAnotherCheckPaymentFailsAgain Tic ' \ 'InputCashDetails Tic ' \ 'ResetInventory Tic ' \ 'PayCheckPaymentFails Tic ' \ 'DeleteResetInventory Tic ' \ 'Pay Tic ' \ 'CheckCheckIsDelivered Tic ' \ 'CheckUndeliverCheck Tic ' \ 'CheckFinalInventory Cleanup Tic' # sequence 2 : check if validating with non-exiting check fail if # automatic check creation is disabled. sequence_string_2 = 'Tic CheckObjects Tic CheckInitialInventory ' \ 'CreateCheckPayment Tic ' \ 'AggregateToInnexistantCheck Tic ' \ 'TryCheckConsistencyWithoutAutomaticCheckCreation Tic ' \ 'Cleanup Tic' # sequence 3 : check is validating with non-existing check succeeds if # automatic check creation is enabled. sequence_string_3 = 'Tic CheckObjects Tic CheckInitialInventory ' \ 'CreateCheckPayment Tic ' \ 'AggregateToInnexistantCheck Tic ' \ 'TryCheckConsistencyWithAutomaticCheckCreation Tic ' \ 'Cleanup Tic' # sequence 4 : reject document and change check number sequence_string_4 = 'Tic CheckObjects Tic CheckInitialInventory ' \ 'CreateCheckPayment Tic ' \ 'CheckConsistency Tic ' \ 'SendToCounter Tic ' \ 'RejectCheckPayment Tic ' \ 'ModifyCheckPayment Tic ' \ 'CheckConsistency Tic ' \ 'SendToCounter Tic ' \ 'CheckConfirmedInventory ' \ 'InputCashDetails Tic ' \ 'Pay Tic ' \ 'CheckCheckAfterReject ' \ 'CheckFinalInventory Cleanup Tic' sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string_2) sequence_list.addSequenceString(sequence_string_3) sequence_list.addSequenceString(sequence_string_4) # play the sequence sequence_list.play(self)
def test_request_new_with_destroyed_reference_web_ui(self): """Prove that having destroyed SI allows to request new one with same reference Supports web UI case. """ sequence_list = SequenceList() sequence_string = ( "SetSoftwareTitleRandom" + self.prepare_destroyed_computer_partition + """ LoginTestVifibCustomer SetSequenceSoftwareInstanceStateStopped PersonRequestSoftwareInstance Tic Logout LoginDefaultUser CallConfirmOrderedSaleOrderAlarm Tic SetSelectedComputerPartition SelectCurrentlyUsedSalePackingListUid Logout LoginDefaultUser CheckComputerPartitionInstanceSetupSalePackingListDelivered Logout LoginERP5TypeTestCase CheckSiteConsistency Logout """ ) sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_01_NotVariatedInventory(self, quiet=0, run=run_all_test): """ We will create an inventory with the default quantity for a particular resource. Then we will check if the is correct. Then we create another inventory and see if we have the new stock value """ if not run: return self.logMessage('Test Not Variated Inventory') sequence_list = SequenceList() # Test with a simple inventory without cell sequence_string = 'stepCreateNotVariatedResource \ stepCreateOrganisation1 \ stepCreateInitialMovements \ stepTic \ stepCreateFirstNotVariatedInventory \ stepTic \ stepCheckFirstNotVariatedInventory \ stepCreateSecondNotVariatedInventory \ stepTic \ stepCheckSecondNotVariatedInventory \ stepModifySecondNotVariatedInventory \ stepTic \ stepCheckSecondNotVariatedInventoryModified' sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_computer_bang_not_called_on_destroying_destroyed(self): """Check that bang is ignoring destruction in progress and destroyed computer partitions""" self.computer_partition_amount = 1 sequence_list = SequenceList() sequence_string = self.prepare_destroy_requested_computer_partition + \ """ SlapLoginCurrentComputer CheckSuccessComputerGetComputerPartitionCall ComputerBang Tic SlapLogout SlapLoginCurrentComputer SoftwareInstanceDestroyed Tic SlapLogout LoginDefaultUser CheckComputerPartitionInstanceCleanupSalePackingListDelivered CheckComputerPartitionIsFree Logout SlapLoginCurrentComputer CheckSuccessComputerGetComputerPartitionCall ComputerBang Tic SlapLogout LoginERP5TypeTestCase CheckSiteConsistency Logout """ sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_04_VariatedAggregatedInventoryGetInventoryList( self, run=run_all_test): """ Same thing as test_03 with testing getInventoryList columns """ if not run: return self.logMessage( 'Test getInventoryList and Variated Aggregated Inventory') sequence_list = SequenceList() # Test with a variated inventory with some aggregate sequence_string = 'stepCreateVariatedResource \ stepCreateOrganisation1 \ stepCreateInitialMovements \ stepTic \ stepCreateItem \ stepCreateItem \ stepCreateFirstVariatedAggregatedInventory \ stepTic \ stepCheckFirstVariatedAggregatedInventory \ stepCheckExplanationTextInInventoryList \ stepCreateSecondVariatedAggregatedInventory \ stepTic \ stepCheckSecondVariatedAggregatedInventory \ stepCheckExplanationTextInInventoryList' sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_01_ERP5BankingCheckbookReception(self, quiet=QUIET, run=RUN_ALL_TEST): """ Define the sequence of step that will be play """ if not run: return sequence_list = SequenceList() # define the sequence sequence_string = 'Tic CheckObjects Tic CheckInitialCheckbookInventory ' \ + 'CreateCheckbookReception Tic ' \ + 'CreateCheckAndCheckbookLineList Tic ' \ + 'ConfirmCheckbookReception Tic ' \ + 'DeliverCheckbookReception Tic ' \ + 'CheckItemsCreated ' \ + 'CheckFinalCheckbookInventory' sequence_list.addSequenceString(sequence_string) # Make sure it is impossible to create a checkbook with a reference # wich is inside the range of another checkbook sequence_string = 'Tic ' \ + 'CreateCheckbookReception2 Tic ' \ + 'CreateCheckAndCheckbookLineList2 Tic ' \ + 'ConfirmCheckbookReception2 Tic ' \ + 'DeliverCheckbookReception2Fails Tic ' sequence_list.addSequenceString(sequence_string) # Make sure it is impossible to create in the same time # two checkbooks with the same reference, so we must # do deliver without tic sequence_string = 'Tic ' \ + 'CreateCheckbookReception3 Tic ' \ + 'CreateCheckbookReception4 Tic ' \ + 'CreateCheckAndCheckbookLineList3 Tic ' \ + 'ConfirmCheckbookReception3 Tic ' \ + 'CreateCheckAndCheckbookLineList4 Tic ' \ + 'ConfirmCheckbookReception4 Tic ' \ + 'DeliverCheckbookReception3 Tic ' \ + 'DeliverCheckbookReception4Fails ' sequence_list.addSequenceString(sequence_string) # Make sure that if we have an import, then everything # will be confirmed automatically sequence_string = 'Tic ' \ + 'CreateCheckbookReception5 Tic ' \ + 'CreateCheckAndCheckbookLineList5 Tic ' \ + 'ConfirmCheckbookReception5 Tic ' \ + 'DeliverCheckbookReception5 Tic ' \ + 'CheckConfirmedCheckbookForImport Tic ' sequence_list.addSequenceString(sequence_string) # Check that it is possible to have 2 receptions on the same range for 2 different checkbook models sequence_string = 'Tic ' \ + 'CreateCheckbookReception6 Tic ' \ + 'CreateCheckAndCheckbookLineList6 Tic ' \ + 'ConfirmCheckbookReception6 Tic ' \ + 'DeliverCheckbookReception6 Tic' sequence_list.addSequenceString(sequence_string) # play the sequence sequence_list.play(self)
def test_01_splitAndDefer(self, quiet=quiet, run=run_all_test): """ Change the quantity on an delivery line, then see if the packing list is divergent and then split and defer the packing list """ if not run: return sequence_list = SequenceList() # Test with a simply order without cell sequence_string = self.default_sequence + '\ stepIncreasePackingListLineQuantity2 \ stepCheckPackingListIsCalculating \ stepTic \ stepCheckPackingListIsNotDivergent \ stepCheckPackingListIsSolved \ stepDecreasePackingListLineQuantity1 \ stepCheckPackingListIsCalculating \ stepTic \ stepCheckPackingListIsNotDivergent \ stepCheckPackingListIsSolved \ stepDecreasePackingListLineQuantity10 \ stepCheckPackingListIsCalculating \ stepTic \ stepCheckPackingListIsDiverged \ stepSplitAndDeferPackingList \ stepCheckSolverIsSolving \ stepTic \ stepCheckPackingListSplitted \ stepCheckPackingListIsSolved \ stepCheckSolverIsSolved \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_01a_simpleOrderBuilderVariatedResource(self, quiet=0, run=run_all_test): """ Test simple Order Builder for Variated Resource """ if not run: return sequence_string = """ CreateOrganisation CreateVariatedResource SetMaxDelayOnResource SetMinFlowOnResource Tic DecreaseOrganisationResourceQuantityVariated Tic CreateOrderBuilder FillOrderBuilder Tic BuildOrderBuilder Tic CheckGeneratedDocumentListVariated """ self.wanted_quantity = 1.0 self.wanted_start_date = DateTime( str(self.datetime + self.order_builder_hardcoded_time_diff)) self.wanted_stop_date = self.wanted_start_date sequence_list = SequenceList() sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_01_dataProtectionRequest(self): """This test create a person with a compromised description. A data protection request is create from this document. Then user erase properties and workflow history and check expected result. - property on object are deleted - Worlkflow history comments are deleted - Permission "View History" is granted only for Manager """ sequence_list = SequenceList() sequence_string = '\ CreatePersonDocument \ EditDocument \ ValidateDocument \ Tic \ CreateDataProtectionRequest \ Tic \ EraseDocumentProperties \ Tic \ CheckErasedDataProperties \ EraseWorkflowHistoryCommentList \ Tic \ CheckErasedWorkflowHistoryCommentList \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_sentMailMessageCreateOneInternetMessagePostForEachRecipient(self): """ In case of multi recipients for emails, one mail message content is generated and sent through the MailHost. As the purpose of Internet Message Post is to track what goes out of ERP5, one Internet Message Post must be created for each of these mail message contents. """ recipient_2 = self.portal.person_module.newContent( portal_type='Person', title='recipient_2', default_email_coordinate_text='*****@*****.**', ) self.recipient_list.append(recipient_2) sequence_list = SequenceList() sequence_string = """ stepCreateMailMessage stepStartMailMessage stepCheckMailMessage stepTic stepCheckInternetMessagePostCreated stepCheckLatestMessageListFromMailHost """ sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_01_getAggregatedAmountList(self, quiet=0, run=run_all_test): """ Test the method getAggregatedAmountList """ if not run: return sequence_list = SequenceList() # Test with a simply order without cell sequence_string = '\ CreateComponentDict \ CreateOperationDict \ Tic \ CreateVariatedResource \ Tic \ CreateTransformation \ Tic \ CreateTransformationLine \ Tic \ CreateIncludedTransformation \ Tic \ CreateIncludedTransformationLine \ Tic \ VerifyTransformationAggregatedAmountList \ VerifyIncludedTransformationAggregatedAmountList \ IncludeTransformation \ Tic \ VerifySpecialisedTransformationAggregatedAmountList \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_01_ERP5BankingCashToCurrencySale(self, quiet=QUIET, run=RUN_ALL_TEST): if not run: return sequence_list = SequenceList() sequence_list.addSequenceString(""" stepTic stepCheckObjects stepTic stepCheckInitialInventoryGuichet stepCreateCashToCurrencySale stepCreateValidIncomingLine stepCheckSubTotal stepCreateValidOutgoingLine stepTic stepCheckTotal stepResetSourceInventory stepTic stepDeliverCashToCurrencySaleFails stepTic stepDeleteResetInventory stepTic stepDeliverCashToCurrencySale stepTic stepCheckFinalInventoryGuichet_Entrante stepCheckFinalInventoryGuichet_Sortante """) sequence_list.play(self)
def test_02_AdoptingPrevision(self, quiet=quiet): sequence_list = SequenceList() sequence = sequence_list.addSequenceString(self.DEFAULT_SEQUENCE + \ """ stepUpdatePackingList stepTic stepAcceptDecisionPackingListQuantity stepTic stepCheckInvoiceIsDivergent stepCheckInvoiceIsDiverged stepAdoptPrevisionInvoiceQuantity stepTic """ ) sequence_list.play(self, quiet=quiet) document = sequence.get('invoice') self.assertEquals('solved', document.getCausalityState()) line_list = document.objectValues( portal_type=self.portal.getPortalInvoiceMovementTypeList()) self.assertEquals(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)) line_line = line.objectValues()[0] self.assertEquals('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())
def test_01_ERP5BankingUsualCashRendering(self, quiet=QUIET, run=RUN_ALL_TEST): """ Define the sequence of step that will be play """ if not run: return sequence_list = SequenceList() # define the sequence sequence_string = 'Tic CheckObjects Tic CheckInitialInventory CheckSource CheckDestination ' \ + 'CreateUsualCashRendering ' \ + 'CreateValidLine1 CheckSubTotal ' \ + 'CreateValidLine2 CheckTotal ' \ + 'CheckSource CheckDestination ' \ + 'CreateInvalidLine ' \ + 'TryPlanUsualCashRenderingWithBadInventory ' \ + 'DelInvalidLine Tic CheckTotal ' \ + 'PlanUsualCashRendering ' \ + 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \ + 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \ + 'OrderUsualCashRendering ' \ + 'ResetSourceInventory Tic ' \ + 'DeliverUsualCashRenderingFails Tic ' \ + 'DeleteResetInventory Tic ' \ + 'DeliverUsualCashRendering ' \ + 'CheckSourceDebit CheckDestinationCredit ' sequence_list.addSequenceString(sequence_string) # play the sequence sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_twoActivePurchasePackingList(self): """ Check that getSoftwareReleaseList only returns 1 software release if it is associated to 2 purchase packing list. """ sequence_list = SequenceList() sequence_string = \ self.prepare_software_release_purchase_packing_list + '\ LoginDefaultUser \ Tic \ CreatePurchasePackingList \ Tic \ CreatePurchasePackingListLine \ Tic \ SetPurchasePackingListLineSetupResource \ SetPurchasePackingListLineAggregate \ ConfirmPurchasePackingList \ Tic \ Logout \ SlapLoginCurrentComputer \ CheckSuccessComputerGetSoftwareReleaseListCall \ SlapLogout \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_05_checkBackupWithTrashSubObjects(self, quiet=quiet, run=run_all_test): """ Test we can backup a tree like this : base_category/trash_folder/category """ if not run: return if not quiet: message = 'Test Check Backup With Trash Sub Object' ZopeTestCase._print('\n%s ' % message) LOG('Testing... ', 0, message) sequence_list = SequenceList() sequence_string = '\ CheckTrashToolExists \ CreateTrashBin \ AddBaseCategory \ AddCategories \ AddSubCategories \ Tic \ BackupObjectsWithSave \ Tic \ CheckObjectBackupWithoutSubObjects \ BackupSubCategories \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_AcceptQuantityDivergenceOnInvoiceWithStoppedPackingList(self, quiet=quiet, run=RUN_ALL_TESTS): """Accept divergence with stopped packing list""" if not run: return sequence_list = SequenceList() sequence = sequence_list.addSequenceString( self.PACKING_LIST_DEFAULT_SEQUENCE + """ stepTic stepSetReadyPackingList stepTic stepStartPackingList stepStopPackingList stepTic stepInvoiceBuilderAlarm stepTic stepChangeQuantityDoubledOnInvoice stepTic stepCheckDivergedQuantityOnInvoice stepAcceptDecisionOnInvoice stepTic stepCheckDivergenceOnInvoice stepCheckSolvedOnPackingList """) sequence_list.play(self, quiet=quiet) packing_list = sequence.get('packing_list') self.assertEquals([], packing_list.getDivergenceList()) self.assertEquals('solved', packing_list.getCausalityState())
def test_01_ERP5BankingDestructionSurvey(self, quiet=QUIET, run=RUN_ALL_TEST): """ Define the sequence of step that will be play """ if not run: return sequence_list = SequenceList() # define the sequence sequence_string = 'Tic CheckObjects Tic CheckSourceInitial CheckDestinationInitial ' \ + 'CreateDestructionSurvey ' \ + 'CreateValidLine1 CheckSubTotal ' \ + 'CreateValidLine2 CheckTotal ' \ + 'CheckSourceInitial CheckDestinationInitial ' \ + 'CreateInvalidLine ' \ + 'TryConfirmDestructionSurveyWithBadInventory ' \ + 'DelInvalidLine Tic CheckTotal ' \ + 'ConfirmDestructionSurvey ' \ + 'ResetSourceInventory Tic ' \ + 'DeliverDestructionSurveyFails Tic ' \ + 'DeleteResetInventory Tic ' \ + 'DeliverDestructionSurvey ' \ + 'CheckSourceFinal CheckDestinationFinal ' sequence_list.addSequenceString(sequence_string) # play the sequence sequence_list.play(self)
def test_01_TwoInvoicesFromTwoPackingList(self, quiet=quiet, run=RUN_ALL_TESTS): """ This test was created for the following bug: - an order is created and confirmed - the packing list is split - the 2 packing list are delivered (at different date) - 2 invoices are built, then we set the same date on both of them - the accounting rules are generated and put in only one invoice !!, so we have an invoice with twice the number of accounting rules and an invoice with no accounting rules. both invoices are wrong """ if not run: return if not quiet: self.logMessage('Two Invoices from Two Packing List') sequence_list = SequenceList() sequence_list.addSequenceString( self.TWO_PACKING_LIST_DEFAULT_SEQUENCE + """ stepSetReadyPackingList stepSetReadyNewPackingList stepTic stepStartPackingList stepStartNewPackingList stepTic stepInvoiceBuilderAlarm stepTic stepCheckTwoInvoices stepRemoveDateMovementGroupForAdvancedTransactionBuilder stepStartTwoInvoices stepTic stepCheckInvoicesAndTransactionsConsistency """) sequence_list.play(self, quiet=quiet)
def test_workflow_chain_constraint(self): """ Check if Workflow chains is broken, it can be detected and fixed after upgrade""" sequence_list = SequenceList() sequence_string = """ stepActiveSensePreUpgradeAlarm stepTic stepRunUpgrader stepTic stepCheckUpgradeNotRequired stepTic stepSetConstraintInTemplateToolPortalType stepActiveSensePostUpgradeAlarm stepTic stepCheckPostUpgradeEmptyConstraintList stepSetDefaultWorkflowChainToPreference stepActiveSensePostUpgradeAlarm stepTic stepCheckPosUpgradeWorkflowChainConsistency stepRunPostUpgrade stepTic stepActiveSensePostUpgradeAlarm stepTic stepCheckPostUpgradeEmptyConstraintList """ sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_10_ManuallyAddedMovements(self, quiet=quiet, run=RUN_ALL_TESTS): """ Checks that adding invoice lines and accounting lines to one invoice generates correct simulation """ if not run: return if not quiet: self.logMessage('Invoice with Manually Added Movements') sequence_list = SequenceList() sequence_list.addSequenceString( self.PACKING_LIST_DEFAULT_SEQUENCE + """ stepSetReadyPackingList stepTic stepStartPackingList stepCheckInvoicingRule stepTic stepInvoiceBuilderAlarm stepTic stepCheckInvoiceBuilding stepRebuildAndCheckNothingIsCreated stepCheckInvoicesConsistency stepStartInvoice stepTic stepAddInvoiceTransactionLines stepTic stepCheckSimulationTrees """) sequence_list.play(self, quiet=quiet)
def test_add_pre_upgrade_constraint(self): """ Check that is possible fix consistency before the upgrade""" sequence_list = SequenceList() sequence_string = """ stepCreatePerson stepTic stepCreateScriptCheckPreUpgradeReferenceConsistency stepCreatePersonPropertySheet stepSetConstraintInPersonPortalType stepTic stepActiveSensePreUpgradeAlarm stepTic stepCheckPersonPreUpgradeConstraintList stepRemoveConstraintFromPersonPortalType stepActiveSensePreUpgradeAlarm stepTic stepCheckPreUpgradeEmptyConstraintList stepSetConstraintInPersonPortalType stepRunPreUpgrade stepTic stepCheckPersonPreUpgradeConstraintListAfterUpgrade stepActiveSensePreUpgradeAlarm stepTic stepCheckPreUpgradeEmptyConstraintList """ sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_bug_archived_software_release_access(self): """Checks that Computer has access to archived Software Release""" sequence_string = ( self.prepare_start_requested_computer_partition_sequence_string + """ LoginTestVifibDeveloper ArchiveSoftwareRelease Tic Logout SlapLoginCurrentComputer SoftwareInstanceStarted Tic SlapLogout LoginDefaultUser CheckComputerPartitionInstanceHostingSalePackingListStarted Logout LoginERP5TypeTestCase CheckSiteConsistency Logout """ ) sequence_list = SequenceList() sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_upgrade_in_one_transaction(self): """Check that all constraints with contraint_type equal upgrade run in the same transaction""" sequence_list = SequenceList() sequence_string = """ stepCreatePropertySheetToValidateOrganisation stepUninstallERP5Web stepInstallERP5UpgraderTestBT stepTic stepActiveSensePromiseCheckUpgrade stepTic stepRunPreUpgrade stepTic stepSetConstraintInOrganisationPortalType stepCreateSmallIncosistentData stepTic stepActiveSenseUpgradeAlarm stepTic stepRunUpgrader stepCheckNoActivitiesCreated stepCreateBigIncosistentData stepTic stepActiveSenseUpgradeAlarm stepTic stepRunUpgrader stepCheckActivitiesCreated stepRemoveConstraintFromOrganisationPortalType """ sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_hosting_subscription_security_on_partition_with_destroyed(self): """Checks that history of Computer Partition does not impacts its security configuration""" sequence_list = SequenceList() sequence_string = ( self.prepare_destroyed_computer_partition + """ LoginDefaultUser CheckComputerPartitionInstanceSetupSalePackingListDelivered CheckComputerPartitionInstanceHostingSalePackingListDelivered CheckComputerPartitionInstanceCleanupSalePackingListDelivered # Marked busy in order to simulate previous wrong behaviour MarkBusyComputerPartition Tic UpdateLocalRolesOnComputerPartition Tic # All related packing lists are delivered, so no local roles for # Hosting Subscription shall be defined CheckNoHostingSubscriptionComputerPartitionLocalRoles Logout LoginERP5TypeTestCase CheckSiteConsistency Logout """ ) sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_03_solverProcessCreatedOnlyOnce(self, quiet=quiet, run=run_all_test): """ Solver Process used to be created after selecting 'Solve Divergences' Action: 1. Select 'Solve Divergences' Action. 2. Dialog is displayed and new 'draft' 'Solver Process' is created if it does not exist yet. 3. Adopt Prevision/Accept Decision is selected: this creates a 'solve' Activity after changing Solver Process workflow state to 'solving' Until 'solve' Activity is processed: => 2. meant that there was no more 'Solver Process' in 'draft' state and thus a new one may be created. => The 'Solve Divergences' Action was still available. Now Solver Process is created when causality_state changed to diverged and 'Solve Divergences' Action is not displayed unless its state is 'draft'. """ if not run: return sequence_list = SequenceList() # Test with a simply order without cell sequence_string = self.default_sequence + '\ stepIncreasePackingListLineQuantity1000 \ stepCheckPackingListIsCalculating \ stepTic \ stepCheckPackingListIsDiverged \ stepSolveDivergenceThroughDialog \ stepCheckOnlyOneSolverProcessCreated \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_05_checkBackupWithTrashSubObjects(self, quiet=quiet, run=run_all_test): """ Test we can backup a tree like this : base_category/trash_folder/category """ if not run: return if not quiet: message = 'Test Check Backup With Trash Sub Object' ZopeTestCase._print('\n%s ' % message) LOG('Testing... ', 0, message) sequence_list = SequenceList() sequence_string = '\ CheckTrashToolExists \ CreateTrashBin \ CheckTrashBinIndexable \ AddBaseCategory \ AddCategories \ AddSubCategories \ Tic \ BackupObjectsWithSave \ Tic \ CheckObjectBackupWithoutSubObjects \ BackupSubCategories \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)
def test_usageReportWithSinglePartition(self): """ Checks if useComputer method of SlapTool is properly called one time. """ self.computer_partition_amount = 1 self.purchase_packing_list_quantity = 1 self.sale_invoice_list_quantity = 1 self.sale_invoice_line_list_quantity = 2 self.sale_invoice_line_quantity = 42.42 sequence_list = SequenceList() sequence_string = \ self.prepare_configured_instance + \ self.prepare_reported_usage_call + """ \ LoginERP5TypeTestCase \ BuildSalePackingList \ Tic \ CheckCreatedSalePackingList \ CheckCompleteSalePackingList \ CheckSaleInvoiceExists \ CheckSaleInvoiceQuantitySinglePartition \ ClearModules \ Logout LoginERP5TypeTestCase CheckSiteConsistency Logout """ sequence_list.addSequenceString(sequence_string) sequence_list.play(self)
def test_01_ReturnedSalePackingListWithInventory(self, quiet=quiet, run=run_all_test): """ Test that returned sale packing list with its inventory """ if not run: return sequence_list = SequenceList() sequence_string = self.default_sequence + '\ stepTic \ stepCreateInitialInventory \ stepTic \ stepCheckInitialInventory \ stepCreateReturnedPackingList \ stepConfirmReturnedPackingList \ stepShipReturnedPackingList \ stepReceiveReturnedPackingList \ stepDeliverReturnedPackingList \ stepTic \ stepCheckReturnedInventory \ ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet)