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

Proposed by Virgil Dupras
Status: Needs review
Proposed branch: lp:~savoirfairelinux-openerp/openobject-server/testfix-bug1206557
Merge into: lp:openobject-server/7.0
Diff against target: 46 lines (+8/-5)
2 files modified
openerp/addons/base/tests/test_base.py (+3/-3)
openerp/addons/base/tests/test_expression.py (+5/-2)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/openobject-server/testfix-bug1206557
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+177624@code.launchpad.net

Description of the change

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.

To post a comment you must log in.

Unmerged revisions

5040. By Virgil Dupras

[FIX] Fixed 2 tests in "base" test suite.

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.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/addons/base/tests/test_base.py'
2--- openerp/addons/base/tests/test_base.py 2013-04-25 17:12:38 +0000
3+++ openerp/addons/base/tests/test_base.py 2013-07-30 15:24:45 +0000
4@@ -239,13 +239,13 @@
5 p.refresh()
6 self.assertEquals(p.commercial_partner_id, sunhelm, 'Incorrect commercial entity resolution')
7 self.assertEquals(p.vat, sunhelm.vat, 'Commercial fields must be automatically synced')
8- sunhelmvat = 'BE0123456789'
9+ sunhelmvat = 'BE0123456749'
10 sunhelm.write({'vat': sunhelmvat})
11 for p in (p0, p1, p11, p2):
12 p.refresh()
13 self.assertEquals(p.vat, sunhelmvat, 'Commercial fields must be automatically and recursively synced')
14
15- p1vat = 'BE0987654321'
16+ p1vat = 'BE0987654394'
17 p1.write({'vat': p1vat})
18 for p in (sunhelm, p0, p11, p2):
19 p.refresh()
20@@ -261,7 +261,7 @@
21 self.assertEquals(p1.commercial_partner_id, p1, 'Incorrect commercial entity resolution after setting is_company')
22
23 # writing on parent should not touch child commercial entities
24- sunhelmvat2 = 'BE0112233445'
25+ sunhelmvat2 = 'BE0112233453'
26 sunhelm.write({'vat': sunhelmvat2})
27 p1.refresh()
28 self.assertEquals(p1.vat, p1vat, 'Setting is_company should stop auto-sync of commercial fields')
29
30=== modified file 'openerp/addons/base/tests/test_expression.py'
31--- openerp/addons/base/tests/test_expression.py 2013-04-19 17:31:59 +0000
32+++ openerp/addons/base/tests/test_expression.py 2013-07-30 15:24:45 +0000
33@@ -137,8 +137,11 @@
34 partner_bank_ids_col = partner_obj._columns.get('bank_ids') # one2many on res.partner to res.partner.bank
35 category_id_col = partner_obj._columns.get('category_id') # many2many on res.partner to res.partner.category
36
37- # Get the first bank account type to be able to create a res.partner.bank
38- bank_type = bank_obj._bank_type_get(cr, uid)[0]
39+ # Get the 'bank' bank type to use for partner bank creation. We don't want to use the 'iban'
40+ # type because it entails complicated validations with which we don't want to be involved
41+ # for our test.
42+ bank_types = bank_obj._bank_type_get(cr, uid)
43+ [bank_type] = [(code, name) for code, name in bank_types if code == 'bank']
44 # Get country/state data
45 country_us_id = registry('res.country').search(cr, uid, [('code', 'like', 'US')])[0]
46 state_ids = registry('res.country.state').search(cr, uid, [('country_id', '=', country_us_id)], limit=2)