Merge lp:~openerp-dev/openobject-addons/7.0-opw-603100-rgo into lp:openobject-addons/7.0

Proposed by Anaël Closson (openerp)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-603100-rgo
Merge into: lp:openobject-addons/7.0
Diff against target: 122 lines (+12/-12)
5 files modified
email_template/tests/test_mail.py (+1/-1)
mail/tests/test_invite.py (+1/-1)
mail/tests/test_mail_base.py (+2/-2)
mail/tests/test_mail_features.py (+5/-5)
portal/tests/test_portal.py (+3/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-603100-rgo
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+209015@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

9860. By Ravi Gohil (OpenERP)

[FIX] Fixed translation issues(which leads the test cases to fail) for the unittests which is faced when installing/updating the mail module with default lang other than English set in OE server config file. (Maintenance Case: 603100)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'email_template/tests/test_mail.py'
2--- email_template/tests/test_mail.py 2014-01-14 13:46:27 +0000
3+++ email_template/tests/test_mail.py 2014-03-03 09:17:35 +0000
4@@ -204,7 +204,7 @@
5 @mute_logger('openerp.osv.orm', 'openerp.osv.orm')
6 def test_10_email_templating(self):
7 """ Tests designed for the mail.compose.message wizard updated by email_template. """
8- cr, uid, context = self.cr, self.uid, {}
9+ cr, uid, context = self.cr, self.uid, {'lang': 'en_US'}
10
11 # create the email.template on mail.group model
12 group_model_id = self.registry('ir.model').search(cr, uid, [('model', '=', 'mail.group')])[0]
13
14=== modified file 'mail/tests/test_invite.py'
15--- mail/tests/test_invite.py 2012-12-12 10:42:20 +0000
16+++ mail/tests/test_invite.py 2014-03-03 09:17:35 +0000
17@@ -30,7 +30,7 @@
18
19 # Do: create a mail_wizard_invite, validate it
20 self._init_mock_build_email()
21- context = {'default_res_model': 'mail.group', 'default_res_id': self.group_pigs_id}
22+ context = {'default_res_model': 'mail.group', 'default_res_id': self.group_pigs_id, 'lang': 'en_US'}
23 mail_invite_id = mail_invite.create(cr, self.user_raoul_id, {'partner_ids': [(4, self.partner_bert_id)]}, context)
24 mail_invite.add_followers(cr, self.user_raoul_id, [mail_invite_id], {'default_model': 'mail.group', 'default_res_id': 0})
25
26
27=== modified file 'mail/tests/test_mail_base.py'
28--- mail/tests/test_mail_base.py 2013-03-20 11:41:11 +0000
29+++ mail/tests/test_mail_base.py 2014-03-03 09:17:35 +0000
30@@ -40,7 +40,7 @@
31
32 def setUp(self):
33 super(TestMailBase, self).setUp()
34- cr, uid = self.cr, self.uid
35+ cr, uid, context = self.cr, self.uid, {'lang': 'en_US'}
36
37 # Install mock SMTP gateway
38 self._init_mock_build_email()
39@@ -84,7 +84,7 @@
40 self.group_pigs_id = self.mail_group.create(cr, uid,
41 {'name': 'Pigs', 'description': 'Fans of Pigs, unite !'},
42 {'mail_create_nolog': True})
43- self.group_pigs = self.mail_group.browse(cr, uid, self.group_pigs_id)
44+ self.group_pigs = self.mail_group.browse(cr, uid, self.group_pigs_id, context)
45
46 def tearDown(self):
47 # Remove mocks
48
49=== modified file 'mail/tests/test_mail_features.py'
50--- mail/tests/test_mail_features.py 2013-08-23 12:06:11 +0000
51+++ mail/tests/test_mail_features.py 2014-03-03 09:17:35 +0000
52@@ -228,7 +228,7 @@
53
54 def test_20_message_post(self):
55 """ Tests designed for message_post. """
56- cr, uid, user_raoul, group_pigs = self.cr, self.uid, self.user_raoul, self.group_pigs
57+ cr, uid, user_raoul, group_pigs, context = self.cr, self.uid, self.user_raoul, self.group_pigs, {'lang': 'en_US'}
58
59 # --------------------------------------------------
60 # Data creation
61@@ -288,7 +288,7 @@
62 msg1_id = self.mail_group.message_post(cr, user_raoul.id, self.group_pigs_id,
63 body=_body1, subject=_subject, partner_ids=[p_b_id, p_c_id],
64 attachment_ids=[attach1_id, attach2_id], attachments=_attachments,
65- type='comment', subtype='mt_comment')
66+ type='comment', subtype='mt_comment', context=context)
67 msg = self.mail_message.browse(cr, uid, msg1_id)
68 msg_message_id = msg.message_id
69 msg_pids = [partner.id for partner in msg.notified_partner_ids]
70@@ -387,7 +387,7 @@
71 msg2_id = self.mail_group.message_post(cr, user_raoul.id, self.group_pigs_id,
72 body=_body2, type='email', subtype='mt_comment',
73 partner_ids=[p_d_id], parent_id=msg1_id, attachment_ids=[attach3_id],
74- context={'mail_post_autofollow': True})
75+ context=dict(context, mail_post_autofollow=True))
76 msg = self.mail_message.browse(cr, uid, msg2_id)
77 msg_pids = [partner.id for partner in msg.notified_partner_ids]
78 msg_aids = [attach.id for attach in msg.attachment_ids]
79@@ -667,7 +667,7 @@
80 return body.replace(' ', '').replace('\n', '')
81
82 # Data: subscribe Raoul to Pigs, because he will change the public attribute and may loose access to the record
83- cr, uid = self.cr, self.uid
84+ cr, uid, context = self.cr, self.uid, {'lang': 'en_US'}
85 self.mail_group.message_subscribe_users(cr, uid, [self.group_pigs_id], [self.user_raoul_id])
86
87 # Data: res.users.group, to test group_public_id automatic logging
88@@ -728,7 +728,7 @@
89 self.assertIn(u'Pigs\u2192supername', _strip_string_spaces(last_msg.body), 'tracked feature: message body does not hold always tracked field')
90
91 # Test: change public as public, group_public_id -> 1 subtype, name always tracked
92- self.mail_group.write(cr, self.user_raoul_id, [self.group_pigs_id], {'public': 'public', 'group_public_id': group_system_id})
93+ self.mail_group.write(cr, self.user_raoul_id, [self.group_pigs_id], {'public': 'public', 'group_public_id': group_system_id}, context)
94 self.group_pigs.refresh()
95 self.assertEqual(len(self.group_pigs.message_ids), 4, 'tracked: one message should have been produced')
96 # Test: first produced message: mt_group_public_id, with name always tracked, public tracked on change
97
98=== modified file 'portal/tests/test_portal.py'
99--- portal/tests/test_portal.py 2013-11-19 17:56:58 +0000
100+++ portal/tests/test_portal.py 2014-03-03 09:17:35 +0000
101@@ -110,7 +110,7 @@
102
103 # Do: create a mail_wizard_invite, validate it
104 self._init_mock_build_email()
105- context = {'default_res_model': 'mail.group', 'default_res_id': self.group_pigs_id}
106+ context = {'default_res_model': 'mail.group', 'default_res_id': self.group_pigs_id, 'lang': 'en_US'}
107 mail_invite_id = mail_invite.create(cr, uid, {'partner_ids': [(4, partner_carine_id)]}, context)
108 mail_invite.add_followers(cr, uid, [mail_invite_id])
109
110@@ -137,10 +137,10 @@
111 'body of invitation email does not contain signup url')
112
113 def test_20_message_read(self):
114- cr, uid, group_port_id = self.cr, self.uid, self.group_port_id
115+ cr, uid, group_port_id, context = self.cr, self.uid, self.group_port_id, {'lang': 'en_US'}
116
117 # Data: custom subtypes
118- mt_group_public_id = self.mail_message_subtype.create(cr, uid, {'name': 'group_public', 'description': 'Group changed'})
119+ mt_group_public_id = self.mail_message_subtype.create(cr, uid, {'name': 'group_public', 'description': 'Group changed'}, context)
120 self.ir_model_data.create(cr, uid, {'name': 'mt_group_public', 'model': 'mail.message.subtype', 'module': 'mail', 'res_id': mt_group_public_id})
121 # Data: post messages with various subtypes
122 msg1_id = self.mail_group.message_post(cr, uid, group_port_id, body='Body1', type='comment', subtype='mail.mt_comment')