testStandardConfigurationWorkflow.py 69.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
##############################################################################
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
#                     Rafael Monnerat <rafael@nexedi.com>
#                     Ivan Tyagov <ivan@nexedi.com>
#                     Lucas Carvalho <lucas@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
##############################################################################


31
import os
Lucas Carvalho's avatar
Lucas Carvalho committed
32
import transaction
33 34 35
from DateTime import DateTime
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
36
from Products.ERP5Type.tests.utils import FileUpload
Lucas Carvalho's avatar
Lucas Carvalho committed
37 38
from Products.ERP5Configurator.tests.ConfiguratorTestMixin import \
                                             TestLiveConfiguratorWorkflowMixin
39 40
from AccessControl import Unauthorized

41
class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
42
  """
43 44
    Mixin for shared methods between Consulting and Standard Configurator
    Workflow.
45
  """
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
  AFTER_CONFIGURATION_SEQUENCE = '''
      stepCheckValidAccountList
      stepCheckAccountReference
      stepCheckValidPersonList
      stepCheckPersonInformationList
      stepCheckValidOrganisationList
      stepCheckValidCurrencyList
      stepCheckPublicGadgetList
      stepCheckPreferenceList
      stepCheckModulesBusinessApplication
      stepCheckBaseCategoryList
      stepCheckOrganisationSite
      stepCheckAccountingPeriod
      stepCheckRuleValidation
      stepCheckBusinessProcess
      stepCheckSolver
      stepCheckSaleTradeCondition
      stepCheckPurchaseTradeCondition
      stepCheckSaleOrderSimulation
      '''
66

67
  SECURITY_CONFIGURATION_SEQUENCE = """
68
      stepTic
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
      stepViewAddGadget
      stepViewEventModule
      stepAddEvent
      stepSentEventWorkflow
      stepViewAccountModule
      stepAddAccountModule
      stepViewAccount
      stepCopyPasteAccount
      stepViewEntityModules
      stepAddEntityModules
      stepCopyAndPastePerson
      stepCopyAndPasteOrganisation
      stepEntityWorkflow
      stepViewCreatedPersons
      stepViewCreatedOrganisations
      stepViewCreatedAssignemnts
      stepAddAccoutingPeriod
      stepValidatedAccountingPeriods
      stepViewBankAccount
      stepViewCreditCard
      stepValidateAndModifyBankAccount
      stepValidateAndModifyCreditCard
      stepAddPaymentNodeInPerson
      stepAddPaymentNodeInOrganisation
      stepCopyAndPasteBankAccountInPerson
      stepCopyAndPasteBankAccountInOrganisation
      stepViewAccountingTransactionModule
      stepAddAccountingTransactionModule
      stepCopyAndPasteAccountingTransactions
98
      stepTic
99
      stepAccountingTransaction
100
      stepTic
101
      stepSaleInvoiceTransaction
102
      stepTic
103
      stepPurchaseInvoiceTransaction
104
      stepTic
105
      stepPaymentTransaction
106
      stepTic
107
      stepBalanceTransaction
108
      stepTic
109 110 111 112 113 114 115 116 117 118 119 120 121
      stepAccountingTransaction_getCausalityGroupedAccountingTransactionList
      stepAddAssignments
      stepAssignmentTI
      stepEditAssignments
      stepViewAcessAddPurchaseTradeCondition
      stepViewAccessAddSaleTradeCondition
      stepViewAccessAddSaleOrder
      stepViewAccessAddSalePackingList
      stepViewAccessPurchaseOrder
      stepPurchasePackingList
      stepWebSiteModule
      stepPortalContributionsTool
      stepConfiguredPropertySheets
122
      """
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
  def stepSetFranceCase(self, sequence=None, sequence_list=None, **kw):
    """ Check if configuration key was created fine """
    sequence.edit(configuration_currency_reference='EUR',
                  configuration_gap = 'gap/fr/pcg',
                  configuration_accounting_plan='fr',
                  configuration_currency_title = 'Euro',
                  configuration_lang = 'erp5_l10n_fr',
                  configuration_price_currency = 'EUR;0.01;Euro',
                  organisation_default_address_city='LILLE',
                  organisation_default_address_region='europe/western_europe/france')

  def stepSetBrazilCase(self, sequence=None, sequence_list=None, **kw):
    """ Check if configuration key was created fine """
    sequence.edit(configuration_currency_reference='BRL',
                  configuration_gap = 'gap/br/pcg',
                  configuration_accounting_plan='br',
                  configuration_lang = 'erp5_l10n_pt-BR',
                  configuration_currency_title = 'Brazilian Real',
                  configuration_price_currency = 'BRL;0.01;Brazilian Real',
                  organisation_default_address_city='CAMPOS',
                  organisation_default_address_region='americas/south_america/brazil')

  def stepSetRussiaCase(self, sequence=None, sequence_list=None, **kw):
    """ Check if configuration key was created fine """
147

148 149 150 151 152 153 154 155
    sequence.edit(configuration_currency_reference='BYR',
                  configuration_gap = 'gap/ru/ru2000',
                  configuration_accounting_plan='ru',
                  configuration_price_currency = 'BYR;0.01;Belarusian Rouble',
                  configuration_lang = 'erp5_l10n_ru',
                  configuration_currency_title = 'Belarusian Rouble',
                  organisation_default_address_city='MOSCOW',
                  organisation_default_address_region='europe/eastern_europe/russian_federation')
156 157


158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
  def getBusinessConfigurationObjectList(self, business_configuration,
                                               portal_type):
    """
      It returns a list of object filtered by portal_type.
      This list should be created based on the paths into specialise value
      of the business configuration.
    """
    object_list = []
    bt5_obj = business_configuration.getSpecialiseValue()
    for path in bt5_obj.getTemplatePathList():
      obj = self.portal.restrictedTraverse(path, None)
      if obj is not None and hasattr(obj, 'getPortalType'):
        if obj.getPortalType() == portal_type:
          object_list.append(obj)
    return object_list
173

