From 3bfe5c9222129a0169f41c3d0cef30a794a256ea 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:58:29 +0000 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=A7=AA=20QA:=20Add=20tests=20for=20SO?= =?UTF-8?q?C2=20compliance=20monitor=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> --- tests/test_compliance_monitor.py | 66 ++++++++++++++++++++++++++++++++ 1 file changed, 66 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..645212bb2 --- /dev/null +++ b/tests/test_compliance_monitor.py @@ -0,0 +1,66 @@ +import pytest +import sys +import os +import importlib.util + +spec = importlib.util.spec_from_file_location("compliance_monitor", "security/compliance-monitor.py") +compliance_monitor = importlib.util.module_from_spec(spec) +spec.loader.exec_module(compliance_monitor) + +def test_monitor_soc2_compliance_all_pass(): + monitor = compliance_monitor.ComplianceMonitor() + result = monitor.monitor_soc2_compliance() + + assert result["framework"] == "SOC2" + assert result["compliance_score"] == 100.0 + assert result["status"] == "compliant" + + checks = result["checks"] + assert checks["access_controls"] is True + assert checks["system_monitoring"] is True + assert checks["data_encryption"] is True + assert checks["backup_procedures"] is True + assert checks["incident_response"] is True + +def test_monitor_soc2_compliance_partial_fail(): + monitor = compliance_monitor.ComplianceMonitor() + + monitor.check_access_controls = lambda: False + monitor.check_data_encryption = lambda: False + + result = monitor.monitor_soc2_compliance() + + assert result["framework"] == "SOC2" + assert result["compliance_score"] == 60.0 + assert result["status"] == "non_compliant" + + checks = result["checks"] + assert checks["access_controls"] is False + assert checks["system_monitoring"] is True + assert checks["data_encryption"] is False + assert checks["backup_procedures"] is True + assert checks["incident_response"] is True + +def test_monitor_soc2_compliance_edge_cases(): + monitor = compliance_monitor.ComplianceMonitor() + + monitor.check_access_controls = lambda: False + monitor.check_system_monitoring = lambda: False + monitor.check_data_encryption = lambda: False + monitor.check_backup_procedures = lambda: False + monitor.check_incident_response = lambda: False + + result = monitor.monitor_soc2_compliance() + + assert result["compliance_score"] == 0.0 + assert result["status"] == "non_compliant" + +def test_monitor_soc2_compliance_just_below_threshold(): + monitor = compliance_monitor.ComplianceMonitor() + + monitor.check_access_controls = lambda: False + + result = monitor.monitor_soc2_compliance() + + assert result["compliance_score"] == 80.0 + assert result["status"] == "non_compliant" From c7a1aa287e36d306b1bb0ba18ff943f90260cd2d 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:05:07 +0000 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=A7=AA=20QA:=20Add=20tests=20for=20SO?= =?UTF-8?q?C2=20compliance=20monitor=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> From e3f8cc5e225318766ed40086f799bd0c66c9ccf9 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:11:40 +0000 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=A7=AA=20QA:=20Add=20tests=20for=20SO?= =?UTF-8?q?C2=20compliance=20monitor=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> From a78e45262adbf0039383896819b3c4f800e7ff85 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:20:22 +0000 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=A7=AA=20QA:=20Add=20tests=20for=20SO?= =?UTF-8?q?C2=20compliance=20monitor=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> From 8880f7f6086406a94920d6c67283861162643f6f 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:35:08 +0000 Subject: [PATCH 5/8] =?UTF-8?q?=F0=9F=A7=AA=20QA:=20Add=20tests=20for=20SO?= =?UTF-8?q?C2=20compliance=20monitor=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> From 282a0a773dba78defc7a6391bf6958b540006089 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:08:33 +0000 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=A7=AA=20QA:=20Add=20tests=20for=20SO?= =?UTF-8?q?C2=20compliance=20monitor=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> From 52a4763d6eaceb8d1c42f053460f90c81770800c 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:11:49 +0000 Subject: [PATCH 7/8] =?UTF-8?q?=F0=9F=A7=AA=20QA:=20Add=20tests=20for=20SO?= =?UTF-8?q?C2=20compliance=20monitor=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> From caebe6d3b45426ac1b42ffa49799f004482a8b39 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:25:39 +0000 Subject: [PATCH 8/8] =?UTF-8?q?=F0=9F=A7=AA=20QA:=20Add=20tests=20for=20SO?= =?UTF-8?q?C2=20compliance=20monitor=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>