testERP5Base.py 67.2 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
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
#                    Kevin Deldycke <kevin_AT_nexedi_DOT_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.
#
##############################################################################


30
import os
Jérome Perrin's avatar
Jérome Perrin committed
31
import unittest
32
import transaction
Jérome Perrin's avatar
Jérome Perrin committed
33

34 35 36 37
from DateTime import DateTime
from Products.ERP5Type.Utils import convertToUpperCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList
38
from Products.ERP5Type.tests.utils import createZODBPythonScript, FileUpload
39 40
from AccessControl.SecurityManagement import newSecurityManager

41 42
class TestERP5Base(ERP5TypeTestCase):
  """ERP5 Base tests.
Jérome Perrin's avatar
Jérome Perrin committed
43

44
  Those are tests for erp5_base business template.
45 46 47 48
  """

  # pseudo constants
  RUN_ALL_TEST = 1
49
  QUIET = 1
50 51 52 53 54 55 56 57 58 59


  ##################################
  ##  ZopeTestCase Skeleton
  ##################################

  def getTitle(self):
    """
      Return the title of the current test set.
    """
60
    return "ERP5 Base"
61 62 63 64 65 66


  def getBusinessTemplateList(self):
    """
      Return the list of required business templates.
    """
Sebastien Robin's avatar
Sebastien Robin committed
67
    return ('erp5_base',)
68 69


70
  def afterSetUp(self):
71 72 73 74
    """
      Initialize the ERP5 site.
    """
    self.login()
75
    self.datetime          = DateTime()
76 77 78
    self.portal            = self.getPortal()
    self.portal_categories = self.getCategoryTool()
    self.portal_catalog    = self.getCatalogTool()
79
    self.portal_preferences = self.getPreferenceTool()
80 81
    self.createCategories()

82 83 84 85 86 87 88
  def beforeTearDown(self):
    transaction.abort()
    for module in ( self.portal.person_module,
                    self.portal.organisation_module, ):
      module.manage_delObjects(list(module.objectIds()))
    transaction.commit()
    self.tic()
89 90 91 92 93

  ##################################
  ##  Usefull methods
  ##################################

94 95 96 97 98
  def makeImageFileUpload(self, filename):
    return FileUpload(
            os.path.join(os.path.dirname(__file__),
            'test_data', 'images', filename), 'rb')

Jérome Perrin's avatar
Jérome Perrin committed
99 100
  def login(self):
    """Create a new manager user and login.
101 102 103 104 105 106 107
    """
    user_name = 'kevin'
    user_folder = self.getPortal().acl_users
    user_folder._doAddUser(user_name, '', ['Manager', 'Owner', 'Assignor'], [])
    user = user_folder.getUserById(user_name).__of__(user_folder)
    newSecurityManager(None, user)

108 109
  def login_as_auditor(self):
    """Create a new member user with Auditor role, and login
110
    """
111 112
    user_name = 'auditor_user'
    user_folder = self.portal.acl_users
113
    user_folder._doAddUser(user_name, '', ['Member', 'Auditor'], [])
114 115
    user = user_folder.getUserById(user_name).__of__(user_folder)
    newSecurityManager(None, user)
116 117 118 119 120 121 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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206

  def createCategories(self):
    """
      Create some categories for testing.
    """
    self.category_list = [
                         # Grade categories
                           {'path' : 'grade/director'
                           ,'title': 'Director'
                           }
                         , {'path' : 'grade/engineer'
                           ,'title': 'Engineer'
                           }

                         # Function categories
                         , {'path' : 'function/hq'
                           ,'title': 'Headquarters'
                           }
                         , {'path' : 'function/warehouse'
                           ,'title': 'Warehouse'
                           }
                         , {'path' : 'function/research_center'
                           ,'title': 'Research Center'
                           }

                         # Activity categories
                         , {'path' : 'activity/media'
                           ,'title': 'Media'
                           }
                         , {'path' : 'activity/software'
                           ,'title': 'Software'
                           }
                         , {'path' : 'activity/mechanics'
                           ,'title': 'Mechanics'
                           }
                         , {'path' : 'activity/mechanics/aerospace'
                           ,'title': 'Aerospace'
                           }
                         , {'path' : 'activity/mechanics/automotive'
                           ,'title': 'Automotive'
                           }

                         # Group categories
                         , {'path' : 'group/nexedi'
                           ,'title': 'Nexedi'
                           }
                         , {'path' : 'group/nexedi/storever'
                           ,'title': 'Storever'
                           }
                         , {'path' : 'group/nexedi/rentalinux'
                           ,'title': 'Rentalinux'
                           }

                         # Role categories
                         , {'path' : 'role/client'
                           ,'title': 'Client'
                           }
                         , {'path' : 'role/supplier'
                           ,'title': 'Supplier'
                           }
                         , {'path' : 'role/internal'
                           ,'title': 'Internal'
                           }

                         # Site categories
                         , {'path' : 'site/production/madrid'
                           ,'title': 'Madrid Production Site'
                           }
                         , {'path' : 'site/distibution/paris'
                           ,'title': 'Paris Distribution Site'
                           }
                         , {'path' : 'site/distibution/tokyo'
                           ,'title': 'Tokyo Distribution Site'
                           }
                         , {'path' : 'site/distibution/new_york'
                           ,'title': 'New York Distribution Site'
                           }

                         # Skill categories
                         , {'path' : 'skill/design/graphic'
                           ,'title': 'Graphic'
                           }
                         , {'path' : 'skill/design/sound'
                           ,'title': 'Sound'
                           }
                         , {'path' : 'skill/it/consulting'
                           ,'title': 'Consulting'
                           }
                         , {'path' : 'skill/it/programming'
                           ,'title': 'Programming'
                           }
207 208 209 210 211 212 213 214 215 216 217 218 219 220

                         # Region categories
                         , {'path' : 'region/europe/france'
                           ,'title': 'France'
                           }
                         , {'path' : 'region/europe/germany'
                           ,'title': 'Germany'
                           }
                         , {'path' : 'region/america/canada'
                           ,'title': 'Canada'
                           }
                         , {'path' : 'region/america/brazil'
                           ,'title': 'Brazil'
                           }
221 222 223 224 225 226 227 228 229 230 231 232 233 234

                         # Salary Level categories
                         , {'path' : 'salary_level/france/1/A'
                           ,'title': '1.A'
                           }
                         , {'path' : 'salary_level/france/1/B'
                           ,'title': '1.B'
                           }
                         , {'path' : 'salary_level/france/1/C'
                           ,'title': '1.C'
                           }
                         , {'path' : 'salary_level/france/2'
                           ,'title': '2'
                           }
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
                         ]

    # Create categories
    # Note : this code was taken from the CategoryTool_importCategoryFile python
    #        script (packaged in erp5_core).
    for category in self.category_list:
      keys = category.keys()
      if 'path' in keys:
        base_path_obj = self.portal_categories
        is_base_category = True
        for category_id in category['path'].split('/'):
          # The current category is not existing
          if category_id not in base_path_obj.contentIds():
            # Create the category
            if is_base_category:
              category_type = 'Base Category'
            else:
              category_type = 'Category'
            base_path_obj.newContent( portal_type       = category_type
                                    , id                = category_id
                                    )
          base_path_obj = base_path_obj[category_id]
          is_base_category = False
        new_category = base_path_obj

        # Set the category properties
        for key in keys:
          if key != 'path':
            method_id = "set" + convertToUpperCase(key)
            value = category[key]
            if value not in ('', None):
              if hasattr(new_category, method_id):
                method = getattr(new_category, method_id)
                method(value.encode('UTF-8'))


  def getCategoryList(self, base_category=None):
    """
      Get a list of categories with same base categories.
    """
    categories = []
    if base_category != None:
      for category in self.category_list:
        if category["path"].split('/')[0] == base_category:
          categories.append(category)
    return categories



  ##################################
  ##  Basic steps
  ##################################

  def stepCreateOrganisation(self, sequence=None, sequence_list=None, **kw):
    """
290
      Create an organisation.
291 292 293
    """
    portal_type = 'Organisation'
    organisation_module = self.portal.getDefaultModule(portal_type)
294 295
    organisation = organisation_module.newContent(portal_type=portal_type,
                                                  title='A new organisation')
296
    sequence.edit(organisation = organisation)
297 298


299 300
  def stepSetOrganisationCategories(self, sequence=None,
                                    sequence_list=None, **kw):
301
    """
302 303
      Set & Check default organisation categories 
      (function, activity, site, group...).
304
    """
305 306
    organisation = sequence.get('organisation')

307 308 309 310 311
    # Set & Check function
    function_categories = self.getCategoryList(base_category='function')
    function_path   = function_categories[0]['path']
    function_title  = function_categories[0]['title']
    function_object = self.portal_categories.resolveCategory(function_path)
