Skip to content

Commit

Permalink
[IMP] minor perf improvement during tests
Browse files Browse the repository at this point in the history
During tests, some creation of user records would unnecessarily trigger
password reset or set a password, both of which would trigger password
hashing which takes some time (for good reasons).

Fix by:
* passing no_reset_password in YAML tests and some Python tests still
  missing it (a number of Python tests already used it)
* removing passwords from YAML records as they're never necessary, the
  test user records are not expected to ever log in
  • Loading branch information
xmo-odoo committed Jun 26, 2015
1 parent 6cb3fe4 commit f5b88f6
Show file tree
Hide file tree
Showing 25 changed files with 22 additions and 60 deletions.
4 changes: 1 addition & 3 deletions addons/account/test/account_test_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: Accountant
login: acc
password: acc
email: [email protected]
-
I added groups for Accountant.
Expand All @@ -21,12 +20,11 @@
company_id: base.main_company
name: Financial Manager
login: fm
password: fm
email: [email protected]
-
I added groups for Financial Manager.
-
!record {model: res.users, id: res_users_account_manager}:
groups_id:
- account.group_account_manager
- base.group_partner_manager
- base.group_partner_manager
2 changes: 0 additions & 2 deletions addons/account_voucher/test/account_voucher_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: Voucher Accountant
login: vacc
password: acc
email: [email protected]
-
I added groups to Accountant for account voucher.
Expand All @@ -21,7 +20,6 @@
company_id: base.main_company
name: Financial Manager for voucher
login: fmv
password: fmv
email: [email protected]
-
I added groups to Financial Manager for account voucher.
Expand Down
2 changes: 0 additions & 2 deletions addons/auth_signup/auth_signup_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
<record id="default_template_user" model="res.users">
<field name="name">Template User</field>
<field name="login">portaltemplate</field>
<!-- No password: this template user doesn't need to log in -->
<field name="password"></field>
<field name="active" eval="False"/>
<!-- Avoid auto-including this user in any default group, just like a typical portal member -->
<field name="groups_id" eval="[(6, 0, [ref('base.group_portal')])]"/>
Expand Down
2 changes: 0 additions & 2 deletions addons/crm/test/crm_access_group_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: Crm Sales manager
login: csm
password: csm
email: [email protected]
-
I added groups for Crm Salesmanager.
Expand All @@ -20,7 +19,6 @@
company_id: base.main_company
name: Crm Salesman
login: csu
password: csu
email: [email protected]
-
I added groups for Crm Salesman.
Expand Down
4 changes: 0 additions & 4 deletions addons/crm/test/lead2opportunity_assign_salesmen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@
!record {model: res.users, id: test_res_user_01}:
name: 'Test user A'
login: '[email protected]'
new_password: 'tua'
-
!record {model: res.users, id: test_res_user_02}:
name: 'Test user B'
login: '[email protected]'
new_password: 'tub'
-
!record {model: res.users, id: test_res_user_03}:
name: 'Test user C'
login: '[email protected]'
new_password: 'tuc'
-
!record {model: res.users, id: test_res_user_04}:
name: 'Test user D'
login: '[email protected]'
new_password: 'tud'
-
Salesman also creates lead so giving access rights of salesman.
-
Expand Down
2 changes: 0 additions & 2 deletions addons/event/test/ui/event_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: Event manager
login: em
password: em
email: [email protected]
-
I added groups for Event manager.
Expand All @@ -20,7 +19,6 @@
company_id: base.main_company
name: User
login: eu
password: eu
email: [email protected]
-
I added groups for Event user.
Expand Down
3 changes: 0 additions & 3 deletions addons/hr/test/hr_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: HR manager
login: hrm
password: hrm
-
I added groups for HR Manager.
-
Expand All @@ -19,7 +18,6 @@
company_id: base.main_company
name: HR Officer
login: hro
password: hro
email: [email protected]
-
I added groups for HR Officer.
Expand All @@ -34,7 +32,6 @@
company_id: base.main_company
name: Employee
login: emp
password: emp
-
I added groups for Employee.
-
Expand Down
1 change: 0 additions & 1 deletion addons/hr_attendance/test/attendance_process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: HR Officer
login: ao
password: ao
-
I added groups for HR Attendance Officer.
-
Expand Down
1 change: 0 additions & 1 deletion addons/hr_recruitment/test/recruitment_process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: HR Recruitment Officer
login: hrro
password: hrro
email: [email protected]
-
I added groups for HR Recruitment Officer.
Expand Down
3 changes: 0 additions & 3 deletions addons/hr_timesheet/test/hr_timesheet_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: HR timesheet manager
login: hrtm
password: hrtm
-
I added groups for HR timesheet Manager.
-
Expand All @@ -19,7 +18,6 @@
company_id: base.main_company
name: HR timesheet Officer
login: hrto
password: hrto
-
I added groups for HR timesheet Officer.
-
Expand All @@ -33,7 +31,6 @@
company_id: base.main_company
name: Timesheet Employee
login: empt
password: empt
-
I added groups for Timesheet Employee.
-
Expand Down
4 changes: 2 additions & 2 deletions addons/mail/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ def send_email(self, cr, uid, message, *args, **kwargs):
'login': 'raoul',
'alias_name': 'raoul',
'groups_id': [(6, 0, [cls.group_employee_id])]
})
}, {'no_reset_password': True})
cls.user_bert_id = cls.res_users.create(cr, uid, {
'name': 'Bert Tartignole',
'signature': 'SignBert',
'email': '[email protected]',
'login': 'bert',
'alias_name': 'bert',
'groups_id': [(6, 0, [])]
})
}, {'no_reset_password': True})
cls.user_raoul = cls.res_users.browse(cr, uid, cls.user_raoul_id)
cls.user_bert = cls.res_users.browse(cr, uid, cls.user_bert_id)
cls.user_admin = cls.res_users.browse(cr, uid, uid)
Expand Down
4 changes: 1 addition & 3 deletions addons/mrp/test/mrp_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: MRP Manager
login: mam
password: mam
email: [email protected]
-
I added groups for MRP Manager.
Expand All @@ -21,11 +20,10 @@
company_id: base.main_company
name: MRP User
login: mau
password: mau
email: [email protected]
-
I added groups for MRP User.
-
!record {model: res.users, id: res_users_mrp_user}:
groups_id:
- mrp.group_mrp_user
- mrp.group_mrp_user
1 change: 0 additions & 1 deletion addons/mrp_operations/test/workcenter_operations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: MRP User
login: maou
password: maou
email: [email protected]
-
I added groups for MRP User.
Expand Down
4 changes: 1 addition & 3 deletions addons/mrp_repair/test/mrp_repair_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: MRP Manager
login: marm
password: marm
email: [email protected]
-
I added groups for MRP Repair Manager.
Expand All @@ -20,11 +19,10 @@
company_id: base.main_company
name: MRP User
login: maru
password: maru
email: [email protected]
-
I added groups for MRP Repair User.
-
!record {model: res.users, id: res_mrp_repair_user}:
groups_id:
- mrp.group_mrp_user
- mrp.group_mrp_user
7 changes: 6 additions & 1 deletion addons/portal/tests/test_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ def setUpClass(cls):
cls.group_portal_id = cls.env.ref('base.group_portal').id

