From 086ca02435a420c513d3b5dc8932f09245164100 Mon Sep 17 00:00:00 2001 From: Alvaro Tinoco Date: Tue, 16 Jul 2024 13:35:52 +0200 Subject: [PATCH] Implement workflow operations --- osidb_bindings/session.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/osidb_bindings/session.py b/osidb_bindings/session.py index c2fefbd..c2d76e9 100644 --- a/osidb_bindings/session.py +++ b/osidb_bindings/session.py @@ -71,6 +71,34 @@ def file_trackers(self, form_data: Dict[str, Any], *args, **kwargs): ) +def promote_flaw(self, id, *args, **kwargs): + method_module = importlib.import_module( + f".bindings.python_client.api.osidb.osidb_api_{OSIDB_API_VERSION}_flaws_promote_create", + package="osidb_bindings", + ) + sync_fn = get_sync_function(method_module) + return sync_fn( + id, + *args, + client=self.client(), + **kwargs, + ) + + +def reject_flaw(self, id, *args, **kwargs): + method_module = importlib.import_module( + f".bindings.python_client.api.osidb.osidb_api_{OSIDB_API_VERSION}_flaws_reject_create", + package="osidb_bindings", + ) + sync_fn = get_sync_function(method_module) + return sync_fn( + id, + *args, + client=self.client(), + **kwargs, + ) + + def double_underscores_to_single_underscores(fn): """ Function decorator which changes all the keyword arguments which include @@ -214,6 +242,7 @@ def __init__(self, base_url, auth=None, verify_ssl=True): ] }, }, + extra_operations=[("promote", promote_flaw), ("reject", reject_flaw)], ) self.affects = SessionOperationsGroup( self.__get_client_with_new_access_token,