← Back to team overview

savoirfairelinux-openerp team mailing list archive

lp:~savoirfairelinux-openerp/openobject-server/testfix-bug1206557 into lp:openobject-server/7.0

 

Virgil Dupras has proposed merging lp:~savoirfairelinux-openerp/openobject-server/testfix-bug1206557 into lp:openobject-server/7.0.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #1206557 in OpenERP Server: "Failures in "base" test suite related to IBAN and VAT"
  https://bugs.launchpad.net/openobject-server/+bug/1206557

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/openobject-server/testfix-bug1206557/+merge/177624

When running the test suite for the "base" module, I get two failures.

The first one is about VAT validation. The dummy VAT numbers used are not valid Belgian VAT numbers and this causes a validation error which causes the test to wrongly fail. I've changed the VAT numbers to be valid ones

The second one is about bank accounts. The test creates dummy partner/bank relation and uses the first available bank type which, on my machine, happens to be the "iban" type. This type entails extra validation which make the test prematurely fail. I've made sure that the bank type used is the "bank" type.
-- 
https://code.launchpad.net/~savoirfairelinux-openerp/openobject-server/testfix-bug1206557/+merge/177624
Your team Savoir-faire Linux' OpenERP is subscribed to branch lp:~savoirfairelinux-openerp/openobject-server/testfix-bug1206557.
=== modified file 'openerp/addons/base/tests/test_base.py'
--- openerp/addons/base/tests/test_base.py	2013-04-25 17:12:38 +0000
+++ openerp/addons/base/tests/test_base.py	2013-07-30 15:24:45 +0000
@@ -239,13 +239,13 @@
             p.refresh()
             self.assertEquals(p.commercial_partner_id, sunhelm, 'Incorrect commercial entity resolution')
             self.assertEquals(p.vat, sunhelm.vat, 'Commercial fields must be automatically synced')
-        sunhelmvat = 'BE0123456789'
+        sunhelmvat = 'BE0123456749'
         sunhelm.write({'vat': sunhelmvat})
         for p in (p0, p1, p11, p2):
             p.refresh()
             self.assertEquals(p.vat, sunhelmvat, 'Commercial fields must be automatically and recursively synced')
 
-        p1vat = 'BE0987654321'
+        p1vat = 'BE0987654394'
         p1.write({'vat': p1vat})
         for p in (sunhelm, p0, p11, p2):
             p.refresh()
@@ -261,7 +261,7 @@
         self.assertEquals(p1.commercial_partner_id, p1, 'Incorrect commercial entity resolution after setting is_company')
 
         # writing on parent should not touch child commercial entities
-        sunhelmvat2 = 'BE0112233445'
+        sunhelmvat2 = 'BE0112233453'
         sunhelm.write({'vat': sunhelmvat2})
         p1.refresh()
         self.assertEquals(p1.vat, p1vat, 'Setting is_company should stop auto-sync of commercial fields')

=== modified file 'openerp/addons/base/tests/test_expression.py'
--- openerp/addons/base/tests/test_expression.py	2013-04-19 17:31:59 +0000
+++ openerp/addons/base/tests/test_expression.py	2013-07-30 15:24:45 +0000
@@ -137,8 +137,11 @@
         partner_bank_ids_col = partner_obj._columns.get('bank_ids')  # one2many on res.partner to res.partner.bank
         category_id_col = partner_obj._columns.get('category_id')  # many2many on res.partner to res.partner.category
 
-        # Get the first bank account type to be able to create a res.partner.bank
-        bank_type = bank_obj._bank_type_get(cr, uid)[0]
+        # Get the 'bank' bank type to use for partner bank creation. We don't want to use the 'iban'
+        # type because it entails complicated validations with which we don't want to be involved
+        # for our test.
+        bank_types = bank_obj._bank_type_get(cr, uid)
+        [bank_type] = [(code, name) for code, name in bank_types if code == 'bank']
         # Get country/state data
         country_us_id = registry('res.country').search(cr, uid, [('code', 'like', 'US')])[0]
         state_ids = registry('res.country.state').search(cr, uid, [('country_id', '=', country_us_id)], limit=2)