|
|
@ -1,11 +1,11 @@ |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
# © 2016 Therp BV <http://therp.nl> |
|
|
|
# Copyright 2016-2018 Therp BV <https://therp.nl>. |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
from openerp.tests.common import TransactionCase |
|
|
|
from contextlib import contextmanager |
|
|
|
|
|
|
|
|
|
|
|
class patch_ldap_connection(object): |
|
|
|
class PatchLDAPConnection(object): |
|
|
|
def __init__(self, results): |
|
|
|
self.results = results |
|
|
|
|
|
|
@ -30,7 +30,7 @@ def patch_ldap(self, results): |
|
|
|
original_initialize = ldap.initialize |
|
|
|
|
|
|
|
def initialize(uri): |
|
|
|
return patch_ldap_connection(results) |
|
|
|
return PatchLDAPConnection(results) |
|
|
|
ldap.initialize = initialize |
|
|
|
yield |
|
|
|
ldap.initialize = original_initialize |
|
|
@ -41,7 +41,7 @@ def get_fake_ldap(self): |
|
|
|
company.write({ |
|
|
|
'ldaps': [(0, 0, { |
|
|
|
'ldap_server': 'fake', |
|
|
|
'ldap_port': 'fake', |
|
|
|
'ldap_server_port': 389, |
|
|
|
'ldap_filter': '(uid=%s)', |
|
|
|
'ldap_base': 'fake', |
|
|
|
'deactivate_unknown_users': True, |
|
|
|