Browse Source

Merge pull request #28 from saif-serpentcs/10.0

[IMP] Improved the Test case for the search method
Serpent Consulting Services Pvt. Ltd 7 years ago
parent
commit
bfa32889a7
2 changed files with 13 additions and 2 deletions
  1. 2 1
      mass_editing/hooks.py
  2. 11 1
      mass_editing/tests/test_mass_editing.py

+ 2 - 1
mass_editing/hooks.py

@@ -8,5 +8,6 @@ def uninstall_hook(cr, registry):
                WHERE res_model = 'mass.editing.wizard'""")
     for res in cr.dictfetchall():
         value = 'ir.actions.act_window,%s' % res.get('id')
-        cr.execute("DELETE FROM ir_values WHERE value = '%s'" % value)
+        cr.execute("""DELETE FROM ir_values WHERE
+        value = '%s' """ % value)
     return True

+ 11 - 1
mass_editing/tests/test_mass_editing.py

@@ -6,7 +6,7 @@ import ast
 
 from odoo.tests import common
 from odoo.modules import registry
-from odoo.addons.mass_editing.hooks import uninstall_hook
+from ..hooks import uninstall_hook
 
 
 class TestMassEditing(common.TransactionCase):
@@ -21,11 +21,21 @@ class TestMassEditing(common.TransactionCase):
         self.partner_model = model_obj.\
             search([('model', '=', 'res.partner')])
         self.user_model = model_obj.search([('model', '=', 'res.users')])
+        # Calling the Search method without context for
+        # the Search from the List view of the Fields
         self.fields_model = self.env['ir.model.fields'].\
             search([('model_id', '=', self.partner_model.id),
                     ('name', 'in', ['email', 'phone', 'category_id', 'comment',
                                     'country_id', 'customer', 'child_ids',
                                     'title'])])
+        # Calling the Search method with context for the Search
+        # model_id field related fields in the fields_ids
+        self.fields_model = self.env['ir.model.fields'].\
+            with_context({'mass_edit': True}).\
+            search([('model_id', '=', self.partner_model.id),
+                    ('name', 'in', ['email', 'phone', 'category_id', 'comment',
+                                    'country_id', 'customer', 'child_ids',
+                                    'title'])])
         self.mass = self._create_mass_editing(self.partner_model,
                                               self.fields_model)
         self.copy_mass = self.mass.copy()