312 313 314 315 316
    organisation.setFunction(function_path)
    self.assertEquals(organisation.getFunction()     , function_path)
    self.assertEquals(organisation.getFunctionTitle(), function_title)
    self.assertEquals(organisation.getFunctionValue(), function_object)

317 318 319 320 321
    # Set & Check activity
    activity_categories = self.getCategoryList(base_category='activity')
    activity_path   = activity_categories[0]['path']
    activity_title  = activity_categories[0]['title']
    activity_object = self.portal_categories.resolveCategory(activity_path)
322 323 324 325 326
    organisation.setActivity(activity_path)
    self.assertEquals(organisation.getActivity()     , activity_path)
    self.assertEquals(organisation.getActivityTitle(), activity_title)
    self.assertEquals(organisation.getActivityValue(), activity_object)

327 328 329 330 331
    # Set & Check group
    group_categories = self.getCategoryList(base_category='group')
    group_path   = group_categories[0]['path']
    group_title  = group_categories[0]['title']
    group_object = self.portal_categories.resolveCategory(group_path)
332 333 334 335 336
    organisation.setGroup(group_path)
    self.assertEquals(organisation.getGroup()     , group_path)
    self.assertEquals(organisation.getGroupTitle(), group_title)
    self.assertEquals(organisation.getGroupValue(), group_object)

337 338 339 340 341
    # Set & Check role
    role_categories = self.getCategoryList(base_category='role')
    role_path   = role_categories[0]['path']
    role_title  = role_categories[0]['title']
    role_object = self.portal_categories.resolveCategory(role_path)
342 343 344 345 346
    organisation.setRole(role_path)
    self.assertEquals(organisation.getRole()     , role_path)
    self.assertEquals(organisation.getRoleTitle(), role_title)
    self.assertEquals(organisation.getRoleValue(), role_object)

347 348 349 350 351
    # Set & Check site
    site_categories = self.getCategoryList(base_category='site')
    site_path   = site_categories[0]['path']
    site_title  = site_categories[0]['title']
    site_object = self.portal_categories.resolveCategory(site_path)
352 353 354 355 356
    organisation.setSite(site_path)
    self.assertEquals(organisation.getSite()     , site_path)
    self.assertEquals(organisation.getSiteTitle(), site_title)
    self.assertEquals(organisation.getSiteValue(), site_object)

357 358 359 360 361 362 363 364 365 366 367 368
    # Set & Check skills
    skill_categories = self.getCategoryList(base_category='skill')
    skill_path_list   = []
    skill_title_list  = []
    skill_object_list = []
    for skill in skill_categories[:2]:
      skill_path   = skill['path']
      skill_title  = skill['title']
      skill_object = self.portal_categories.resolveCategory(skill_path)
      skill_path_list.append(skill_path)
      skill_title_list.append(skill_title)
      skill_object_list.append(skill_object)
369
    organisation.setSkillList(skill_path_list)
370 371 372
    self.assertEquals(organisation.getSkillList()     , skill_path_list)
    self.assertEquals(organisation.getSkillTitleList(), skill_title_list)
    self.assertEquals(organisation.getSkillValueList(), skill_object_list)
373 374


375 376
  def stepResetOrganisationCategories(self, sequence=None,
                                      sequence_list=None, **kw):
377
    """
378
      Reset default organisation categories (function, activity, site, group...).
379
    """
380 381 382 383 384 385 386 387 388 389 390 391 392 393
    organisation = sequence.get('organisation')

    organisation.setFunction(None)
    organisation.setActivity(None)
    organisation.setGroup(None)
    organisation.setRole(None)
    organisation.setSite(None)
    organisation.setSkillList(None)

    self.assertEquals(organisation.getFunction()       , None)
    self.assertEquals(organisation.getActivity()       , None)
    self.assertEquals(organisation.getGroup()          , None)
    self.assertEquals(organisation.getRole()           , None)
    self.assertEquals(organisation.getSite()           , None)
394
    self.assertEquals(organisation.getSkillList(), [])
395 396 397 398 399 400

    self.assertEquals(organisation.getFunctionTitle()       , None)
    self.assertEquals(organisation.getActivityTitle()       , None)
    self.assertEquals(organisation.getGroupTitle()          , None)
    self.assertEquals(organisation.getRoleTitle()           , None)
    self.assertEquals(organisation.getSiteTitle()           , None)
401
    self.assertEquals(organisation.getSkillTitleList(), [])
402 403 404 405 406 407

    self.assertEquals(organisation.getFunctionValue()       , None)
    self.assertEquals(organisation.getActivityValue()       , None)
    self.assertEquals(organisation.getGroupValue()          , None)
    self.assertEquals(organisation.getRoleValue()           , None)
    self.assertEquals(organisation.getSiteValue()           , None)
408
    self.assertEquals(organisation.getSkillValueList(), [])
409 410 411 412


  def stepSetOrganisationAddress(self, sequence=None, sequence_list=None, **kw):
    """
413 414
      Set organisation address and test acquired properties and categories
      from the Address sub-object.
415 416 417 418 419 420 421 422 423 424 425
    """
    organisation = sequence.get('organisation')

    region = self.getCategoryList(base_category='region')[0]
    region_path   = region["path"]
    region_title  = region["title"]
    region_object = self.portal_categories.resolveCategory(region_path)
    organisation.setDefaultAddressCity('Lille')
    organisation.setDefaultAddressRegion(region_path)
    organisation.setDefaultAddressZipCode('59000')
    organisation.setDefaultAddressStreetAddress('42, rue des gnous')
426 427
    organisation.setDefaultTelephoneText('+55(0)66-5555') # Phone follows default conventions
    organisation.setDefaultFaxText('+55(0)69-1337')
428 429 430 431 432 433 434 435 436 437 438 439 440
    organisation.setDefaultEmailText('kevin@truc-bidule.com')

    self.failUnless('default_address' in organisation.contentIds())
    default_address = organisation.default_address
    self.assertEquals(default_address.getPortalType(), 'Address')
    self.assertEquals(organisation.getDefaultAddressValue(), default_address)

    self.assertEquals( organisation.getDefaultAddressCity()
                     , default_address.getCity()
                     )
    self.assertEquals( organisation.getDefaultAddressRegion()
                     , default_address.getRegion()
                     )
441 442 443 444 445 446
    self.assertEquals( organisation.getDefaultAddressRegionTitle()
                     , default_address.getRegionTitle()
                     )
    self.assertEquals( default_address.getRegionValue()
                     , region_object
                     )
447 448 449 450 451 452
    self.assertEquals( organisation.getDefaultAddressZipCode()
                     , default_address.getZipCode()
                     )
    self.assertEquals( organisation.getDefaultAddressStreetAddress()
                     , default_address.getStreetAddress()
                     )
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
    
    # Organisation's region is acquired from the Address object
    self.assertEquals( organisation.getRegion()
                     , default_address.getRegion()
                     )
    
    self.failUnless('default_telephone' in organisation.contentIds())
    default_telephone = organisation.default_telephone
    self.assertEquals(default_telephone.getPortalType(), 'Telephone')
    self.assertEquals( organisation.getDefaultTelephoneText()
                     , default_telephone.asText()
                     )
                     
    self.failUnless('default_fax' in organisation.contentIds())
    default_fax = organisation.default_fax
    self.assertEquals(default_fax.getPortalType(), 'Fax')
    self.assertEquals( organisation.getDefaultFaxText()
                     , default_fax.asText()
                     )
    
    self.failUnless('default_email' in organisation.contentIds())
    default_email = organisation.default_email
    self.assertEquals(default_email.getPortalType(), 'Email')
    self.assertEquals( organisation.getDefaultEmailText()
                     , default_email.asText()
                     )
479

480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495
  def stepCreatePerson(self, sequence=None, sequence_list=None, **kw):
    """
      Create a person.
    """
    portal_type = 'Person'
    person_module = self.portal.getDefaultModule(portal_type)
    person = person_module.newContent( portal_type       = portal_type
                                     )
    sequence.edit(person = person)


  def stepSetPersonCareer(self, sequence=None, sequence_list=None, **kw):
    """
      Set & Check default person properties acquired through default career.
    """
    person = sequence.get('person')
496 497 498 499 500 501
    organisation = sequence.get('organisation')
    
    # Set subordination
    person.setCareerSubordinationValue(organisation)
    self.assertEquals(person.getCareerSubordinationValue(), organisation)
    
502 503
    # Set & Check simple properties with 'Career' prefix
    person.setCareerTitle('A brand new career step')
504 505
    person.setCareerDescription(
        'This career step correspond to my arrival at Nexedi as employee')
506
    self.assertEquals(person.getCareerTitle()      , 'A brand new career step')
507 508
    self.assertEquals(person.getCareerDescription(),
        'This career step correspond to my arrival at Nexedi as employee')