# Create Chell (portal user)
cls.user_chell_id = cls.res_users.create(cr, uid, {'name': 'Chell Gladys', 'login': 'chell', 'email': '[email protected]', 'groups_id': [(6, 0, [cls.group_portal_id])]})
cls.user_chell_id = cls.res_users.create(cr, uid, {
'name': 'Chell Gladys',
'login': 'chell',
'email': '[email protected]',
'groups_id': [(6, 0, [cls.group_portal_id])]
}, {'no_reset_password': True})
cls.user_chell = cls.res_users.browse(cr, uid, cls.user_chell_id)
cls.partner_chell_id = cls.user_chell.partner_id.id

Expand Down
6 changes: 3 additions & 3 deletions addons/portal_project/tests/test_access_rights.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ def setUp(self):
'login': 'chell',
'alias_name': 'chell',
'groups_id': [(6, 0, [self.group_portal_id])]
})
}, {'no_reset_password': True})
self.user_public_id = self.res_users.create(cr, uid, {
'name': 'Donovan Public',
'login': 'donovan',
'alias_name': 'donovan',
'groups_id': [(6, 0, [self.group_public_id])]
})
}, {'no_reset_password': True})
self.user_manager_id = self.res_users.create(cr, uid, {
'name': 'Eustache Manager',
'login': 'eustache',
'alias_name': 'eustache',
'groups_id': [(6, 0, [self.group_project_manager_id])]
})
}, {'no_reset_password': True})

