Skip to content

Commit

Permalink
Fix issue with mock cursor in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanc-me committed Jul 30, 2024
1 parent 8dde183 commit 1a89c3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions users_ldap_groups/tests/test_users_ldap_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
def mock_cursor(cr):
with mock.patch("odoo.sql_db.Connection.cursor") as mocked_cursor_call:
org_close = cr.close
org_autocommit = cr.autocommit
org_autocommit = cr.connection.set_isolation_level
try:
cr.close = mock.Mock()
cr.autocommit = mock.Mock()
cr.connection.set_isolation_level = mock.Mock()
cr.commit = mock.Mock()
mocked_cursor_call.return_value = cr
yield
finally:
cr.close = org_close
cr.autocommit = org_autocommit
cr.connection.set_isolation_level = org_autocommit


class FakeLdapConnection:
Expand Down

0 comments on commit 1a89c3b

Please sign in to comment.