509 510 511

    dummy_date1 = self.datetime + 10
    dummy_date2 = self.datetime + 20
512 513 514 515
    person.setCareerStopDate(dummy_date2)
    person.setCareerStartDate(dummy_date1)
    person.setCareerSalaryCoefficient(1)
    person.setCareerCollectiveAgreementTitle('SYNTEC convention')
516
    person.setCareerActivity('software')
517
    person.setCareerReference('1234')
518 519 520 521
    self.assertEquals(person.getCareerStopDate()                , dummy_date2)
    self.assertEquals(person.getCareerStartDate()               , dummy_date1)
    self.assertEquals(person.getCareerSalaryCoefficient()       , 1)
    self.assertEquals(person.getCareerCollectiveAgreementTitle(), 'SYNTEC convention')
522
    self.assertEquals(person.getCareerActivityTitle(), 'Software')
523
    self.assertEquals(person.getCareerReference(), '1234')
524

525 526 527 528
    # activity must be acquired on person
    self.assertEquals(person.getActivity(), person.getCareerActivity())
    self.assertEquals('Software', person.getActivityTitle())

529 530 531 532 533 534 535 536 537
    # Set & Check function
    function_categories = self.getCategoryList(base_category='function')
    function_path   = function_categories[1]['path']
    function_title  = function_categories[1]['title']
    function_object = self.portal_categories.resolveCategory(function_path)
    person.setCareerFunction(function_path)
    self.assertEquals(person.getCareerFunction()     , function_path)
    self.assertEquals(person.getCareerFunctionTitle(), function_title)
    self.assertEquals(person.getCareerFunctionValue(), function_object)
538
    # function must be acquired on person
539
    person.reindexObject(); transaction.commit(); self.tic()
540
    self.failUnless(person in function_object.getFunctionRelatedValueList())
541 542 543 544 545 546

    # Set & Check role
    role_categories = self.getCategoryList(base_category='role')
    role_path   = role_categories[1]['path']
    role_title  = role_categories[1]['title']
    role_object = self.portal_categories.resolveCategory(role_path)
547 548 549 550
    person.setCareerRole(role_path)
    self.assertEquals(person.getCareerRole()     , role_path)
    self.assertEquals(person.getCareerRoleTitle(), role_title)
    self.assertEquals(person.getCareerRoleValue(), role_object)
551
    # role must be acquired on person
552
    person.reindexObject(); transaction.commit(); self.tic()
553
    self.failUnless(person in role_object.getRoleRelatedValueList())
554 555 556 557 558 559

    # Set & Check grade
    grade_categories = self.getCategoryList(base_category='grade')
    grade_path   = grade_categories[1]['path']
    grade_title  = grade_categories[1]['title']
    grade_object = self.portal_categories.resolveCategory(grade_path)
560 561 562 563
    person.setCareerGrade(grade_path)
    self.assertEquals(person.getCareerGrade()     , grade_path)
    self.assertEquals(person.getCareerGradeTitle(), grade_title)
    self.assertEquals(person.getCareerGradeValue(), grade_object)
564
    # grade must be acquired on person 
565
    person.reindexObject(); transaction.commit(); self.tic()
566
    self.failUnless(person in grade_object.getGradeRelatedValueList())
567 568

    # Set & Check salary level
569 570
    salary_level_categories = self.getCategoryList(
                                base_category='salary_level')
571 572
    salary_level_path   = salary_level_categories[1]['path']
    salary_level_title  = salary_level_categories[1]['title']
573 574
    salary_level_object = self.portal_categories.resolveCategory(
                          salary_level_path)
575 576 577 578
    person.setCareerSalaryLevel(salary_level_path)
    self.assertEquals(person.getCareerSalaryLevel()     , salary_level_path)
    self.assertEquals(person.getCareerSalaryLevelTitle(), salary_level_title)
    self.assertEquals(person.getCareerSalaryLevelValue(), salary_level_object)
579
    # salary_level must be acquired on person 
580
    person.reindexObject(); transaction.commit(); self.tic()
581 582
    self.failUnless(person in
                   salary_level_object.getSalaryLevelRelatedValueList())
583 584 585 586 587 588 589 590 591 592 593 594 595

    # Set & Check skills
    skill_categories = self.getCategoryList(base_category='skill')
    skill_path_list   = []
    skill_title_list  = []
    skill_object_list = []
    for skill in skill_categories[1:3]:
      skill_path   = skill['path']
      skill_title  = skill['title']
      skill_object = self.portal_categories.resolveCategory(skill_path)
      skill_path_list.append(skill_path)
      skill_title_list.append(skill_title)
      skill_object_list.append(skill_object)
596
    person.setCareerSkillList(skill_path_list)
597 598 599
    self.assertEquals(person.getCareerSkillList()     , skill_path_list)
    self.assertEquals(person.getCareerSkillTitleList(), skill_title_list)
    self.assertEquals(person.getCareerSkillValueList(), skill_object_list)
600 601
    self.assertEquals(person.getCareerSkillTitle(), skill_title_list[0])
    self.assertEquals(person.getCareerSkillValue(), skill_object_list[0])
602
    # skill must be acquired on person 
603
    person.reindexObject(); transaction.commit(); self.tic()
604 605
    for skill_object in skill_object_list:
      self.failUnless(person in skill_object.getSkillRelatedValueList())
606
    self.assertEquals(person.getSkillValue(), skill_object_list[0])
607 608 609

  def stepCheckPersonCareer(self, sequence=None, sequence_list=None, **kw):
    """
610 611
      Check the consistency of default_career properties with person
      getters (= check the acquisition).
612 613 614 615 616 617 618 619 620 621 622
    """
    person = sequence.get('person')

    # Check default career sub-object
    self.failUnless('default_career' in person.contentIds())
    default_career = person.default_career
    self.assertEquals(default_career.getPortalType(), 'Career')

    # Test getter with 'Career' prefix
    self.assertEquals(person.getCareer()           , default_career.getRelativeUrl())
    self.assertEquals(person.getCareerTitle()      , default_career.getTitle())
623
    self.assertEquals(person.getCareerReference(), default_career.getReference())
624 625 626 627 628 629 630 631 632
    self.assertEquals(person.getCareerValue()      , default_career)
    self.assertEquals(person.getCareerDescription(), default_career.getDescription())

    self.assertEquals(person.getCareerFunction()     , default_career.getFunction())
    self.assertEquals(person.getCareerFunctionTitle(), default_career.getFunctionTitle())
    self.assertEquals(person.getCareerFunctionValue(), default_career.getFunctionValue())

    # Test getter with no prefix (aka 'transparent' getters) on simple properties
    #   then on category properties
633 634 635 636 637 638 639 640 641 642 643 644
    self.assertEquals(person.getCareerStopDate()                , default_career.getStopDate())
    self.assertEquals(person.getCareerStartDate()               , default_career.getStartDate())
    self.assertEquals(person.getCareerSalaryCoefficient()       , default_career.getSalaryCoefficient())
    self.assertEquals(person.getCareerCollectiveAgreementTitle(), default_career.getCollectiveAgreementTitle())

    self.assertEquals(person.getCareerRole()     , default_career.getRole())
    self.assertEquals(person.getCareerRoleTitle(), default_career.getRoleTitle())
    self.assertEquals(person.getCareerRoleValue(), default_career.getRoleValue())

    self.assertEquals(person.getCareerGrade()     , default_career.getGrade())
    self.assertEquals(person.getCareerGradeTitle(), default_career.getGradeTitle())
    self.assertEquals(person.getCareerGradeValue(), default_career.getGradeValue())
645 646 647 648 649 650 651
    
    self.assertEquals(person.getCareerActivity(),
                      default_career.getActivity())
    self.assertEquals(person.getCareerActivityTitle(),
                      default_career.getActivityTitle())
    self.assertEquals(person.getCareerActivityValue(),
                      default_career.getActivityValue())
652 653 654 655 656

    self.assertEquals(person.getCareerSalaryLevel()     , default_career.getSalaryLevel())
    self.assertEquals(person.getCareerSalaryLevelTitle(), default_career.getSalaryLevelTitle())
    self.assertEquals(person.getCareerSalaryLevelValue(), default_career.getSalaryLevelValue())

657 658 659
    self.assertEquals(person.getCareerSkillList()     , default_career.getSkillList())
    self.assertEquals(person.getCareerSkillTitleList(), default_career.getSkillTitleList())
    self.assertEquals(person.getCareerSkillValueList(), default_career.getSkillValueList())
660

661 662 663 664
    self.assertEquals(person.getCareerSubordination(), default_career.getSubordination())
    # Person's subordination is acquired from default career
    self.assertEquals(person.getSubordination(), default_career.getSubordination())
    
