From 34149e768eeb71c8a892a1eee867d6ad630458ce Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 19:56:35 +0000 Subject: [PATCH 1/5] test: add unit tests for HIPAA compliance monitor Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> --- tests/test_compliance_monitor.py | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/test_compliance_monitor.py diff --git a/tests/test_compliance_monitor.py b/tests/test_compliance_monitor.py new file mode 100644 index 000000000..920e09a51 --- /dev/null +++ b/tests/test_compliance_monitor.py @@ -0,0 +1,56 @@ +import os +import sys +import importlib.util + +# Load the module dynamically since it has a hyphen in the filename +spec = importlib.util.spec_from_file_location( + "compliance_monitor", + os.path.join(os.path.dirname(__file__), "..", "security", "compliance-monitor.py") +) +compliance_monitor = importlib.util.module_from_spec(spec) +spec.loader.exec_module(compliance_monitor) + +ComplianceMonitor = compliance_monitor.ComplianceMonitor + +class TestComplianceMonitorHIPAA: + def test_hipaa_compliance_all_pass(self): + monitor = ComplianceMonitor() + result = monitor.monitor_hipaa_compliance() + + assert result["framework"] == "HIPAA" + assert result["compliance_score"] == 100.0 + assert result["status"] == "compliant" + assert all(result["checks"].values()) + + def test_hipaa_compliance_some_fail(self): + monitor = ComplianceMonitor() + + # Override a few methods to simulate failure + monitor.check_administrative_safeguards = lambda: False + monitor.check_technical_safeguards = lambda: False + + result = monitor.monitor_hipaa_compliance() + + assert result["framework"] == "HIPAA" + assert result["compliance_score"] == 60.0 + assert result["status"] == "non_compliant" + assert result["checks"]["administrative_safeguards"] is False + assert result["checks"]["technical_safeguards"] is False + assert result["checks"]["physical_safeguards"] is True + + def test_hipaa_compliance_all_fail(self): + monitor = ComplianceMonitor() + + # Override all methods to simulate failure + monitor.check_administrative_safeguards = lambda: False + monitor.check_physical_safeguards = lambda: False + monitor.check_technical_safeguards = lambda: False + monitor.check_breach_notification = lambda: False + monitor.check_baa = lambda: False + + result = monitor.monitor_hipaa_compliance() + + assert result["framework"] == "HIPAA" + assert result["compliance_score"] == 0.0 + assert result["status"] == "non_compliant" + assert not any(result["checks"].values()) From ee7f5cc5655ecd3a2899842b103a2a2f72bec1c8 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 20:02:37 +0000 Subject: [PATCH 2/5] test: add unit tests for HIPAA compliance monitor Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> From d4fd3d18598cb2944360ec5e017e83a0eaf30826 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 20:13:46 +0000 Subject: [PATCH 3/5] test: add unit tests for HIPAA compliance monitor Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> From ce7247b0a9d63e5a2ed42c21ee170591ac699209 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 20:26:24 +0000 Subject: [PATCH 4/5] test: add unit tests for HIPAA compliance monitor Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> From 18d1964d2826e32cfc7000d1a00907da6d7056a0 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 02:07:21 +0000 Subject: [PATCH 5/5] test: add unit tests for HIPAA compliance monitor Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>