diff --git a/addons/rpc_helper/tests/test_decorator.py b/addons/rpc_helper/tests/test_decorator.py new file mode 100644 index 0000000..1ee3ee5 --- /dev/null +++ b/addons/rpc_helper/tests/test_decorator.py @@ -0,0 +1,34 @@ +# Copyright 2022 Camptocamp SA +# @author: Simone Orsi +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + + +import unittest + +from ..decorator import disable_rpc + + +@disable_rpc() +class All: + pass + + +@disable_rpc("create") +class One: + pass + + +@disable_rpc("create", "write") +class Multi: + pass + + +class TestDecorator(unittest.TestCase): + def test_all(self): + self.assertEqual(All._disable_rpc, ("all",)) + + def test_one(self): + self.assertEqual(One._disable_rpc, ("create",)) + + def test_multi(self): + self.assertEqual(Multi._disable_rpc, ("create", "write"))