665 666 667 668 669 670 671 672
  def stepAddCareerStepInAnotherOrganisation(self, sequence=None, **kw) :
    """Adds another career step on the person."""
    person = sequence.get('person')
    other_organisation = self.getOrganisationModule().newContent(
                            portal_type = 'Organisation',
                            title = 'Another Organistion')
    new_career_title = 'new career title'
    # Create a new career step.
673
    person.Person_shiftDefaultCareer()
674 675
    self.assertEquals( 2,
          len(person.contentValues(filter={'portal_type':'Career'})))
676 677
    person.setCareerSubordination(other_organisation.getRelativeUrl())
    person.setCareerTitle(new_career_title)
678
    
679
    # Get the new and the old career, as Person_shiftDefaultCareer changes
680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723
    # objects id, this may be the only safe way ...
    old_career_step = None
    new_career_step = None
    for career in person.contentValues(filter={'portal_type':'Career'}):
      if career.getTitle() == new_career_title :
        new_career_step = career
      else :
        old_career_step = career
    self.assertNotEquals(new_career_step, None)
    self.assertNotEquals(old_career_step, None)
    
    sequence.edit( old_career_step = old_career_step,
                   new_career_step = new_career_step,
                   new_organisation = other_organisation,
                   old_organisation = sequence.get('organisation') )

  def stepCheckCareerSubordination (self, sequence=None, **kw) :
    """checks that setting subordination on a career does not conflict 
        with acquisition."""
    person = sequence.get('person')
    old_career_step = sequence.get('old_career_step')
    new_career_step = sequence.get('new_career_step')
    new_organisation = sequence.get('new_organisation')
    old_organisation = sequence.get('old_organisation')
    new_organisation_title = new_organisation.getTitle()
    old_organisation_title = old_organisation.getTitle()
    
    self.assert_( "subordination/%s" % old_organisation.getRelativeUrl() in
                    old_career_step.getCategoryList(),
                '%s not in %s' % (old_organisation.getRelativeUrl(),
                                  old_career_step.getCategoryList()))
    self.assertEquals( old_career_step.getSubordination(),
                       old_organisation.getRelativeUrl() )
    self.assertEquals( old_career_step.getSubordinationTitle(),
                       old_organisation_title )
  
    self.assert_( "subordination/%s" % new_organisation.getRelativeUrl() in
                    new_career_step.getCategoryList(),
                '%s not in %s' % (new_organisation.getRelativeUrl(),
                                  new_career_step.getCategoryList()))
    self.assertEquals( new_career_step.getSubordination(),
                       new_organisation.getRelativeUrl() )
    self.assertEquals( new_career_step.getSubordinationTitle(),
                       new_organisation_title )
724

725 726 727 728 729 730 731 732
  def stepCheckChangePersonAddress(self, sequence=None, **kw) :
    """
    We must make sure that if we change the address of a person,
    then it will not change the address of the organisation.
    """
    person = sequence.get('person')
    organisation = sequence.get('organisation')
    self.assertEquals(organisation.getDefaultAddressCity(),'Lille')
733
    self.assertEquals(organisation.getDefaultAddressZipCode(), '59000')
734
    self.assertEquals(person.getDefaultAddressCity(),'Lille')
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757
    self.assertEquals(person.getDefaultAddressZipCode(), '59000')

    # here, the parameters we pass to edit are the same as the one acquired
    # from the organisation, edit shouldn't do anything
    person.edit(
        default_address_city='Lille',
        default_address_zip_code='59000')

    self.assertEquals(person.getDefaultAddress(),
        organisation.getDefaultAddress())
    self.assertEquals(person.getDefaultAddressCity(),'Lille')
    self.assertEquals(person.getDefaultAddressZipCode(), '59000')

    # here, the first parameter we pass will trigger the creation of a
    # subobject on person, and we need to make sure that the second one gets
    # copied (when calling edit from the interface, all displayed fields are
    # passed to edit)
    person.edit(
        default_address_city='La Garnache',
        default_address_zip_code='59000')

    self.assertNotEquals(person.getDefaultAddress(),
        organisation.getDefaultAddress())
758
    self.assertEquals(person.getDefaultAddressCity(),'La Garnache')
759
    self.assertEquals(person.getDefaultAddressZipCode(), '59000')
760
    self.assertEquals(organisation.getDefaultAddressCity(),'Lille')
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779
    self.assertEquals(organisation.getDefaultAddressZipCode(), '59000')

    # retry last action, inverting the modified property
    # XXX Whether this test is usefull or not completely depends on Python
    # implementation. Python currently does not guarantee the order of a dict,
    # so it might very well be that at some point, a change in the
    # implementation makes the test always succeed, where it would fail with
    # the curent implementation.
    person.manage_delObjects(['default_address'])

    person.edit(
        default_address_city='Lille',
        default_address_zip_code='69000')

    self.assertNotEquals(person.getDefaultAddress(),
        organisation.getDefaultAddress())
    self.assertEquals(person.getDefaultAddressCity(),'Lille')
    self.assertEquals(person.getDefaultAddressZipCode(), '69000')
    self.assertEquals(organisation.getDefaultAddressCity(),'Lille')
780
    self.assertEquals(organisation.getDefaultAddressZipCode(), '59000')
781

782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802
    # if the address of the person is the same of the organisation
    # there is no reason to create a subobject (default_address)
    person.manage_delObjects(['default_address'])
    person.edit(career_subordination_value=organisation)
    self.assertTrue('default_address' not in person.objectIds())
    self.assertEquals(person.getDefaultAddress(),
        organisation.getDefaultAddress())
    self.assertEquals(person.getDefaultAddressCity(),
        organisation.getDefaultAddressCity())
    self.assertEquals(person.getDefaultAddressZipCode(),
        organisation.getDefaultAddressZipCode())
    # if the address of the person is different then the subobject
    # (default_address) must be created.
    person.edit(default_address_city='La Garnache')
    self.assertTrue('default_address' in person.objectIds())
    self.assertNotEquals(person.getDefaultAddressCity(),
         organisation.getDefaultAddressCity())




803 804 805 806
  ##################################
  ##  Tests
  ##################################

807
  def test_01_Organisation(self, quiet=QUIET, run=RUN_ALL_TEST):
808
    """
809
      Test basic behaviour of Organisation.
810 811 812
    """
    if not run: return
    sequence_list = SequenceList()
813 814 815 816
    step_list = [ 'stepCreateOrganisation'
                , 'stepSetOrganisationCategories'
                , 'stepResetOrganisationCategories'
                , 'stepSetOrganisationAddress'
817 818 819
                ]
    sequence_string = ' '.join(step_list)
    sequence_list.addSequenceString(sequence_string)
820
    sequence_list.play(self, quiet=quiet)
821 822


823 824 825 826 827 828
  def test_02_Person(self, quiet=QUIET, run=RUN_ALL_TEST):
    """
      Test basic behaviour of Person.
    """
    if not run: return
    sequence_list = SequenceList()
829 830 831 832
    step_list = [ 'stepCreatePerson'
                , 'stepCreateOrganisation'
                , 'stepSetPersonCareer'
                , 'stepCheckPersonCareer'
833 834 835
                ]
    sequence_string = ' '.join(step_list)
    sequence_list.addSequenceString(sequence_string)
836
    sequence_list.play(self, quiet=quiet)
837

838 839 840 841 842 843
  def test_03_Subordination(self, quiet=QUIET, run=RUN_ALL_TEST):
    """
      Tests that career steps subordination properties behave correctly
    """
    if not run: return
    sequence_list = SequenceList()
844 845 846 847 848
    step_list = [ 'stepCreatePerson'
                , 'stepCreateOrganisation'
                , 'stepSetPersonCareer'
                , 'stepAddCareerStepInAnotherOrganisation'
                , 'stepCheckCareerSubordination'
849 850 851
                ]
    sequence_string = ' '.join(step_list)
    sequence_list.addSequenceString(sequence_string)
852
    sequence_list.play(self, quiet=quiet)
853

854 855 856 857 858 859
  def test_04_SubordinationAndAddress(self, quiet=QUIET, run=RUN_ALL_TEST):
    """
      Tests that career steps subordination properties behave correctly
    """
    if not run: return
    sequence_list = SequenceList()
860 861 862 863 864
    step_list = [ 'stepCreatePerson'
                , 'stepCreateOrganisation'
                , 'stepSetOrganisationAddress'
                , 'stepSetPersonCareer'
                , 'stepCheckChangePersonAddress'
865 866 867
                ]
    sequence_string = ' '.join(step_list)
    sequence_list.addSequenceString(sequence_string)
868
    sequence_list.play(self, quiet=quiet)
869

