mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[ADD] base_external_system: Implement interface/adapter (#993)
* [ADD] base_external_system: Implement interface/adapter for external systems * base_external_system: Fix OS model, add inherits, add validate * base_external_system: Usability and private key pass * base_external_system: Use contextmanager in adapter client * base_external_system: Move contextmanager to interface * base_external_system: Include contextmanager on adapter and system * base_external_system: Unify client * Use password widget for password field * Add tests & security * Fix lint * Add plaintext note
This commit is contained in:
committed by
Ronald Portier
parent
1d2cad45f9
commit
0c879cf0cf
22
base_external_system/tests/common.py
Normal file
22
base_external_system/tests/common.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
from contextlib import contextmanager
|
||||
from mock import MagicMock
|
||||
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class Common(TransactionCase):
|
||||
|
||||
@contextmanager
|
||||
def _mock_method(self, method_name, method_obj=None):
|
||||
if method_obj is None:
|
||||
method_obj = self.record
|
||||
magic = MagicMock()
|
||||
method_obj._patch_method(method_name, magic)
|
||||
try:
|
||||
yield magic
|
||||
finally:
|
||||
method_obj._revert_method(method_name)
|
||||
Reference in New Issue
Block a user