From f8f01cb8a8aad6b647d38cf997d92871ead7bc94 Mon Sep 17 00:00:00 2001 From: cccs-nr Date: Thu, 3 Oct 2024 17:00:21 +0000 Subject: [PATCH 1/2] Added the test_clear_status() --- test/test_signature.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/test_signature.py b/test/test_signature.py index 1fc1667..9d37c43 100644 --- a/test/test_signature.py +++ b/test/test_signature.py @@ -96,6 +96,25 @@ def test_change_status(datastore, client): assert signature_data['status'] != new_signature_data['status'] +def test_clear_status(datastore, client): + signature_id = random_id_from_collection(datastore, 'signature') + signature_data = datastore.signature.get(signature_id, as_obj=False) + + res = client.signature.change_status(signature_id, 'DISABLED') + assert res['success'] + + new_signature_data = datastore.signature.get(signature_id, as_obj=False) + assert new_signature_data['state_change_date'] is not None + assert new_signature_data['state_change_user'] is not None + + res = client.signature.clear_status(signature_id) + assert res['success'] + + new_signature_data = datastore.signature.get(signature_id, as_obj=False) + assert new_signature_data['state_change_date'] is None + assert new_signature_data['state_change_user'] is None + + def test_delete(datastore, client): signature_id = random_id_from_collection(datastore, 'signature') res = client.signature.delete(signature_id) From 3f14663593c3cc495740e52982408c4e18b1ee1b Mon Sep 17 00:00:00 2001 From: cccs-nr Date: Mon, 7 Oct 2024 19:18:21 +0000 Subject: [PATCH 2/2] Added the clear_status() method to clear the signature's status --- assemblyline_client/v4_client/module/signature.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/assemblyline_client/v4_client/module/signature.py b/assemblyline_client/v4_client/module/signature.py index 5fe8aef..f4fd3c8 100644 --- a/assemblyline_client/v4_client/module/signature.py +++ b/assemblyline_client/v4_client/module/signature.py @@ -88,6 +88,17 @@ def change_status(self, signature_id, status): """ return self._connection.get(api_path_by_module(self, signature_id, status)) + def clear_status(self, signature_id): + """\ +Clear the user's status change of a signature + +Required: +signature_id : ID of the signature to clear the status + +Throws a Client exception if the signature does not exist. +""" + return self._connection.get(api_path_by_module(self, signature_id)) + def delete(self, signature_id): """\ Delete a signature based off its ID