870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890
  def test_SubordinationAcquisition(self):
    """
    Tests that persons acquire properties through subordination.
    """
    portal_categories = self.portal.portal_categories
    organisation = self.portal.organisation_module.newContent(
                            portal_type='Organisation',
                            role_value=portal_categories.role.client,
                            activity_value=portal_categories.activity.software,
                            group_value=portal_categories.group.nexedi,)
    person = self.portal.person_module.newContent(
                            portal_type='Person',
                            career_subordination_value=organisation)
    self.assertEquals(portal_categories.role.client,
                      person.getRoleValue())
    self.assertEquals(portal_categories.activity.software,
                      person.getActivityValue())
    self.assertEquals(portal_categories.group.nexedi,
                      person.getGroupValue())


Jérome Perrin's avatar
Jérome Perrin committed
891
  # Dates
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920
  def test_05_DatesOnPerson(self, quiet=QUIET, run=RUN_ALL_TEST):
    """Tests dates on Person objects.
    """
    pers = self.getPersonModule().newContent(portal_type='Person')
    birthday = DateTime(1999, 01, 01)
    now = DateTime()
    pers.edit(birthday = birthday)
    self.assertEquals(birthday, pers.getBirthday())
    self.assertEquals(birthday, pers.getStartDate())
    
    for slot in ['year', 'month', 'day', 'hour', 'minute']:
      self.assertEquals(getattr(now, slot)(),
                        getattr(pers.getCreationDate(), slot)(),
                        'Wrong creation date %s' % pers.getCreationDate())
  
  def test_06_DatesOnOrganisation(self, quiet=QUIET, run=RUN_ALL_TEST):
    """Tests dates on Organisation objects.
    """
    org = self.getOrganisationModule().newContent(portal_type='Organisation')
    start_date = DateTime(1999, 01, 01)
    now = DateTime()
    org.edit(start_date = start_date)
    self.assertEquals(start_date, org.getStartDate())
    
    for slot in ['year', 'month', 'day', 'hour', 'minute']:
      self.assertEquals(getattr(now, slot)(),
                        getattr(org.getCreationDate(), slot)(),
                        'Wrong creation date %s' % org.getCreationDate())

921 922 923 924 925 926 927
  def test_07_BirthplaceOnPerson(self, quiet=QUIET, run=RUN_ALL_TEST):
    """Tests birthplace on Person objects.
    """
    pers = self.getPersonModule().newContent(portal_type='Person')
    pers.setDefaultBirthplaceAddressCity('Lille')
    self.assertEquals('Lille', pers.getDefaultBirthplaceAddressCity())

Jérome Perrin's avatar
Jérome Perrin committed
928 929 930 931 932
  def test_TelephoneAsText(self):
    # Test asText method
    pers = self.getPersonModule().newContent(portal_type='Person')
    tel = pers.newContent(portal_type='Telephone')
    tel.setTelephoneCountry(33)
933 934 935 936 937
    tel.setTelephoneArea(2)
    tel.setTelephoneNumber(12345678)
    tel.setTelephoneExtension(999)
    self.assertEquals('+33(0)2-12345678/999', tel.asText())

938
  def test_TelephonePreference(self):
939 940 941 942 943 944
    pers = self.getPersonModule().newContent(portal_type='Person')
    tel = pers.newContent(portal_type='Telephone')
    pref = self.portal_preferences.default_site_preference
    pref.setPreferredTelephoneDefaultCountryNumber('33')
    pref.setPreferredTelephoneDefaultAreaNumber('2')
    pref.enable()
945 946
    tel.fromText(coordinate_text='11111111')
    self.assertEquals('+33(0)2-11111111',tel.asText())
947