# Test 'Pigs' project
self.project_pigs_id = self.project_project.create(cr, uid, {
Expand Down
6 changes: 3 additions & 3 deletions addons/project/tests/test_project_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ def setUpClass(cls):
'alias_name': 'armande',
'email': '[email protected]',
'groups_id': [(6, 0, [cls.group_employee_id, cls.group_project_user_id])]
})
}, {'no_reset_password': True})
cls.user_projectmanager_id = cls.res_users.create(cr, uid, {
'name': 'Bastien ProjectManager',
'login': 'bastien',
'alias_name': 'bastien',
'email': '[email protected]',
'groups_id': [(6, 0, [cls.group_employee_id, cls.group_project_manager_id])]
})
}, {'no_reset_password': True})
cls.user_none_id = cls.res_users.create(cr, uid, {
'name': 'Charlie Avotbonkeur',
'login': 'charlie',
'alias_name': 'charlie',
'email': '[email protected]',
'groups_id': [(6, 0, [])]
})
}, {'no_reset_password': True})
cls.user_projectuser = cls.res_users.browse(cr, uid, cls.user_projectuser_id)
cls.user_projectmanager = cls.res_users.browse(cr, uid, cls.user_projectmanager_id)
cls.partner_projectuser_id = cls.user_projectuser.partner_id.id
Expand Down
4 changes: 1 addition & 3 deletions addons/project_issue/test/issue_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: Project Manager
login: prim
password: prim
email: [email protected]
-
I added groups for Project manager.
Expand All @@ -20,11 +19,10 @@
company_id: base.main_company
name: Project User
login: priu
password: priu
email: [email protected]
-
I added groups for Project user.
-
!record {model: res.users, id: res_users_project_issue_user}:
groups_id:
- project.group_project_user
- project.group_project_user
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: HR Manager
login: hr
password: hr
groups_id:
- base.group_hr_manager
-
Expand Down
2 changes: 0 additions & 2 deletions addons/purchase/test/ui/purchase_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: Purchase Manager
login: pm
password: pm
email: [email protected]
-
I added groups for Purchase manager.
Expand All @@ -20,7 +19,6 @@
company_id: base.main_company
name: Purchase User
login: pu
password: pu
email: [email protected]
-
I added groups for Purchase user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: Purchase requisition Manager
login: prm
password: prm
email: [email protected]
-
I added groups for Purchase Requisition Manager.
Expand All @@ -20,11 +19,10 @@
company_id: base.main_company
name: Purchase requisition User
login: pru
password: pru
email: [email protected]
-
I added groups for Purchase Requisition User.
-
!record {model: res.users, id: res_users_purchase_requisition_user}:
groups_id:
- purchase_requisition.group_purchase_requisition_user
- purchase_requisition.group_purchase_requisition_user
2 changes: 0 additions & 2 deletions addons/sale/test/create_sale_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
company_id: base.main_company
name: Sales manager
login: sm
password: sm
email: [email protected]
-
I added groups for Salesmanager.
Expand All @@ -20,7 +19,6 @@
company_id: base.main_company
name: Salesman
login: su
password: su
email: [email protected]
-
I added groups for Salesman.
Expand Down
Loading

0 comments on commit f5b88f6

Please sign in to comment.