Browse Source

base_phone: Add YAML test

pull/18/head
Alexis de Lattre 10 years ago
parent
commit
0ad368989a
  1. 1
      base_phone/__openerp__.py
  2. 37
      base_phone/test/phonenum.yml

1
base_phone/__openerp__.py

@ -77,6 +77,7 @@ for any help or question about this module.
], ],
'qweb': ['static/src/xml/*.xml'], 'qweb': ['static/src/xml/*.xml'],
'demo': ['base_phone_demo.xml'], 'demo': ['base_phone_demo.xml'],
'test': ['test/phonenum.yml'],
'images': [], 'images': [],
'installable': True, 'installable': True,
} }

37
base_phone/test/phonenum.yml

@ -0,0 +1,37 @@
-
Write french phone numbers in national format
-
!record {model: res.partner, id: partner1}:
name: Pierre Paillet
mobile: 06 42 77 42 66
fax: (0) 1 45 42 12 42
-
Write swiss phone numbers in international format
-
!record {model: res.partner, id: partner2}:
name: Joël Grand-Guillaume
parent_id: base.res_partner_12
phone: +41 21 619 10 10
mobile: +41 79 606 42 42
-
Write invalid phone number
-
!record {model: res.partner, id: partner3}:
name: Jean Badphone
phone: 42
-
Check that valid phone numbers have been converted to E.164
-
!python {model: res.partner}: |
partner1 = self.browse(cr, uid, ref('partner1'), context=context)
assert partner1.mobile == '+33642774266', 'Mobile number not written in E.164 format (partner1)'
assert partner1.fax == '+33145421242', 'Fax number not written in E.164 format (partner1)'
partner2 = self.browse(cr, uid, ref('partner2'), context=context)
assert partner2.phone == '+41216191010', 'Phone number not written in E.164 format (partner2)'
assert partner2.mobile == '+41796064242', 'Mobile number not written in E.164 format (partner2)'
-
Check that invalid phone numbers are kept unchanged
-
!python {model: res.partner}: |
partner3 = self.browse(cr, uid, ref('partner3'), context=context)
assert partner3.phone == '42', 'Invalid phone numbers should not be changed'
Loading…
Cancel
Save