948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968
  def test_TelephoneCountryAndAreaCodeRemains(self):
    pers = self.getPersonModule().newContent(portal_type='Person')
    tel = pers.newContent(portal_type='Telephone')
    pref = self.portal_preferences.default_site_preference
    pref.setPreferredTelephoneDefaultCountryNumber('')
    pref.setPreferredTelephoneDefaultAreaNumber('')
    pref.enable()
    tel.fromText(coordinate_text='+11 1 11111111')
    tel.fromText(coordinate_text='+22333445555')
    self.assertEquals('+(0)-22333445555',tel.asText())

  def test_TelephoneInputList(self):
    pers = self.getPersonModule().newContent(portal_type='Person')
    tel = pers.newContent(portal_type='Telephone')
    input_list = [
      ['+11(0)1-11111111/111', '+11(0)1-11111111/111'],
      ['+11(0)1-11111111/', '+11(0)1-11111111'],
      ['+11(0)1-11111111', '+11(0)1-11111111'],
      ['+11(0)-1111111/111', '+11(0)-1111111/111'],
      ['+11(0)-1111111/', '+11(0)-1111111'],
      ['+11(0)-1111111', '+11(0)-1111111'],
969
      ['+11 111 1111 1111/111', '+11(0)111-1111-1111/111'],
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987
      ['+11(1)11111111/', '+11(0)1-11111111'],
      ['+11(1)11111111', '+11(0)1-11111111'],
      ['+11()11111111/111', '+11(0)-11111111/111'],
      ['+11()11111111/', '+11(0)-11111111'],
      ['+11()11111111', '+11(0)-11111111'],
      ['+11()-11111111/111', '+11(0)-11111111/111'],
      ['+11()-11111111/', '+11(0)-11111111'],
      ['+11()-11111111', '+11(0)-11111111'],
      ['+11(111)011111/', '+11(0)111-011111'],
      ['+11-011-11111111/111', '+11(0)011-11111111/111'],
      ['+11-011-11111111/', '+11(0)011-11111111'],
      ['+11-011-11111111', '+11(0)011-11111111'],
      ['+110 1111111/111', '+110(0)-1111111/111'],
      ['+110 1111111/', '+110(0)-1111111'],
      ['+110 1111111', '+110(0)-1111111'],
      ['+111 11111111/111', '+111(0)-11111111/111'],
      ['+111 11111111/', '+111(0)-11111111'],
      ['+111 11111111', '+111(0)-11111111'],
988 989 990
      ['+(0)1-1111-1111/111', '+(0)1-1111-1111/111'],
      ['+(0)1-1111-1111/', '+(0)1-1111-1111'],
      ['+(0)1-1111-1111', '+(0)1-1111-1111'],
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
      ['+(0)1-11111111/111', '+(0)1-11111111/111'],
      ['+(0)1-11111111/', '+(0)1-11111111'],
      ['+(0)1-11111111', '+(0)1-11111111'],
      ['+(0)-11111111/111', '+(0)-11111111/111'],
      ['+(0)-11111111/', '+(0)-11111111'],
      ['+(0)-11111111', '+(0)-11111111'],
      ['+11(111)011111/111', '+11(0)111-011111/111'],
      ['+11(111)011111', '+11(0)111-011111'],
      ['(11)11111111/', '+(0)11-11111111'],
      ['(11)11111111', '+(0)11-11111111'],
      ['(11)-11111111/111', '+(0)11-11111111/111'],
      ['(11)-11111111/', '+(0)11-11111111'],
      ['(11)-11111111', '+(0)11-11111111'],
      ['+11 1 011111111/1', '+11(0)1-011111111/1'],
      ['+11 1 011111111', '+11(0)1-011111111'],
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018
      ['+11 111 1111 1111/', '+11(0)111-1111-1111'],
      ['1-11 01 11 11/111', '+(0)1-11-011111/111'],
      ['1-11 01 11 11/', '+(0)1-11-011111'],
      ['1-11 01 11 11', '+(0)1-11-011111'],
      ['11 01 11 11/111', '+(0)11-01-1111/111'],
      ['11 01 11 11/', '+(0)11-01-1111'],
      ['11 01 11 11', '+(0)11-01-1111'],
      ['111 11 11/111', '+(0)111-11-11/111'],
      ['111 11 11/', '+(0)111-11-11'],
      ['111 11 11', '+(0)111-11-11'],
      ['111-11 11/111', '+(0)111-11-11/111'],
      ['111-11 11/', '+(0)111-11-11'],
      ['111-11 11', '+(0)111-11-11'],
1019
      ['1111111/11', '+(0)-1111111/11'],
1020 1021 1022
      ['011-111-1111/111', '+(0)11-111-1111/111'],
      ['011-111-1111/', '+(0)11-111-1111'],
      ['011-111-1111', '+(0)11-111-1111'],
1023 1024 1025
      ['011(111)1111/111', '+(0)11-1111111/111'],
      ['011(111)1111/', '+(0)11-1111111'],
      ['011(111)1111', '+(0)11-1111111'],
1026 1027 1028
      ['111/111-1111/111', '+(0)111-111-1111/111'],
      ['111/111-1111/', '+(0)111-111-1111'],
      ['111/111-1111', '+(0)111-111-1111'],
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040
      ['+11 111111111/111', '+11(0)-111111111/111'],
      ['+11 111111111/', '+11(0)-111111111'],
      ['+11 111111111', '+11(0)-111111111'],
      ['+111-1101110/111', '+111(0)-1101110/111'],
      ['+111-1101110/', '+111(0)-1101110'],
      ['+111-1101110', '+111(0)-1101110'],
      ['110-111111/111', '+(0)110-111111/111'],
      ['110-111111/', '+(0)110-111111'],
      ['110-111111', '+(0)110-111111'],
      ['111.111.1111/111', '+(0)111-1111111/111'],
      ['111.111.1111/', '+(0)111-1111111'],
      ['111.111.1111', '+(0)111-1111111'],
1041 1042 1043 1044 1045 1046
      ['+ 11 (0)1-11 11 01 01/111', '+11(0)1-11-110101/111'],
      ['+ 11 (0)1-11 11 01 01/', '+11(0)1-11-110101'],
      ['+ 11 (0)1-11 11 01 01', '+11(0)1-11-110101'],
      ['+11-1 11 11 01 11/111', '+11(0)1-11-110111/111'],
      ['+11-1 11 11 01 11/', '+11(0)1-11-110111'],
      ['+11-1 11 11 01 11', '+11(0)1-11-110111'],
1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058
      ['+111 (0) 1 111 11011/111', '+111(0)1-11111011/111'],
      ['+111 (0) 1 111 11011/', '+111(0)1-11111011'],
      ['+111 (0) 1 111 11011', '+111(0)1-11111011'],
      ['+111 (0) 111111101-01/111', '+111(0)-11111110101/111'],
      ['+111 (0) 111111101-01/', '+111(0)-11111110101'],
      ['+111 (0) 111111101-01', '+111(0)-11111110101'],
      ['+111 111111/111', '+111(0)-111111/111'],
      ['+111 111111/', '+111(0)-111111'],
      ['+111 111111', '+111(0)-111111'],
      ['+111 101011111/111', '+111(0)-101011111/111'],
      ['+111 101011111/', '+111(0)-101011111'],
      ['+111 101011111', '+111(0)-101011111'],
1059 1060 1061 1062 1063 1064
      ['+11 (0)11 1011 1100/111', '+11(0)11-1011-1100/111'],
      ['+11 (0)11 1011 1100/', '+11(0)11-1011-1100'],
      ['+11 (0)11 1011 1100', '+11(0)11-1011-1100'],
      ['+11 (0)10 1101 1111/111', '+11(0)10-1101-1111/111'],
      ['+11 (0)10 1101 1111/', '+11(0)10-1101-1111'],
      ['+11 (0)10 1101 1111', '+11(0)10-1101-1111'],
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
      ['(111 11) 111111/111', '+111(0)11-111111/111'],
      ['(111 11) 111111/', '+111(0)11-111111'],
      ['(111 11) 111111', '+111(0)11-111111'],
      ['(111 11) 111-11-11/111', '+111(0)11-1111111/111'],
      ['(111 11) 111-11-11/', '+111(0)11-1111111'],
      ['(111 11) 111-11-11', '+111(0)11-1111111'],
      ['(111 11)101011/111', '+111(0)11-101011/111'],
      ['(111 11)101011/', '+111(0)11-101011'],
      ['(111 11)101011', '+111(0)11-101011'],
      ['(+111)101111111/111', '+111(0)-101111111/111'],
      ['(+111)101111111/', '+111(0)-101111111'],
      ['(+111)101111111', '+111(0)-101111111'],
      ['(+111) 11110011/111', '+111(0)-11110011/111'],
      ['(+111) 11110011/', '+111(0)-11110011'],
      ['(+111) 11110011', '+111(0)-11110011'],
      ['+11 (11) 1111 1111/111', '+11(0)11-11111111/111'],
      ['+11 (11) 1111 1111/', '+11(0)11-11111111'],
      ['+11 (11) 1111 1111', '+11(0)11-11111111'],
      ['+11 (11)-10111111/111', '+11(0)11-10111111/111'],
      ['+11 (11)-10111111/', '+11(0)11-10111111'],
      ['+11 (11)-10111111', '+11(0)11-10111111'],
      ['(+11-111) 1111111/111', '+11(0)111-1111111/111'],
      ['(+11-111) 1111111/', '+11(0)111-1111111'],
      ['(+11-111) 1111111', '+11(0)111-1111111'],
      ['(+11-11)-1111111/111', '+11(0)11-1111111/111'],
      ['(+11-11)-1111111/', '+11(0)11-1111111'],
      ['(+11-11)-1111111', '+11(0)11-1111111'],
      ['(11-11) 111-1111/111', '+11(0)11-1111111/111'],
      ['(11-11) 111-1111/', '+11(0)11-1111111'],
      ['(11-11) 111-1111', '+11(0)11-1111111'],
      ['(11-1) 1.111.111/111', '+11(0)1-1111111/111'],
      ['(11-1) 1.111.111/', '+11(0)1-1111111'],
      ['(11-1) 1.111.111', '+11(0)1-1111111'],
      ['+111-11111110/111', '+111(0)-11111110/111'],
      ['+111-11111110/', '+111(0)-11111110'],
      ['+111-11111110', '+111(0)-11111110'],
      ['(11 11) 110 11 11/111', '+11(0)11-1101111/111'],
      ['(11 11) 110 11 11/', '+11(0)11-1101111'],
      ['(11 11) 110 11 11', '+11(0)11-1101111'],
      ['(11 011) 110-10-11/111', '+11(0)011-1101011/111'],
      ['(11 011) 110-10-11/', '+11(0)011-1101011'],
      ['(11 011) 110-10-11', '+11(0)011-1101011'],
      ['+1 (111) 1101-111/111', '+1(0)111-1101111/111'],
      ['+1 (111) 1101-111/', '+1(0)111-1101111'],
      ['+1 (111) 1101-111', '+1(0)111-1101111'],
      ['1 (111) 1101-101/111', '+1(0)111-1101101/111'],
      ['1 (111) 1101-101/', '+1(0)111-1101101'],
      ['1 (111) 1101-101', '+1(0)111-1101101'],
      ['+10 (111) 110 11 11/111', '+10(0)111-1101111/111'],
      ['+10 (111) 110 11 11/', '+10(0)111-1101111'],
      ['+10 (111) 110 11 11', '+10(0)111-1101111'],
1116 1117 1118
      ['+ 111 1 1101 101/111', '+111(0)1-1101-101/111'],
      ['+ 111 1 1101 101/', '+111(0)1-1101-101'],
      ['+ 111 1 1101 101', '+111(0)1-1101-101'],
1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133
      ['+11 1111-1111/111', '+11(0)-11111111/111'],
      ['+11 1111-1111/', '+11(0)-11111111'],
      ['+11 1111-1111', '+11(0)-11111111'],
      ['+(111 11) 100-11-11/111', '+111(0)11-1001111/111'],
      ['+(111 11) 100-11-11/', '+111(0)11-1001111'],
      ['+(111 11) 100-11-11', '+111(0)11-1001111'],
      ['+ 111-11-1110111/111', '+111(0)11-1110111/111'],
      ['+ 111-11-1110111/', '+111(0)11-1110111'],
      ['+ 111-11-1110111', '+111(0)11-1110111'],
      ['+ (111) 111-111/111', '+111(0)-111111/111'],
      ['+ (111) 111-111/', '+111(0)-111111'],
      ['+ (111) 111-111', '+111(0)-111111'],
      ['+111/1/1111 1100/111', '+111(0)1-11111100/111'],
      ['+111/1/1111 1100/', '+111(0)1-11111100'],
      ['+111/1/1111 1100', '+111(0)1-11111100'],
1134
      ['+11(0)11-1111-1111/111', '+11(0)11-1111-1111/111'],
1135 1136 1137 1138 1139 1140
    ]

    for i in input_list:
      tel.fromText(coordinate_text=i[0])
      self.assertEquals(i[1],tel.asText())

1141 1142 1143
  def test_TelephoneWhenTheDefaultCountryAndAreaPreferenceIsBlank(self):
    pers = self.getPersonModule().newContent(portal_type='Person')
    tel = pers.newContent(portal_type='Telephone')
1144 1145 1146 1147
    pref = self.portal_preferences.default_site_preference
    pref.setPreferredTelephoneDefaultCountryNumber('')
    pref.setPreferredTelephoneDefaultAreaNumber('')
    pref.enable()
1148
    tel.fromText(coordinate_text='12345678')
1149
    self.assertEquals('+(0)-12345678',tel.asText())
Jérome Perrin's avatar
Jérome Perrin committed
1150

1151 1152 1153 1154 1155
  def test_TelephoneAsTextBlankNumber(self):
    # Test asText method with blank number
    pers = self.getPersonModule().newContent(portal_type='Person')
    tel = pers.newContent(portal_type='Telephone')
    self.assertEquals('', tel.asText())
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168

  def test_TelephoneUrl(self):
    # http://www.rfc-editor.org/rfc/rfc3966.txt
    pers = self.getPersonModule().newContent(portal_type='Person')
    tel = pers.newContent(portal_type='Telephone')
    tel.setTelephoneCountry(33)
    tel.setTelephoneNumber(123456789)
    self.assertEquals('tel:+33123456789', tel.asURL())
    
    tel.setTelephoneCountry(None)
    tel.setTelephoneNumber(123456789)
    self.assertEquals('tel:0123456789', tel.asURL())

