Commit 8af811a4 authored by Georgios Dagkakis's avatar Georgios Dagkakis

testERP5Base: add a test to check reachability_workflow and coordinate_interaction_workflow

for Coordinates

Test also checks accessors like getDefaultEmailValidationState.
parent bb930866
......@@ -1460,6 +1460,168 @@ class TestERP5Base(ERP5TypeTestCase):
],
)
def test_CoordinateReachability(self):
'''
Check the reachability_workflow and coordinate_interaction_workflow
for Coordinates.
Test also checks accessors like getDefaultEmailValidationState.
'''
portal_type = 'Person'
person_module = self.portal.getDefaultModule(portal_type)
person = person_module.newContent(portal_type=portal_type)
# Address
address = person.newContent(portal_type='Address')
self.assertEqual(address.getValidationState(), 'reachable')
address.declareUnreachable()
self.assertEqual(address.getValidationState(), 'unreachable')
address.setStreetAddress('Rue Nationale')
self.assertEqual(address.getValidationState(), 'reachable')
self.tic()
address.declareUnreachable()
self.assertEqual(address.getValidationState(), 'unreachable')
address.setZipCode('59000')
self.assertEqual(address.getValidationState(), 'reachable')
self.tic()
address.declareUnreachable()
self.assertEqual(address.getValidationState(), 'unreachable')
address.setCity('Lille')
self.assertEqual(address.getValidationState(), 'reachable')
self.tic()
address.declareUnreachable()
self.assertEqual(address.getValidationState(), 'unreachable')
address.setRegionValue(self.portal.portal_categories.region.europe.france)
self.assertEqual(address.getValidationState(), 'reachable')
self.tic()
address.declareUnreachable()
self.assertEqual(address.getValidationState(), 'unreachable')
address.edit(zip_code='59160', street_address='Rue Victor Hugo')
self.assertEqual(address.getValidationState(), 'reachable')
# Telephone
person.setMobileTelephoneCoordinateText('+12345')
telephone = person.mobile_telephone
self.assertEqual(person.getMobileTelephoneValidationState(), 'reachable')
self.tic()
telephone.declareUnreachable()
self.assertEqual(person.getMobileTelephoneValidationState(), 'unreachable')
telephone.setTelephoneCountry('33')
self.assertEqual(person.getMobileTelephoneValidationState(), 'reachable')
self.tic()
telephone.declareUnreachable()
self.assertEqual(person.getMobileTelephoneValidationState(), 'unreachable')
telephone.setTelephoneArea('0')
self.assertEqual(person.getMobileTelephoneValidationState(), 'reachable')
self.tic()
telephone.declareUnreachable()
self.assertEqual(person.getMobileTelephoneValidationState(), 'unreachable')
telephone.setTelephoneCity('07')
self.assertEqual(person.getMobileTelephoneValidationState(), 'reachable')
self.tic()
telephone.declareUnreachable()
self.assertEqual(person.getMobileTelephoneValidationState(), 'unreachable')
telephone.setTelephoneNumber('12345678')
self.assertEqual(person.getMobileTelephoneValidationState(), 'reachable')
self.tic()
telephone.declareUnreachable()
self.assertEqual(person.getMobileTelephoneValidationState(), 'unreachable')
telephone.setTelephoneExtension('0')
self.assertEqual(person.getMobileTelephoneValidationState(), 'reachable')
self.tic()
telephone.declareUnreachable()
self.assertEqual(person.getMobileTelephoneValidationState(), 'unreachable')
telephone.edit(telephone_country='30', telephone_number='12345670')
self.assertEqual(person.getMobileTelephoneValidationState(), 'reachable')
self.tic()
telephone.declareUnreachable()
telephone.setCoordinateText('+33-123.456.789')
self.assertEqual(person.getMobileTelephoneValidationState(), 'reachable')
self.tic()
telephone.declareUnreachable()
telephone.setMobileTelephoneCoordinateText('+33-123.456.780')
self.assertEqual(person.getMobileTelephoneValidationState(), 'reachable')
self.tic()
telephone.declareUnreachable()
telephone.edit(coordinate_text='+33-789 456 123 ')
self.assertEqual(person.getMobileTelephoneValidationState(), 'reachable')
# Check also that id we change a non-coordinate nothing happens
self.tic()
telephone.declareUnreachable()
telephone.edit(description="This must be old number", title="telephone")
self.assertEqual(person.getMobileTelephoneValidationState(), 'unreachable')
# Fax
person.setFaxCoordinateText('+12345')
fax = person.default_fax
self.assertEqual(person.getDefaultFaxValidationState(), 'reachable')
self.tic()
fax.declareUnreachable()
self.assertEqual(person.getDefaultFaxValidationState(), 'unreachable')
fax.setTelephoneCountry('33')
self.assertEqual(person.getDefaultFaxValidationState(), 'reachable')
self.tic()
fax.declareUnreachable()
self.assertEqual(person.getDefaultFaxValidationState(), 'unreachable')
fax.setTelephoneArea('0')
self.assertEqual(person.getDefaultFaxValidationState(), 'reachable')
self.tic()
fax.declareUnreachable()
self.assertEqual(person.getDefaultFaxValidationState(), 'unreachable')
fax.setTelephoneCity('07')
self.assertEqual(person.getDefaultFaxValidationState(), 'reachable')
self.tic()
fax.declareUnreachable()
self.assertEqual(person.getDefaultFaxValidationState(), 'unreachable')
fax.setTelephoneNumber('12345678')
self.assertEqual(person.getDefaultFaxValidationState(), 'reachable')
self.tic()
fax.declareUnreachable()
self.assertEqual(person.getDefaultFaxValidationState(), 'unreachable')
fax.setTelephoneExtension('0')
self.assertEqual(person.getDefaultFaxValidationState(), 'reachable')
self.tic()
fax.declareUnreachable()
self.assertEqual(person.getDefaultFaxValidationState(), 'unreachable')
fax.setDefaultFaxTelephoneExtension('0')
self.assertEqual(person.getDefaultFaxValidationState(), 'reachable')
# Email
person.setDefaultEmailCoordinateText('test@mail1.com')
email = person.default_email
self.assertEqual(person.getDefaultEmailValidationState(), 'reachable')
self.tic()
email.declareUnreachable()
self.assertEqual(person.getDefaultEmailValidationState(), 'unreachable')
email.setCoordinateText('test@mail2.com')
self.assertEqual(person.getDefaultEmailValidationState(), 'reachable')
self.tic()
email.declareUnreachable()
self.assertEqual(person.getDefaultEmailValidationState(), 'unreachable')
person.setDefaultEmailCoordinateText('test@mail3.com')
self.assertEqual(person.getDefaultEmailValidationState(), 'reachable')
# External Identifier
external_identifier = person.newContent(portal_type='External Identifier')
self.assertEqual(external_identifier.getValidationState(), 'reachable')
self.tic()
external_identifier.declareUnreachable()
self.assertEqual(external_identifier.getValidationState(), 'unreachable')
external_identifier.setCoordinateText('test')
self.assertEqual(external_identifier.getValidationState(), 'reachable')
# Link
link = person.newContent(portal_type='Link')
self.assertEqual(link.getValidationState(), 'reachable')
self.tic()
link.declareUnreachable()
self.assertEqual(link.getValidationState(), 'unreachable')
link.setUrlString('www.dummy-link.com')
self.assertEqual(link.getValidationState(), 'reachable')
# Chat Address
chat_address = person.newContent(portal_type='Chat Address')
self.assertEqual(chat_address.getValidationState(), 'reachable')
self.tic()
chat_address.declareUnreachable()
self.assertEqual(chat_address.getValidationState(), 'unreachable')
chat_address.setUrlString('www.dummy-chat.com')
self.assertEqual(chat_address.getValidationState(), 'reachable')
# Do a final tic to make sure no activities fail
self.tic()
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Base))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment