Skip to content

Commit

Permalink
increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ysindel committed Dec 10, 2024
1 parent 277c762 commit 4c96be5
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import uuid

from unittest.mock import patch

import pytest
from sekoiaio.operation_center.update_alert_status import UpdateAlertStatus

module_base_url = "https://app.sekoia.fake/"
Expand Down Expand Up @@ -44,3 +48,15 @@ def test_patch_alert_status_only_accept_valid_status_or_action_uuid(requests_moc
arguments = {"status": str(uuid.uuid4()), "uuid": alert_uuid}
results: dict = action.run(arguments)
assert results == None


def test_patch_alert_status_fails(requests_mock):
action = UpdateAlertStatus()
action.module.configuration = {"base_url": module_base_url, "api_key": apikey}
alert_uuid = str(uuid.uuid4())
arguments = {"status": "8f206505-af6d-433e-93f4-775d46dc7d0f", "uuid": alert_uuid}

requests_mock.patch(f"{base_url}/{alert_uuid}/workflow", json={}, status_code=500)
with patch("tenacity.nap.time"):
with pytest.raises(Exception):
action.run(arguments)

0 comments on commit 4c96be5

Please sign in to comment.