Jérome Perrin's avatar
Jérome Perrin committed
1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181

  def test_EmptyTelephoneAsText(self):
    # asText method returns an empty string for empty telephones
    pers = self.getPersonModule().newContent(portal_type='Person')
    self.assertEquals('', pers.newContent(portal_type='Telephone').asText())


  def test_EmptyFaxAsText(self):
    # asText method returns an empty string for empty faxes
    pers = self.getPersonModule().newContent(portal_type='Person')
    self.assertEquals('', pers.newContent(portal_type='Fax').asText())


Jérome Perrin's avatar
Jérome Perrin committed
1182 1183 1184 1185
  def test_EmailAsURL(self):
    # asURL method works on email
    pers = self.getPersonModule().newContent(portal_type='Person')
    pers.setDefaultEmailText('nobody@example.com')
1186
    email = pers.getDefaultEmailValue()
Jérome Perrin's avatar
Jérome Perrin committed
1187
    self.assertEquals('mailto:nobody@example.com', email.asURL())
1188 1189
    self.assertEquals('mailto:nobody@example.com',
                      pers.Entity_getDefaultEmailAsURL())
Jérome Perrin's avatar
Jérome Perrin committed
1190

1191 1192 1193 1194 1195 1196 1197 1198 1199
  def test_LinkAsURL(self):
    person = self.getPersonModule().newContent(portal_type='Person')
    link = person.newContent(portal_type='Link',
                             url_string='http://www.nexedi.com/')
    self.assertEquals(link.asURL(), 'http://www.nexedi.com/')
    link = person.newContent(portal_type='Link',
                             url_string='www.nexedi.com')
    self.assertEquals(link.asURL(), 'http://www.nexedi.com')

1200 1201 1202 1203 1204 1205 1206 1207
  def test_getTranslatedId(self):
    pers = self.getPersonModule().newContent(
                portal_type='Person', id='default_email')
    self.assertEquals(None, pers.getTranslatedId())
    pers.setDefaultEmailText('nobody@example.com')
    email = pers.getDefaultEmailValue()
    self.assertEquals('Default Email', str(email.getTranslatedId()))
    
1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221
  def test_SubordinationAcquisitionAndFunction(self):
    # function is acquired from the subordination, organisation function are
    # usually only nodes, and persons functions are leaves.
    function_node = self.portal.portal_categories.function.newContent(
         portal_type='Category', id='function_node', title='Function Node')
    function_leave = function_node.newContent(
         portal_type='Category', id='function_leave', title='Function Leave')
    self.portal.portal_caches.clearAllCache()
    organisation = self.getOrganisationModule().newContent(
                                  portal_type='Organisation',
                                  function_value=function_node)
    person = self.getPersonModule().newContent(portal_type='Person',
                            career_subordination_value=organisation)
    # on Organisation_view, the user usually select node for functions:
1222 1223 1224 1225 1226 1227 1228 1229 1230
    self.assertEquals([['', ''], ['Function Node', 'function_node']],
      organisation.Organisation_view.my_function.get_value('items'))
    
    # on Person_view, the user select leaves for functions:
    field = person.Person_view.my_career_function
    self.assertTrue('function_node' not in [x[1] for x in
                          field.get_value('items')])
    self.assertTrue('function_node/function_leave' in [x[1] for x in
                          field.get_value('items')])
1231 1232 1233
    # person acquire function from the organisation
    self.assertEquals(person.getFunctionValue(), function_node)
    # but the user interface does not show the acquired value in this case
1234 1235 1236 1237 1238 1239
    self.assertEquals('', field.get_value('default'))
    # (the field is working)
    person.setDefaultCareerFunctionValue(function_leave)
    self.assertEquals(person.getFunctionValue(), function_leave)
    self.assertEquals('function_node/function_leave',
                      field.get_value('default'))
1240

1241

1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260
  def test_CreateBankAccount(self):
    # We can add Bank Accounts inside Persons and Organisation
    for entity in (self.getPersonModule().newContent(portal_type='Person'),
        self.getOrganisationModule().newContent(portal_type='Organisation')):
      bank_account = entity.newContent(portal_type='Bank Account')
      self.assertEquals([], bank_account.checkConsistency())
      bank_account.newContent(portal_type='Agent')
      self.assertEquals([], bank_account.checkConsistency())
      self.portal.portal_workflow.doActionFor(bank_account, 'validate_action')
      self.assertEquals('validated', bank_account.getValidationState())

  def test_CreateImage(self):
    # We can add Images inside Persons and Organisation
    for entity in (self.getPersonModule().newContent(portal_type='Person'),
        self.getOrganisationModule().newContent(portal_type='Organisation')):
      image = entity.newContent(portal_type='Image')
      self.assertEquals([], image.checkConsistency())
      image.view() # viewing the image does not cause error

1261 1262 1263
  def test_ConvertImage(self):
    image = self.portal.newContent(portal_type='Image', id='test_image')
    image.edit(file=self.makeImageFileUpload('erp5_logo.png'))
1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277
    self.assertEqual('image/png', image.getContentType())
    self.assertEqual((320, 250), (image.getWidth(), image.getHeight()))

    from Products.ERP5Type.Document import newTempImage
    def convert(**kw):
      image_type, image_data = image.convert('jpg', display='thumbnail', **kw)
      self.assertEqual('image/jpeg', image_type)
      thumbnail = newTempImage(self.portal, 'thumbnail', data=image_data)
      self.assertEqual(image_type, thumbnail.getContentType())
      self.assertEqual((128, 100), (thumbnail.getWidth(),
                                    thumbnail.getHeight()))
      return thumbnail.getSize()
    self.assertTrue(convert() < convert(quality=100))

1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289
  def test_ConvertImagePdata(self):
    image = self.portal.newContent(portal_type='Image', id='test_image')
    image.edit(file=self.makeImageFileUpload('erp5_logo.bmp'))
    from OFS.Image import Pdata
    self.assertTrue(isinstance(image.data, Pdata))

    image_type, image_data = image.convert('jpg', display='thumbnail')
    self.assertEquals('image/jpeg', image_type)
    # magic
    self.assertEquals('\xff', image_data[0])
    self.assertEquals('\xd8', image_data[1])

1290 1291 1292 1293 1294 1295 1296 1297
  def test_ImageSize(self):
    image = self.portal.newContent(portal_type='Image', id='test_image')
    image.edit(file=self.makeImageFileUpload('erp5_logo.png'))
    self.assertEquals(320, image.getWidth())
    self.assertEquals(250, image.getHeight())
    image.edit(file=self.makeImageFileUpload('erp5_logo_small.png'))
    self.assertEquals(160, image.getWidth())
    self.assertEquals(125, image.getHeight())
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
  def test_Person_getCareerStartDate(self):
    # Person_getCareerStartDate scripts returns the date when an employee
    # started to work for an employer
    first_organisation = self.getOrganisationModule().newContent(
                                  portal_type='Organisation')
    second_organisation = self.getOrganisationModule().newContent(
                                  portal_type='Organisation')
    person = self.getPersonModule().newContent(
              portal_type='Person',
              default_career_subordination_value=first_organisation)
    current_career = person.getDefaultCareerValue()
    current_career.setStartDate(DateTime(2002, 1, 1))
    previous_career = person.newContent(
                              portal_type='Career',
                              subordination_value=first_organisation,
                              start_date=DateTime(2001, 1, 1))
    other_organisation_career= person.newContent(
                              portal_type='Career',
                              subordination_value=second_organisation,
                              start_date=DateTime(1999, 9, 9))
    self.assertEquals(DateTime(2001, 1, 1),
         person.Person_getCareerStartDate(
            subordination_relative_url=first_organisation.getRelativeUrl()))
    self.assertEquals(DateTime(1999, 9, 9),
         person.Person_getCareerStartDate(
            subordination_relative_url=second_organisation.getRelativeUrl()))

    # only validated careers are used (for conveniance, draft careers are
    # accepted as well)
    another_cancelled_career = person.newContent(
                              portal_type='Career',
                              subordination_value=first_organisation,
                              start_date=DateTime(1996, 9, 9))
    another_cancelled_career.cancel()
    self.assertEquals(DateTime(2001, 01, 01),
         person.Person_getCareerStartDate(
            subordination_relative_url=first_organisation.getRelativeUrl()))

  def test_Person_getAge(self):
    person = self.getPersonModule().newContent(
                                  portal_type='Person',
                                  start_date=DateTime(2001, 2, 3))

    self.assertEquals(1,
          person.Person_getAge(year=1, at_date=DateTime(2002, 2, 4)))
    self.assertTrue(person.Person_getAge(year=1) > 5)

    # if year is not passed, the script returns the age in a translated string.
    age_as_text = person.Person_getAge(at_date=DateTime(2002, 2, 4))
