Browse Source

Fix unittest and another attempt at fixing travis

pull/88/head
Alexis de Lattre 8 years ago
parent
commit
12627f9bc8
  1. 4
      .travis.yml
  2. 14
      base_phone/tests/test_phone.py
  3. 10
      crm_phone/tests/test_crm_phone.py

4
.travis.yml

@ -33,9 +33,9 @@ install:
- travis_install_nightly
- pip install phonenumbers py-Asterisk SOAPpy
- hg clone http://bitbucket.org/anybox/web_action_request -b ${VERSION} ${HOME}/web_action_request
- ln -s ${HOME}/web_action_request/web_action_request /home/travis/build/OCA/connector-telephony
- ln -s ${HOME}/web_action_request/web_action_request /home/travis/odoo-${VERSION}/addons
- hg clone http://bitbucket.org/anybox/bus_enhanced -b ${VERSION} ${HOME}/bus_enhanced
- ln -s ${HOME}/bus_enhanced/bus_enhanced /home/travis/build/OCA/connector-telephony
- ln -s ${HOME}/bus_enhanced/bus_enhanced /home/travis/odoo-${VERSION}/addons
script:
- travis_run_tests

14
base_phone/tests/test_phone.py

@ -17,9 +17,9 @@ class TestPhone(TransactionCase):
'mobile': '06.42.77.42.66',
'fax': '(0) 1 45 42 12 42',
})
self.assertEquals(partner1.phone, u'+33 4 72 08 87 32')
self.assertEquals(partner1.mobile, u'+33 6 42 77 42 66')
self.assertEquals(partner1.fax, u'+33 1 45 42 12 42')
self.assertEquals(partner1.phone, u'+33 4 72 08 87 32')
self.assertEquals(partner1.mobile, u'+33 6 42 77 42 66')
self.assertEquals(partner1.fax, u'+33 1 45 42 12 42')
# Create a partner with country
self.env.ref('base.res_partner_12').country_id =\
self.env.ref('base.ch').id
@ -31,19 +31,19 @@ class TestPhone(TransactionCase):
'mobile': '(0) 79 606 42 42',
})
self.assertEquals(partner2.country_id, self.env.ref('base.ch'))
self.assertEquals(partner2.phone, u'+41 21 619 10 10')
self.assertEquals(partner2.mobile, u'+41 79 606 42 42')
self.assertEquals(partner2.phone, u'+41 21 619 10 10')
self.assertEquals(partner2.mobile, u'+41 79 606 42 42')
# Write on an existing partner
agrolait = self.env.ref('base.res_partner_2')
self.assertEquals(agrolait.country_id, self.env.ref('base.be'))
agrolait.write({'phone': '(0) 2 391 43 74'})
self.assertEquals(agrolait.phone, u'+32 2 391 43 74')
self.assertEquals(agrolait.phone, u'+32 2 391 43 74')
# Write on an existing partner with country at the same time
agrolait.write({
'fax': '04 72 89 32 43',
'country_id': self.env.ref('base.fr').id,
})
self.assertEquals(agrolait.fax, u'+33 4 72 89 32 43')
self.assertEquals(agrolait.fax, u'+33 4 72 89 32 43')
# Write an invalid phone number
partner2.fax = '42'
self.assertEquals(partner2.fax, u'42')

10
crm_phone/tests/test_crm_phone.py

@ -17,8 +17,8 @@ class TestCRMPhone(TransactionCase):
'fax': '(0) 1 45 44 42 43',
'country_id': self.env.ref('base.fr').id,
})
self.assertEquals(lead1.mobile, u'+33 6 42 77 42 77')
self.assertEquals(lead1.fax, u'+33 1 45 44 42 43')
self.assertEquals(lead1.mobile, u'+33 6 42 77 42 77')
self.assertEquals(lead1.fax, u'+33 1 45 44 42 43')
lead2 = clo.create({
'name': u'Automobile Odoo deployment',
'partner_name': u'Kia',
@ -26,19 +26,19 @@ class TestCRMPhone(TransactionCase):
'country_id': self.env.ref('base.ch').id,
'phone': '04 31 23 45 67',
})
self.assertEquals(lead2.phone, u'+41 43 123 45 67')
self.assertEquals(lead2.phone, u'+41 43 123 45 67')
lead3 = clo.create({
'name': 'Angela Strasse',
'country_id': self.env.ref('base.de').id,
})
lead3.write({'phone': '08912345678'})
self.assertEquals(lead3.phone, u'+49 89 12345678')
self.assertEquals(lead3.phone, u'+49 89 12345678')
lead4 = clo.create({
'name': 'Large Odoo deployment',
'partner_id': self.env.ref('base.res_partner_2').id,
})
lead4.write({'mobile': '(0) 2-391-43-75'})
self.assertEquals(lead4.mobile, u'+32 2 391 43 75')
self.assertEquals(lead4.mobile, u'+32 2 391 43 75')
pco = self.env['phone.common']
name = pco.get_name_from_phone_number('0642774277')
self.assertEquals(name, 'Jacques Toufaux (Ford)')

Loading…
Cancel
Save