diff --git a/addon_toolkit/operation.py b/addon_toolkit/operation.py index 2fa28f1b..780b0151 100644 --- a/addon_toolkit/operation.py +++ b/addon_toolkit/operation.py @@ -53,12 +53,14 @@ class _UnboundAddonOperation: def __set_name__(self, cls, name): AddonOperation._register_operation(self, cls, name) - # replace this AddonOperation with the original function + # replace this _UnboundAddonOperation with the original function setattr(cls, name, self.operation_fn) @dataclasses.dataclass(frozen=True) -class AddonOperation(_UnboundAddonOperation): +class AddonOperation: + operation_type: AddonOperationType + capability: enum.Enum declaration_cls: type[AddonInterface] method_name: str @@ -81,7 +83,8 @@ def _register_operation( method_name: str, ): _operation = cls( - **dataclasses.asdict(unbound_operation), + operation_type=unbound_operation.operation_type, + capability=unbound_operation.capability, declaration_cls=declaration_cls, method_name=method_name, ) diff --git a/addon_toolkit/tests/test_addon_category.py b/addon_toolkit/tests/test_addon_category.py index 65155fa2..3aa51148 100644 --- a/addon_toolkit/tests/test_addon_category.py +++ b/addon_toolkit/tests/test_addon_category.py @@ -62,21 +62,18 @@ def test_operation_list(self): _my_cap = self.my_addon_category.capabilities _my_interface_cls = self.my_addon_category.base_interface _expected_get_op = AddonOperation( - operation_fn=_my_interface_cls.url_for_get, operation_type=AddonOperationType.REDIRECT, capability=_my_cap.GET_IT, declaration_cls=_my_interface_cls, method_name="url_for_get", ) _expected_put_op = AddonOperation( - operation_fn=_my_interface_cls.url_for_put, operation_type=AddonOperationType.REDIRECT, capability=_my_cap.PUT_IT, declaration_cls=_my_interface_cls, method_name="url_for_put", ) _query_operation = AddonOperation( - operation_fn=_my_interface_cls.query_relations, operation_type=AddonOperationType.PROXY, capability=_my_cap.GET_IT, declaration_cls=_my_interface_cls,