Yusei Tahara's avatar
Yusei Tahara committed
1348
    self.assertEquals(age_as_text, "1 years old")
1349

1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365
  def test_AssignmentWorkflow(self):
    person = self.getPersonModule().newContent(portal_type='Person',)
    assignment = person.newContent(portal_type='Assignment')
    self.assertEquals('draft', assignment.getValidationState())
    self.portal.portal_workflow.doActionFor(assignment, 'open_action')
    self.assertEquals('open', assignment.getValidationState())
    self.portal.portal_workflow.doActionFor(assignment, 'update_action')
    self.assertEquals('updated', assignment.getValidationState())
    self.portal.portal_workflow.doActionFor(assignment, 'open_action')
    self.assertEquals('open', assignment.getValidationState())
    # date is set automatically when closing
    self.assertEquals(None, assignment.getStopDate())
    self.portal.portal_workflow.doActionFor(assignment, 'close_action')
    self.assertEquals('closed', assignment.getValidationState())
    self.assertNotEquals(None, assignment.getStopDate())
    self.assertEquals(DateTime().day(), assignment.getStopDate().day())
1366

1367 1368 1369
  def test_ERP5Site_checkDataWithScript(self):
    test = 'test_ERP5Site_checkDataWithScript'
    createZODBPythonScript(self.getSkinsTool().custom, test, '',
1370
                           'return context.absolute_url(relative=1),')
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382

    organisation = self.getOrganisationModule() \
                       .newContent(portal_type='Organisation')
    organisation.setDefaultAddressCity('Lille')
    organisation.setDefaultAddressZipCode('59000')
    person = self.getPersonModule().newContent(portal_type='Person')
    person.setDefaultEmailText('nobody@example.com')

    portal_activities = self.getActivityTool()
    active_process = portal_activities.newActiveProcess()
    portal_activities.ERP5Site_checkDataWithScript(method_id=test, tag=test,
                                       active_process=active_process.getPath())
1383
    transaction.commit()
1384 1385 1386 1387 1388 1389
    self.tic()
    relative_url_list = sum((x.detail.split('\n')
                             for x in active_process.getResultList()), [])

    self.assertEquals(len(relative_url_list), len(set(relative_url_list)))
    for obj in organisation, person, person.getDefaultEmailValue():
1390
      self.assertTrue(obj.absolute_url(relative=1) in relative_url_list)
1391 1392 1393 1394
    for relative_url in relative_url_list:
      self.assertTrue('/' in relative_url)
      self.assertNotEquals(None, self.portal.unrestrictedTraverse(relative_url))

1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408
  def test_standard_translated_related_keys(self):
    # make sure we can search by "translated_validation_state_title" and
    # "translated_portal_type"
    message_catalog = self.portal.Localizer.erp5_ui
    lang = 'fr'
    if lang not in [x['id'] for x in
        self.portal.Localizer.get_languages_map()]:
      self.portal.Localizer.manage_addLanguage(lang)

    message_catalog.gettext('Draft', add=1)
    message_catalog.gettext('Person', add=1)
    message_catalog.message_edit('Draft', lang, 'Brouillon', '')
    message_catalog.message_edit('Person', lang, 'Personne', '')

1409 1410
    self.portal.ERP5Site_updateTranslationTable()

1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434
    person_1 = self.portal.person_module.newContent(portal_type='Person')
    person_1.validate()
    person_2 = self.portal.person_module.newContent(portal_type='Person')
    organisation = self.portal.organisation_module.newContent(
                            portal_type='Organisation')
    transaction.commit()
    self.tic()

    # patch the method, we'll abort later
    self.portal.Localizer.get_selected_language = lambda: lang

    self.assertEquals(set([person_1, person_2]),
        set([x.getObject() for x in
          self.portal.portal_catalog(translated_portal_type='Personne')]))
    self.assertEquals(set([person_2, organisation]),
        set([x.getObject() for x in
          self.portal.portal_catalog(translated_validation_state_title='Brouillon',
                                     portal_type=('Person', 'Organisation'))]))
    self.assertEquals([person_2],
        [x.getObject() for x in
          self.portal.portal_catalog(translated_validation_state_title='Brouillon',
                                     translated_portal_type='Personne')])
    transaction.abort()

1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462
  def test_Base_createCloneDocument(self):
    module = self.portal.person_module
    module.manage_permission('Add portal content', ['Member'], 0)
    self.login_as_auditor()
    person = module.newContent(portal_type='Person',)
    self.assertEquals(1, len(module))
    person.Base_createCloneDocument()
    self.assertEquals(2, len(module))

  def test_Base_createCloneDocument_document_in_document(self):
    module = self.portal.person_module
    module.manage_permission('Add portal content', ['Member'], 0)
    self.login_as_auditor()
    person = module.newContent(portal_type='Person',)
    # An address is a document, it cannot contain anything
    address = person.newContent(portal_type='Address')
    self.assertEquals(0, len(address.allowedContentTypes()))

    self.assertEquals(1, len(person))
    address.Base_createCloneDocument()
    self.assertEquals(2, len(person))

  def test_Base_createCloneDocument_folder_in_document(self):
    module = self.portal.person_module
    module.manage_permission('Add portal content', ['Member'], 0)
    self.login_as_auditor()
    person = module.newContent(portal_type='Person',)
    bank_account = person.newContent(portal_type='Bank Account')
Jérome Perrin's avatar
typo  
Jérome Perrin committed
1463
    # A bank account is a folder, it can contain other documents
1464 1465 1466 1467 1468 1469
    self.assertNotEquals(0, len(bank_account.allowedContentTypes()))

    self.assertEquals(1, len(person))
    bank_account.Base_createCloneDocument()
    self.assertEquals(2, len(person))

1470 1471 1472 1473 1474 1475 1476 1477
  def getWorkflowHistory(self, document, workflow_id):
    return self.portal.portal_workflow.getInfoFor(ob=document, name='history',
        wf_id=workflow_id)

  def test_comment_edit_workflow(self):
    comment = 'some comment'
    person = self.portal.person_module.newContent(portal_type='Person')
    person.edit(comment = comment)
1478
    workflow_history = self.getWorkflowHistory(person, 'edit_workflow')
1479 1480 1481
    # person has property comment with value
    self.assertEqual(person.comment, comment)
    # workflow has no artificial comment
1482 1483
    self.assertFalse(comment in [q['comment'] for q in workflow_history ])

1484 1485 1486 1487 1488 1489 1490 1491 1492 1493
  def test_comment_edit_workflow_store_workflow(self):
    comment = 'some comment'
    person = self.portal.person_module.newContent(portal_type='Person')
    self.portal.portal_workflow.doActionFor(person, 'edit_action', comment=comment)
    workflow_history = self.getWorkflowHistory(person, 'edit_workflow')
    # person is not changed
    self.assertEqual(getattr(person, 'comment', None), None)
    # workflow is affected
    self.assertTrue(comment in [q['comment'] for q in workflow_history ])

1494 1495 1496 1497 1498
  def test_comment_validation_workflow(self):
    comment = 'some comment'
    person = self.portal.person_module.newContent(portal_type='Person')
    person.validate(comment = comment)
    workflow_history = self.getWorkflowHistory(person, 'validation_workflow')
1499
    # person is not changed
1500
    self.assertEqual(getattr(person, 'comment', None), None)
1501
    # workflow is affected
1502
    self.assertTrue(comment in [q['comment'] for q in workflow_history])
1503

1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530
  def test_user_creation(self):
    person = self.portal.person_module.newContent(portal_type='Person')
    assignment = person.newContent(portal_type='Assignment',
                                   group='nexedi')
    self.assertNotEquals(None, assignment.getGroupValue())
    assignment.open()
    self.portal.portal_workflow.doActionFor(person, 'create_user_action',
                  reference='user_login',
                  password='pass',
                  password_confirm='pass')
    transaction.commit()
    self.tic()

    # a user is created
    user = self.portal.acl_users.getUserById('user_login')
    self.assertNotEquals(None, user)

    # and this user has a preference created
    newSecurityManager(None, user.__of__(self.portal.acl_users))
    self.assertNotEquals(None,
        self.portal.portal_catalog.getResultValue(portal_type='Preference',
                                                  owner='user_login'))
    # for his assignent group
    self.assertEquals('group/nexedi',
        self.portal.portal_preferences.getPreferredSectionCategory())


Jérome Perrin's avatar
Jérome Perrin committed
1531 1532
def test_suite():
  suite = unittest.TestSuite()
1533
  suite.addTest(unittest.makeSuite(TestERP5Base))
Jérome Perrin's avatar
Jérome Perrin committed
1534
  return suite