174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
  def stepCheckValidPersonList(self, sequence=None, sequence_list=None, **kw):
    """
      Check if after the configuration the Person objects are validated.
      The Assignments must be opened and valid.
    """
    business_configuration = sequence.get("business_configuration")
    person_list = self.getBusinessConfigurationObjectList(business_configuration, 'Person')
    self.assertNotEquals(len(person_list), 0)
    for person in person_list:
      self.assertEquals('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.assertNotEquals(None, assignment.getStartDate())
        self.assertNotEquals(None, assignment.getStopDate())
        self.assertEquals(assignment.getGroup(), "my_group")
        assignment.Base_checkConsistency()
193

194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
  def stepCheckPersonInformationList(self, sequence=None, sequence_list=None, **kw):
    """
      Check created person informations.
    """
    business_configuration = sequence.get("business_configuration")
    person_list = self.getBusinessConfigurationObjectList(business_configuration, 'Person')
    self.assertEquals(len(person_list), len(self.user_list))
    for person in person_list:
      user_info = None
      for user_dict in self.user_list:
        if user_dict["field_your_reference"] == person.getReference():
          user_info = user_dict
          break

      self.assertNotEquals(user_info, None)
      self.assertEquals(user_info["field_your_first_name"],
                        person.getFirstName())
      self.assertEquals(user_info["field_your_last_name"],
                        person.getLastName())
      self.assertNotEquals(person.getPassword(), None)
      self.assertEquals(user_info["field_your_function"],
                        person.getFunction())
      self.assertEquals(user_info["field_your_default_email_text"],
                        person.getDefaultEmailText())
      self.assertEquals(user_info["field_your_default_telephone_text"],
                        person.getDefaultTelephoneText())
220

221 222 223
      assignment_list = person.contentValues(portal_type='Assignment')
      self.assertEquals(len(assignment_list), 1)
      self.assertEquals('my_group', assignment_list[0].getGroup())
224

225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
  def stepCheckValidOrganisationList(self, sequence=None, sequence_list=None, **kw):
    """
      Check if after the configuration the Organisation objects are validated.
    """
    business_configuration = sequence.get("business_configuration")
    organisation_list = self.getBusinessConfigurationObjectList(business_configuration, 'Organisation')
    self.assertNotEquals(len(organisation_list), 0)
    organisation = organisation_list[0]
    self.assertEquals('validated', organisation.getValidationState())
    organisation.Base_checkConsistency()

  def stepCheckBaseCategoryList(self, sequence=None, sequence_list=None, **kw):
    """
       Tests that common base categories are not overwritten by configurator
       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())
    # ... this is enough to proove it has not been erased by an empty one

  def stepCheckOrganisationSite(self, sequence=None, sequence_list=None, **kw):
    """
      Check if organisation is on the main site (for stock browser)
    """
    business_configuration = sequence.get('business_configuration')
    organisation_list = self.getBusinessConfigurationObjectList(business_configuration, 'Organisation')
    self.assertNotEquals(len(organisation_list), 0)

    self.assertEquals(self.portal.portal_categories.site.main,
                      organisation_list[0].getSiteValue())
257

258 259 260 261 262 263

  def stepSetConfiguratorWorkflow(self, sequence=None, sequence_list=None, **kw):
    """ Set Consulting Workflow into Business Configuration """
    business_configuration = sequence.get("business_configuration")
    self.setBusinessConfigurationWorkflow(business_configuration,
                                   self.CONFIGURATION_WORKFLOW)
264 265 266 267 268 269

  def stepCreateBusinessConfiguration(self,  sequence=None, sequence_list=None, **kw):
    """ Create one Business Configuration """
    module = self.portal.business_configuration_module
    business_configuration = module.newContent(
                               portal_type="Business Configuration",
270
                               title=self.getTitle())
271
    next_dict = {}
272
    sequence.edit(business_configuration=business_configuration, 
273 274
                  next_dict=next_dict)

275 276 277 278
  def stepCheckValidCurrencyList(self, sequence=None, sequence_list=None, **kw):
    """
      Check if after configuration the Currency objects are validated.
    """
279
    business_configuration = sequence.get("business_configuration")
280 281 282 283 284 285 286
    currency_list = self.getBusinessConfigurationObjectList(business_configuration, 'Currency')
    self.assertNotEquals(len(currency_list), 0)
    for currency in currency_list:
      # XXX FIXME: should the currency be validated by After Configuration Script?
      # On tiolive it is not validated, is there any reason?
      # self.assertEquals('validated', currency.getValidationState())
      currency.Base_checkConsistency()
287

288 289 290 291
  def stepCheckPublicGadgetList(self, sequence=None, sequence_list=None, **kw):
    """
     Assert all gadgets are publics.
    """
292
    business_configuration = sequence.get("business_configuration")
293 294 295 296 297 298
    gadget_list = self.getBusinessConfigurationObjectList(business_configuration, 'Gadget')
    for gadget in gadget_list:
      self.assertEquals('public', gadget.getValidationState(),
                        "%s is not public but %s" % (gadget.getRelativeUrl(),
                                                     gadget.getValidationState()))
      gadget.Base_checkConsistency()
299

300 301 302 303 304 305 306 307 308
  def stepCheckPreferenceList(self, sequence=None, sequence_list=None, **kw):
    """
      Assert all the Peference properties.
    """
    preference_tool = self.portal.portal_preferences
    business_configuration = sequence.get("business_configuration")
    bt5_object = business_configuration.getSpecialiseValue()
    preference_list = bt5_object.getTemplatePreferenceList()
    self.assertEquals(len(preference_list), 2)
309

310 311 312
    for preference in preference_list:
      self.assertEquals(preference_tool[preference].getPreferenceState(),
                        'global')
313

314 315 316 317
    organisation_list = self.getBusinessConfigurationObjectList(business_configuration,
                                                                'Organisation')
    self.assertNotEquals(len(organisation_list), 0)
    organisation_id = organisation_list[0].getId()
318

319 320 321 322 323 324 325 326
    # ui
    # The default preferences are not disabled anymore, there is no reason to
    # assert such properties.
    #self.assertEquals('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())
327

328 329 330 331 332
    currency_reference = sequence.get('configuration_currency_reference')
    self.assertEquals('currency_module/%s' % currency_reference,
                     preference_tool.getPreferredAccountingTransactionCurrency())
    self.assertEquals(sequence.get('configuration_gap') ,
                      preference_tool.getPreferredAccountingTransactionGap())
333 334


335 336 337
    # on Business Configuration
    #self.assertEquals('localhost', preference_tool.getPreferredOoodocServerAddress())
    #self.assertEquals(8011, preference_tool.getPreferredOoodocServerPortNumber())
338

339 340 341 342 343 344 345 346 347 348 349
    # accounting
    self.assertEquals('group/my_group',
                  preference_tool.getPreferredAccountingTransactionSectionCategory())
    self.assertEquals('organisation_module/%s' % organisation_id,
                      preference_tool.getPreferredAccountingTransactionSourceSection())
    self.assertEquals(preference_tool.getPreferredSectionCategory(),
                      'group/my_group')
    self.assertEquals('organisation_module/%s' % organisation_id,
                      preference_tool.getPreferredSection())
    self.assertSameSet(['delivered', 'stopped'],
                  preference_tool.getPreferredAccountingTransactionSimulationStateList())
350

351 352 353 354 355 356
    # trade
    self.assertEquals(['supplier'], preference_tool.getPreferredSupplierRoleList())
    self.assertEquals(['client'], preference_tool.getPreferredClientRoleList())
    self.assertEquals(['trade/sale'], preference_tool.getPreferredSaleUseList())
    self.assertEquals(['trade/purchase'], preference_tool.getPreferredPurchaseUseList())
    self.assertEquals(['trade/container'], preference_tool.getPreferredPackingUseList())
357

358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
  def stepCheckModulesBusinessApplication(self, sequence=None, sequence_list=None, **kw):
    """
      Test modules business application.
    """
    ba = self.portal.portal_categories.business_application
    self.assertEquals('Base',
        self.portal.organisation_module.getBusinessApplicationTitle())
    self.assertEquals('Base',
        self.portal.person_module.getBusinessApplicationTitle())
    self.assertEquals('Base',
        self.portal.currency_module.getBusinessApplicationTitle())
    self.assertEquals(set([self.portal.organisation_module,
                       self.portal.person_module,
                       self.portal.currency_module,
                       ba.base]),
         set(ba.base.getBusinessApplicationRelatedValueList()))
374

375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
    self.assertEquals('CRM',
        self.portal.campaign_module.getBusinessApplicationTitle())
    self.assertEquals('CRM',
        self.portal.event_module.getBusinessApplicationTitle())
    self.assertEquals('CRM',
        self.portal.sale_opportunity_module.getBusinessApplicationTitle())
    self.assertEquals('CRM',
        self.portal.meeting_module.getBusinessApplicationTitle())
    self.assertEquals('CRM',
        self.portal.support_request_module.getBusinessApplicationTitle())
    self.assertEquals(set([self.portal.campaign_module,
                       self.portal.event_module,
                       self.portal.sale_opportunity_module,
                       self.portal.meeting_module,
                       self.portal.support_request_module,
                       ba.crm]),
         set(ba.crm.getBusinessApplicationRelatedValueList()))
392

393 394 395 396 397 398 399 400
    self.assertEquals('Accounting',
        self.portal.account_module.getBusinessApplicationTitle())
    self.assertEquals('Accounting',
        self.portal.accounting_module.getBusinessApplicationTitle())
    self.assertEquals(set([self.portal.account_module,
                       self.portal.accounting_module,
                       ba.accounting]),
         set(ba.accounting.getBusinessApplicationRelatedValueList()))
401

402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
    self.assertEquals('Trade',
        self.portal.sale_order_module.getBusinessApplicationTitle())
    self.assertEquals('Trade',
        self.portal.purchase_order_module.getBusinessApplicationTitle())
    self.assertEquals('Trade',
        self.portal.sale_trade_condition_module.getBusinessApplicationTitle())
    self.assertEquals('Trade',
        self.portal.purchase_trade_condition_module.getBusinessApplicationTitle())
    self.assertEquals('Trade',
        self.portal.sale_packing_list_module.getBusinessApplicationTitle())
    self.assertEquals('Trade',
        self.portal.purchase_packing_list_module.getBusinessApplicationTitle())
    self.assertEquals('Trade',
        self.portal.inventory_module.getBusinessApplicationTitle())
    self.assertEquals('Trade',
        self.portal.internal_packing_list_module.getBusinessApplicationTitle())
    self.assertEquals('Trade',
        self.portal.returned_sale_packing_list_module.getBusinessApplicationTitle())
    self.assertEquals(set([self.portal.sale_order_module,
                       self.portal.purchase_order_module,
                       self.portal.sale_trade_condition_module,
                       self.portal.purchase_trade_condition_module,
                       self.portal.sale_packing_list_module,
                       self.portal.purchase_packing_list_module,
                       self.portal.internal_packing_list_module,
                       self.portal.returned_sale_packing_list_module,
                       self.portal.inventory_module,
                       ba.trade]),
         set(ba.trade.getBusinessApplicationRelatedValueList()))
431

432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
    self.assertEquals('PDM',
        self.portal.service_module.getBusinessApplicationTitle())
    self.assertEquals('PDM',
        self.portal.product_module.getBusinessApplicationTitle())
    self.assertEquals('PDM',
        self.portal.component_module.getBusinessApplicationTitle())
    self.assertEquals('PDM',
        self.portal.transformation_module.getBusinessApplicationTitle())
    self.assertEquals('PDM',
        self.portal.sale_supply_module.getBusinessApplicationTitle())
    self.assertEquals('PDM',
        self.portal.purchase_supply_module.getBusinessApplicationTitle())
    self.assertEquals(set([self.portal.service_module,
                       self.portal.product_module,
                       self.portal.component_module,
                       self.portal.transformation_module,
                       self.portal.sale_supply_module,
                       self.portal.purchase_supply_module,
                       ba.pdm]),
         set(ba.pdm.getBusinessApplicationRelatedValueList()))
452

453 454 455 456 457 458 459 460 461 462 463 464 465 466
  def stepCheckValidAccountList(self, sequence=None, sequence_list=None, **kw):
    """
      Check is the Account documents are validated
    """
    business_configuration = sequence.get("business_configuration")
    account_list = self.getBusinessConfigurationObjectList(business_configuration, 'Account')
    self.assertNotEquals(len(account_list), 0)
    for account in account_list:
      self.assertEquals('validated', account.getValidationState())
      # all accounts have a financial section set correctly
      self.assertNotEquals(None, account.getFinancialSectionValue())
      # all accounts have a gap correctly
      self.assertNotEquals(None, account.getGapValue())
      account.Base_checkConsistency()
467

468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
  def stepCheckAccountReference(self, sequence=None, sequence_list=None, **kw):
    """
     Accounts are exported with the same ID that the one in the spreadsheet
    """
    # XXX FIXME (Lucas): this is not possible yet, because the Account does not have
    # the id set like that, we probably gonna use reference.
    return
    account_id_list = [
      'capital', 'profit_loss', 'equipments',
      'inventories', 'bank', 'receivable',
      'payable', 'refundable_vat', 'coll_vat',
      'purchase', 'sales']
    for account_id in account_id_list:
      account = self.portal.account_module._getOb(account_id)
      self.assertNotEquals(account, None,
                     "%s account is not Found." % account_id)
484

485 486 487 488 489 490 491
  def stepCheckSolver(self, sequence=None, sequence_list=None, **kw):
    """
      Check if Solver objects have been created.
    """
    # XXX FIXME Make sure we verify if the default set of solvers
    # are present on the portal.
    return
492

493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
  def stepCheckRuleValidation(self, sequence=None, sequence_list=None, **kw):
    """
      Check if rule are cloned and validated.
    """
    business_configuration = sequence.get('business_configuration')
    for rule_template_id in [
                          "new_order_root_simulation_rule",
                          "new_delivery_simulation_rule",
                          "new_trade_model_simulation_rule",
                          "new_accounting_transaction_root_simulation_rule",
                          "new_invoice_transaction_simulation_rule",
                          "new_payment_simulation_rule",
                          "new_invoice_root_simulation_rule",
                          "new_delivery_root_simulation_rule",
                          "new_invoice_simulation_rule"]:

      rule_template = getattr(self.portal.portal_rules, rule_template_id, None)
      self.assertNotEquals(rule_template, None)
      rule_list = self.portal.portal_rules.searchFolder(
                        reference=rule_template.getReference(),
                        title=rule_template.getTitle(),
                        validation_stade="validated")

      self.assertTrue(len(rule_list) > 0)
      self.assertEquals(int(rule_template.getVersion(0)) + 1,
                        int(rule_list[-1].getVersion(0)))

      result = self.getBusinessConfigurationObjectList(business_configuration,
                                                 rule_template.getPortalType())
      self.assertNotEquals(0, len(result))
      # one rule with same reference must exist.
      self.assertTrue(len([i for i in result \
                   if i.getReference() == rule_template.getReference()]) == 1)
526

527 528 529 530 531 532 533 534 535
  def stepCheckBusinessProcess(self, sequence=None, sequence_list=None, **kw):
    """
      Check if there is a Business Process on the site.
    """
    business_configuration = sequence.get('business_configuration')
    business_process_list = \
              self.getBusinessConfigurationObjectList(business_configuration,
                                                           'Business Process')
    self.assertEquals(len(business_process_list), 1)
536

537 538 539
    business_process = business_process_list[0]
    self.assertEquals("default_erp5_business_process",
                      business_process.getReference())
540

541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642
    self.assertEquals("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)

    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)

    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)

    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")

    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")

    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')

    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.assertEquals(deliver_link.getDeliveryBuilderList(),
           ["portal_deliveries/sale_packing_list_builder",
            "portal_deliveries/internal_packing_list_builder",
            "portal_deliveries/purchase_packing_list_builder"])

    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(),
                        ['confirmed','delivered','started','stopped'])
    self.assertEquals(invoice_link.getFrozenStateList(),['delivered','stopped'])
    self.assertEquals(invoice_link.getTradePhase(),'trade/invoicing')

    self.assertEquals(invoice_link.getDeliveryBuilderList(),
           ["portal_deliveries/purchase_invoice_builder",
            "portal_deliveries/purchase_invoice_transaction_trade_model_builder",
            "portal_deliveries/sale_invoice_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.assertSameSet(account_link.getDeliveryBuilderList(),
           ["portal_deliveries/purchase_invoice_transaction_builder",
            "portal_deliveries/sale_invoice_transaction_builder"])

    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.assertEquals(pay_link.getDeliveryBuilderList(),
           ["portal_deliveries/payment_transaction_builder"])
643

644 645 646 647 648 649 650 651
  def stepCheckAccountingPeriod(self, sequence=None, sequence_list=None, **kw):
    """
      The configurator prepared an accounting period for 2008, make
      sure it's openned and have correct parameters.
    """
    business_configuration = sequence.get('business_configuration')
    organisation_list = self.getBusinessConfigurationObjectList(business_configuration, 'Organisation')
    self.assertNotEquals(len(organisation_list), 0)
652

653 654 655 656 657 658 659 660
    organisation = organisation_list[0]
    period_list = organisation.contentValues(portal_type='Accounting Period')
    self.assertEquals(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())
Lucas Carvalho's avatar
Lucas Carvalho committed
661

662 663 664 665
    # security on this period has been initialised
    for username in self.accountant_username_list:
      self.failUnlessUserCanPassWorkflowTransition(
          username, 'cancel_action', period)
666

667 668 669 670 671 672 673 674 675 676
  def stepCheckSaleTradeCondition(self, sequence=None, sequence_list=None, **kw):
    """
      Check if Sale Trade Condition object has been created.
    """
    business_configuration = sequence.get('business_configuration')
    sale_trade_condition_list = \
                self.getBusinessConfigurationObjectList(business_configuration,
                                                        'Sale Trade Condition')
    self.assertEquals(len(sale_trade_condition_list), 1)
    sale_trade_condition = sale_trade_condition_list[0]
677

678 679 680
    self.assertEquals("General Sale Trade Condition",
                                              sale_trade_condition.getTitle())
    self.assertEquals("STC-General", sale_trade_condition.getReference())
681

682 683
    self.assertNotEquals(None, sale_trade_condition.getEffectiveDate())
    self.assertNotEquals(None, sale_trade_condition.getExpirationDate())
684

685 686 687 688 689
    # Check relation with Business Process
    business_process_list = \
              self.getBusinessConfigurationObjectList(business_configuration,
                                                           'Business Process')
    self.assertEquals(len(business_process_list), 1)
690

691 692 693
    business_process = business_process_list[0]
    self.assertEquals(business_process,
                      sale_trade_condition.getSpecialiseValue())
Lucas Carvalho's avatar
Lucas Carvalho committed
694

695 696 697 698 699
    # Check relation with Organisation
    organisation_list = \
                self.getBusinessConfigurationObjectList(business_configuration,
                                                                'Organisation')
    organisation = organisation_list[0]
700

701 702 703
    self.assertEquals(organisation, sale_trade_condition.getSourceValue())
    self.assertEquals(organisation,
                      sale_trade_condition.getSourceSectionValue())
704

705 706 707 708 709 710 711
    # Check relation with Currency
    currency_list = \
                self.getBusinessConfigurationObjectList(business_configuration,
                                                                    'Currency')
    currency = currency_list[0]
    self.assertEquals(currency.getRelativeUrl(),
                      sale_trade_condition.getPriceCurrency())
712

713
  def stepCheckPurchaseTradeCondition(self, sequence=None, sequence_list=None, **kw):
714
    """
715
      Check if Purchase Trade Condition object has been created.
716
    """
717 718 719 720 721 722
    business_configuration = sequence.get('business_configuration')
    purchase_trade_condition_list = \
                self.getBusinessConfigurationObjectList(business_configuration,
                                                        'Purchase Trade Condition')
    self.assertEquals(len(purchase_trade_condition_list), 1)
    purchase_trade_condition = purchase_trade_condition_list[0]
723

724 725 726
    self.assertEquals("General Purchase Trade Condition",
                                              purchase_trade_condition.getTitle())
    self.assertEquals("PTC-General", purchase_trade_condition.getReference())
727

728 729
    self.assertNotEquals(None, purchase_trade_condition.getEffectiveDate())
    self.assertNotEquals(None, purchase_trade_condition.getExpirationDate())
730

731 732 733 734 735
    # Check relation with Business Process
    business_process_list = \
              self.getBusinessConfigurationObjectList(business_configuration,
                                                           'Business Process')
    self.assertEquals(len(business_process_list), 1)
736

737 738 739 740 741 742 743 744
    business_process = business_process_list[0]
    self.assertEquals(business_process,
                      purchase_trade_condition.getSpecialiseValue())

    # Check relation with Organisation
    organisation_list = \
                self.getBusinessConfigurationObjectList(business_configuration,
                                                                'Organisation')
745 746
    organisation = organisation_list[0]

747 748 749 750
    self.assertEquals(organisation,
                      purchase_trade_condition.getDestinationValue())
    self.assertEquals(organisation,
                      purchase_trade_condition.getDestinationSectionValue())
751

752 753 754 755 756 757 758
    # Check relation with Currency
    currency_list = \
                self.getBusinessConfigurationObjectList(business_configuration,
                                                                    'Currency')
    currency = currency_list[0]
    self.assertEquals(currency.getRelativeUrl(),
                      purchase_trade_condition.getPriceCurrency())
759

760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786
  @expectedFailure
  def stepCheckQuantityConversion(self, sequence=None, sequence_list=None, **kw):
    resource = self.portal.product_module.newContent(
                      portal_type='Product',
                      quantity_unit_list=('mass/gram',
                                          'mass/kilogram'),)
    node = self.portal.organisation_module.newContent(
                      portal_type='Organisation')
    delivery = self.portal.purchase_packing_list_module.newContent(
                      portal_type='Purchase Packing List',
                      start_date='2010-01-26',
                      price_currency='currency_module/EUR',
                      destination_value=node,
                      destination_section_value=node)
    delivery.newContent(portal_type='Purchase Packing List Line',
                        resource_value=resource,
                        quantity=10,
                        quantity_unit='mass/gram')
    delivery.newContent(portal_type='Purchase Packing List Line',
                        resource_value=resource,
                        quantity=3,
                        quantity_unit='mass/kilogram')
    delivery.confirm()
    delivery.start()
    delivery.stop()
    transaction.commit()
    self.tic()
787

788 789 790 791 792
    # inventories of that resource are index in grams
    self.assertEquals(3010,
        self.portal.portal_simulation.getCurrentInventory(
          resource_uid=resource.getUid(),
          node_uid=node.getUid()))
793

794 795 796 797 798 799
    # converted inventory also works
    self.assertEquals(3.01,
        self.portal.portal_simulation.getCurrentInventory(
          quantity_unit='mass/kilogram',
          resource_uid=resource.getUid(),
          node_uid=node.getUid()))
Lucas Carvalho's avatar
Lucas Carvalho committed
800

801
  def stepConfiguredPropertySheets(self, sequence=None, sequence_list=None, **kw):
802
    """
803
      Configurator can configure some PropertySheets.
804
    """
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826
    portal = self.portal
    purchase_order = portal.portal_types['Purchase Order']
    purchase_order_line = portal.portal_types['Purchase Order Line']
    sale_order = portal.portal_types['Sale Order']
    sale_order_line = portal.portal_types['Sale Order Line']
    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,
                      'TradeOrder' in sale_packing_list.getTypePropertySheetList())
    self.assertEquals(True,
                      'TradeOrderLine' in sale_packing_list_line.getTypePropertySheetList())
    self.assertEquals(True,
                      'TradeOrder' in purchase_order.getTypePropertySheetList())
    self.assertEquals(True,
                      'TradeOrderLine' in purchase_order_line.getTypePropertySheetList())
    self.assertEquals(True,
                      'TradeOrder' in sale_order.getTypePropertySheetList())
    self.assertEquals(True,
                      'TradeOrderLine' in sale_order_line.getTypePropertySheetList())
    self.assertEquals(True,
                      'InventoryConstraint' in inventory.getTypePropertySheetList())
827 828


829
  def stepCheckSaleOrderSimulation(self, sequence=None, sequence_list=None, **kw):
830
    """
831 832
      After the configuration we need to make sure that Simulation for
      Sale Order is working as expected.
833
    """
834 835 836
    # stepCreateSaleOrders
    portal = self.getPortal()
    module = portal.sale_order_module
837
    business_configuration = sequence.get('business_configuration')
838 839 840 841 842 843 844 845
    sale_trade_condition = \
                self.getBusinessConfigurationObjectList(business_configuration,
                                                     'Sale Trade Condition')[0]
    # Check relation with Business Process
    business_process_list = \
              self.getBusinessConfigurationObjectList(business_configuration,
                                                           'Business Process')
    self.assertEquals(len(business_process_list), 1)
846

847 848 849 850 851 852 853 854 855 856 857 858 859 860
    business_process = business_process_list[0]
    destination_decision = portal.portal_catalog.getResultValue(
                                       portal_type='Person',
                                       reference=self.sales_manager_reference)
    destination_administration = portal.portal_catalog.getResultValue(
                                     portal_type='Person',
                                     reference=self.purchase_manager_reference)
    resource = portal.product_module.newContent(portal_type='Product',
                                quantity_unit='unit/piece',
                                individual_variation_base_category='variation',
                                base_contribution='base_amount/taxable')
    self.stepTic()
    resource.validate()
    self.stepTic()
861

862 863 864 865 866 867 868 869 870 871
    start_date = sale_trade_condition.getEffectiveDate() + 1
    stop_date = sale_trade_condition.getExpirationDate() - 1
    order = module.newContent(
       portal_type='Sale Order',
       specialise=(sale_trade_condition.getRelativeUrl(),),
       destination_decision=destination_decision.getRelativeUrl(),
       destination_administration=destination_administration.getRelativeUrl(),
       start_date=start_date,
       stop_date=stop_date)
    self.stepTic()
872

873 874 875
    # Set the rest through the trade condition.
    order.SaleOrder_applySaleTradeCondition()
    self.stepTic()
876

877 878 879 880
    order.newContent(portal_type='Sale Order Line',
                     resource=resource.getRelativeUrl(),
                     quantity=1.0)
    self.stepTic()
881

882 883 884 885 886
    # stepPlanSaleOrders
    self.assertEquals(order.getSimulationState(), 'draft')
    order.plan()
    self.stepTic()
    self.assertEquals(order.getSimulationState(), 'planned')
Lucas Carvalho's avatar
Lucas Carvalho committed
887

888 889 890 891
    # stepOrderSaleOrders
    order.order()
    self.stepTic()
    self.assertEquals(order.getSimulationState(), 'ordered')
Lucas Carvalho's avatar
Lucas Carvalho committed
892

893 894 895 896
    # stepConfirmSaleOrders
    order.confirm()
    self.stepTic()
    self.assertEquals(order.getSimulationState(), 'confirmed')
Lucas Carvalho's avatar
Lucas Carvalho committed
897

898 899 900 901 902 903 904 905 906
    # stepCheckSaleOrderSimulation
    causality_list = order.getCausalityRelatedValueList(portal_type='Applied Rule')
    self.assertEquals(len(causality_list), 1)
    applied_rule = causality_list[0]
    self.assertEquals(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)
Lucas Carvalho's avatar
Lucas Carvalho committed
907

908 909 910 911 912
    simulation_movement = applied_rule.objectValues()[0]
    self.assertEquals(simulation_movement.getPortalType(),
                                                      'Simulation Movement')
    self.assertEquals(simulation_movement.getQuantity(), 1.0)
    self.assertEquals(simulation_movement.getResourceValue(), resource)
Lucas Carvalho's avatar
Lucas Carvalho committed
913

914 915 916 917 918
    self.assertNotEquals(simulation_movement.getCausality(), None)
    self.assertEquals(simulation_movement.getDestinationDecisionValue(),
                                                       destination_decision)
    self.assertEquals(simulation_movement.getDestinationAdministrationValue(),
                                                 destination_administration)
Lucas Carvalho's avatar
Lucas Carvalho committed
919 920


921 922 923 924
class TestConsultingConfiguratorWorkflow(StandardConfigurationMixin):
  """
    Test Live Consulting Configuration Workflow
  """
925

926
  CONFIGURATION_WORKFLOW = 'workflow_module/erp5_consulting_workflow'
Lucas Carvalho's avatar
Lucas Carvalho committed
927

928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978
  DEFAULT_SEQUENCE_LIST = """
      stepSet%(country)sCase
      stepCreateBusinessConfiguration
      stepTic
      stepSetConfiguratorWorkflow
      stepTic
      stepConfiguratorNext
      stepTic
      stepCheckBT5ConfiguratorItem
      stepCheckConfigureCategoriesForm
      stepSetupCategoriesConfiguratorItem
      stepConfiguratorNext
      stepTic
      stepCheckConfigureRolesForm
      stepCheckCategoriesConfiguratorItem
      stepSetupRolesConfiguratorItem
      stepConfiguratorNext
      stepTic
      stepCheckConfigureOrganisationForm
      stepSetupOrganisationConfiguratorItem
      stepConfiguratorNext
      stepTic
      stepCheckConfigureUserAccountNumberForm
      stepCheckOrganisationConfiguratorItem
      stepSetupUserAccounNumberSix
      stepConfiguratorNext
      stepTic
      stepCheckConfigureMultipleUserAccountForm
      stepSetupMultipleUserAccountSix
      stepConfiguratorNext
      stepTic
      stepCheckConfigureAccountingForm
      stepCheckMultiplePersonConfigurationItem
      stepSetupAccountingConfiguration
      stepConfiguratorNext
      stepTic
      stepCheckConfigurePreferenceForm
      stepCheckAccountingConfigurationItemList%(country)s
      stepSetupPreferenceConfiguration
      stepConfiguratorNext
      stepTic
      stepCheckPreferenceConfigurationItemList
      stepCheckConfigureInstallationForm
      stepSetupInstallConfiguration
      stepConfiguratorNext
      stepTic
      stepCheckInstallConfiguration
      stepStartConfigurationInstallation
      stepTic
      stepCheckInstanceIsConfigured%(country)s
      """
Lucas Carvalho's avatar
Lucas Carvalho committed
979

980 981 982 983 984 985 986 987
  def uploadFile(self, file_id):
    file_obj = getattr(self.portal, file_id)
    file_path = '/tmp/%s' % file_id
    temp_file = open(file_path, 'w+b')
    try:
      temp_file.write(str(file_obj))
    finally:
      temp_file.close()
Lucas Carvalho's avatar
Lucas Carvalho committed
988

989
    return (file_path, FileUpload(file_path, file_id))
Lucas Carvalho's avatar
Lucas Carvalho committed
990

991 992 993 994 995
  def afterSetUp(self):
    TestLiveConfiguratorWorkflowMixin.afterSetUp(self)
    categories_file_id = 'standard_category.ods'
    self.categories_file_path, self.categories_file_upload = \
                                           self.uploadFile(categories_file_id)
Lucas Carvalho's avatar
Lucas Carvalho committed
996

997 998 999 1000 1001
    roles_file_id = 'standard_portal_types_roles.ods'
    self.roles_file_path, self.roles_file_upload = \
                                           self.uploadFile(roles_file_id)
    # set the company employees number
    self.company_employees_number = '3'
Lucas Carvalho's avatar
Lucas Carvalho committed
1002

1003 1004 1005 1006 1007
    newId = self.portal.portal_ids.generateNewId
    id_group ='testConfiguratorConsultingWorkflow'
    self.person_creator_reference = 'person_creator_%s' % newId(id_group)
    self.person_assignee_reference = 'person_assignee_%s' % newId(id_group)
    self.person_assignor_reference = 'person_assignor_%s' % newId(id_group)
Lucas Carvalho's avatar
Lucas Carvalho committed
1008

1009

1010 1011 1012
    self.accountant_username_list = (self.person_creator_reference,
                                     self.person_assignee_reference,
                                     self.person_assignor_reference)
Lucas Carvalho's avatar
Lucas Carvalho committed
1013

1014 1015 1016 1017 1018 1019
    self.sales_manager_reference = self.person_assignee_reference
    self.purchase_manager_reference = self.person_assignee_reference
    self.accounting_agent_reference = self.person_assignee_reference
    self.accounting_manager_reference = self.person_assignee_reference
    self.warehouse_agent_reference = self.person_assignee_reference
    self.simple_user_reference = self.person_assignee_reference
Lucas Carvalho's avatar
Lucas Carvalho committed
1020

1021 1022 1023 1024
    self.sales_and_purchase_username_list = (self.sales_manager_reference,
                                             self.purchase_manager_reference,)
    self.warehouse_username_list = (self.warehouse_agent_reference,)
    self.simple_username_list = (self.simple_user_reference,)
Lucas Carvalho's avatar
Lucas Carvalho committed
1025 1026


1027
    self.all_username_list = self.accountant_username_list
1028

1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059
    # set the user list
    self.user_list = [
      dict(
        field_your_first_name='Person',
        field_your_last_name='Creator',
        field_your_reference=self.person_creator_reference,
        field_your_password='person_creator',
        field_your_password_confirm='person_creator',
        field_your_function='hr/manager',
        field_your_default_email_text='person_creator@example.com',
        field_your_default_telephone_text='',
      ), dict(
        field_your_first_name='Person',
        field_your_last_name='Assignee',
        field_your_reference=self.person_assignee_reference,
        field_your_password='person_assignee',
        field_your_password_confirm='person_assignee',
        field_your_function='af/accounting/manager',
        field_your_default_email_text='person_assignee@example.com',
        field_your_default_telephone_text='',
      ), dict(
        field_your_first_name='Person',
        field_your_last_name='Assignor',
        field_your_reference=self.person_assignor_reference,
        field_your_password='person_assignor',
        field_your_password_confirm='person_assignor',
        field_your_function='sales/manager',
        field_your_default_email_text='person_assignor@example.com',
        field_your_default_telephone_text='',
      ),
    ]
1060

1061 1062
    # set preference group
    self.preference_group = 'group/my_group'
1063

1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366
  def beforeTearDown(self):
    os.remove(self.categories_file_path)
    os.remove(self.roles_file_path)

  def stepCheckConfigureCategoriesForm(self, sequence=None, sequence_list=None, **kw):
    """ 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.assertCurrentStep('Your Categories', response_dict)

  def stepSetupCategoriesConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
    """ Load the categories """
    next_dict = dict(field_your_configuration_spreadsheet=self.categories_file_upload)
    next_dict.update(**kw)
    sequence.edit(next_dict=next_dict)

  def stepCheckConfigureRolesForm(self, sequence=None, sequence_list=None, **kw):
    """ 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.assertCurrentStep('Your roles settings', response_dict)

  def stepCheckCategoriesConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
    """ Checki if categories was created """
    business_configuration = sequence.get("business_configuration")
    # this created a categories spreadsheet confiurator item
    categories_spreadsheet_configuration_save = business_configuration['3']
    categories_spreadsheet_configuration_item =\
          categories_spreadsheet_configuration_save['1']
    self.assertEquals('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())

  def stepSetupRolesConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
    """ Load the Roles """
    next_dict = dict(field_your_portal_type_roles_spreadsheet=self.roles_file_upload)
    next_dict.update(**kw)
    sequence.edit(next_dict=next_dict)

  def stepCheckConfigureOrganisationForm(self, sequence=None, sequence_list=None, **kw):
    """ Check if Confire Organisation step was showed """
    response_dict = sequence.get("response_dict")
    TestLiveConfiguratorWorkflowMixin.stepCheckConfigureOrganisationForm(
                         self, sequence, sequence_list, **kw)
    self.assertEquals('Previous', response_dict['previous'])

  def stepSetupOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
    """ Create one Organisation with French information """
    TestLiveConfiguratorWorkflowMixin.stepSetupOrganisationConfiguratorItem(
        self,
        sequence=sequence,
        sequence_list=sequence_list,
        field_your_group='my_group')

  def stepCheckOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
    """ Check if organisation was created fine """
    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()))
    # first item: configuration of our organisation
    organisation_config_item = organisation_config_save['1']
    self.assertEquals(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(),
                      'LILLE')
    self.assertEquals(organisation_config_item.getDefaultAddressRegion(),
                      'europe/western_europe/france')
    self.assertEquals(organisation_config_item.getDefaultEmailText(),
                      'me@example.com')
    self.assertEquals('01234567890',
        organisation_config_item.getDefaultTelephoneTelephoneNumber())

    configuration_save_list = business_configuration.contentValues(
                                             portal_type="Configuration Save")
    self.assertEquals(5, len(configuration_save_list))

    link_list = business_configuration.contentValues(portal_type="Link")
    self.assertEquals(0, len(link_list))

  def stepCheckMultiplePersonConfigurationItem(self, sequence=None, sequence_list=None, **kw):
    """
      Check if multiple Person Configuration Item of the Business
      Configuration have been created successfully.
    """
    person_business_configuration_save = TestLiveConfiguratorWorkflowMixin.\
              stepCheckMultiplePersonConfigurationItem(
                                  self, sequence, sequence_list, **kw)

    person_business_configuration_item =\
          person_business_configuration_save['1']
    self.assertEquals('Person Configurator Item',
            person_business_configuration_item.getPortalType())
    self.assertEquals('Person',
            person_business_configuration_item.getFirstName())
    self.assertEquals('Creator',
            person_business_configuration_item.getLastName())
    self.assertEquals(self.person_creator_reference,
            person_business_configuration_item.getReference())
    self.assertEquals('person_creator',
            person_business_configuration_item.getPassword())
    self.assertEquals('hr/manager',
            person_business_configuration_item.getFunction())

    person_business_configuration_item =\
          person_business_configuration_save['2']
    self.assertEquals('Person Configurator Item',
            person_business_configuration_item.getPortalType())
    self.assertEquals('Person',
            person_business_configuration_item.getFirstName())
    self.assertEquals('Assignee',
            person_business_configuration_item.getLastName())
    self.assertEquals(self.person_assignee_reference,
            person_business_configuration_item.getReference())
    self.assertEquals('person_assignee',
            person_business_configuration_item.getPassword())
    self.assertEquals('af/accounting/manager',
            person_business_configuration_item.getFunction())

    person_business_configuration_item =\
          person_business_configuration_save['3']
    self.assertEquals('Person Configurator Item',
            person_business_configuration_item.getPortalType())
    self.assertEquals('Person',
            person_business_configuration_item.getFirstName())
    self.assertEquals('Assignor',
            person_business_configuration_item.getLastName())
    self.assertEquals(self.person_assignor_reference,
            person_business_configuration_item.getReference())
    self.assertEquals('person_assignor',
            person_business_configuration_item.getPassword())
    self.assertEquals('sales/manager',
            person_business_configuration_item.getFunction())

  def test_consulting_workflow(self):
    """ Test the consulting workflow configuration"""
    sequence_list = SequenceList()
    sequence_string = \
      self.DEFAULT_SEQUENCE_LIST % dict(country='France') + \
      self.AFTER_CONFIGURATION_SEQUENCE + \
      self.SECURITY_CONFIGURATION_SEQUENCE

    sequence_list.addSequenceString(sequence_string)
    sequence_list.play(self)

class TestStandardConfiguratorWorkflow(StandardConfigurationMixin):
  """
    Test Live Standard Configuration Workflow.
  """
  CONFIGURATION_WORKFLOW = 'workflow_module/erp5_standard_workflow'

  DEFAULT_SEQUENCE_LIST = """
      stepSet%(country)sCase
      stepCreateBusinessConfiguration
      stepTic
      stepSetConfiguratorWorkflow
      stepTic
      stepConfiguratorNext
      stepTic
      stepCheckBT5ConfiguratorItem
      stepCheckConfigureOrganisationForm
      stepSetupOrganisationConfiguratorItem
      stepConfiguratorNext
      stepTic
      stepCheckConfigureUserAccountNumberForm
      stepCheckOrganisationConfiguratorItem
      stepSetupUserAccounNumberSix
      stepConfiguratorNext
      stepTic
      stepCheckConfigureMultipleUserAccountForm
      stepSetupMultipleUserAccountSix
      stepConfiguratorNext
      stepTic
      stepCheckConfigureAccountingForm
      stepCheckMultiplePersonConfigurationItem
      stepSetupAccountingConfiguration
      stepConfiguratorNext
      stepTic
      stepCheckConfigurePreferenceForm
      stepCheckAccountingConfigurationItemList%(country)s
      stepSetupPreferenceConfiguration
      stepConfiguratorNext
      stepTic
      stepCheckConfigureInstallationForm
      stepCheckPreferenceConfigurationItemList
      stepSetupInstallConfiguration
      stepConfiguratorNext
      stepTic
      stepCheckInstallConfiguration
      stepStartConfigurationInstallation
      stepTic
      stepCheckInstanceIsConfigured%(country)s
      """ + \
      StandardConfigurationMixin.AFTER_CONFIGURATION_SEQUENCE + \
      StandardConfigurationMixin.SECURITY_CONFIGURATION_SEQUENCE

  def afterSetUp(self):
    TestLiveConfiguratorWorkflowMixin.afterSetUp(self)
    newId = self.portal.portal_ids.generateNewId
    id_group ='testConfiguratorStandardWorkflow'

    self.sales_manager_reference = 'sales_manager_%s' % newId(id_group)
    self.purchase_manager_reference = 'purchase_manager_%s' % newId(id_group)
    self.accounting_agent_reference = 'accounting_agent_%s' % newId(id_group)
    self.accounting_manager_reference = 'accounting_manager_%s' % newId(id_group)
    self.warehouse_agent_reference = 'warehouse_agent_%s' % newId(id_group)
    self.simple_user_reference = 'simple_user_%s' % newId(id_group)

    self.accountant_username_list = (self.accounting_agent_reference,
                                     self.accounting_manager_reference,)
    self.all_username_list = (self.sales_manager_reference,
                              self.purchase_manager_reference,
                              self.accounting_agent_reference,
                              self.accounting_manager_reference,
                              self.warehouse_agent_reference,
                              self.simple_user_reference,)
    self.sales_and_purchase_username_list = (self.sales_manager_reference,
                                             self.purchase_manager_reference,)
    self.warehouse_username_list = (self.warehouse_agent_reference,)
    self.simple_username_list = (self.simple_user_reference,)

    # set the company employees number
    self.company_employees_number = '6'

    # create our 6 users:
    self.user_list = [
      dict(
                # A sales manager
        field_your_first_name='Sales',
        field_your_last_name='Manager',
        field_your_reference=self.sales_manager_reference,
        field_your_password='sales_manager',
        field_your_password_confirm='sales_manager',
        field_your_function='sales/manager',
        field_your_default_email_text='sales_manager@example.com',
        field_your_default_telephone_text='',
      ), dict(
                # A purchase manager
        field_your_first_name='Purchase',
        field_your_last_name='Manager',
        field_your_reference=self.purchase_manager_reference,
        field_your_password='purchase_manager',
        field_your_password_confirm='purchase_manager',
        field_your_function='purchase/manager',
        field_your_default_email_text='purchase_manager@example.com',
        field_your_default_telephone_text='',
      ), dict(
                # An Accounting agent
        field_your_first_name='Accounting',
        field_your_last_name='Agent',
        field_your_reference=self.accounting_agent_reference,
        field_your_password='accounting_agent',
        field_your_password_confirm='accounting_agent',
        field_your_function='af/accounting/agent',
        field_your_default_email_text='accounting_agent@example.com',
        field_your_default_telephone_text='',
      ), dict(
                # An Accounting Manager
        field_your_first_name='Accounting',
        field_your_last_name='Manager',
        field_your_reference=self.accounting_manager_reference,
        field_your_password='accounting_manager',
        field_your_password_confirm='accounting_manager',
        field_your_function='af/accounting/manager',
        field_your_default_email_text='accounting_manager@example.com',
        field_your_default_telephone_text='',
      ), dict(
                # A Warehouse Agent
        field_your_first_name='Warehouse',
        field_your_last_name='Agent',
        field_your_reference=self.warehouse_agent_reference,
        field_your_password='warehouse_agent',
        field_your_password_confirm='warehouse_agent',
        field_your_function='warehouse/agent',
        field_your_default_email_text='warehouse_agent@example.com',
        field_your_default_telephone_text='',
      ), dict(
          # A Simple user without meaningfull function ( hr / manager)
        field_your_first_name='Simple',
        field_your_last_name='User',
        field_your_reference=self.simple_user_reference,
        field_your_password='simple_user',
        field_your_password_confirm='simple_user',
        field_your_function='hr/manager',
        field_your_default_email_text='simple_user@example.com',
        field_your_default_telephone_text='',
      ),
    ]
    # set preference group
    self.preference_group = 'group/my_group'
1367

1368 1369 1370 1371 1372 1373
  def stepCheckConfigureOrganisationForm(self, sequence=None, sequence_list=None, **kw):
    """ Check if Confire Organisation step was showed """
    response_dict = sequence.get("response_dict")
    TestLiveConfiguratorWorkflowMixin.stepCheckConfigureOrganisationForm(
                         self, sequence, sequence_list, **kw)
    self.assertEquals(None, response_dict['previous'])
Lucas Carvalho's avatar
Lucas Carvalho committed
1374

1375 1376
  def stepCheckOrganisationConfiguratorItem(self, sequence=None, sequence_list=None, **kw):
    """ Check if configuration key was created fine """
Lucas Carvalho's avatar
Lucas Carvalho committed
1377
    business_configuration = sequence.get('business_configuration')
1378 1379
    default_address_city = sequence.get('organisation_default_address_city')
    default_address_region = sequence.get('organisation_default_address_region')
Lucas Carvalho's avatar
Lucas Carvalho committed
1380

1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397
    # last one: a step for what the client selected
    organisation_config_save = business_configuration['5']
    self.assertEquals(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(),
                      'Organisation Configurator Item')
    # this organisation configurator items contains all properties that the
    # orgnanisation will have.
    self.assertEquals(organisation_config_item.getDefaultAddressCity(),
                      default_address_city)
    self.assertEquals(organisation_config_item.getDefaultAddressRegion(),
                      default_address_region)
    self.assertEquals(organisation_config_item.getDefaultEmailText(),
                      'me@example.com')
    self.assertEquals('01234567890',
        organisation_config_item.getDefaultTelephoneTelephoneNumber())
Lucas Carvalho's avatar
Lucas Carvalho committed
1398

1399 1400 1401 1402 1403 1404
    # we also create a category for our group
    category_config_item = organisation_config_save['2']
    self.assertEquals(category_config_item.getPortalType(),
                      'Category Configurator Item')
    self.assertEquals(category_config_item.getTitle(),
                      'My Organisation')
Lucas Carvalho's avatar
Lucas Carvalho committed
1405

1406 1407
    self.assertEquals(5, len(business_configuration.contentValues(portal_type="Configuration Save")))
    self.assertEquals(0, len(business_configuration.contentValues(portal_type="Link")))
Lucas Carvalho's avatar
Lucas Carvalho committed
1408

1409 1410 1411 1412 1413 1414 1415 1416
  def stepCheckMultiplePersonConfigurationItem(self, sequence=None, sequence_list=None, **kw):
    """
      Check if multiple Person Configuration Item of the Business
      Configuration have been created successfully.
    """
    person_business_configuration_save = TestLiveConfiguratorWorkflowMixin.\
              stepCheckMultiplePersonConfigurationItem(
                                  self, sequence, sequence_list, **kw)
Lucas Carvalho's avatar
Lucas Carvalho committed
1417

1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431
    person_business_configuration_item =\
          person_business_configuration_save['1']
    self.assertEquals('Person Configurator Item',
            person_business_configuration_item.getPortalType())
    self.assertEquals('Sales',
            person_business_configuration_item.getFirstName())
    self.assertEquals('Manager',
            person_business_configuration_item.getLastName())
    self.assertEquals(self.sales_manager_reference,
            person_business_configuration_item.getReference())
    self.assertEquals('sales_manager',
            person_business_configuration_item.getPassword())
    self.assertEquals('sales/manager',
            person_business_configuration_item.getFunction())
1432

1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447
    # ...
    person_business_configuration_item =\
          person_business_configuration_save['3']
    self.assertEquals('Person Configurator Item',
            person_business_configuration_item.getPortalType())
    self.assertEquals('Accounting',
            person_business_configuration_item.getFirstName())
    self.assertEquals('Agent',
            person_business_configuration_item.getLastName())
    self.assertEquals(self.accounting_agent_reference,
            person_business_configuration_item.getReference())
    self.assertEquals('accounting_agent',
            person_business_configuration_item.getPassword())
    self.assertEquals('af/accounting/agent',
            person_business_configuration_item.getFunction())
1448

1449
  ##########################################
1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463
  def test_standard_workflow_france(self):
    """ Test the standard workflow with french configuration"""
    sequence_list = SequenceList()
    sequence_string = self.DEFAULT_SEQUENCE_LIST % dict(country='France')
    sequence_list.addSequenceString(sequence_string)
    sequence_list.play(self)

  def test_standard_workflow_brazil(self):
    """ Test the standard workflow with brazilian configuration """
    sequence_list = SequenceList()
    sequence_string = self.DEFAULT_SEQUENCE_LIST % dict(country='Brazil')
    sequence_list.addSequenceString(sequence_string)
    sequence_list.play(self)

1464 1465 1466 1467 1468 1469 1470
  def test_standard_workflow_russia(self):
    """ Test the standard workflow with russian configuration """
    sequence_list = SequenceList()
    sequence_string = self.DEFAULT_SEQUENCE_LIST % dict(country='Russia')
    sequence_list.addSequenceString(sequence_string)
    sequence_list.play(self)

1471 1472 1473 1474
  def test_standard_workflow_brazil_with_previous(self):
    """ This time we must simulate the previous buttom """
    sequence_list = SequenceList()
    sequence_string = """
1475
      stepSetBrazilCase
1476 1477
      stepCreateBusinessConfiguration
      stepTic
1478
      stepSetConfiguratorWorkflow
1479 1480 1481 1482 1483
      stepTic
      stepConfiguratorNext
      stepTic
      stepCheckBT5ConfiguratorItem
      stepCheckConfigureOrganisationForm
1484
      stepSetupOrganisationConfiguratorItem
1485 1486 1487
      stepConfiguratorNext
      stepTic
      stepCheckConfigureUserAccountNumberForm
1488
      stepCheckOrganisationConfiguratorItem
1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510
    """
    # check previous to organisation form and go back to
    # User Account Number Form to setup the number of user
    sequence_string += """
      stepConfiguratorPrevious
      stepCheckConfigureOrganisationForm
      stepConfiguratorNext
      stepCheckConfigureUserAccountNumberForm
      stepSetupUserAccounNumberSix
      stepConfiguratorNext
      stepTic
      stepCheckConfigureMultipleUserAccountForm
    """
    # check previous to user account number form
    sequence_string += """
      stepConfiguratorPrevious
      stepCheckConfigureUserAccountNumberForm
    """
    # check previous to organisation form
    sequence_string += """
      stepConfiguratorPrevious
      stepCheckConfigureOrganisationForm
1511
      stepSetupOrganisationConfiguratorItem
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527
    """
    # go next to user account number form
    sequence_string += """
      stepConfiguratorNext
      stepCheckConfigureUserAccountNumberForm
      stepSetupUserAccounNumberSix
    """
    # go next to Multiple User Account Form
    sequence_string += """
      stepConfiguratorNext
      stepCheckConfigureMultipleUserAccountForm
      stepSetupMultipleUserAccountSix
      stepConfiguratorNext
      stepTic
      stepCheckMultiplePersonConfigurationItem
      stepCheckConfigureAccountingForm
1528
      stepSetupAccountingConfiguration
1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545
      stepConfiguratorNext
      stepTic
      stepCheckAccountingConfigurationItemListBrazil
      stepCheckConfigurePreferenceForm
    """
    # check previous until organisation form
    # and go back to Configure Preference form
    sequence_string += """
      stepConfiguratorPrevious
      stepCheckConfigureAccountingForm
      stepConfiguratorPrevious
      stepCheckConfigureMultipleUserAccountForm
      stepConfiguratorPrevious
      stepCheckConfigureUserAccountNumberForm
      stepConfiguratorPrevious
      stepCleanUpRequest
      stepCheckConfigureOrganisationForm
1546
      stepSetupOrganisationConfiguratorItem
1547 1548 1549 1550 1551 1552 1553 1554
      stepConfiguratorNext
      stepCheckConfigureUserAccountNumberForm
      stepSetupUserAccounNumberSix
      stepConfiguratorNext
      stepCheckConfigureMultipleUserAccountForm
      stepSetupMultipleUserAccountSix
      stepConfiguratorNext
      stepCheckConfigureAccountingForm
1555
      stepSetupAccountingConfiguration
1556 1557 1558 1559 1560 1561
      stepConfiguratorNext
      stepTic
      stepCheckConfigurePreferenceForm
    """
    # check next Configure Installation form
    sequence_string += """
1562
      stepSetupPreferenceConfiguration
1563 1564
      stepConfiguratorNext
      stepTic
1565
      stepCheckPreferenceConfigurationItemList
1566 1567 1568 1569 1570 1571 1572
      stepCheckConfigureInstallationForm
      stepSetupInstallConfiguration
      stepConfiguratorNext
      stepCheckInstallConfiguration
      stepTic
      stepStartConfigurationInstallation
      stepTic
Rafael Monnerat's avatar
Rafael Monnerat committed
1573
      stepCheckInstanceIsConfiguredBrazil
1574 1575 1576
    """
    sequence_list.addSequenceString(sequence_string)
    sequence_list.play(self)
Lucas Carvalho's avatar
Lucas Carvalho committed
1577

1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592
#  def exportConfiguratorBusinessTemplate(self):
#    """ """
#    # we save this configuration business template for another test
#    outfile_path = os.path.join(os.environ['INSTANCE_HOME'],
#                        'configurator_express_configuration.bt5')
#    outfile = file(outfile_path, 'w')
#    try:
#      outfile.write(server_response['filedata'][-1])
#      print 'Saved generated business template as', outfile_path
#    finally:
#      outfile.close()

import unittest
def test_suite():
  suite = unittest.TestSuite()
1593 1594
  suite.addTest(unittest.makeSuite(TestConsultingConfiguratorWorkflow))
  suite.addTest(unittest.makeSuite(TestStandardConfiguratorWorkflow))
1595
  return suite