From 952eaa5960df563ae444f34c66f87ff0c30dbf8b Mon Sep 17 00:00:00 2001 From: Joao Paulo Ramos Date: Thu, 12 Dec 2024 18:35:11 -0300 Subject: [PATCH] tests: Add tests --- tests/test_custom_staleness.py | 9 +++++++++ tests/test_notifications.py | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/tests/test_custom_staleness.py b/tests/test_custom_staleness.py index 197a975b76..2772f199d8 100644 --- a/tests/test_custom_staleness.py +++ b/tests/test_custom_staleness.py @@ -43,6 +43,15 @@ "immutable_time_to_delete": 15552000, } +CUSTOM_STALENESS_HOST_BECAME_STALE = { + "conventional_time_to_stale": 1, + "conventional_time_to_stale_warning": 604800, + "conventional_time_to_delete": 1209600, + "immutable_time_to_stale": 172800, + "immutable_time_to_stale_warning": 10368000, + "immutable_time_to_delete": 15552000, +} + def test_delete_only_immutable_hosts( flask_app, diff --git a/tests/test_notifications.py b/tests/test_notifications.py index 0d65ad820d..acb8c88b0f 100644 --- a/tests/test_notifications.py +++ b/tests/test_notifications.py @@ -1,4 +1,6 @@ import json +import os +from unittest import mock import pytest @@ -62,6 +64,12 @@ def test_add_host_fail(mq_create_or_update_host, notification_event_producer_moc # System Became Stale +@mock.patch.dict(os.environ, {"STALE_OFFSET_SECONDS": "10"}, clear=True) +def test_system_became_stale(notification_event_producer_mock, db_create_staleness_culling): + # db_create_staleness_culling(**CUSTOM_STALENESS_HOST_BECAME_STALE) + # host = minimal_host(org_id=SYSTEM_IDENTITY["org_id"]) + pass + # System Deleted